Skip to contentSkip to conversation

tst_net.sh: Remove rsh, update docs add debug & test

PATCH Superseded Petr Vorel 3 participants 26 messages Jul 10, 2020 – Jul 30, 2020

lore
Share & tools
lore

Petr Vorel

author
#0 lore raw

v2 cover tst_net.sh: Remove rsh, update docs add debug & test

Hi Alexey, Xiao,

changes v1->v2:
* Add new commit "net: Remove rsh, rcp, rlogin tests"
* Use TST_NET_RHOST_RUN_DEBUG=1 instead of -d in tst_rhost_run

I wonder if we want to drop more TCP tests
(testcases/network/tcp_cmds/). Maybe:

* drop arping and clockdiff (they're legacy + IMHO they should be tested in inputils package)
* drop arp from ipneigh01.sh (keep only ip neigh)
* drop netstat (legacy, from net-tools) should be replaced with ss (iproute2)
* also ftp01.sh has non-trivial setup, but maybe there is a benefit in this smoke test
* how about telnet01.sh and host01.sh?

If we keep them I'd suggest (apart from porting to the new API) also use different variable than RHOST for tests in testcases/network/tcp_cmds/ (ftp01.sh, host01.sh, telnet01.sh) to avoid having the same variable for 2 purposes, it's already used in two host configuration - now only ssh.

Other thing is the docs, we have setup in INSTALL, testcases/network/README.md, than specific setup in testcases/network/tcp_cmds/README, testcases/network/stress/README and other various places. I'd prefer to have some cleanup, but first we should decide which tests are worth to keep.

Kind regards,
Petr

Petr Vorel (7):
tst_net.sh: Remove rsh support
tst_net.sh: Use ssh in LTP_RSH
net: Remove rsh, rcp, rlogin tests
net: Update README.md
tst_net.sh: Drop 'sh -c' use from ssh in tst_rhost_run net/test: Add basic testing for tst_rhost_run tst_net.sh/tst_rhost_run: Add debugging

 lib/newlib_tests/shell/net/tst_rhost_run.sh   |  27 ++++
 runtest/net.tcp_cmds                          |   3 -
 testcases/lib/tst_net.sh                      |  33 ++--
 testcases/lib/tst_test.sh                     |   2 +-
 testcases/network/README.md                   |  97 +++++-------
 testcases/network/stress/README               |   9 +-
 testcases/network/tcp_cmds/rcp/Makefile       |  30 ----
 testcases/network/tcp_cmds/rcp/rcp01.sh       | 144 ------------------
 testcases/network/tcp_cmds/rlogin/Makefile    |  31 ----
 testcases/network/tcp_cmds/rlogin/rlogin01.sh |  91 -----------
 testcases/network/tcp_cmds/rsh/Makefile       |  31 ----
 testcases/network/tcp_cmds/rsh/rsh01.sh       | 115 --------------
 12 files changed, 91 insertions(+), 522 deletions(-)
 create mode 100755 lib/newlib_tests/shell/net/tst_rhost_run.sh
 delete mode 100644 testcases/network/tcp_cmds/rcp/Makefile
 delete mode 100755 testcases/network/tcp_cmds/rcp/rcp01.sh
 delete mode 100644 testcases/network/tcp_cmds/rlogin/Makefile
 delete mode 100755 testcases/network/tcp_cmds/rlogin/rlogin01.sh
 delete mode 100644 testcases/network/tcp_cmds/rsh/Makefile
 delete mode 100755 testcases/network/tcp_cmds/rsh/rsh01.sh
Signature · 1 line
2.27.0
author
#1 lore raw

PATCH v2 1/7 tst_net.sh: Remove rsh support

rsh is not used nowadays. When was the first network library version added in 18739ff06 (2014), it was a default + and ssh replacement was optional. Netns based single machine testing was added in 5f8ca6cf0 (2016). After 6 years it's time to drop legacy rsh.

ssh based testing setup requires only RHOST variable, TST_USE_SSH has been removed as unneeded. Also check for ssh in tst_rhost_run().

We still keep $LTP_RSH for some of the network stress tests, which has not been ported to tst_net.sh yet.

---
 testcases/lib/tst_net.sh | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
testcases/lib/tst_net.sh +4 -6
index 806b540cd..7ba267eda 100644
@@ -136,7 +136,7 @@ init_ltp_netspace()
 # -b run in background
 # -c CMD specify command to run (this must be binary, not shell builtin/function)
 # -s safe option, if something goes wrong, will exit with TBROK
-# -u USER for ssh/rsh (default root)
+# -u USER for ssh (default root)
 # RETURN: 0 on success, 1 on failure
 tst_rhost_run()
 {
@@ -166,14 +166,12 @@ tst_rhost_run()
 		return 1
 	fi
 
-	if [ -n "${TST_USE_SSH:-}" ]; then
-		output=`ssh -n -q $user@$RHOST "sh -c \
-			'$pre_cmd $cmd $post_cmd'" $out 2>&1 || echo 'RTERR'`
-	elif [ -n "${TST_USE_NETNS:-}" ]; then
+	if [ -n "${TST_USE_NETNS:-}" ]; then
 		output=`$LTP_NETNS sh -c \
 			"$pre_cmd $cmd $post_cmd" $out 2>&1 || echo 'RTERR'`
 	else
-		output=`rsh -n -l $user $RHOST "sh -c \
+		tst_require_cmds ssh
+		output=`ssh -nq $user@$RHOST "sh -c \
 			'$pre_cmd $cmd $post_cmd'" $out 2>&1 || echo 'RTERR'`
 	fi
 	echo "$output" | grep -q 'RTERR$' && ret=1
Signature · 1 line
2.27.0
#2 lore raw

PATCH v2 1/7 tst_net.sh: Remove rsh support

Quoted 10 lines · Petr Vorel

rsh is not used nowadays. When was the first network library version added in 18739ff06 (2014), it was a default + and ssh replacement was optional. Netns based single machine testing was added in 5f8ca6cf0 (2016). After 6 years it's time to drop legacy rsh.

ssh based testing setup requires only RHOST variable, TST_USE_SSH has been removed as unneeded. Also check for ssh in tst_rhost_run().

We still keep $LTP_RSH for some of the network stress tests, which has not been ported to tst_net.sh yet.

Hi Petr,

Thanks,
Xiao Yang

Quoted 37 lines
---
 testcases/lib/tst_net.sh | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
testcases/lib/tst_net.sh +4 -6
index 806b540cd..7ba267eda 100644
@@ -136,7 +136,7 @@ init_ltp_netspace()
 # -b run in background
 # -c CMD specify command to run (this must be binary, not shell builtin/function)
 # -s safe option, if something goes wrong, will exit with TBROK
-# -u USER for ssh/rsh (default root)
+# -u USER for ssh (default root)
 # RETURN: 0 on success, 1 on failure
 tst_rhost_run()
 {
@@ -166,14 +166,12 @@ tst_rhost_run()
 		return 1
 	fi
 
-	if [ -n "${TST_USE_SSH:-}" ]; then
-		output=`ssh -n -q $user@$RHOST "sh -c \
-			'$pre_cmd $cmd $post_cmd'" $out 2>&1 || echo 'RTERR'`
-	elif [ -n "${TST_USE_NETNS:-}" ]; then
+	if [ -n "${TST_USE_NETNS:-}" ]; then
 		output=`$LTP_NETNS sh -c \
 			"$pre_cmd $cmd $post_cmd" $out 2>&1 || echo 'RTERR'`
 	else
-		output=`rsh -n -l $user $RHOST "sh -c \
+		tst_require_cmds ssh
+		output=`ssh -nq $user@$RHOST "sh -c \
 			'$pre_cmd $cmd $post_cmd'" $out 2>&1 || echo 'RTERR'`
 	fi
 	echo "$output" | grep -q 'RTERR$' && ret=1
author
#3 lore raw

PATCH v2 2/7 tst_net.sh: Use ssh in LTP_RSH

In reply to Petr Vorel

for LTP_RSH (rsh fallback) it's better to use ssh instead of rsh by default, using current user.

+ update docs.

---
 testcases/lib/tst_net.sh        | 2 +-
 testcases/network/stress/README | 9 ++++-----
 2 files changed, 5 insertions(+), 6 deletions(-)
testcases/lib/tst_net.sh +1 -1
index 7ba267eda..0a8b2a8ca 100644
@@ -838,7 +838,7 @@ tst_default_max_pkt()
 export RHOST="$RHOST"
 export PASSWD="${PASSWD:-}"
 # Don't use it in new tests, use tst_rhost_run() from tst_net.sh instead.
-export LTP_RSH="${LTP_RSH:-rsh -n}"
+export LTP_RSH="${LTP_RSH:-ssh -nq}"
 
 # Test Links
 # IPV{4,6}_{L,R}HOST can be set with or without prefix (e.g. IP or IP/prefix),
testcases/network/stress/README +4 -5
index bc51a4cc9..b9537b1ce 100644
@@ -48,10 +48,9 @@ To run the network stress testcases, use network.sh script, located in
 testscripts directory. For documentation about using network.sh see INSTALL
 and testcases/network/README.md
 
-Unfortunately some stress tests still depend on rsh for accessing remote host, even
-you decide to use SSH or network namespaces with network.sh.
-Instead of rsh, you can use ssh to set the environment variable LTP_RSH.
-Please refer the `Environment Variable' section of this document.
+Some stress tests originally designed to be tested with rsh for accessing
+remote host are now using ssh using the current user. Old behavior (using rsh
+can be achieved with setting LTP_RSH variable).
 
 The behaviour of network stress tests is configurable with environment
 variables (See `Environment Variable' section).
@@ -146,7 +145,7 @@ Optional environment variables
 ------------------------------
 
  o LTP_RSH
-   The name of the remote shell command, namely rsh or ssh.
+   The name of the remote shell command, namely ssh (the default) or rsh.
    In ether case, the remote host must accept the login from the local host
    without password.
 
Signature · 1 line
2.27.0
#4 lore raw

PATCH v2 2/7 tst_net.sh: Use ssh in LTP_RSH

Quoted 17 lines · Petr Vorel

for LTP_RSH (rsh fallback) it's better to use ssh instead of rsh by default, using current user.

+ update docs.

---
 testcases/lib/tst_net.sh        | 2 +-
 testcases/network/stress/README | 9 ++++-----
 2 files changed, 5 insertions(+), 6 deletions(-)
testcases/lib/tst_net.sh +0 -0
index 7ba267eda..0a8b2a8ca 100644

testcases/lib/tst_net.sh tst_default_max_pkt() · line 841

Quoted 5 lines
testcases/lib/tst_net.sh +1 -1
@@ -838,7 +838,7 @@ tst_default_max_pkt()
 export RHOST="$RHOST"
 export PASSWD="${PASSWD:-}"
 # Don't use it in new tests, use tst_rhost_run() from tst_net.sh instead.
-export LTP_RSH="${LTP_RSH:-rsh -n}"
+export LTP_RSH="${LTP_RSH:-ssh -nq}"

Hi Petr,

Some very old stress tests use check_envval(instead of tst_net.sh) to init LTP_RSH,
Do you think if we need to change it as well:
--------------------------------------
# LTP_RSH
LTP_RSH=${LTP_RSH:=}
if [ x"${LTP_RSH}" = x ]; then
LTP_RSH="rsh -n"
elif [ "$LTP_RSH" = "rsh" ]; then
LTP_RSH="rsh -n"
fi
--------------------------------------

Thanks,
Xiao Yang

Quoted 30 lines
testcases/lib/tst_net.sh +0 -0
 # Test Links
 # IPV{4,6}_{L,R}HOST can be set with or without prefix (e.g. IP or IP/prefix),
testcases/network/stress/README +4 -5
index bc51a4cc9..b9537b1ce 100644
@@ -48,10 +48,9 @@ To run the network stress testcases, use network.sh script, located in
 testscripts directory. For documentation about using network.sh see INSTALL
 and testcases/network/README.md
 
-Unfortunately some stress tests still depend on rsh for accessing remote host, even
-you decide to use SSH or network namespaces with network.sh.
-Instead of rsh, you can use ssh to set the environment variable LTP_RSH.
-Please refer the `Environment Variable' section of this document.
+Some stress tests originally designed to be tested with rsh for accessing
+remote host are now using ssh using the current user. Old behavior (using rsh
+can be achieved with setting LTP_RSH variable).
 
 The behaviour of network stress tests is configurable with environment
 variables (See `Environment Variable' section).
@@ -146,7 +145,7 @@ Optional environment variables
 ------------------------------
 
  o LTP_RSH
-   The name of the remote shell command, namely rsh or ssh.
+   The name of the remote shell command, namely ssh (the default) or rsh.
    In ether case, the remote host must accept the login from the local host
    without password.
 
#5 lore raw

PATCH v2 2/7 tst_net.sh: Use ssh in LTP_RSH

Quoted 25 lines · Xiao Yang
Quoted 17 lines · Petr Vorel

for LTP_RSH (rsh fallback) it's better to use ssh instead of rsh by default, using current user.

+ update docs.

---
  testcases/lib/tst_net.sh        | 2 +-
  testcases/network/stress/README | 9 ++++-----
  2 files changed, 5 insertions(+), 6 deletions(-)
testcases/lib/tst_net.sh +0 -0
index 7ba267eda..0a8b2a8ca 100644

testcases/lib/tst_net.sh tst_default_max_pkt() · line 841

Quoted 5 lines
testcases/lib/tst_net.sh +1 -1
@@ -838,7 +838,7 @@ tst_default_max_pkt()
  export RHOST="$RHOST"
  export PASSWD="${PASSWD:-}"
  # Don't use it in new tests, use tst_rhost_run() from tst_net.sh instead.
-export LTP_RSH="${LTP_RSH:-rsh -n}"
+export LTP_RSH="${LTP_RSH:-ssh -nq}"

Hi Petr,

Quoted 12 lines

Some very old stress tests use check_envval(instead of tst_net.sh) to init LTP_RSH,
Do you think if we need to change it as well:
--------------------------------------
# LTP_RSH
LTP_RSH=${LTP_RSH:=}
if [ x"${LTP_RSH}" = x ]; then
LTP_RSH="rsh -n"
elif [ "$LTP_RSH" = "rsh" ]; then
LTP_RSH="rsh -n"
fi
--------------------------------------

testscripts/exportfs.sh, tcp_cmds/ftp/ftp01.sh and nfsv4/acl/runtest also use rsh command directly.

Quoted 35 lines

Thanks,
Xiao Yang

Quoted 30 lines
testcases/lib/tst_net.sh +0 -0
  # Test Links
  # IPV{4,6}_{L,R}HOST can be set with or without prefix (e.g. IP or IP/prefix),
testcases/network/stress/README +4 -5
index bc51a4cc9..b9537b1ce 100644
@@ -48,10 +48,9 @@ To run the network stress testcases, use network.sh script, located in
  testscripts directory. For documentation about using network.sh see INSTALL
  and testcases/network/README.md
 
-Unfortunately some stress tests still depend on rsh for accessing remote host, even
-you decide to use SSH or network namespaces with network.sh.
-Instead of rsh, you can use ssh to set the environment variable LTP_RSH.
-Please refer the `Environment Variable' section of this document.
+Some stress tests originally designed to be tested with rsh for accessing
+remote host are now using ssh using the current user. Old behavior (using rsh
+can be achieved with setting LTP_RSH variable).
 
  The behaviour of network stress tests is configurable with environment
  variables (See `Environment Variable' section).
@@ -146,7 +145,7 @@ Optional environment variables
  ------------------------------
 
   o LTP_RSH
-   The name of the remote shell command, namely rsh or ssh.
+   The name of the remote shell command, namely ssh (the default) or rsh.
     In ether case, the remote host must accept the login from the local host
     without password.
 
author
#6 lore raw

PATCH v2 2/7 tst_net.sh: Use ssh in LTP_RSH

Quoted 2 lines

testscripts/exportfs.sh, tcp_cmds/ftp/ftp01.sh and nfsv4/acl/runtest also use rsh command directly.

That's a sign of legacy code with questionable usability.

Although runltp-ng [1] has not been merged yet, I'm going to sent RFC patch to remove exportfs.sh. I'll also send RFC to drop network/nfsv4 (NFS maintainers use their own pynfs [2] anyway).

[1] https://github.com/metan-ucw/runltp-ng
[2] http://git.linux-nfs.org/?p=bfields/pynfs.git;a=summary

Kind regards,
Petr

author
#7 lore raw

PATCH v2 2/7 tst_net.sh: Use ssh in LTP_RSH

In reply to Xiao Yang

Hi Yang,

Quoted 14 lines

Hi Petr,

Some very old stress tests use check_envval(instead of tst_net.sh) to init LTP_RSH,
Do you think if we need to change it as well:
--------------------------------------
# LTP_RSH
LTP_RSH=${LTP_RSH:=}
if [ x"${LTP_RSH}" = x ]; then
LTP_RSH="rsh -n"
elif [ "$LTP_RSH" = "rsh" ]; then
LTP_RSH="rsh -n"
fi
--------------------------------------

No, I wouldn't touch this legacy code. The goal is to rewrite this old code, there is a ticket for it:
https://github.com/linux-test-project/ltp/issues/440

Quoted 2 lines

Thanks,
Xiao Yang

Kind regards,
Petr

author
#8 lore raw

PATCH v2 3/7 net: Remove rsh, rcp, rlogin tests

In reply to Petr Vorel

as they've been replaced by ssh/scp long time ago.

As we still keep telnet test for testing basic network functionality we can safely drop these tests.

---
New commit.

Kind regards,
Petr

 runtest/net.tcp_cmds                          |   3 -
 testcases/network/tcp_cmds/rcp/Makefile       |  30 ----
 testcases/network/tcp_cmds/rcp/rcp01.sh       | 144 ------------------
 testcases/network/tcp_cmds/rlogin/Makefile    |  31 ----
 testcases/network/tcp_cmds/rlogin/rlogin01.sh |  91 -----------
 testcases/network/tcp_cmds/rsh/Makefile       |  31 ----
 testcases/network/tcp_cmds/rsh/rsh01.sh       | 115 --------------
 7 files changed, 445 deletions(-)
 delete mode 100644 testcases/network/tcp_cmds/rcp/Makefile
 delete mode 100755 testcases/network/tcp_cmds/rcp/rcp01.sh
 delete mode 100644 testcases/network/tcp_cmds/rlogin/Makefile
 delete mode 100755 testcases/network/tcp_cmds/rlogin/rlogin01.sh
 delete mode 100644 testcases/network/tcp_cmds/rsh/Makefile
 delete mode 100755 testcases/network/tcp_cmds/rsh/rsh01.sh
runtest/net.tcp_cmds +0 -3
index afe6d7c71..db47dfd5b 100644
@@ -11,9 +11,6 @@ host host01.sh
 netstat netstat01.sh
 ping01 ping01.sh
 ping02 ping02.sh
-rcp rcp01.sh
-rlogin rlogin01.sh
-rsh rsh01.sh
 sendfile sendfile01.sh
 tcpdump tcpdump01.sh
 telnet telnet01.sh
testcases/network/tcp_cmds/rcp/Makefile deleted +0 -30
deleted file mode 100644
index f8131a986..000000000
@@ -1,30 +0,0 @@
-#
-#    network/tcp_cmds/rcp testcases Makefile.
-#
-#    Copyright (C) 2009, Cisco Systems Inc.
-#
-#    This program is free software; you can redistribute it and/or modify
-#    it under the terms of the GNU General Public License as published by
-#    the Free Software Foundation; either version 2 of the License, or
-#    (at your option) any later version.
-#
-#    This program is distributed in the hope that it will be useful,
-#    but WITHOUT ANY WARRANTY; without even the implied warranty of
-#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#    GNU General Public License for more details.
-#
-#    You should have received a copy of the GNU General Public License along
-#    with this program; if not, write to the Free Software Foundation, Inc.,
-#    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Ngie Cooper, September 2009
-#
-
-top_srcdir		?= ../../../..
-
-include $(top_srcdir)/include/mk/testcases.mk
-include $(abs_srcdir)/../Makefile.inc
-
-INSTALL_TARGETS		:= rcp01.sh
-
-include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/network/tcp_cmds/rcp/rcp01.sh deleted +0 -144

144 lines not on this page · raw message

testcases/network/tcp_cmds/rlogin/Makefile deleted +0 -31
deleted file mode 100644
index 1e8d10ea4..000000000
@@ -1,31 +0,0 @@
-#
-#    network/tcp_cmds/rlogin testcases Makefile.
-#
-#    Copyright (C) 2009, Cisco Systems Inc.
-#
-#    This program is free software; you can redistribute it and/or modify
-#    it under the terms of the GNU General Public License as published by
-#    the Free Software Foundation; either version 2 of the License, or
-#    (at your option) any later version.
-#
-#    This program is distributed in the hope that it will be useful,
-#    but WITHOUT ANY WARRANTY; without even the implied warranty of
-#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#    GNU General Public License for more details.
-#
-#    You should have received a copy of the GNU General Public License along
-#    with this program; if not, write to the Free Software Foundation, Inc.,
-#    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Ngie Cooper, July 2009
-#
-
-top_srcdir		?= ../../../..
-
-include $(top_srcdir)/include/mk/env_pre.mk
-
-INSTALL_TARGETS		:= rlogin01.sh
-
-MAKE_TARGETS		:=
-
-include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/network/tcp_cmds/rlogin/rlogin01.sh deleted +0 -91

91 lines not on this page · raw message

testcases/network/tcp_cmds/rsh/Makefile deleted +0 -31
deleted file mode 100644
index 00ae49d8b..000000000
@@ -1,31 +0,0 @@
-#
-#    network/tcp_cmds/rsh testcases Makefile.
-#
-#    Copyright (C) 2009, Cisco Systems Inc.
-#
-#    This program is free software; you can redistribute it and/or modify
-#    it under the terms of the GNU General Public License as published by
-#    the Free Software Foundation; either version 2 of the License, or
-#    (at your option) any later version.
-#
-#    This program is distributed in the hope that it will be useful,
-#    but WITHOUT ANY WARRANTY; without even the implied warranty of
-#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#    GNU General Public License for more details.
-#
-#    You should have received a copy of the GNU General Public License along
-#    with this program; if not, write to the Free Software Foundation, Inc.,
-#    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Ngie Cooper, July 2009
-#
-
-top_srcdir		?= ../../../..
-
-include $(top_srcdir)/include/mk/env_pre.mk
-
-INSTALL_TARGETS		:= rsh01.sh
-
-MAKE_TARGETS		:=
-
-include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/network/tcp_cmds/rsh/rsh01.sh deleted +0 -115

115 lines not on this page · raw message

Signature · 1 line
2.27.0
#9 lore raw

PATCH v2 3/7 net: Remove rsh, rcp, rlogin tests

Quoted 8 lines · Petr Vorel

as they've been replaced by ssh/scp long time ago.

As we still keep telnet test for testing basic network functionality we can safely drop these tests.

---
New commit.

Hi Petr,

Need to remove rlogin in tcp_cmds/Makefile:
------------------------
ifneq ($(WITH_EXPECT),yes)
FILTER_OUT_SUBDIRS := ftp rlogin ssh telnet
endif
------------------------

Thanks,
Xiao Yang

Quoted 510 lines

Kind regards,
Petr

 runtest/net.tcp_cmds                          |   3 -
 testcases/network/tcp_cmds/rcp/Makefile       |  30 ----
 testcases/network/tcp_cmds/rcp/rcp01.sh       | 144 ------------------
 testcases/network/tcp_cmds/rlogin/Makefile    |  31 ----
 testcases/network/tcp_cmds/rlogin/rlogin01.sh |  91 -----------
 testcases/network/tcp_cmds/rsh/Makefile       |  31 ----
 testcases/network/tcp_cmds/rsh/rsh01.sh       | 115 --------------
 7 files changed, 445 deletions(-)
 delete mode 100644 testcases/network/tcp_cmds/rcp/Makefile
 delete mode 100755 testcases/network/tcp_cmds/rcp/rcp01.sh
 delete mode 100644 testcases/network/tcp_cmds/rlogin/Makefile
 delete mode 100755 testcases/network/tcp_cmds/rlogin/rlogin01.sh
 delete mode 100644 testcases/network/tcp_cmds/rsh/Makefile
 delete mode 100755 testcases/network/tcp_cmds/rsh/rsh01.sh
runtest/net.tcp_cmds +0 -3
index afe6d7c71..db47dfd5b 100644
@@ -11,9 +11,6 @@ host host01.sh
 netstat netstat01.sh
 ping01 ping01.sh
 ping02 ping02.sh
-rcp rcp01.sh
-rlogin rlogin01.sh
-rsh rsh01.sh
 sendfile sendfile01.sh
 tcpdump tcpdump01.sh
 telnet telnet01.sh
testcases/network/tcp_cmds/rcp/Makefile deleted +0 -30
deleted file mode 100644
index f8131a986..000000000
@@ -1,30 +0,0 @@
-#
-#    network/tcp_cmds/rcp testcases Makefile.
-#
-#    Copyright (C) 2009, Cisco Systems Inc.
-#
-#    This program is free software; you can redistribute it and/or modify
-#    it under the terms of the GNU General Public License as published by
-#    the Free Software Foundation; either version 2 of the License, or
-#    (at your option) any later version.
-#
-#    This program is distributed in the hope that it will be useful,
-#    but WITHOUT ANY WARRANTY; without even the implied warranty of
-#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#    GNU General Public License for more details.
-#
-#    You should have received a copy of the GNU General Public License along
-#    with this program; if not, write to the Free Software Foundation, Inc.,
-#    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Ngie Cooper, September 2009
-#
-
-top_srcdir		?= ../../../..
-
-include $(top_srcdir)/include/mk/testcases.mk
-include $(abs_srcdir)/../Makefile.inc
-
-INSTALL_TARGETS		:= rcp01.sh
-
-include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/network/tcp_cmds/rcp/rcp01.sh deleted +0 -144
deleted file mode 100755
index 4eaeca175..000000000
@@ -1,144 +0,0 @@
-#!/bin/sh
-#
-#   Copyright (c) International Business Machines  Corp., 2000
-#
-#   This program is free software;  you can redistribute it and/or modify
-#   it under the terms of the GNU General Public License as published by
-#   the Free Software Foundation; either version 2 of the License, or
-#   (at your option) any later version.
-#
-#   This program is distributed in the hope that it will be useful,
-#   but WITHOUT ANY WARRANTY;  without even the implied warranty of
-#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
-#   the GNU General Public License for more details.
-#
-#   You should have received a copy of the GNU General Public License
-#   along with this program;  if not, write to the Free Software
-#   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-#
-#
-#
-#  FILE   : rcp
-#
-#  PURPOSE: To test the basic functionality of the `rcp` command.
-#
-#  SETUP: The home directory of root on the machine exported as "RHOST"
-#         MUST have a ".rhosts" file with the hostname of the machine
-#         where the test is executed.
-#
-#  HISTORY:
-#    06/06/03 Manoj Iyer [email protected]
-#    - Modified testcases to use test APIS and fixed bugs
-#    03/01 Robbie Williamson ([email protected])
-#      -Ported
-#
-#
-#-----------------------------------------------------------------------
-
-#-----------------------------------------------------------------------
-#
-# FUNCTION:  do_setup
-#
-#-----------------------------------------------------------------------
-
-do_setup()
-{
-
-    TCtmp=${TCtmp:-$LTPROOT/testcases/bin/$TC${EXEC_SUFFIX}$$}
-    TCdat=${TCdat:-$LTPROOT/testcases/bin/datafiles}
-    LHOST=`hostname`
-    RHOST=${RHOST:-$LHOST}
-    SLEEPTIME=${SLEEPTIME:-0}
-    FILES=${FILES:-"bin.sm bin.med bin.lg bin.jmb"}
-
-    tst_setup
-
-    exists awk rcp rsh sum
-
-    if ! rsh -n -l root $RHOST mkdir -p $TCtmp >/dev/null 2>&1; then
-        end_testcase "Remote mkdir failed"
-    fi
-
-    trap do_cleanup EXIT
-
-}
-
-#-----------------------------------------------------------------------
-#
-# FUNCTION:  do_test
-#
-#-----------------------------------------------------------------------
-
-do_test()
-{
-
-    for j in $FILES; do
-
-        if ! rcp $TCdat/$j $RHOST:$TCtmp/$j; then
-            end_testcase "Failed to rcp file."
-        fi
-
-        SUM1=`sum $TCdat/$j | awk '{print $1}'`
-        SUM2=`rsh -n -l root $RHOST sum $TCtmp/$j | awk '{print $1}'`
-        rsh -n -l root $RHOST "rm -f $TCtmp/$j"
-        sleep $SLEEPTIME
-
-        if [ "$SUM1" = "$SUM2" ]; then
-            tst_resm TINFO "rcp $TCdat/$j $RHOST:$TCtmp/$j successful"
-        else
-            end_testcase "FAILED: wrong sum in transfer to $RHOST"
-        fi
-
-        sleep $SLEEPTIME
-
-    done
-
-    for j in $FILES; do
-
-        tst_resm TINFO "remote copying $RHOST:$TCdat/$j to $TCtmp/$j"
-        if ! rcp $RHOST:$TCdat/$j $TCtmp/$j >/dev/null 2>&1; then
-            tst_resm TFAIL "Failed to rcp file."; continue
-        fi
-
-        SUM1=`sum $TCtmp/$j | awk '{print $1}'`
-        SUM2=`rsh -n -l root $RHOST sum $TCdat/$j | awk '{print $1}'`
-        rm -f $TCtmp/$j
-        sleep $SLEEPTIME
-
-        if [ "$SUM1" = "$SUM2" ]; then
-            tst_resm TINFO "rcp $RHOST:$TCdat/$j $TCtmp/$j successful"
-        else
-            end_testcase "FAILED: wrong sum in transfer to $LHOST from $RHOST"
-        fi
-        sleep $SLEEPTIME
-
-    done
-
-}
-
-#-----------------------------------------------------------------------
-#
-# FUNCTION:  do_cleanup
-#
-#-----------------------------------------------------------------------
-
-do_cleanup()
-{
-    rsh -n -l root $RHOST rmdir $TCtmp
-    tst_cleanup
-}
-
-#----------------------------------------------------------------------
-# FUNCTION: MAIN
-# PURPOSE:  To invoke the functions to perform the tasks described in
-#           the prologue.
-# INPUT:    None.
-# OUTPUT:   A testcase run log with the results of the execution of this
-#           test.
-#----------------------------------------------------------------------
-. net_cmdlib.sh
-
-read_opts $*
-do_setup
-do_test
-end_testcase
testcases/network/tcp_cmds/rlogin/Makefile deleted +0 -31
deleted file mode 100644
index 1e8d10ea4..000000000
@@ -1,31 +0,0 @@
-#
-#    network/tcp_cmds/rlogin testcases Makefile.
-#
-#    Copyright (C) 2009, Cisco Systems Inc.
-#
-#    This program is free software; you can redistribute it and/or modify
-#    it under the terms of the GNU General Public License as published by
-#    the Free Software Foundation; either version 2 of the License, or
-#    (at your option) any later version.
-#
-#    This program is distributed in the hope that it will be useful,
-#    but WITHOUT ANY WARRANTY; without even the implied warranty of
-#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#    GNU General Public License for more details.
-#
-#    You should have received a copy of the GNU General Public License along
-#    with this program; if not, write to the Free Software Foundation, Inc.,
-#    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Ngie Cooper, July 2009
-#
-
-top_srcdir		?= ../../../..
-
-include $(top_srcdir)/include/mk/env_pre.mk
-
-INSTALL_TARGETS		:= rlogin01.sh
-
-MAKE_TARGETS		:=
-
-include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/network/tcp_cmds/rlogin/rlogin01.sh deleted +0 -91
deleted file mode 100755
index c34ab1c4e..000000000
@@ -1,91 +0,0 @@
-#!/bin/sh
-#   Copyright (c) International Business Machines  Corp., 2000
-#
-#   This program is free software;  you can redistribute it and/or modify
-#   it under the terms of the GNU General Public License as published by
-#   the Free Software Foundation; either version 2 of the License, or
-#   (at your option) any later version.
-#
-#   This program is distributed in the hope that it will be useful,
-#   but WITHOUT ANY WARRANTY;  without even the implied warranty of
-#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
-#   the GNU General Public License for more details.
-#
-#   You should have received a copy of the GNU General Public License
-#   along with this program;  if not, write to the Free Software
-#   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-#
-#    03/01 Robbie Williamson ([email protected])
-
-TCID="rlogin01"
-TST_TOTAL=1
-
-TST_USE_LEGACY_API=1
-. tst_net.sh
-
-setup()
-{
-	tst_require_cmds rlogin expect
-
-	if [ -z $RUSER ]; then
-		RUSER=root
-	fi
-
-	if [ -z $PASSWD ]; then
-		tst_brkm TCONF "Please set PASSWD for $RUSER."
-	fi
-
-	if [ -z $RHOST ]; then
-		tst_brkm TCONF "Please set RHOST."
-	fi
-
-	if [ -z $LOOPCOUNT ]; then
-		LOOPCOUNT=25
-	fi
-}
-
-do_test()
-{
-	tst_resm TINFO "Starting"
-
-	for i in $(seq 1 ${LOOPCOUNT})
-	do
-		rlogin_test || return 1
-	done
-}
-
-rlogin_test()
-{
-	tst_resm TINFO "login with rlogin($i/$LOOPCOUNT)"
-
-	expect -c "
-		spawn rlogin $RHOST -l $RUSER
-
-		expect {
-			\"Password:\" {
-				send \"$PASSWD\r\"; exp_continue
-			} \"incorrect\" {
-				exit 1
-			} \"$RUSER@\" {
-				send \"LC_ALL=C; ls -l /etc/hosts | \\
-				       wc -w > $RUSER.$RHOST\rexit\r\";
-				exp_continue
-			}
-		}
-	" > /dev/null || return 1
-
-	tst_resm TINFO "checking rlogin 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"
-}
-
-setup
-
-do_test
-if [ $? -ne 0 ]; then
-	tst_resm TFAIL "Test $TCID failed."
-else
-	tst_resm TPASS "Test $TCID succeeded."
-fi
-
-tst_exit
testcases/network/tcp_cmds/rsh/Makefile deleted +0 -31
deleted file mode 100644
index 00ae49d8b..000000000
@@ -1,31 +0,0 @@
-#
-#    network/tcp_cmds/rsh testcases Makefile.
-#
-#    Copyright (C) 2009, Cisco Systems Inc.
-#
-#    This program is free software; you can redistribute it and/or modify
-#    it under the terms of the GNU General Public License as published by
-#    the Free Software Foundation; either version 2 of the License, or
-#    (at your option) any later version.
-#
-#    This program is distributed in the hope that it will be useful,
-#    but WITHOUT ANY WARRANTY; without even the implied warranty of
-#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#    GNU General Public License for more details.
-#
-#    You should have received a copy of the GNU General Public License along
-#    with this program; if not, write to the Free Software Foundation, Inc.,
-#    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Ngie Cooper, July 2009
-#
-
-top_srcdir		?= ../../../..
-
-include $(top_srcdir)/include/mk/env_pre.mk
-
-INSTALL_TARGETS		:= rsh01.sh
-
-MAKE_TARGETS		:=
-
-include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/network/tcp_cmds/rsh/rsh01.sh deleted +0 -115
deleted file mode 100755
index 3968f9056..000000000
@@ -1,115 +0,0 @@
-#!/bin/sh
-#
-#   Copyright (c) International Business Machines  Corp., 2000
-#
-#   This program is free software;  you can redistribute it and/or modify
-#   it under the terms of the GNU General Public License as published by
-#   the Free Software Foundation; either version 2 of the License, or
-#   (at your option) any later version.
-#
-#   This program is distributed in the hope that it will be useful,
-#   but WITHOUT ANY WARRANTY;  without even the implied warranty of
-#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
-#   the GNU General Public License for more details.
-#
-#   You should have received a copy of the GNU General Public License
-#   along with this program;  if not, write to the Free Software
-#   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-#
-#
-#
-#  FILE   : rsh
-#
-#  PURPOSE: To test the basic functionality of the `rsh` command.
-#
-#  SETUP: The home directory of root on the machine exported as "RHOST"
-#         MUST have a ".rhosts" file with the hostname of the machine
-#         where the test is executed.
-#
-#  HISTORY:
-#    03/01 Robbie Williamson ([email protected])
-#      -Ported
-#
-#
-#
-#----------------------------------------------------------------------
-
-do_setup()
-{
-
-    FAIL_IMMEDIATELY=${FAIL_IMMEDIATELY:-1}
-    SLEEPTIME=${SLEEPTIME:-0}
-    NUMLOOPS=${NUMLOOPS:-1}
-
-    export TST_TOTAL=$NUMLOOPS
-
-    tst_setup
-
-    exists awk hostname rsh
-
-    RHOST=${RHOST:-`hostname`}
-
-}
-
-#-----------------------------------------------------------------------
-#
-# FUNCTION:  do_test
-#
-#-----------------------------------------------------------------------
-
-do_test()
-{
-
-    while [ $TST_COUNT -le $NUMLOOPS ]; do
-
-        PASSED=0
-
-        if OUT=$(rsh -n -l root $RHOST 'ls -l /etc/hosts'); then
-
-            #
-            # Successful output would be something of the form:
-            #
-            # gcooper@orangebox ~ $ ls -l /etc/hosts
-            # -rw-r--r-- 1 root root 463 Jul  5 09:26 /etc/hosts
-            #
-            echo "$OUT" |
-                awk 'BEGIN { RET=1 } NF == 9 && $NF == "/etc/hosts" { RET=0 } END { exit RET }' \
-                > /dev/null 2>&1
-
-            if [ $? -eq 0 ] ; then
-                tst_resm TPASS "rsh to $RHOST test succeeded"
-                PASSED=1
-            fi
-
-        fi
-
-        if [ $PASSED -ne 1 ] ; then
-            tst_resm TFAIL "rsh to $RHOST failed"
-            # If the first rsh failed, the likelihood that the rest will
-            # succeed is low.
-            if [ "$FAIL_IMMEDIATELY" = "1" ] && [ $TST_COUNT -eq 1 ]; then
-                exit 2
-            fi
-        fi
-
-        sleep $SLEEPTIME
-        incr_tst_count
-
-    done
-
-}
-
-#----------------------------------------------------------------------
-# FUNCTION: MAIN
-# PURPOSE:  To invoke the functions to perform the tasks described in
-#           the prologue.
-# INPUT:    None.
-# OUTPUT:   A testcase run log with the results of the execution of this
-#           test.
-#----------------------------------------------------------------------
-. net_cmdlib.sh
-
-read_opts $*
-do_setup
-do_test
-end_testcase
author
#10 lore raw

