public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH] network: fix telnet test for running on single machine
@ 2016-12-19 15:44 Petr Vorel
  2016-12-21 11:23 ` Alexey Kodanev
  0 siblings, 1 reply; 4+ messages in thread
From: Petr Vorel @ 2016-12-19 15:44 UTC (permalink / raw)
  To: ltp

Since 5f8ca6cf0 it's possible to run network test on single machine
=> don't require setting RHOST in this case.

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 testcases/network/tcp_cmds/telnet/telnet01 | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/testcases/network/tcp_cmds/telnet/telnet01 b/testcases/network/tcp_cmds/telnet/telnet01
index a1609f0f6..633fb89dd 100755
--- a/testcases/network/tcp_cmds/telnet/telnet01
+++ b/testcases/network/tcp_cmds/telnet/telnet01
@@ -34,8 +34,13 @@ setup()
 		tst_brkm TCONF "Please set PASSWD for $RUSER."
 	fi
 
-	if [ -z $RHOST ]; then
-		tst_brkm TCONF "Please set RHOST."
+	if [ -n "$TST_USE_NETNS" ]; then
+		HOST=localhost
+	else
+		if [ -z $RHOST ]; then
+			tst_brkm TCONF "Please set RHOST."
+		fi
+		HOST=$RHOST
 	fi
 
 	if [ -z $LOOPCOUNT ]; then
@@ -58,7 +63,7 @@ telnet_test()
 	tst_resm TINFO "login with telnet($i/$LOOPCOUNT)"
 
 	expect -c "
-		spawn telnet $RHOST
+		spawn telnet $HOST
 
 		expect -re \"login:\"
 		send \"$RUSER\r\"
@@ -71,15 +76,15 @@ telnet_test()
 				exit 1
 			} \"$RUSER@\" {
 				send \"LC_ALL=C ls -l /etc/hosts | \\
-				       wc -w > $RUSER.$RHOST\rexit\r\";
+				       wc -w > $RUSER.$HOST\rexit\r\";
 				exp_continue}
 		}
 
 	" > /dev/null || return 1
 
 	tst_resm TINFO "checking telnet status($i/$LOOPCOUNT)"
-	tst_rhost_run -u $RUSER -c "grep -q 9 $RUSER.$RHOST" || return 1
-	tst_rhost_run -u $RUSER -c "rm -f $RUSER.$RHOST"
+	tst_rhost_run -u $RUSER -c "grep -q 9 $RUSER.$HOST" || return 1
+	tst_rhost_run -u $RUSER -c "rm -f $RUSER.$HOST"
 }
 
 setup
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-12-21 21:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-19 15:44 [LTP] [PATCH] network: fix telnet test for running on single machine Petr Vorel
2016-12-21 11:23 ` Alexey Kodanev
2016-12-21 16:27   ` Petr Vorel
2016-12-21 21:43     ` Alexey Kodanev

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox