[LTP] [PATCH] network: fix telnet test for running on single machine
Petr Vorel
pvorel@suse.cz
Mon Dec 19 16:44:33 CET 2016
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
More information about the ltp
mailing list