[LTP] [PATCH 1/2] Add test for per-NS NFS client statistics

Martin Doucha mdoucha@suse.cz
Fri Aug 30 16:13:39 CEST 2024


Check that /proc/net/rpc/nfs file exists in nested network namespaces.

Signed-off-by: Martin Doucha <mdoucha@suse.cz>
---

Only do the minimal check here. If the file exists in namespaces,
nfsstat01.sh will take care of functional testing.

 runtest/net.nfs                              |  2 ++
 testcases/network/nfs/nfsstat01/nfsstat02.sh | 23 ++++++++++++++++++++
 2 files changed, 25 insertions(+)
 create mode 100755 testcases/network/nfs/nfsstat01/nfsstat02.sh

diff --git a/runtest/net.nfs b/runtest/net.nfs
index 929868a7b..7f84457bc 100644
--- a/runtest/net.nfs
+++ b/runtest/net.nfs
@@ -116,6 +116,8 @@ nfsstat01_v40_ip6t nfsstat01.sh -6 -v 4 -t tcp
 nfsstat01_v41_ip6t nfsstat01.sh -6 -v 4.1 -t tcp
 nfsstat01_v42_ip6t nfsstat01.sh -6 -v 4.2 -t tcp
 
+nfsstat02 nfsstat02.sh
+
 fsx_v30_ip4u fsx.sh -v 3 -t udp
 fsx_v30_ip4t fsx.sh -v 3 -t tcp
 fsx_v40_ip4t fsx.sh -v 4 -t tcp
diff --git a/testcases/network/nfs/nfsstat01/nfsstat02.sh b/testcases/network/nfs/nfsstat01/nfsstat02.sh
new file mode 100755
index 000000000..1e1bebe97
--- /dev/null
+++ b/testcases/network/nfs/nfsstat01/nfsstat02.sh
@@ -0,0 +1,23 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2024 SUSE LLC <mdoucha@suse.cz>
+
+TST_TESTFUNC="do_test"
+
+# PURPOSE:  Check that /proc/net/rpc/nfs exists in nested network namespaces
+do_test()
+{
+	local procfile="/proc/net/rpc/nfs"
+
+	if tst_rhost_run -c "test -e '$procfile'"; then
+		tst_res TPASS "$procfile exists in net namespaces"
+	else
+		tst_res TFAIL "$procfile missing in net namespaces"
+	fi
+}
+
+# Force use of nested net namespace
+unset RHOST
+
+. nfs_lib.sh
+tst_run
-- 
2.46.0



More information about the ltp mailing list