* [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
* [LTP] [PATCH] network: fix telnet test for running on single machine
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
0 siblings, 1 reply; 4+ messages in thread
From: Alexey Kodanev @ 2016-12-21 11:23 UTC (permalink / raw)
To: ltp
Hi,
On 12/19/2016 06:44 PM, Petr Vorel wrote:
> 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
Hmm, instead of $RHOST the test should have used $(tst_ipaddr rhost).
In general, RHOST variable is for management link, but it can be set to the
same IP just the same (when there is only one link between hosts).
Moreover,in case we are using $(tst_ipaddr rhost) here we can run this
test over IPv6 byadding '-6' option.
But if we replaced $RHOST with $(tst_ipaddr rhost) we still wouldn't connect
with telnetto ltp_ns netns as there is no corresponding listening TCP
socket.
It seems there are several solutions:
1. we could do something similar to ssh/dns/http tests,
i.e. start the client side from remote host;
2. add $(tst_ipaddr rservice), and in case of netns, it will return
127.0.0.1/::1 addresses;
3. start those services inside ltp_ns;
4. other suggestions?
Thanks,
Alexey
>
> 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
^ permalink raw reply [flat|nested] 4+ messages in thread
* [LTP] [PATCH] network: fix telnet test for running on single machine
2016-12-21 11:23 ` Alexey Kodanev
@ 2016-12-21 16:27 ` Petr Vorel
2016-12-21 21:43 ` Alexey Kodanev
0 siblings, 1 reply; 4+ messages in thread
From: Petr Vorel @ 2016-12-21 16:27 UTC (permalink / raw)
To: ltp
Hi,
> It seems there are several solutions:
> 1. we could do something similar to ssh/dns/http tests,
> i.e. start the client side from remote host;
What means "remote host" in this context?
> 2. add $(tst_ipaddr rservice), and in case of netns, it will return
> 127.0.0.1/::1 addresses;
> 3. start those services inside ltp_ns;
No idea, what is the easiest solution. Maybe 2.?
Kind regards,
Petr
^ permalink raw reply [flat|nested] 4+ messages in thread
* [LTP] [PATCH] network: fix telnet test for running on single machine
2016-12-21 16:27 ` Petr Vorel
@ 2016-12-21 21:43 ` Alexey Kodanev
0 siblings, 0 replies; 4+ messages in thread
From: Alexey Kodanev @ 2016-12-21 21:43 UTC (permalink / raw)
To: ltp
On 21.12.2016 19:27, Petr Vorel wrote:
> Hi,
>
>> It seems there are several solutions:
>> 1. we could do something similar to ssh/dns/http tests,
>> i.e. start the client side from remote host;
> What means "remote host" in this context?
Inside network namespace (ltp_ns)
>
>> 2. add $(tst_ipaddr rservice), and in case of netns, it will return
>> 127.0.0.1/::1 addresses;
>> 3. start those services inside ltp_ns;
> No idea, what is the easiest solution. Maybe 2.?
Yeah, that one seems the easiest.
Best regards,
Alexey
>
>
> Kind regards,
> Petr
^ permalink raw reply [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