All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH 1/3] tst_net.sh: Move check_portmap_rpcbind() + fixes
@ 2021-05-25 13:50 Petr Vorel
  2021-05-25 13:50 ` [LTP] [PATCH 2/3] nfs_lib.sh: Check running rpc.mountd, rpcbind/portmap Petr Vorel
  2021-05-25 13:50 ` [LTP] [PATCH 3/3] nfs_lib.sh: Print verbose mount info on error Petr Vorel
  0 siblings, 2 replies; 6+ messages in thread
From: Petr Vorel @ 2021-05-25 13:50 UTC (permalink / raw)
  To: ltp

move from rpc_lib.sh, because it'll be used also in NFS tests.

Fixes:
* check for pgrep
* local and lowercase for variable

And remove rpc_lib.sh, as check_portmap_rpcbind() was the only function
in it.

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 testcases/lib/tst_net.sh                       | 18 +++++++++++++++++-
 testcases/network/rpc/basic_tests/Makefile     |  1 -
 .../network/rpc/basic_tests/rpc01/rpc01.sh     |  2 +-
 testcases/network/rpc/basic_tests/rpc_lib.sh   | 15 ---------------
 .../rpc/basic_tests/rpcinfo/rpcinfo01.sh       |  2 +-
 testcases/network/rpc/rpc-tirpc/rpc_test.sh    |  2 +-
 6 files changed, 20 insertions(+), 20 deletions(-)
 delete mode 100644 testcases/network/rpc/basic_tests/rpc_lib.sh

diff --git a/testcases/lib/tst_net.sh b/testcases/lib/tst_net.sh
index fc5719057..d793541e2 100644
--- a/testcases/lib/tst_net.sh
+++ b/testcases/lib/tst_net.sh
@@ -1,7 +1,7 @@
 #!/bin/sh
 # SPDX-License-Identifier: GPL-2.0-or-later
 # Copyright (c) 2014-2017 Oracle and/or its affiliates. All Rights Reserved.
-# Copyright (c) 2016-2019 Petr Vorel <pvorel@suse.cz>
+# Copyright (c) 2016-2021 Petr Vorel <pvorel@suse.cz>
 # Author: Alexey Kodanev <alexey.kodanev@oracle.com>
 
 [ -n "$TST_LIB_NET_LOADED" ] && return 0
@@ -933,6 +933,22 @@ tst_default_max_pkt()
 	echo "$((mtu + mtu / 10))"
 }
 
+check_portmap_rpcbind()
+{
+	local portmapper
+
+	tst_require_cmds pgrep
+
+	if pgrep portmap > /dev/null; then
+		portmapper="portmap"
+	else
+		pgrep rpcbind > /dev/null && portmapper="rpcbind" || \
+			tst_brk TCONF "portmap or rpcbind is not running"
+	fi
+
+	tst_res TINFO "using $portmapper"
+}
+
 # Management Link
 [ -z "$RHOST" ] && TST_USE_NETNS="yes"
 export RHOST="$RHOST"
diff --git a/testcases/network/rpc/basic_tests/Makefile b/testcases/network/rpc/basic_tests/Makefile
index 7862e41e5..66e9d5675 100644
--- a/testcases/network/rpc/basic_tests/Makefile
+++ b/testcases/network/rpc/basic_tests/Makefile
@@ -21,7 +21,6 @@
 #
 
 top_srcdir		?= ../../../..
-INSTALL_TARGETS	:= rpc_lib.sh
 
 include $(top_srcdir)/include/mk/env_pre.mk
 include $(top_srcdir)/include/mk/generic_trunk_target.mk
diff --git a/testcases/network/rpc/basic_tests/rpc01/rpc01.sh b/testcases/network/rpc/basic_tests/rpc01/rpc01.sh
index 9ca5daae6..7a8ff75e6 100755
--- a/testcases/network/rpc/basic_tests/rpc01/rpc01.sh
+++ b/testcases/network/rpc/basic_tests/rpc01/rpc01.sh
@@ -7,7 +7,7 @@ TST_TESTFUNC=do_test
 TST_SETUP=do_setup
 TST_CLEANUP=do_cleanup
 TST_NEEDS_CMDS="pkill rpcinfo"
-. rpc_lib.sh
+. tst_net.sh
 
 NUMLOOPS=${NUMLOOPS:-3}
 DATAFILES="${DATAFILES:-file.1 file.2}"