PATCH v2 4/7 net: Update README.md

In reply to Petr Vorel

to previous commits (dropped rsh based testing and rsh, rcp, rlogin tests):

* drop rlogin, rsh, rexec setup
* rewrite ftp & telnet setup
* remove suggestion to run tests for 24 hrs (we lowered values in the variables for stress testing in 52857efb7)
* mention testcases/network/stress/README
* update package names
* fix formatting

---
 testcases/network/README.md | 96 ++++++++++++++-----------------------
 1 file changed, 36 insertions(+), 60 deletions(-)
testcases/network/README.md +36 -60
index 3a9c98125..1c19a2c15 100644
@@ -1,91 +1,67 @@
 # LTP Network Tests
 
-## Pre-requisites
-Enable all the networking services on test machine(s): rshd, nfsd, fingerd.
-
 ## Single Host Configuration
 
-It is a default configuration ('RHOST' is not defined). LTP adds 'ltp_ns'
-network namespace and auto-configure 'veth' pair according to LTP network
-environment variables.
+It is the default configuration (if the `RHOST` environment variable is not
+defined). LTP adds `ltp_ns` network namespace and auto-configure `veth` pair
+according to LTP network environment variables.
 
 ## Two Host Configuration
 
-This setup requires 'RHOST' environment variable to be set properly and
-configured SSH or RSH (default) access to a remote host.
-
-The 'RHOST' variable name must be set to the hostname of the server
-(test management link) and PASSWD should be set to the root password
-of the remote server.
-
-In order to have RSH access:
-* Edit the "/root/.rhosts" file. Please note that the file may not exist,
-so you must create one if it does not. You must add the fully qualified
-hostname of the machine you are testing on to this file. By adding the test
-machine's hostname to this file, you will be allowing the machine to rsh to itself,
-as root, without the requirement of a password.
-
-```sh
-echo $client_hostname >> /root/.rhosts
-```
-
-You may need to re-label '.rhost' file to make sure rlogind will have access to it:
-
-```sh
-/sbin/restorecon -v /root/.rhosts
-```
+This setup requires the `RHOST` environment variable to be set properly and
+configured SSH access to a remote host.
 
