All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH v2 0/7] tst_net.sh: Remove rsh, update docs add debug & test
@ 2020-07-10 17:20 Petr Vorel
  2020-07-10 17:20 ` [LTP] [PATCH v2 1/7] tst_net.sh: Remove rsh support Petr Vorel
                   ` (8 more replies)
  0 siblings, 9 replies; 26+ messages in thread
From: Petr Vorel @ 2020-07-10 17:20 UTC (permalink / raw)
  To: ltp

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

-- 
2.27.0


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

* [LTP] [PATCH v2 1/7] tst_net.sh: Remove rsh support
  2020-07-10 17:20 [LTP] [PATCH v2 0/7] tst_net.sh: Remove rsh, update docs add debug & test Petr Vorel
@ 2020-07-10 17:20 ` Petr Vorel
  2020-07-20  7:37   ` Xiao Yang
  2020-07-10 17:20 ` [LTP] [PATCH v2 2/7] tst_net.sh: Use ssh in LTP_RSH Petr Vorel
                   ` (7 subsequent siblings)
  8 siblings, 1 reply; 26+ messages in thread
From: Petr Vorel @ 2020-07-10 17:20 UTC (permalink / raw)
  To: ltp

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.

Suggested-by: Alexey Kodanev <alexey.kodanev@oracle.com>
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 testcases/lib/tst_net.sh | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/testcases/lib/tst_net.sh b/testcases/lib/tst_net.sh
index 806b540cd..7ba267eda 100644
--- a/testcases/lib/tst_net.sh
+++ b/testcases/lib/tst_net.sh
@@ -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
-- 
2.27.0


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