diff --git a/testcases/network/rpc/basic_tests/rpc_lib.sh b/testcases/network/rpc/basic_tests/rpc_lib.sh
deleted file mode 100644
index c7c868709..000000000
--- a/testcases/network/rpc/basic_tests/rpc_lib.sh
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/bin/sh
-# Copyright (c) 2020 Petr Vorel <pvorel@suse.cz>
-
-. tst_net.sh
-
-check_portmap_rpcbind()
-{
-	if pgrep portmap > /dev/null; then
-		PORTMAPPER="portmap"
-	else
-		pgrep rpcbind > /dev/null && PORTMAPPER="rpcbind" || \
-			tst_brk TCONF "portmap or rpcbind is not running"
-	fi
-	tst_res TINFO "using $PORTMAPPER"
-}
diff --git a/testcases/network/rpc/basic_tests/rpcinfo/rpcinfo01.sh b/testcases/network/rpc/basic_tests/rpcinfo/rpcinfo01.sh
index 811f79ef7..0a371ceac 100755
--- a/testcases/network/rpc/basic_tests/rpcinfo/rpcinfo01.sh
+++ b/testcases/network/rpc/basic_tests/rpcinfo/rpcinfo01.sh
@@ -7,7 +7,7 @@ TST_TESTFUNC=do_test
 TST_SETUP=do_setup
 TST_NEEDS_TMPDIR=1
 TST_NEEDS_CMDS="rpcinfo wc"