-* Add rlogin, rsh, rexec into /etc/securetty file:
+The `RHOST` variable must be set to the hostname of the server (test management
+link) and public key setup or login without password is required.
 
-```sh
-for i in rlogin rsh rexec; do echo $i >> /etc/securetty; done
-```
+Some of the network stress tests which hasn't been ported to network API were
+designed to be tested with `rsh` via `LTP_RSH` environment variable. Now it's
+by default used `ssh`, for details see `testcases/network/stress/README`.
 
 ## Server Services Configuration
 Verify that the below daemon services are running. If not, please install
 and start them:
-rsh-server, telnet-server, finger-server, rdist, rsync, dhcp-server, http-server.
+
+dhcp-server, dnsmasq, http-server, nfs-kernel-server, rpcbind, rsync,
+telnet-server, vsftpd
 
 Note: If any of the above daemon is not running on server, the test related to
 that service running from client will fail.
 
-### FTP setup
-* In ?/etc/ftpusers? [or vi /etc/vsftpd.ftpusers], comment the line containing
-?root? string. This file lists all those users who are not given access to do ftp
+### FTP and telnet setup
+Both tests require environment variables `RHOST` (remote machine), `RUSER`
+(remote user) and `PASSWD` (remote password). NOTE: `RHOST` will imply two host
+configuratioe for other tests.
+
+If `RHOST` is set to `root`, either of these steps is required:
+
+* In `/etc/ftpusers` (or `/etc/vsftpd.ftpusers`), comment the line containing
+"root" string. This file lists all those users who are not given access to do ftp
 on the current system.
 