* [LTP] [PATCH v2 2/7] tst_net.sh: Use ssh in LTP_RSH
  2020-07-10 17:20 [LTP] [PATCH v2 0/7] tst_net.sh: Remove rsh, update docs add debug & test Petr Vorel
  2020-07-10 17:20 ` [LTP] [PATCH v2 1/7] tst_net.sh: Remove rsh support Petr Vorel
@ 2020-07-10 17:20 ` Petr Vorel
  2020-07-20  8:17   ` Xiao Yang
  2020-07-10 17:20 ` [LTP] [PATCH v2 3/7] net: Remove rsh, rcp, rlogin tests Petr Vorel
                   ` (6 subsequent siblings)
  8 siblings, 1 reply; 26+ messages in thread
From: Petr Vorel @ 2020-07-10 17:20 UTC (permalink / raw)
  To: ltp

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

+ update docs.

Suggested-by: Alexey Kodanev <alexey.kodanev@oracle.com>
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 testcases/lib/tst_net.sh        | 2 +-
 testcases/network/stress/README | 9 ++++-----
 2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/testcases/lib/tst_net.sh b/testcases/lib/tst_net.sh
index 7ba267eda..0a8b2a8ca 100644
--- a/testcases/lib/tst_net.sh
+++ b/testcases/lib/tst_net.sh
@@ -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),
diff --git a/testcases/network/stress/README b/testcases/network/stress/README
index bc51a4cc9..b9537b1ce 100644
--- a/testcases/network/stress/README
+++ b/testcases/network/stress/README
@@ -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.
 
-- 
2.27.0


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

* [LTP] [PATCH v2 3/7] net: Remove rsh, rcp, rlogin tests
  2020-07-10 17:20 [LTP] [PATCH v2 0/7] tst_net.sh: Remove rsh, update docs add debug & test Petr Vorel
  2020-07-10 17:20 ` [LTP] [PATCH v2 1/7] tst_net.sh: Remove rsh support Petr Vorel
  2020-07-10 17:20 ` [LTP] [PATCH v2 2/7] tst_net.sh: Use ssh in LTP_RSH Petr Vorel
@ 2020-07-10 17:20 ` Petr Vorel
  2020-07-20  8:31   ` Xiao Yang
  2020-07-10 17:20 ` [LTP] [PATCH v2 4/7] net: Update README.md Petr Vorel
                   ` (5 subsequent siblings)
  8 siblings, 1 reply; 26+ messages in thread
From: Petr Vorel @ 2020-07-10 17:20 UTC (permalink / raw)
  To: ltp

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.

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
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

diff --git a/runtest/net.tcp_cmds b/runtest/net.tcp_cmds
index afe6d7c71..db47dfd5b 100644
--- a/runtest/net.tcp_cmds
+++ b/runtest/net.tcp_cmds
@@ -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
diff --git a/testcases/network/tcp_cmds/rcp/Makefile b/testcases/network/tcp_cmds/rcp/Makefile
deleted file mode 100644
index f8131a986..000000000
--- a/testcases/network/tcp_cmds/rcp/Makefile
+++ /dev/null
@@ -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
diff --git a/testcases/network/tcp_cmds/rcp/rcp01.sh b/testcases/network/tcp_cmds/rcp/rcp01.sh
deleted file mode 100755
index 4eaeca175..000000000
--- a/testcases/network/tcp_cmds/rcp/rcp01.sh
+++ /dev/null
@@ -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 manjo@mail.utexas.edu
-#    - Modified testcases to use test APIS and fixed bugs
-#    03/01 Robbie Williamson (robbiew@us.ibm.com)
-#      -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
diff --git a/testcases/network/tcp_cmds/rlogin/Makefile b/testcases/network/tcp_cmds/rlogin/Makefile
deleted file mode 100644
index 1e8d10ea4..000000000
--- a/testcases/network/tcp_cmds/rlogin/Makefile
+++ /dev/null
@@ -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
diff --git a/testcases/network/tcp_cmds/rlogin/rlogin01.sh b/testcases/network/tcp_cmds/rlogin/rlogin01.sh
deleted file mode 100755
index c34ab1c4e..000000000
--- a/testcases/network/tcp_cmds/rlogin/rlogin01.sh
+++ /dev/null
@@ -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 (robbiew@us.ibm.com)
-
-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
diff --git a/testcases/network/tcp_cmds/rsh/Makefile b/testcases/network/tcp_cmds/rsh/Makefile
deleted file mode 100644
index 00ae49d8b..000000000
--- a/testcases/network/tcp_cmds/rsh/Makefile
+++ /dev/null
@@ -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
diff --git a/testcases/network/tcp_cmds/rsh/rsh01.sh b/testcases/network/tcp_cmds/rsh/rsh01.sh
deleted file mode 100755
index 3968f9056..000000000
--- a/testcases/network/tcp_cmds/rsh/rsh01.sh
+++ /dev/null
@@ -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 (robbiew@us.ibm.com)
-#      -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
-- 
2.27.0


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

* [LTP] [PATCH v2 4/7] net: Update README.md
  2020-07-10 17:20 [LTP] [PATCH v2 0/7] tst_net.sh: Remove rsh, update docs add debug & test Petr Vorel
                   ` (2 preceding siblings ...)
  2020-07-10 17:20 ` [LTP] [PATCH v2 3/7] net: Remove rsh, rcp, rlogin tests Petr Vorel
@ 2020-07-10 17:20 ` Petr Vorel
  2020-07-20  9:48   ` Xiao Yang
  2020-07-10 17:20 ` [LTP] [PATCH v2 5/7] tst_net.sh: Drop 'sh -c' use from ssh in tst_rhost_run Petr Vorel
                   ` (4 subsequent siblings)
  8 siblings, 1 reply; 26+ messages in thread
From: Petr Vorel @ 2020-07-10 17:20 UTC (permalink / raw)
  To: ltp

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

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 testcases/network/README.md | 96 ++++++++++++++-----------------------
 1 file changed, 36 insertions(+), 60 deletions(-)

diff --git a/testcases/network/README.md b/testcases/network/README.md
index 3a9c98125..1c19a2c15 100644
--- a/testcases/network/README.md
+++ b/testcases/network/README.md
@@ -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.
-- 
2.27.0


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

* [LTP] [PATCH v2 5/7] tst_net.sh: Drop 'sh -c' use from ssh in tst_rhost_run
  2020-07-10 17:20 [LTP] [PATCH v2 0/7] tst_net.sh: Remove rsh, update docs add debug & test Petr Vorel
                   ` (3 preceding siblings ...)
  2020-07-10 17:20 ` [LTP] [PATCH v2 4/7] net: Update README.md Petr Vorel
@ 2020-07-10 17:20 ` Petr Vorel
  2020-07-20  8:49   ` Xiao Yang
  2020-07-10 17:20 ` [LTP] [PATCH v2 6/7] net/test: Add basic testing for tst_rhost_run Petr Vorel
                   ` (3 subsequent siblings)
  8 siblings, 1 reply; 26+ messages in thread
From: Petr Vorel @ 2020-07-10 17:20 UTC (permalink / raw)
  To: ltp

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.

Suggested-by: Alexey Kodanev <alexey.kodanev@oracle.com>
Acked-by: Alexey Kodanev <alexey.kodanev@oracle.com>
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 testcases/lib/tst_net.sh | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/testcases/lib/tst_net.sh b/testcases/lib/tst_net.sh
index 0a8b2a8ca..f6ac4c087 100644
--- a/testcases/lib/tst_net.sh
+++ b/testcases/lib/tst_net.sh
@@ -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
-- 
2.27.0


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

* [LTP] [PATCH v2 6/7] net/test: Add basic testing for tst_rhost_run
  2020-07-10 17:20 [LTP] [PATCH v2 0/7] tst_net.sh: Remove rsh, update docs add debug & test Petr Vorel
                   ` (4 preceding siblings ...)
  2020-07-10 17:20 ` [LTP] [PATCH v2 5/7] tst_net.sh: Drop 'sh -c' use from ssh in tst_rhost_run Petr Vorel
@ 2020-07-10 17:20 ` Petr Vorel
  2020-07-20  9:02   ` Xiao Yang
  2020-07-10 17:20 ` [LTP] [PATCH v2 7/7] tst_net.sh/tst_rhost_run: Add debugging Petr Vorel
                   ` (2 subsequent siblings)
  8 siblings, 1 reply; 26+ messages in thread
From: Petr Vorel @ 2020-07-10 17:20 UTC (permalink / raw)
  To: ltp

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

Acked-by: Alexey Kodanev <alexey.kodanev@oracle.com>
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 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

diff --git a/lib/newlib_tests/shell/net/tst_rhost_run.sh b/lib/newlib_tests/shell/net/tst_rhost_run.sh
new file mode 100755
index 000000000..4c034a4ac
--- /dev/null
+++ b/lib/newlib_tests/shell/net/tst_rhost_run.sh
@@ -0,0 +1,25 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2020 Petr Vorel <pvorel@suse.cz>
+
+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
-- 
2.27.0


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

* [LTP] [PATCH v2 7/7] tst_net.sh/tst_rhost_run: Add debugging
  2020-07-10 17:20 [LTP] [PATCH v2 0/7] tst_net.sh: Remove rsh, update docs add debug & test Petr Vorel
                   ` (5 preceding siblings ...)
  2020-07-10 17:20 ` [LTP] [PATCH v2 6/7] net/test: Add basic testing for tst_rhost_run Petr Vorel
@ 2020-07-10 17:20 ` Petr Vorel
  2020-07-20  9:23   ` Xiao Yang
  2020-07-10 17:22 ` [LTP] [PATCH v2 0/7] tst_net.sh: Remove rsh, update docs add debug & test Petr Vorel
  2020-07-30  8:16 ` Petr Vorel
  8 siblings, 1 reply; 26+ messages in thread
From: Petr Vorel @ 2020-07-10 17:20 UTC (permalink / raw)
  To: ltp

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

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
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(-)

diff --git a/lib/newlib_tests/shell/net/tst_rhost_run.sh b/lib/newlib_tests/shell/net/tst_rhost_run.sh
index 4c034a4ac..9b058a57a 100755
--- a/lib/newlib_tests/shell/net/tst_rhost_run.sh
+++ b/lib/newlib_tests/shell/net/tst_rhost_run.sh
@@ -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"
diff --git a/testcases/lib/tst_net.sh b/testcases/lib/tst_net.sh
index f6ac4c087..d939a5780 100644
--- a/testcases/lib/tst_net.sh
+++ b/testcases/lib/tst_net.sh
@@ -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//')
diff --git a/testcases/lib/tst_test.sh b/testcases/lib/tst_test.sh
index 2e637b25b..fa97acbac 100644
--- a/testcases/lib/tst_test.sh
+++ b/testcases/lib/tst_test.sh
@@ -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
diff --git a/testcases/network/README.md b/testcases/network/README.md
index 1c19a2c15..081ce834a 100644
--- a/testcases/network/README.md
+++ b/testcases/network/README.md
@@ -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
-- 
2.27.0


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

* [LTP] [PATCH v2 0/7] tst_net.sh: Remove rsh, update docs add debug & test
  2020-07-10 17:20 [LTP] [PATCH v2 0/7] tst_net.sh: Remove rsh, update docs add debug & test Petr Vorel
                   ` (6 preceding siblings ...)
  2020-07-10 17:20 ` [LTP] [PATCH v2 7/7] tst_net.sh/tst_rhost_run: Add debugging Petr Vorel
@ 2020-07-10 17:22 ` Petr Vorel
  2020-07-30  8:16 ` Petr Vorel
  8 siblings, 0 replies; 26+ messages in thread
From: Petr Vorel @ 2020-07-10 17:22 UTC (permalink / raw)
  To: ltp

Hi,

testcases/network/README.md is visible in
https://github.com/pevik/ltp/tree/net/remove-rhost.v2/testcases/network

Kind regards,
Petr

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

* [LTP] [PATCH v2 1/7] tst_net.sh: Remove rsh support
  2020-07-10 17:20 ` [LTP] [PATCH v2 1/7] tst_net.sh: Remove rsh support Petr Vorel