-. rpc_lib.sh
+. tst_net.sh
 
 do_setup()
 {
diff --git a/testcases/network/rpc/rpc-tirpc/rpc_test.sh b/testcases/network/rpc/rpc-tirpc/rpc_test.sh
index ffb58769d..48ed97742 100755
--- a/testcases/network/rpc/rpc-tirpc/rpc_test.sh
+++ b/testcases/network/rpc/rpc-tirpc/rpc_test.sh
@@ -17,7 +17,7 @@ TST_SETUP=setup
 TST_CLEANUP=cleanup
 TST_PARSE_ARGS=rpc_parse_args
 TST_NEEDS_CMDS="pkill rpcinfo"
-. rpc_lib.sh
+. tst_net.sh
 
 usage()
 {
-- 
2.31.1


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

* [LTP] [PATCH 2/3] nfs_lib.sh: Check running rpc.mountd, rpcbind/portmap
  2021-05-25 13:50 [LTP] [PATCH 1/3] tst_net.sh: Move check_portmap_rpcbind() + fixes Petr Vorel
@ 2021-05-25 13:50 ` Petr Vorel
  2021-05-26  7:18   ` Petr Vorel
  2021-05-25 13:50 ` [LTP] [PATCH 3/3] nfs_lib.sh: Print verbose mount info on error Petr Vorel
  1 sibling, 1 reply; 6+ messages in thread
From: Petr Vorel @ 2021-05-25 13:50 UTC (permalink / raw)
  To: ltp

Both are required to be running for NFS tests.

This requires to add pgrep dependency, as we don't have custom LTP C
based tool for searching in processes.

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 testcases/network/nfs/nfs_stress/nfs_lib.sh | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/testcases/network/nfs/nfs_stress/nfs_lib.sh b/testcases/network/nfs/nfs_stress/nfs_lib.sh
index 1bd057717..25fe67bda 100644
--- a/testcases/network/nfs/nfs_stress/nfs_lib.sh
+++ b/testcases/network/nfs/nfs_stress/nfs_lib.sh
@@ -27,7 +27,7 @@ TST_PARSE_ARGS=nfs_parse_args
 TST_USAGE=nfs_usage
 TST_NEEDS_TMPDIR=1
 TST_NEEDS_ROOT=1
-TST_NEEDS_CMDS="$TST_NEEDS_CMDS mount exportfs"
+TST_NEEDS_CMDS="$TST_NEEDS_CMDS exportfs mount pgrep"
 TST_SETUP="${TST_SETUP:-nfs_setup}"
 TST_CLEANUP="${TST_CLEANUP:-nfs_cleanup}"
 
@@ -107,6 +107,11 @@ nfs_setup()
 		tst_brk TCONF "Cannot run nfs-stress test on mounted NFS"
 	fi
 
+	pgrep rpc.mountd > /dev/null || \
+		tst_brk TCONF "rpc.mountd not running"
+
+	check_portmap_rpcbind
+
 	local i
 	local type
 	local n=0
-- 
2.31.1


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

* [LTP] [PATCH 3/3] nfs_lib.sh: Print verbose mount info on error
  2021-05-25 13:50 [LTP] [PATCH 1/3] tst_net.sh: Move check_portmap_rpcbind() + fixes Petr Vorel
  2021-05-25 13:50 ` [LTP] [PATCH 2/3] nfs_lib.sh: Check running rpc.mountd, rpcbind/portmap Petr Vorel
@ 2021-05-25 13:50 ` Petr Vorel
  2021-05-25 16:31   ` Alexey Kodanev
  1 sibling, 1 reply; 6+ messages in thread
From: Petr Vorel @ 2021-05-25 13:50 UTC (permalink / raw)
  To: ltp

Suggested-by: NeilBrown <neilb@suse.de>
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 testcases/network/nfs/nfs_stress/nfs_lib.sh | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/testcases/network/nfs/nfs_stress/nfs_lib.sh b/testcases/network/nfs/nfs_stress/nfs_lib.sh
index 25fe67bda..fb0f10020 100644
--- a/testcases/network/nfs/nfs_stress/nfs_lib.sh
+++ b/testcases/network/nfs/nfs_stress/nfs_lib.sh
@@ -83,16 +83,17 @@ nfs_mount()
 		mount_dir="$(tst_ipaddr $host_type):$remote_dir"
 	fi
 
-	local mnt_cmd="mount -t nfs $opts $mount_dir $local_dir"
+	local mnt_cmd="mount -v -t nfs $opts $mount_dir $local_dir"
 
 	tst_res TINFO "Mounting NFS: $mnt_cmd"
 	if [ -n "$LTP_NETNS" ] && [ -z "$LTP_NFS_NETNS_USE_LO" ]; then
-		tst_rhost_run -c "$mnt_cmd"
+		tst_rhost_run -c "$mnt_cmd" > mount.log
 	else
-		$mnt_cmd > /dev/null
+		$mnt_cmd > mount.log
 	fi
 
 	if [ $? -ne 0 ]; then
+		cat mount.log
 		if [ "$type" = "udp" -o "$type" = "udp6" ] && tst_kvcmp -ge 5.6; then
 			tst_brk TCONF "UDP support disabled with the kernel config NFS_DISABLE_UDP_SUPPORT?"
 		fi
-- 
2.31.1


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

* [LTP] [PATCH 3/3] nfs_lib.sh: Print verbose mount info on error
  2021-05-25 13:50 ` [LTP] [PATCH 3/3] nfs_lib.sh: Print verbose mount info on error Petr Vorel
@ 2021-05-25 16:31   ` Alexey Kodanev
  2021-05-26  7:11     ` Petr Vorel
  0 siblings, 1 reply; 6+ messages in thread
From: Alexey Kodanev @ 2021-05-25 16:31 UTC (permalink / raw)
  To: ltp

On 25.05.2021 16:50, Petr Vorel wrote:
> Suggested-by: NeilBrown <neilb@suse.de>
> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> ---
>  testcases/network/nfs/nfs_stress/nfs_lib.sh | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/testcases/network/nfs/nfs_stress/nfs_lib.sh b/testcases/network/nfs/nfs_stress/nfs_lib.sh
> index 25fe67bda..fb0f10020 100644
> --- a/testcases/network/nfs/nfs_stress/nfs_lib.sh
> +++ b/testcases/network/nfs/nfs_stress/nfs_lib.sh
> @@ -83,16 +83,17 @@ nfs_mount()
>  		mount_dir="$(tst_ipaddr $host_type):$remote_dir"
>  	fi
>  
> -	local mnt_cmd="mount -t nfs $opts $mount_dir $local_dir"
> +	local mnt_cmd="mount -v -t nfs $opts $mount_dir $local_dir"
>  
>  	tst_res TINFO "Mounting NFS: $mnt_cmd"
>  	if [ -n "$LTP_NETNS" ] && [ -z "$LTP_NFS_NETNS_USE_LO" ]; then
> -		tst_rhost_run -c "$mnt_cmd"
> +		tst_rhost_run -c "$mnt_cmd" > mount.log
>  	else
> -		$mnt_cmd > /dev/null
> +		$mnt_cmd > mount.log
>  	fi
>  
>  	if [ $? -ne 0 ]; then
> +		cat mount.log
>  		if [ "$type" = "udp" -o "$type" = "udp6" ] && tst_kvcmp -ge 5.6; then
>  			tst_brk TCONF "UDP support disabled with the kernel config NFS_DISABLE_UDP_SUPPORT?"
>  		fi
> 

Thanks Petr! For the patch series:

Reviewed-by: Alexey Kodanev <aleksei.kodanev@bell-sw.com>

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

* [LTP] [PATCH 3/3] nfs_lib.sh: Print verbose mount info on error
  2021-05-25 16:31   ` Alexey Kodanev
@ 2021-05-26  7:11     ` Petr Vorel
  0 siblings, 0 replies; 6+ messages in thread
From: Petr Vorel @ 2021-05-26  7:11 UTC (permalink / raw)
  To: ltp

Hi Alexey,

> Thanks Petr! For the patch series:

> Reviewed-by: Alexey Kodanev <aleksei.kodanev@bell-sw.com>

Thanks a lot! Merged this commit, more info at other commits.

Kind regards,
Petr

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

* [LTP] [PATCH 2/3] nfs_lib.sh: Check running rpc.mountd, rpcbind/portmap
  2021-05-25 13:50 ` [LTP] [PATCH 2/3] nfs_lib.sh: Check running rpc.mountd, rpcbind/portmap Petr Vorel
@ 2021-05-26  7:18   ` Petr Vorel
  0 siblings, 0 replies; 6+ messages in thread
From: Petr Vorel @ 2021-05-26  7:18 UTC (permalink / raw)
  To: ltp

Hi Alexey,

> Both are required to be running for NFS tests.

> This requires to add pgrep dependency, as we don't have custom LTP C
> based tool for searching in processes.

> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> ---
>  testcases/network/nfs/nfs_stress/nfs_lib.sh | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)

> diff --git a/testcases/network/nfs/nfs_stress/nfs_lib.sh b/testcases/network/nfs/nfs_stress/nfs_lib.sh
> index 1bd057717..25fe67bda 100644
> --- a/testcases/network/nfs/nfs_stress/nfs_lib.sh
> +++ b/testcases/network/nfs/nfs_stress/nfs_lib.sh
> @@ -27,7 +27,7 @@ TST_PARSE_ARGS=nfs_parse_args
>  TST_USAGE=nfs_usage
>  TST_NEEDS_TMPDIR=1
>  TST_NEEDS_ROOT=1
> -TST_NEEDS_CMDS="$TST_NEEDS_CMDS mount exportfs"
> +TST_NEEDS_CMDS="$TST_NEEDS_CMDS exportfs mount pgrep"
>  TST_SETUP="${TST_SETUP:-nfs_setup}"
>  TST_CLEANUP="${TST_CLEANUP:-nfs_cleanup}"

> @@ -107,6 +107,11 @@ nfs_setup()
>  		tst_brk TCONF "Cannot run nfs-stress test on mounted NFS"
>  	fi

> +	pgrep rpc.mountd > /dev/null || \
> +		tst_brk TCONF "rpc.mountd not running"
> +
> +	check_portmap_rpcbind

I found that at least some tests (e.g. nfs01) runs with stopped rpcbind.
I suppose that's because nfs-server.service is able to restart it
(it's activated via socket).

Although rpc.mountd (nfs-mountd.service) is required, nfs-mountd.service is a
nfs-server.service dependency (nfs-server.service:Requires=nfs-mountd.service).
Thus it's probably enough to check that rpc.nfsd is running.
=> sending v2 with just single commit.

Kind regards,
Petr

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

end of thread, other threads:[~2021-05-26  7:18 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-25 13:50 [LTP] [PATCH 1/3] tst_net.sh: Move check_portmap_rpcbind() + fixes Petr Vorel
2021-05-25 13:50 ` [LTP] [PATCH 2/3] nfs_lib.sh: Check running rpc.mountd, rpcbind/portmap Petr Vorel
2021-05-26  7:18   ` Petr Vorel
2021-05-25 13:50 ` [LTP] [PATCH 3/3] nfs_lib.sh: Print verbose mount info on error Petr Vorel
2021-05-25 16:31   ` Alexey Kodanev
2021-05-26  7:11     ` 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.