-* If you don?t want to do the previous step, put following entry into /root/.netrc
-machine <remote_server_name> login root password <remote_root_password>.
-Otherwise, ftp,rlogin & telnet fails for ?root? user & hence needs to be
-executed using ?test? user to get successful results.
+* If you don?t want to do the previous step, put following entry into `/root/.netrc`:
+```
+machine <remote_server_name>
+login root
+password <remote_root_password>
+```
 
 ## LTP setup
-Install LTP testsuite. In case of two hosts configuration, make sure LTP is installed
-on both client and server machines.
-
-Testcases and network tools must be in PATH, e.g.:
+Install LTP testsuite. In case of two hosts configuration, LTP needs to be installed
+and `LTPROOT` and `PATH` environment variables set on both client and server
+machines (assuming using the default prefix `/opt/ltp`):
 
 ```sh
-export PATH=/opt/ltp/testcases/bin:/usr/bin:$PATH
+export LTPROOT="/opt/ltp"; export PATH="$LTPROOT/testcases/bin:$PATH"
 ```
-Default values for all LTP network variables are set in testcases/lib/tst_net.sh.
-If you need to override some parameters please export them before test run or
-specify them when running ltp-pan or testscripts/network.sh.
+Default values for all LTP network parameters are set in `testcases/lib/tst_net.sh`.
+Network stress parameters are documented in `testcases/network/stress/README`.
 
 ## Running the tests