@ 2020-07-20  7:37   ` Xiao Yang
  0 siblings, 0 replies; 26+ messages in thread
From: Xiao Yang @ 2020-07-20  7:37 UTC (permalink / raw)
  To: ltp

On 2020/7/11 1:20, Petr Vorel wrote:
> 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,

Acked-by: Xiao Yang <yangx.jy@cn.fujitsu.com>

Thanks,
Xiao Yang
> Suggested-by: Alexey Kodanev <alexey.kodanev@oracle.com>
> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> ---
>  testcases/lib/tst_net.sh | 10 ++++------
>  1 file changed, 4 insertions(+), 6 deletions(-)
>
> diff --git a/testcases/lib/tst_net.sh b/testcases/lib/tst_net.sh
> index 806b540cd..7ba267eda 100644
> --- a/testcases/lib/tst_net.sh
> +++ b/testcases/lib/tst_net.sh
> @@ -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




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

* [LTP] [PATCH v2 2/7] tst_net.sh: Use ssh in LTP_RSH
  2020-07-10 17:20 ` [LTP] [PATCH v2 2/7] tst_net.sh: Use ssh in LTP_RSH Petr Vorel
@ 2020-07-20  8:17   ` Xiao Yang
  2020-07-20  8:26     ` Xiao Yang
  2020-07-20  8:43     ` Petr Vorel
  0 siblings, 2 replies; 26+ messages in thread
From: Xiao Yang @ 2020-07-20  8:17 UTC (permalink / raw)
  To: ltp

On 2020/7/11 1:20, Petr Vorel wrote:
> for LTP_RSH (rsh fallback) it's better to use ssh instead of rsh by
> default, using current user.
>
> + update docs.
>
> Suggested-by: Alexey Kodanev <alexey.kodanev@oracle.com>
> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> ---
>  testcases/lib/tst_net.sh        | 2 +-
>  testcases/network/stress/README | 9 ++++-----
>  2 files changed, 5 insertions(+), 6 deletions(-)
>
> diff --git a/testcases/lib/tst_net.sh b/testcases/lib/tst_net.sh
> index 7ba267eda..0a8b2a8ca 100644
> --- a/testcases/lib/tst_net.sh
> +++ b/testcases/lib/tst_net.sh
> @@ -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
>  
>  # Test Links
>  # IPV{4,6}_{L,R}HOST can be set with or without prefix (e.g. IP or IP/prefix),
> diff --git a/testcases/network/stress/README b/testcases/network/stress/README
> index bc51a4cc9..b9537b1ce 100644
> --- a/testcases/network/stress/README
> +++ b/testcases/network/stress/README
> @@ -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.
>  




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

* [LTP] [PATCH v2 2/7] tst_net.sh: Use ssh in LTP_RSH
  2020-07-20  8:17   ` Xiao Yang
