Skip to contentSkip to conversation

ltp-networking/tcp_cmds/finger: fix finger bad user and host test

PATCH Cyril Hrubis 1 participant 1 message Jan 13, 2015 1 message not in the archive

lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive

Hi!

Quoted 3 lines

Finger always return 0 with bad user and host test. And it also return different error message on different distros. So let's only check stderr message and decide whether the test pass or fail.

Okay, so the test passes if anything was written into stderr. Sounds good to me.

Quoted 16 lines
---
 testcases/network/tcp_cmds/finger/finger01 | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)
testcases/network/tcp_cmds/finger/finger01 +1 -1
index 203d746..e01c1ad 100755
@@ -112,14 +112,13 @@ do_test2()
     BADHOST="xxxx"
 
     tst_resm TINFO "finger -badflag default "
-    finger -x 2>&1 1>/dev/null && end_testcase "finger -x should fail"
+    finger -x &>/dev/null && end_testcase "finger -x should fail"
 

testcases/network/tcp_cmds/finger/finger01 do_test2() · line 121

Quoted 10 lines
testcases/network/tcp_cmds/finger/finger01 +4 -5
     tst_resm TINFO "finger -bad user "
-    finger $BADUSER 2>&1 1>/dev/null || end_testcase "finger $BADUSER"
-    finger @$BADHOST 2>&1 1>/dev/null | grep "finger: unknown host" \
-        || end_testcase "finger @$BADHOST"
-    if ! finger $BADUSER@$BADHOST 2>&1 1>/dev/null \
-        | grep "finger: unknown host"; then
+    [ "$(finger $BADUSER 2>&1 1>/dev/null)" ] || end_testcase "finger $BADUSER"
+    [ "$(finger @$BADHOST 2>&1 1>/dev/null)" ] || \
+        end_testcase "finger @$BADHOST"
+    [ "finger $BADUSER@$BADHOST 2>&1 1>/dev/null" ] || \

Missing $(), otherwise this will be always true because we just pass a string to the [].

testcases/network/tcp_cmds/finger/finger01 do_test2() · line 123

Quoted 2 lines
testcases/network/tcp_cmds/finger/finger01 +0 -0
         end_testcase "finger $BADUSER@$BADHOST"
     fi

And this fi does belong to the deleted if.

Alexey can you please fix the minor issues and push the patch?

Signature · 13 lines
Cyril Hrubis
[email protected]

------------------------------------------------------------------------------
New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
GigeNET is offering a free month of service with a new server in Ashburn.
Choose from 2 high performing configs, both with 100TB of bandwidth.
Higher redundancy.Lower latency.Increased capacity.Completely compliant.
http://p.sf.net/sfu/gigenet
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list