-To run the test type the following:
 
 ```sh
 TEST_VARS ./network.sh OPTIONS
 ```
 Where
-* TEST_VARS - non-default network parameters (see testcases/lib/tst_net.sh), they
-  could be exported before test run;
-* OPTIONS - test group(s), use '-h' to see available ones.
-
-## Analyzing the results
-Generally this test must be run more than 24 hours. When you want to stop the test
-press CTRL+C to stop ./network.sh.
-
-Search failed tests in LTP logfile using grep FAIL <logfile>. For any failures,
-run the individual tests and then try to come to the conclusion.
+* `TEST_VARS` - non-default network parameters
+* `OPTIONS` - test group(s), use `-h` to see available ones.
Signature · 1 line
2.27.0
#11 lore raw

PATCH v2 4/7 net: Update README.md

Quoted 71 lines · Petr Vorel

to previous commits (dropped rsh based testing and rsh, rcp, rlogin tests):

* drop rlogin, rsh, rexec setup
* rewrite ftp& telnet setup
* remove suggestion to run tests for 24 hrs (we lowered values in the variables for stress testing in 52857efb7)
* mention testcases/network/stress/README
* update package names
* fix formatting

---
  testcases/network/README.md | 96 ++++++++++++++-----------------------
  1 file changed, 36 insertions(+), 60 deletions(-)
testcases/network/README.md +8 -33
index 3a9c98125..1c19a2c15 100644
@@ -1,91 +1,67 @@
  # LTP Network Tests
 
-## Pre-requisites
-Enable all the networking services on test machine(s): rshd, nfsd, fingerd.
-
  ## Single Host Configuration
 
-It is a default configuration ('RHOST' is not defined). LTP adds 'ltp_ns'
-network namespace and auto-configure 'veth' pair according to LTP network
-environment variables.
+It is the default configuration (if the `RHOST` environment variable is not
+defined). LTP adds `ltp_ns` network namespace and auto-configure `veth` pair
+according to LTP network environment variables.
 
  ## Two Host Configuration
 
-This setup requires 'RHOST' environment variable to be set properly and
-configured SSH or RSH (default) access to a remote host.
-
-The 'RHOST' variable name must be set to the hostname of the server
-(test management link) and PASSWD should be set to the root password
-of the remote server.
-
-In order to have RSH access:
-* Edit the "/root/.rhosts" file. Please note that the file may not exist,
-so you must create one if it does not. You must add the fully qualified
-hostname of the machine you are testing on to this file. By adding the test
-machine's hostname to this file, you will be allowing the machine to rsh to itself,
-as root, without the requirement of a password.
-
-```sh
-echo $client_hostname>>  /root/.rhosts
-```
-
-You may need to re-label '.rhost' file to make sure rlogind will have access to it:
-
-```sh
-/sbin/restorecon -v /root/.rhosts
-```
+This setup requires the `RHOST` environment variable to be set properly and
+configured SSH access to a remote host.
 
-* Add rlogin, rsh, rexec into /etc/securetty file:
+The `RHOST` variable must be set to the hostname of the server (test management
+link) and public key setup or login without password is required.
 
-```sh
-for i in rlogin rsh rexec; do echo $i>>  /etc/securetty; done
-```
+Some of the network stress tests which hasn't been ported to network API were

testcases/network/README.md line 26

Quoted 10 lines
testcases/network/README.md +5 -1
+designed to be tested with `rsh` via `LTP_RSH` environment variable. Now it's
+by default used `ssh`, for details see `testcases/network/stress/README`.
 
  ## Server Services Configuration
  Verify that the below daemon services are running. If not, please install
  and start them:
-rsh-server, telnet-server, finger-server, rdist, rsync, dhcp-server, http-server.
+
+dhcp-server, dnsmasq, http-server, nfs-kernel-server, rpcbind, rsync,
+telnet-server, vsftpd

Hi Petr,

These package names are from Debian/Ubuntu, do we need to mention it?

Quoted 7 lines
testcases/network/README.md +0 -3
  Note: If any of the above daemon is not running on server, the test related to
  that service running from client will fail.
 
-### FTP setup
-* In ?/etc/ftpusers? [or vi /etc/vsftpd.ftpusers], comment the line containing
-?root? string. This file lists all those users who are not given access to do ftp

testcases/network/README.md line 40

Quoted 10 lines
testcases/network/README.md +9 -0
+### FTP and telnet setup
+Both tests require environment variables `RHOST` (remote machine), `RUSER`
+(remote user) and `PASSWD` (remote password). NOTE: `RHOST` will imply two host
+configuratioe for other tests.
+
+If `RHOST` is set to `root`, either of these steps is required:
+
+* In `/etc/ftpusers` (or `/etc/vsftpd.ftpusers`), comment the line containing
+"root" string. This file lists all those users who are not given access to do ftp
  on the current system.

Are this file from Debian/Ubuntu as well?

Other than this, it is good to me. :-)

Thanks,
Xiao Yang

Quoted 50 lines
testcases/network/README.md +14 -23
-* If you don?t want to do the previous step, put following entry into /root/.netrc
-machine<remote_server_name>  login root password<remote_root_password>.
-Otherwise, ftp,rlogin&  telnet fails for ?root? user&  hence needs to be
-executed using ?test? user to get successful results.
+* If you don?t want to do the previous step, put following entry into `/root/.netrc`:
+```
+machine<remote_server_name>
+login root
+password<remote_root_password>
+```
 
  ## LTP setup
-Install LTP testsuite. In case of two hosts configuration, make sure LTP is installed
-on both client and server machines.
-
-Testcases and network tools must be in PATH, e.g.:
+Install LTP testsuite. In case of two hosts configuration, LTP needs to be installed
+and `LTPROOT` and `PATH` environment variables set on both client and server
+machines (assuming using the default prefix `/opt/ltp`):
 
  ```sh
-export PATH=/opt/ltp/testcases/bin:/usr/bin:$PATH
+export LTPROOT="/opt/ltp"; export PATH="$LTPROOT/testcases/bin:$PATH"
  ```
-Default values for all LTP network variables are set in testcases/lib/tst_net.sh.
-If you need to override some parameters please export them before test run or
-specify them when running ltp-pan or testscripts/network.sh.
+Default values for all LTP network parameters are set in `testcases/lib/tst_net.sh`.
+Network stress parameters are documented in `testcases/network/stress/README`.
 
  ## Running the tests
-To run the test type the following:
 
  ```sh
  TEST_VARS ./network.sh OPTIONS
  ```
  Where
-* TEST_VARS - non-default network parameters (see testcases/lib/tst_net.sh), they
-  could be exported before test run;
-* OPTIONS - test group(s), use '-h' to see available ones.
-
-## Analyzing the results
-Generally this test must be run more than 24 hours. When you want to stop the test
-press CTRL+C to stop ./network.sh.
-
-Search failed tests in LTP logfile using grep FAIL<logfile>. For any failures,
-run the individual tests and then try to come to the conclusion.
+* `TEST_VARS` - non-default network parameters
+* `OPTIONS` - test group(s), use `-h` to see available ones.
author
#12 lore raw

PATCH v2 4/7 net: Update README.md

Hi,

...

Quoted 1 line
Quoted 1 line

+++ b/testcases/network/README.md

...

Quoted 10 lines

testcases/network/README.md line 26

Quoted 7 lines