@ 2020-07-20  8:26     ` Xiao Yang
  2020-07-20  9:03       ` Petr Vorel
  2020-07-20  8:43     ` Petr Vorel
  1 sibling, 1 reply; 26+ messages in thread
From: Xiao Yang @ 2020-07-20  8:26 UTC (permalink / raw)
  To: ltp

On 2020/7/20 16:17, Xiao Yang wrote:
> On 2020/7/11 1:20, Petr Vorel wrote:
>> for LTP_RSH (rsh fallback) it's better to use ssh instead of rsh by
>> default, using current user.
>>
>> + update docs.
>>
>> Suggested-by: Alexey Kodanev<alexey.kodanev@oracle.com>
>> Signed-off-by: Petr Vorel<pvorel@suse.cz>
>> ---
>>   testcases/lib/tst_net.sh        | 2 +-
>>   testcases/network/stress/README | 9 ++++-----
>>   2 files changed, 5 insertions(+), 6 deletions(-)
>>
>> diff --git a/testcases/lib/tst_net.sh b/testcases/lib/tst_net.sh
>> index 7ba267eda..0a8b2a8ca 100644
>> --- a/testcases/lib/tst_net.sh
>> +++ b/testcases/lib/tst_net.sh
>> @@ -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
> --------------------------------------
testscripts/exportfs.sh, tcp_cmds/ftp/ftp01.sh and nfsv4/acl/runtest 
also use rsh command directly.
> Thanks,
> Xiao Yang
>>
>>   # Test Links
>>   # IPV{4,6}_{L,R}HOST can be set with or without prefix (e.g. IP or IP/prefix),
>> diff --git a/testcases/network/stress/README b/testcases/network/stress/README
>> index bc51a4cc9..b9537b1ce 100644
>> --- a/testcases/network/stress/README
>> +++ b/testcases/network/stress/README
>> @@ -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.
>>
>
>
>




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

* [LTP] [PATCH v2 3/7] net: Remove rsh, rcp, rlogin tests
  2020-07-10 17:20 ` [LTP] [PATCH v2 3/7] net: Remove rsh, rcp, rlogin tests Petr Vorel
@ 2020-07-20  8:31   ` Xiao Yang
  0 siblings, 0 replies; 26+ messages in thread
From: Xiao Yang @ 2020-07-20  8:31 UTC (permalink / raw)
  To: ltp

On 2020/7/11 1:20, Petr Vorel wrote:
> 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.
>
> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> ---
> 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
> 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
>
> diff --git a/runtest/net.tcp_cmds b/runtest/net.tcp_cmds
> index afe6d7c71..db47dfd5b 100644
> --- a/runtest/net.tcp_cmds
> +++ b/runtest/net.tcp_cmds
> @@ -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
> diff --git a/testcases/network/tcp_cmds/rcp/Makefile b/testcases/network/tcp_cmds/rcp/Makefile
> deleted file mode 100644
> index f8131a986..000000000
> --- a/testcases/network/tcp_cmds/rcp/Makefile
> +++ /dev/null
> @@ -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
> diff --git a/testcases/network/tcp_cmds/rcp/rcp01.sh b/testcases/network/tcp_cmds/rcp/rcp01.sh
> deleted file mode 100755
> index 4eaeca175..000000000
> --- a/testcases/network/tcp_cmds/rcp/rcp01.sh
> +++ /dev/null
> @@ -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 manjo@mail.utexas.edu
> -#    - Modified testcases to use test APIS and fixed bugs
> -#    03/01 Robbie Williamson (robbiew@us.ibm.com)
> -#      -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
> diff --git a/testcases/network/tcp_cmds/rlogin/Makefile b/testcases/network/tcp_cmds/rlogin/Makefile
> deleted file mode 100644
> index 1e8d10ea4..000000000
> --- a/testcases/network/tcp_cmds/rlogin/Makefile
> +++ /dev/null
> @@ -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
> diff --git a/testcases/network/tcp_cmds/rlogin/rlogin01.sh b/testcases/network/tcp_cmds/rlogin/rlogin01.sh
> deleted file mode 100755
> index c34ab1c4e..000000000
> --- a/testcases/network/tcp_cmds/rlogin/rlogin01.sh
> +++ /dev/null
> @@ -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 (robbiew@us.ibm.com)
> -
> -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
> diff --git a/testcases/network/tcp_cmds/rsh/Makefile b/testcases/network/tcp_cmds/rsh/Makefile
> deleted file mode 100644
> index 00ae49d8b..000000000
> --- a/testcases/network/tcp_cmds/rsh/Makefile
> +++ /dev/null
> @@ -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
> diff --git a/testcases/network/tcp_cmds/rsh/rsh01.sh b/testcases/network/tcp_cmds/rsh/rsh01.sh
> deleted file mode 100755
> index 3968f9056..000000000
> --- a/testcases/network/tcp_cmds/rsh/rsh01.sh
> +++ /dev/null
> @@ -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 (robbiew@us.ibm.com)
> -#      -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




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

* [LTP] [PATCH v2 2/7] tst_net.sh: Use ssh in LTP_RSH
  2020-07-20  8:17   ` Xiao Yang
  2020-07-20  8:26     ` Xiao Yang
@ 2020-07-20  8:43     ` Petr Vorel
  1 sibling, 0 replies; 26+ messages in thread
From: Petr Vorel @ 2020-07-20  8:43 UTC (permalink / raw)
  To: ltp

Hi Yang,
> 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

> Thanks,
> Xiao Yang

Kind regards,
Petr

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