## Server Services Configuration
Verify that the below daemon services are running. If not, please install and start them:

testcases/network/README.md +3 -1
-rsh-server, telnet-server, finger-server, rdist, rsync, dhcp-server, http-server.
+
+dhcp-server, dnsmasq, http-server, nfs-kernel-server, rpcbind, rsync,
+telnet-server, vsftpd

Hi Petr,

These package names are from Debian/Ubuntu, do we need to mention it?

All these packages are at least in Debian/Ubuntu and openSUSE. IMHO other distros have similar names. Exception is nfs-kernel-server, which is at least on Fedora/RHEL nfs-server. Thus something like:

dhcp-server, dnsmasq, http-server, nfs-kernel-server or nfs-server, rpcbind, rsync,telnet-server, vsftpd

Quoted 17 lines
Quoted 6 lines

Note: If any of the above daemon is not running on server, the test related to that service running from client will fail.

testcases/network/README.md +0 -3
-### FTP setup
-* In ?/etc/ftpusers? [or vi /etc/vsftpd.ftpusers], comment the line containing
-?root? string. This file lists all those users who are not given access to do ftp

testcases/network/README.md line 40

Quoted 10 lines
testcases/network/README.md +9 -0
+### FTP and telnet setup
+Both tests require environment variables `RHOST` (remote machine), `RUSER`
+(remote user) and `PASSWD` (remote password). NOTE: `RHOST` will imply two host
+configuratioe for other tests.
+
+If `RHOST` is set to `root`, either of these steps is required:
+
+* In `/etc/ftpusers` (or `/etc/vsftpd.ftpusers`), comment the line containing
+"root" string. This file lists all those users who are not given access to do ftp
  on the current system.

Are this file from Debian/Ubuntu as well?

Again, /etc/ftpusers is at least for openSUSE and Debian/Ubuntu. Fedora/RHEL has /etc/vsftpd/ftpusers and /etc/vsftpd/user_list /etc/vsftpd.ftpusers looks like to be on RHEL 4/ some old Fedora.

Thus:
* In /etc/ftpusers (or /etc/vsftpd/ftpusers or /etc/vsftpd.ftpusers),
* comment the line containing
...

I also wondered if setup should mention something related to single test, but it didn't harm. I was thinking whether ftp test is worth to keep (and thus need to be rewritten), but understand it's useful as a high level smoke test.

OK with these changes?

Kind regards,
Petr

Quoted 5 lines

Other than this, it is good to me. :-)

Thanks,
Xiao Yang

#13 lore raw

PATCH v2 4/7 net: Update README.md

Quoted 14 lines · Petr Vorel

Hi,

...

Quoted 1 line
Quoted 1 line

+++ b/testcases/network/README.md

...

Quoted 9 lines

testcases/network/README.md line 26

Quoted 7 lines

## Server Services Configuration
Verify that the below daemon services are running. If not, please install and start them:

testcases/network/README.md +3 -1
-rsh-server, telnet-server, finger-server, rdist, rsync, dhcp-server, http-server.
+
+dhcp-server, dnsmasq, http-server, nfs-kernel-server, rpcbind, rsync,
+telnet-server, vsftpd

Hi Petr,
These package names are from Debian/Ubuntu, do we need to mention it?

Quoted 6 lines

All these packages are at least in Debian/Ubuntu and openSUSE. IMHO other distros have similar names. Exception is nfs-kernel-server, which is at least on Fedora/RHEL nfs-server. Thus something like:

dhcp-server, dnsmasq, http-server, nfs-kernel-server or nfs-server, rpcbind, rsync,telnet-server, vsftpd

Hi Petr,

If these name represent pakcage name, there are some differnets between Debian/Ubuntu/openSUSE and Fedora/RHEL:
Debian/Ubuntu/openSUSE: isc-dhcp-server, dnsmasq?apache2, nfs-kernel-server, rpcbind?rsync, telnetd + xinetd, vsftpd RHEL/Fedora: dhcp, dnsmasq?httpd, nfs-utils?rpcbind?rsync, telnet-server, vsftpd

Could we just represent service name:
dhcpd(or isc-dhcp-server), dnsmasq, httpd(or apache2), nfs-server, rpcbind, telnet.socket(or xinetd), vsftpd

BTW: I cannot find which test use rsync, did I miss something?

Quoted 16 lines
Quoted 8 lines
Quoted 8 lines

Note: If any of the above daemon is not running on server, the test related to that service running from client will fail.

testcases/network/README.md +3 -3
-### FTP setup
-* In ?/etc/ftpusers? [or vi /etc/vsftpd.ftpusers], comment the line containing
-?root? string. This file lists all those users who are not given access to do ftp
+### FTP and telnet setup
+Both tests require environment variables `RHOST` (remote machine), `RUSER`
+(remote user) and `PASSWD` (remote password). NOTE: `RHOST` will imply two host
Quoted 8 lines

testcases/network/README.md line 40

Quoted 7 lines
testcases/network/README.md +6 -0
+configuratioe for other tests.
+
+If `RHOST` is set to `root`, either of these steps is required:
+
+* In `/etc/ftpusers` (or `/etc/vsftpd.ftpusers`), comment the line containing
+"root" string. This file lists all those users who are not given access to do ftp
   on the current system.

Are this file from Debian/Ubuntu as well?

Quoted 8 lines

Again, /etc/ftpusers is at least for openSUSE and Debian/Ubuntu. Fedora/RHEL has /etc/vsftpd/ftpusers and /etc/vsftpd/user_list /etc/vsftpd.ftpusers looks like to be on RHEL 4/ some old Fedora.

Thus:
* In /etc/ftpusers (or /etc/vsftpd/ftpusers or /etc/vsftpd.ftpusers),
* comment the line containing
...

This change looks good. :-)

Quoted 3 lines

I also wondered if setup should mention something related to single test, but it didn't harm. I was thinking whether ftp test is worth to keep (and thus need to be rewritten), but understand it's useful as a high level smoke test.

1) It seems better to mention something related to single test.
2) Perfer to keep and rewrite ftp test.

Thanks,
Xiao Yang

Quoted 12 lines

OK with these changes?

Kind regards,
Petr

Quoted 4 lines

Other than this, it is good to me. :-)

Thanks,
Xiao Yang

.

author
#14 lore raw

PATCH v2 4/7 net: Update README.md

Hi Yang,

Quoted 10 lines

If these name represent pakcage name, there are some differnets between Debian/Ubuntu/openSUSE and Fedora/RHEL:
Debian/Ubuntu/openSUSE: isc-dhcp-server, dnsmasq?apache2, nfs-kernel-server, rpcbind?rsync, telnetd + xinetd, vsftpd RHEL/Fedora: dhcp, dnsmasq?httpd, nfs-utils?rpcbind?rsync, telnet-server, vsftpd

Could we just represent service name:
dhcpd(or isc-dhcp-server), dnsmasq, httpd(or apache2), nfs-server, rpcbind, telnet.socket(or xinetd), vsftpd

I'd either wrote software names (people would have to find the package name for the distro) or find package names for all distros (Debian / Ubuntu, OpenSUSE / SLES, Fedora / CentOS / RHEL as it's in INSTALL).

And there are xinetd tests, so xinetd are always needed.

+ There is some other packages needed. But instead of writing it here it'd be good to add it to metadata. We're working with Cyril on docparse project, which will autogenerate this metadata.

Quoted 1 line

BTW: I cannot find which test use rsync, did I miss something?

Correct, this looks like a leftover from the past. Thanks!

Quoted 20 lines
Quoted 19 lines
Quoted 8 lines
Quoted 8 lines

Note: If any of the above daemon is not running on server, the test related to that service running from client will fail.

testcases/network/README.md +3 -3
-### FTP setup
-* In ?/etc/ftpusers? [or vi /etc/vsftpd.ftpusers], comment the line containing
-?root? string. This file lists all those users who are not given access to do ftp
+### FTP and telnet setup
+Both tests require environment variables `RHOST` (remote machine), `RUSER`
+(remote user) and `PASSWD` (remote password). NOTE: `RHOST` will imply two host
Quoted 8 lines

testcases/network/README.md line 40

Quoted 7 lines
testcases/network/README.md +6 -0
+configuratioe for other tests.
+
+If `RHOST` is set to `root`, either of these steps is required:
+
+* In `/etc/ftpusers` (or `/etc/vsftpd.ftpusers`), comment the line containing
+"root" string. This file lists all those users who are not given access to do ftp
   on the current system.

Are this file from Debian/Ubuntu as well?

Again, /etc/ftpusers is at least for openSUSE and Debian/Ubuntu. Fedora/RHEL has /etc/vsftpd/ftpusers and /etc/vsftpd/user_list /etc/vsftpd.ftpusers looks like to be on RHEL 4/ some old Fedora.

Quoted 6 lines
Quoted 4 lines

Thus:
* In /etc/ftpusers (or /etc/vsftpd/ftpusers or /etc/vsftpd.ftpusers),
* comment the line containing
...

This change looks good. :-)

ok.

Quoted 5 lines
Quoted 3 lines

I also wondered if setup should mention something related to single test, but it didn't harm. I was thinking whether ftp test is worth to keep (and thus need to be rewritten), but understand it's useful as a high level smoke test.

1) It seems better to mention something related to single test.
2) Perfer to keep and rewrite ftp test.

ok.

Kind regards,
Petr

author
#15 lore raw

PATCH v2 5/7 tst_net.sh: Drop 'sh -c' use from ssh in tst_rhost_run

In reply to Petr Vorel

This simplifies the command and allows to use double quotes in command parameter for ssh, as it removes single nested quotes of command parameter (thus fixes like c1a2d53f6 "network/nfs_lib.sh: Use double quotes for grep pattern" are not needed any more).

NOTE: 'sh -c' is still required for netns based testing, but does not use nested quotes. Now both variants use only double quotes.

---
 testcases/lib/tst_net.sh | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
testcases/lib/tst_net.sh +4 -4
index 0a8b2a8ca..f6ac4c087 100644
@@ -167,12 +167,12 @@ tst_rhost_run()
 	fi
 
 	if [ -n "${TST_USE_NETNS:-}" ]; then
-		output=`$LTP_NETNS sh -c \
-			"$pre_cmd $cmd $post_cmd" $out 2>&1 || echo 'RTERR'`
+		output=$($LTP_NETNS sh -c \
+			"$pre_cmd $cmd $post_cmd" $out 2>&1 || echo 'RTERR')
 	else
 		tst_require_cmds ssh