* [LTP] [PATCH v2 5/7] tst_net.sh: Drop 'sh -c' use from ssh in tst_rhost_run
  2020-07-10 17:20 ` [LTP] [PATCH v2 5/7] tst_net.sh: Drop 'sh -c' use from ssh in tst_rhost_run Petr Vorel
@ 2020-07-20  8:49   ` Xiao Yang
  0 siblings, 0 replies; 26+ messages in thread
From: Xiao Yang @ 2020-07-20  8:49 UTC (permalink / raw)
  To: ltp

On 2020/7/11 1:20, Petr Vorel wrote:
> 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,

Acked-by: Xiao Yang <yangx.jy@cn.fujitsu.com>

Thanks,
Xiao Yang

> Suggested-by: Alexey Kodanev <alexey.kodanev@oracle.com>
> Acked-by: Alexey Kodanev <alexey.kodanev@oracle.com>
> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> ---
>  testcases/lib/tst_net.sh | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/testcases/lib/tst_net.sh b/testcases/lib/tst_net.sh
> index 0a8b2a8ca..f6ac4c087 100644
> --- a/testcases/lib/tst_net.sh
> +++ b/testcases/lib/tst_net.sh
> @@ -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




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

* [LTP] [PATCH v2 6/7] net/test: Add basic testing for tst_rhost_run
  2020-07-10 17:20 ` [LTP] [PATCH v2 6/7] net/test: Add basic testing for tst_rhost_run Petr Vorel
@ 2020-07-20  9:02   ` Xiao Yang
  2020-07-20 11:53     ` Petr Vorel
  0 siblings, 1 reply; 26+ messages in thread
From: Xiao Yang @ 2020-07-20  9:02 UTC (permalink / raw)
  To: ltp

On 2020/7/11 1:20, Petr Vorel wrote:
> Regression test for use of nested single quotes
> (fixed in previous commit).
>
> Acked-by: Alexey Kodanev <alexey.kodanev@oracle.com>
> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> ---
>  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
>
> diff --git a/lib/newlib_tests/shell/net/tst_rhost_run.sh b/lib/newlib_tests/shell/net/tst_rhost_run.sh
> new file mode 100755
> index 000000000..4c034a4ac
> --- /dev/null
> +++ b/lib/newlib_tests/shell/net/tst_rhost_run.sh
> @@ -0,0 +1,25 @@
> +#!/bin/sh
> +# SPDX-License-Identifier: GPL-2.0-or-later
> +# Copyright (c) 2020 Petr Vorel <pvorel@suse.cz>
> +
> +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?

> +
> +	tst_rhost_run -c "[ -f $file ]" || \
> +		tst_res TCONF "$file not found on rhost"
Call tst_brk as well?

Thanks,
Xiao Yang
> +
> +	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




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

* [LTP] [PATCH v2 2/7] tst_net.sh: Use ssh in LTP_RSH
  2020-07-20  8:26     ` Xiao Yang
@ 2020-07-20  9:03       ` Petr Vorel
  0 siblings, 0 replies; 26+ messages in thread
From: Petr Vorel @ 2020-07-20  9:03 UTC (permalink / raw)
  To: ltp

> 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

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

* [LTP] [PATCH v2 7/7] tst_net.sh/tst_rhost_run: Add debugging
  2020-07-10 17:20 ` [LTP] [PATCH v2 7/7] tst_net.sh/tst_rhost_run: Add debugging Petr Vorel
@ 2020-07-20  9:23   ` Xiao Yang
  0 siblings, 0 replies; 26+ messages in thread
From: Xiao Yang @ 2020-07-20  9:23 UTC (permalink / raw)
  To: ltp

On 2020/7/11 1:20, Petr Vorel wrote:
> via TST_NET_RHOST_RUN_DEBUG=1 and use it in tst_rhost_run.sh.
Hi Petr,

Acked-by: Xiao Yang <yangx.jy@cn.fujitsu.com>

Thanks,
Xiao Yang

> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> ---
> 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(-)
>
> diff --git a/lib/newlib_tests/shell/net/tst_rhost_run.sh b/lib/newlib_tests/shell/net/tst_rhost_run.sh
> index 4c034a4ac..9b058a57a 100755
> --- a/lib/newlib_tests/shell/net/tst_rhost_run.sh
> +++ b/lib/newlib_tests/shell/net/tst_rhost_run.sh
> @@ -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"
> diff --git a/testcases/lib/tst_net.sh b/testcases/lib/tst_net.sh
> index f6ac4c087..d939a5780 100644
> --- a/testcases/lib/tst_net.sh
> +++ b/testcases/lib/tst_net.sh
> @@ -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//')
> diff --git a/testcases/lib/tst_test.sh b/testcases/lib/tst_test.sh
> index 2e637b25b..fa97acbac 100644
> --- a/testcases/lib/tst_test.sh
> +++ b/testcases/lib/tst_test.sh
> @@ -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
> diff --git a/testcases/network/README.md b/testcases/network/README.md
> index 1c19a2c15..081ce834a 100644
> --- a/testcases/network/README.md
> +++ b/testcases/network/README.md
> @@ -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




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

* [LTP] [PATCH v2 4/7] net: Update README.md
  2020-07-10 17:20 ` [LTP] [PATCH v2 4/7] net: Update README.md Petr Vorel
@ 2020-07-20  9:48   ` Xiao Yang
  2020-07-20 14:15     ` Petr Vorel
  0 siblings, 1 reply; 26+ messages in thread
From: Xiao Yang @ 2020-07-20  9:48 UTC (permalink / raw)
  To: ltp

On 2020/7/11 1:20, Petr Vorel wrote:
> 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
>
> Signed-off-by: Petr Vorel<pvorel@suse.cz>
> ---
>   testcases/network/README.md | 96 ++++++++++++++-----------------------
>   1 file changed, 36 insertions(+), 60 deletions(-)
>
> diff --git a/testcases/network/README.md b/testcases/network/README.md
> index 3a9c98125..1c19a2c15 100644
> --- a/testcases/network/README.md
> +++ b/testcases/network/README.md
> @@ -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
Hi Petr,

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

>
>   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.
Are this file from Debian/Ubuntu as well?

Other than this, it is good to me. :-)
Acked-by: Xiao Yang <yangx.jy@cn.fujitsu.com>

Thanks,
Xiao Yang
>
> -* 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.




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

* [LTP] [PATCH v2 6/7] net/test: Add basic testing for tst_rhost_run
  2020-07-20  9:02   ` Xiao Yang
@ 2020-07-20 11:53     ` Petr Vorel
  2020-07-20 12:30       ` Xiao Yang
  0 siblings, 1 reply; 26+ messages in thread
From: Petr Vorel @ 2020-07-20 11:53 UTC (permalink / raw)
  To: ltp

Hi,

> > +	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.

> -------------------------------------------------
> 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.

> > +
> > +	tst_rhost_run -c "[ -f $file ]" || \
> > +		tst_res TCONF "$file not found on rhost"
> Call tst_brk as well?

> Thanks,
> Xiao Yang

Thanks!
Petr

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

* [LTP] [PATCH v2 6/7] net/test: Add basic testing for tst_rhost_run
  2020-07-20 11:53     ` Petr Vorel
@ 2020-07-20 12:30       ` Xiao Yang
  2020-07-20 17:36         ` Petr Vorel
  0 siblings, 1 reply; 26+ messages in thread
From: Xiao Yang @ 2020-07-20 12:30 UTC (permalink / raw)
  To: ltp

On 7/20/20 7:53 PM, Petr Vorel wrote:
> Hi,
>
>>> +	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

>
>> -------------------------------------------------
>> 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.
>
>>> +
>>> +	tst_rhost_run -c "[ -f $file ]" || \
>>> +		tst_res TCONF "$file not found on rhost"
>> Call tst_brk as well?
>> Thanks,
>> Xiao Yang
> Thanks!
> Petr
>


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

* [LTP] [PATCH v2 4/7] net: Update README.md
  2020-07-20  9:48   ` Xiao Yang
@ 2020-07-20 14:15     ` Petr Vorel
  2020-07-21  2:35       ` Xiao Yang
  0 siblings, 1 reply; 26+ messages in thread
From: Petr Vorel @ 2020-07-20 14:15 UTC (permalink / raw)
  To: ltp

Hi,

...
> > +++ b/testcases/network/README.md
...
> >   ## 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?
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

> >   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.
> 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

> Other than this, it is good to me. :-)
> Acked-by: Xiao Yang <yangx.jy@cn.fujitsu.com>

> Thanks,
> Xiao Yang

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

* [LTP] [PATCH v2 6/7] net/test: Add basic testing for tst_rhost_run
  2020-07-20 12:30       ` Xiao Yang
@ 2020-07-20 17:36         ` Petr Vorel
  0 siblings, 0 replies; 26+ messages in thread
From: Petr Vorel @ 2020-07-20 17:36 UTC (permalink / raw)
  To: ltp

Hi Yang,

> > > 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)
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

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

* [LTP] [PATCH v2 4/7] net: Update README.md
  2020-07-20 14:15     ` Petr Vorel