-		output=`ssh -nq $user@$RHOST "sh -c \
-			'$pre_cmd $cmd $post_cmd'" $out 2>&1 || echo 'RTERR'`
+		output=$(ssh -nq $user@$RHOST \
+			"$pre_cmd $cmd $post_cmd" $out 2>&1 || echo 'RTERR')
 	fi
 	echo "$output" | grep -q 'RTERR$' && ret=1
 	if [ $ret -eq 1 ]; then
Signature · 1 line
2.27.0
#16 lore raw

PATCH v2 5/7 tst_net.sh: Drop 'sh -c' use from ssh in tst_rhost_run

Quoted 7 lines · Petr Vorel

This simplifies the command and allows to use double quotes in command parameter for ssh, as it removes single nested quotes of command parameter (thus fixes like c1a2d53f6 "network/nfs_lib.sh: Use double quotes for grep pattern" are not needed any more).

NOTE: 'sh -c' is still required for netns based testing, but does not use nested quotes. Now both variants use only double quotes.

Hi Petr,

Thanks,
Xiao Yang

Quoted 28 lines
---
 testcases/lib/tst_net.sh | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
testcases/lib/tst_net.sh +4 -4
index 0a8b2a8ca..f6ac4c087 100644
@@ -167,12 +167,12 @@ tst_rhost_run()
 	fi
 
 	if [ -n "${TST_USE_NETNS:-}" ]; then
-		output=`$LTP_NETNS sh -c \
-			"$pre_cmd $cmd $post_cmd" $out 2>&1 || echo 'RTERR'`
+		output=$($LTP_NETNS sh -c \
+			"$pre_cmd $cmd $post_cmd" $out 2>&1 || echo 'RTERR')
 	else
 		tst_require_cmds ssh
-		output=`ssh -nq $user@$RHOST "sh -c \
-			'$pre_cmd $cmd $post_cmd'" $out 2>&1 || echo 'RTERR'`
+		output=$(ssh -nq $user@$RHOST \
+			"$pre_cmd $cmd $post_cmd" $out 2>&1 || echo 'RTERR')
 	fi
 	echo "$output" | grep -q 'RTERR$' && ret=1
 	if [ $ret -eq 1 ]; then
author
#17 lore raw

PATCH v2 6/7 net/test: Add basic testing for tst_rhost_run

In reply to Petr Vorel

Regression test for use of nested single quotes
(fixed in previous commit).

---
 lib/newlib_tests/shell/net/tst_rhost_run.sh | 25 +++++++++++++++++++++
 1 file changed, 25 insertions(+)
 create mode 100755 lib/newlib_tests/shell/net/tst_rhost_run.sh
lib/newlib_tests/shell/net/tst_rhost_run.sh new file +25 -0
new file mode 100755
index 000000000..4c034a4ac
@@ -0,0 +1,25 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2020 Petr Vorel <[email protected]>
+
+TST_TESTFUNC=do_test
+PATH="$(dirname $0)/../../../../testcases/lib/:$PATH"
+. tst_net.sh
+
+do_test()
+{
+	local file="/etc/fstab"
+
+	tst_rhost_run -c 'which grep > /dev/null' || \
+		tst_res TCONF "grep not found on rhost"
+
+	tst_rhost_run -c "[ -f $file ]" || \
+		tst_res TCONF "$file not found on rhost"
+
+	tst_rhost_run -s -c "grep -q \"[^ ]\" $file"
+	tst_rhost_run -s -c "grep -q '[^ ]' $file"
+
+	tst_res TPASS "tst_rhost_run is working"
+}
+
+tst_run
Signature · 1 line
2.27.0
#18 lore raw

PATCH v2 6/7 net/test: Add basic testing for tst_rhost_run

Quoted 20 lines · Petr Vorel

Regression test for use of nested single quotes
(fixed in previous commit).

---
 lib/newlib_tests/shell/net/tst_rhost_run.sh | 25 +++++++++++++++++++++
 1 file changed, 25 insertions(+)
 create mode 100755 lib/newlib_tests/shell/net/tst_rhost_run.sh
lib/newlib_tests/shell/net/tst_rhost_run.sh new file +4 -0
new file mode 100755
index 000000000..4c034a4ac
@@ -0,0 +1,25 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2020 Petr Vorel <[email protected]>
+

lib/newlib_tests/shell/net/tst_rhost_run.sh line 14

Quoted 10 lines
lib/newlib_tests/shell/net/tst_rhost_run.sh new file +10 -0
+TST_TESTFUNC=do_test
+PATH="$(dirname $0)/../../../../testcases/lib/:$PATH"
+. tst_net.sh
+
+do_test()
+{
+	local file="/etc/fstab"
+
+	tst_rhost_run -c 'which grep > /dev/null' || \
+		tst_res TCONF "grep not found on rhost"

Hi Petr,

1) Do you want to discard stderr as well? For example:
-------------------------------------------------

# which gre >/dev/null
/usr/bin/which: no gre in
(/opt/ltp/testcases/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/root/bin)
-------------------------------------------------
2) Is it necessary to continue if grep command is not found on rhost?
How about calling tst_brk?

lib/newlib_tests/shell/net/tst_rhost_run.sh line 17

Quoted 3 lines
lib/newlib_tests/shell/net/tst_rhost_run.sh new file +3 -0
+
+	tst_rhost_run -c "[ -f $file ]" || \
+		tst_res TCONF "$file not found on rhost"

Call tst_brk as well?

Thanks,
Xiao Yang

Quoted 8 lines
lib/newlib_tests/shell/net/tst_rhost_run.sh new file +8 -0
+
+	tst_rhost_run -s -c "grep -q \"[^ ]\" $file"
+	tst_rhost_run -s -c "grep -q '[^ ]' $file"
+
+	tst_res TPASS "tst_rhost_run is working"
+}
+
+tst_run
author
#19 lore raw

PATCH v2 6/7 net/test: Add basic testing for tst_rhost_run

Hi,

Quoted 9 lines

lib/newlib_tests/shell/net/tst_rhost_run.sh line 14

Quoted 2 lines
lib/newlib_tests/shell/net/tst_rhost_run.sh new file +2 -0
+	tst_rhost_run -c 'which grep > /dev/null' || \
+		tst_res TCONF "grep not found on rhost"

Hi Petr,

1) Do you want to discard stderr as well? For example:
-------------------------------------------------

# which gre >/dev/null
/usr/bin/which: no gre in
(/opt/ltp/testcases/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/root/bin)

That's not needed because tst_rhost_run already redirect stderr to stdout.

Quoted 3 lines

-------------------------------------------------
2) Is it necessary to continue if grep command is not found on rhost? How about calling tst_brk?

Good catch, I should use tst_brk on both places.

Quoted 7 lines

lib/newlib_tests/shell/net/tst_rhost_run.sh line 17

Quoted 3 lines
lib/newlib_tests/shell/net/tst_rhost_run.sh new file +3 -0
+
+	tst_rhost_run -c "[ -f $file ]" || \
+		tst_res TCONF "$file not found on rhost"

Call tst_brk as well?

Thanks,
Xiao Yang

Thanks!
Petr

#20 lore raw

PATCH v2 6/7 net/test: Add basic testing for tst_rhost_run

Quoted 11 lines · Petr Vorel

Hi,

Quoted 8 lines

lib/newlib_tests/shell/net/tst_rhost_run.sh line 14

Quoted 2 lines
lib/newlib_tests/shell/net/tst_rhost_run.sh new file +2 -0
+	tst_rhost_run -c 'which grep > /dev/null' || \
+		tst_res TCONF "grep not found on rhost"

Hi Petr,
1) Do you want to discard stderr as well? For example:
-------------------------------------------------

# which gre >/dev/null
/usr/bin/which: no gre in
(/opt/ltp/testcases/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/root/bin)

That's not needed because tst_rhost_run already redirect stderr to stdout.

Hi Petr,

I think you means tst_rhost_run -c 'which grep' >/dev/null rather than tst_rhost_run -c 'which grep > /dev/null'

The current code just discard stdout, for example:

-------------------------------------------------------

[root@Fedora-30-workstation net]# ./tst_rhost_run.sh
...
tst_rhost_run 1 TINFO: NETNS: ns_exec 3079 net,mnt sh -c " which gre >
/dev/null || echo RTERR" 2>&1
which: no gre in (./../../../../testcases/lib/:/usr/share/Modules/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/root/bin:/opt/ltp/testcases/bin)

-------------------------------------------------------

Thanks,

Xiao Yang

Quoted 15 lines
Quoted 4 lines

-------------------------------------------------
2) Is it necessary to continue if grep command is not found on rhost? How about calling tst_brk?

Good catch, I should use tst_brk on both places.

Quoted 6 lines

lib/newlib_tests/shell/net/tst_rhost_run.sh line 17

Quoted 3 lines
lib/newlib_tests/shell/net/tst_rhost_run.sh new file +3 -0
+
+	tst_rhost_run -c "[ -f $file ]" || \
+		tst_res TCONF "$file not found on rhost"

Call tst_brk as well?
Thanks,
Xiao Yang

Thanks!
Petr

author
#21 lore raw

PATCH v2 6/7 net/test: Add basic testing for tst_rhost_run

Hi Yang,

Quoted 15 lines
Quoted 7 lines
Quoted 6 lines

Hi Petr,
1) Do you want to discard stderr as well? For example:
-------------------------------------------------

# which gre >/dev/null
/usr/bin/which: no gre in
(/opt/ltp/testcases/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/root/bin)

That's not needed because tst_rhost_run already redirect stderr to stdout.

Hi Petr,

I think you means tst_rhost_run -c 'which grep' >/dev/null rather than tst_rhost_run -c 'which grep > /dev/null'

The current code just discard stdout, for example:

Quoted 7 lines

-------------------------------------------------------

[root@Fedora-30-workstation net]# ./tst_rhost_run.sh
...
tst_rhost_run 1 TINFO: NETNS: ns_exec 3079 net,mnt sh -c " which gre >
/dev/null || echo RTERR" 2>&1
which: no gre in (./../../../../testcases/lib/:/usr/share/Modules/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/root/bin:/opt/ltp/testcases/bin)