@ 2020-07-21  2:35       ` Xiao Yang
  2020-07-21  6:11         ` Petr Vorel
  0 siblings, 1 reply; 26+ messages in thread
From: Xiao Yang @ 2020-07-21  2:35 UTC (permalink / raw)
  To: ltp

On 2020/7/20 22:15, Petr Vorel wrote:
> Hi,
>
> ...
>>> +++ b/testcases/network/README.md
> ...
>>>    ## 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?
> 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?

>>>    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.
>> 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
> ...

This change looks good. :-)

> 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
> OK with these changes?
>
> Kind regards,
> Petr
>
>> Other than this, it is good to me. :-)
>> Acked-by: Xiao Yang<yangx.jy@cn.fujitsu.com>
>> Thanks,
>> Xiao Yang
>
> .
>




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

* [LTP] [PATCH v2 4/7] net: Update README.md
  2020-07-21  2:35       ` Xiao Yang
@ 2020-07-21  6:11         ` Petr Vorel
  0 siblings, 0 replies; 26+ messages in thread
From: Petr Vorel @ 2020-07-21  6:11 UTC (permalink / raw)
  To: ltp

Hi Yang,

> 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.

> BTW: I cannot find which test use rsync, did I miss something?
Correct, this looks like a leftover from the past. Thanks!

> > > >    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.
> > > 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
> > ...

> This change looks good. :-)
ok.

> > 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

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

* [LTP] [PATCH v2 0/7] tst_net.sh: Remove rsh, update docs add debug & test
  2020-07-10 17:20 [LTP] [PATCH v2 0/7] tst_net.sh: Remove rsh, update docs add debug & test Petr Vorel
                   ` (7 preceding siblings ...)
  2020-07-10 17:22 ` [LTP] [PATCH v2 0/7] tst_net.sh: Remove rsh, update docs add debug & test Petr Vorel
@ 2020-07-30  8:16 ` Petr Vorel
  8 siblings, 0 replies; 26+ messages in thread
From: Petr Vorel @ 2020-07-30  8:16 UTC (permalink / raw)
  To: ltp

Hi Alexey, Xiao,

...
> 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

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

end of thread, other threads:[~2020-07-30  8:16 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-10 17:20 [LTP] [PATCH v2 0/7] tst_net.sh: Remove rsh, update docs add debug & test Petr Vorel
2020-07-10 17:20 ` [LTP] [PATCH v2 1/7] tst_net.sh: Remove rsh support Petr Vorel
2020-07-20  7:37   ` Xiao Yang
2020-07-10 17:20 ` [LTP] [PATCH v2 2/7] tst_net.sh: Use ssh in LTP_RSH Petr Vorel
2020-07-20  8:17   ` Xiao Yang
2020-07-20  8:26     ` Xiao Yang
2020-07-20  9:03       ` Petr Vorel
2020-07-20  8:43     ` Petr Vorel
2020-07-10 17:20 ` [LTP] [PATCH v2 3/7] net: Remove rsh, rcp, rlogin tests Petr Vorel
2020-07-20  8:31   ` Xiao Yang
2020-07-10 17:20 ` [LTP] [PATCH v2 4/7] net: Update README.md Petr Vorel
2020-07-20  9:48   ` Xiao Yang
2020-07-20 14:15     ` Petr Vorel
2020-07-21  2:35       ` Xiao Yang
2020-07-21  6:11         ` Petr Vorel
2020-07-10 17:20 ` [LTP] [PATCH v2 5/7] tst_net.sh: Drop 'sh -c' use from ssh in tst_rhost_run Petr Vorel
2020-07-20  8:49   ` Xiao Yang
2020-07-10 17:20 ` [LTP] [PATCH v2 6/7] net/test: Add basic testing for tst_rhost_run Petr Vorel
2020-07-20  9:02   ` Xiao Yang
2020-07-20 11:53     ` Petr Vorel
2020-07-20 12:30       ` Xiao Yang
2020-07-20 17:36         ` Petr Vorel
2020-07-10 17:20 ` [LTP] [PATCH v2 7/7] tst_net.sh/tst_rhost_run: Add debugging Petr Vorel
2020-07-20  9:23   ` Xiao Yang
2020-07-10 17:22 ` [LTP] [PATCH v2 0/7] tst_net.sh: Remove rsh, update docs add debug & test Petr Vorel
2020-07-30  8:16 ` Petr Vorel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.