I'm sorry, I accidentally tested on which version from debianutils which prints also errors to stdout. which from GNU which (used in openSUSE/SLES, Fedora/RHEL) prints errors to stderr => you're right stderr should be redirected. On the other hand when not redirected, you can see PATH.

Kind regards,
Petr

author
#22 lore raw

PATCH v2 7/7 tst_net.sh/tst_rhost_run: Add debugging

In reply to Petr Vorel

via TST_NET_RHOST_RUN_DEBUG=1 and use it in tst_rhost_run.sh.

---
changes v1->v2:
* Use TST_NET_RHOST_RUN_DEBUG=1 instead of -d in tst_rhost_run This requires to whitelist it in tst_test.sh.
* use tst_res_ TINFO instead of tst_net_debug

Kind regards,
Petr

 lib/newlib_tests/shell/net/tst_rhost_run.sh |  2 ++
 testcases/lib/tst_net.sh                    | 23 +++++++++++++++------
 testcases/lib/tst_test.sh                   |  2 +-
 testcases/network/README.md                 |  3 +++
 4 files changed, 23 insertions(+), 7 deletions(-)
lib/newlib_tests/shell/net/tst_rhost_run.sh +2 -0
index 4c034a4ac..9b058a57a 100755
@@ -6,6 +6,8 @@ TST_TESTFUNC=do_test
 PATH="$(dirname $0)/../../../../testcases/lib/:$PATH"
 . tst_net.sh
 
+export TST_NET_RHOST_RUN_DEBUG=1
+
 do_test()
 {
 	local file="/etc/fstab"
testcases/lib/tst_net.sh +17 -6
index f6ac4c087..d939a5780 100644
@@ -138,15 +138,16 @@ init_ltp_netspace()
 # -s safe option, if something goes wrong, will exit with TBROK
 # -u USER for ssh (default root)
 # RETURN: 0 on success, 1 on failure
+# TST_NET_RHOST_RUN_DEBUG=1 enables debugging
 tst_rhost_run()
 {
 	local post_cmd=' || echo RTERR'
 	local user="root"
 	local ret=0
-	local cmd out output pre_cmd safe
+	local cmd out output pre_cmd rcmd sh_cmd safe use
 
 	local OPTIND
-	while getopts :bsc:u: opt; do
+	while getopts :bc:su: opt; do
 		case "$opt" in
 		b) [ "${TST_USE_NETNS:-}" ] && pre_cmd= || pre_cmd="nohup"
 		   post_cmd=" > /dev/null 2>&1 &"
@@ -166,14 +167,24 @@ tst_rhost_run()
 		return 1
 	fi
 
+	sh_cmd="$pre_cmd $cmd $post_cmd"
+
 	if [ -n "${TST_USE_NETNS:-}" ]; then
-		output=$($LTP_NETNS sh -c \
-			"$pre_cmd $cmd $post_cmd" $out 2>&1 || echo 'RTERR')
+		use="NETNS"
+		rcmd="$LTP_NETNS sh -c"
 	else
 		tst_require_cmds ssh
-		output=$(ssh -nq $user@$RHOST \
-			"$pre_cmd $cmd $post_cmd" $out 2>&1 || echo 'RTERR')
+		use="SSH"
+		rcmd="ssh -nq $user@$RHOST"
+	fi
+
+	if [ "$TST_NET_RHOST_RUN_DEBUG" = 1 ]; then
+		tst_res_ TINFO "tst_rhost_run: cmd: $cmd"
+		tst_res_ TINFO "$use: $rcmd \"$sh_cmd\" $out 2>&1"
 	fi
+
+	output=$($rcmd "$sh_cmd" $out 2>&1 || echo 'RTERR')
+
 	echo "$output" | grep -q 'RTERR$' && ret=1
 	if [ $ret -eq 1 ]; then
 		output=$(echo "$output" | sed 's/RTERR//')
testcases/lib/tst_test.sh +1 -1
index 2e637b25b..fa97acbac 100644
@@ -506,7 +506,7 @@ tst_run()
 			NEEDS_DRIVERS|FS_TYPE|MNTPOINT|MNT_PARAMS);;
 			IPV6|IPVER|TEST_DATA|TEST_DATA_IFS);;
 			RETRY_FUNC|RETRY_FN_EXP_BACKOFF|TIMEOUT);;
-			NET_DATAROOT|NET_MAX_PKT);;
+			NET_DATAROOT|NET_MAX_PKT|NET_RHOST_RUN_DEBUG);;
 			*) tst_res TWARN "Reserved variable TST_$_tst_i used!";;
 			esac
 		done
testcases/network/README.md +3 -0
index 1c19a2c15..081ce834a 100644
@@ -1,5 +1,8 @@
 # LTP Network Tests
 
+Both single and two host configurations support debugging via
+`TST_NET_RHOST_RUN_DEBUG=1` environment variable.
+
 ## Single Host Configuration
 
 It is the default configuration (if the `RHOST` environment variable is not
Signature · 1 line
2.27.0
#23 lore raw

PATCH v2 7/7 tst_net.sh/tst_rhost_run: Add debugging

Quoted 1 line · Petr Vorel

via TST_NET_RHOST_RUN_DEBUG=1 and use it in tst_rhost_run.sh.

Hi Petr,

Thanks,
Xiao Yang

Quoted 108 lines

---
changes v1->v2:
* Use TST_NET_RHOST_RUN_DEBUG=1 instead of -d in tst_rhost_run This requires to whitelist it in tst_test.sh.
* use tst_res_ TINFO instead of tst_net_debug

Kind regards,
Petr

 lib/newlib_tests/shell/net/tst_rhost_run.sh |  2 ++
 testcases/lib/tst_net.sh                    | 23 +++++++++++++++------
 testcases/lib/tst_test.sh                   |  2 +-
 testcases/network/README.md                 |  3 +++
 4 files changed, 23 insertions(+), 7 deletions(-)
lib/newlib_tests/shell/net/tst_rhost_run.sh +2 -0
index 4c034a4ac..9b058a57a 100755
@@ -6,6 +6,8 @@ TST_TESTFUNC=do_test
 PATH="$(dirname $0)/../../../../testcases/lib/:$PATH"
 . tst_net.sh
 
+export TST_NET_RHOST_RUN_DEBUG=1
+
 do_test()
 {
 	local file="/etc/fstab"
testcases/lib/tst_net.sh +17 -6
index f6ac4c087..d939a5780 100644
@@ -138,15 +138,16 @@ init_ltp_netspace()
 # -s safe option, if something goes wrong, will exit with TBROK
 # -u USER for ssh (default root)
 # RETURN: 0 on success, 1 on failure
+# TST_NET_RHOST_RUN_DEBUG=1 enables debugging
 tst_rhost_run()
 {
 	local post_cmd=' || echo RTERR'
 	local user="root"
 	local ret=0
-	local cmd out output pre_cmd safe
+	local cmd out output pre_cmd rcmd sh_cmd safe use
 
 	local OPTIND
-	while getopts :bsc:u: opt; do
+	while getopts :bc:su: opt; do
 		case "$opt" in
 		b) [ "${TST_USE_NETNS:-}" ] && pre_cmd= || pre_cmd="nohup"
 		   post_cmd=" > /dev/null 2>&1 &"
@@ -166,14 +167,24 @@ tst_rhost_run()
 		return 1
 	fi
 
+	sh_cmd="$pre_cmd $cmd $post_cmd"
+
 	if [ -n "${TST_USE_NETNS:-}" ]; then
-		output=$($LTP_NETNS sh -c \
-			"$pre_cmd $cmd $post_cmd" $out 2>&1 || echo 'RTERR')
+		use="NETNS"
+		rcmd="$LTP_NETNS sh -c"
 	else
 		tst_require_cmds ssh
-		output=$(ssh -nq $user@$RHOST \
-			"$pre_cmd $cmd $post_cmd" $out 2>&1 || echo 'RTERR')
+		use="SSH"
+		rcmd="ssh -nq $user@$RHOST"
+	fi
+
+	if [ "$TST_NET_RHOST_RUN_DEBUG" = 1 ]; then
+		tst_res_ TINFO "tst_rhost_run: cmd: $cmd"
+		tst_res_ TINFO "$use: $rcmd \"$sh_cmd\" $out 2>&1"
 	fi
+
+	output=$($rcmd "$sh_cmd" $out 2>&1 || echo 'RTERR')
+
 	echo "$output" | grep -q 'RTERR$' && ret=1
 	if [ $ret -eq 1 ]; then
 		output=$(echo "$output" | sed 's/RTERR//')
testcases/lib/tst_test.sh +1 -1
index 2e637b25b..fa97acbac 100644
@@ -506,7 +506,7 @@ tst_run()
 			NEEDS_DRIVERS|FS_TYPE|MNTPOINT|MNT_PARAMS);;
 			IPV6|IPVER|TEST_DATA|TEST_DATA_IFS);;
 			RETRY_FUNC|RETRY_FN_EXP_BACKOFF|TIMEOUT);;
-			NET_DATAROOT|NET_MAX_PKT);;
+			NET_DATAROOT|NET_MAX_PKT|NET_RHOST_RUN_DEBUG);;
 			*) tst_res TWARN "Reserved variable TST_$_tst_i used!";;
 			esac
 		done
testcases/network/README.md +3 -0
index 1c19a2c15..081ce834a 100644
@@ -1,5 +1,8 @@
 # LTP Network Tests
 
+Both single and two host configurations support debugging via
+`TST_NET_RHOST_RUN_DEBUG=1` environment variable.
+
 ## Single Host Configuration
 
 It is the default configuration (if the `RHOST` environment variable is not
author Applied
#25 lore raw

v2 cover tst_net.sh: Remove rsh, update docs add debug & test

In reply to Petr Vorel

Hi Alexey, Xiao,

...

Quoted 8 lines

Petr Vorel (7):
tst_net.sh: Remove rsh support
tst_net.sh: Use ssh in LTP_RSH
net: Remove rsh, rcp, rlogin tests
net: Update README.md
tst_net.sh: Drop 'sh -c' use from ssh in tst_rhost_run net/test: Add basic testing for tst_rhost_run tst_net.sh/tst_rhost_run: Add debugging

I merged all but these to patches, which I'll resend:

* net: Remove rsh, rcp, rlogin tests
@Alexey: I'd like to get your ack.

* net: Update README.md
I'll fixes package and service names (Xiao) + move networking related doc from INSTALL to testcases/network/README.md.

Kind regards,
Petr