Skip to contentSkip to conversation

selftests: Updates to fcnal-test for autoamted environment

PATCH Applied David Ahern 2 participants 5 messages Jan 24, 2024 – Jan 26, 2024

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover selftests: Updates to fcnal-test for autoamted environment

The first patch updates the PATH for fcnal-test.sh to find the nettest binary when invoked at the top-level directory via
make -C tools/testing/selftests TARGETS=net run_tests

Second patch fixes a bug setting the ping_group; it has a compound value and that value is not traversing the various helper functions in tact. Fix by creating a helper specific to setting it.

Third patch adds more output when a test fails - e.g., to catch a change in the return code of some test.

With these 3 patches, the entire suite completes successfully when run on Ubuntu 23.10 with 6.5 kernel - 914 tests pass, 0 fail.

David Ahern (3):
selftest: Update PATH for nettest in fcnal-test
selftest: Fix set of ping_group_range in fcnal-test
selftest: Show expected and actual return codes for test failures in
fcnal-test

 tools/testing/selftests/net/fcnal-test.sh | 25 +++++++++++++++++------
 1 file changed, 19 insertions(+), 6 deletions(-)
Signature · 1 line
2.39.3 (Apple Git-145)
#1 lore raw

PATCH 1/3 selftest: Update PATH for nettest in fcnal-test

Allow fcnal-test.sh to be run from top level directory in the kernel repo as well as from tools/testing/selftests/net by setting the PATH to find the in-tree nettest.

---
 tools/testing/selftests/net/fcnal-test.sh | 3 +++
 1 file changed, 3 insertions(+)
tools/testing/selftests/net/fcnal-test.sh +3 -0
index 0d4f252427e2..3d69fac6bcc0 100755
@@ -38,6 +38,9 @@
 # server / client nomenclature relative to ns-A
 
 source lib.sh
+
+PATH=$PWD:$PWD/tools/testing/selftests/net:$PATH
+
 VERBOSE=0
 
 NSA_DEV=eth1
Signature · 1 line
2.39.3 (Apple Git-145)
#2 lore raw

PATCH 2/3 selftest: Fix set of ping_group_range in fcnal-test

In reply to David Ahern

ping_group_range sysctl has a compound value which does not go through the various function layers in tact. Create a helper function to bypass the layers and correctly set the value.

---
 tools/testing/selftests/net/fcnal-test.sh | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)
tools/testing/selftests/net/fcnal-test.sh +15 -6
index 3d69fac6bcc0..f590b0fb740e 100755
@@ -190,6 +190,15 @@ kill_procs()
 	sleep 1
 }
 
+set_ping_group()
+{
+	if [ "$VERBOSE" = "1" ]; then
+		echo "COMMAND: ${NSA_CMD} sysctl -q -w net.ipv4.ping_group_range='0 2147483647'"
+	fi
+
+	${NSA_CMD} sysctl -q -w net.ipv4.ping_group_range='0 2147483647'
+}
+
 do_run_cmd()
 {
 	local cmd="$*"
@@ -838,14 +847,14 @@ ipv4_ping()
 	set_sysctl net.ipv4.raw_l3mdev_accept=1 2>/dev/null
 	ipv4_ping_novrf
 	setup
-	set_sysctl net.ipv4.ping_group_range='0 2147483647' 2>/dev/null
+	set_ping_group
 	ipv4_ping_novrf
 
 	log_subsection "With VRF"
 	setup "yes"
 	ipv4_ping_vrf
 	setup "yes"
-	set_sysctl net.ipv4.ping_group_range='0 2147483647' 2>/dev/null
+	set_ping_group
 	ipv4_ping_vrf
 }
 
@@ -2056,12 +2065,12 @@ ipv4_addr_bind()
 
 	log_subsection "No VRF"
 	setup
-	set_sysctl net.ipv4.ping_group_range='0 2147483647' 2>/dev/null
+	set_ping_group
 	ipv4_addr_bind_novrf
 
 	log_subsection "With VRF"
 	setup "yes"
-	set_sysctl net.ipv4.ping_group_range='0 2147483647' 2>/dev/null
+	set_ping_group
 	ipv4_addr_bind_vrf
 }
 
@@ -2524,14 +2533,14 @@ ipv6_ping()
 	setup
 	ipv6_ping_novrf
 	setup
-	set_sysctl net.ipv4.ping_group_range='0 2147483647' 2>/dev/null
+	set_ping_group
 	ipv6_ping_novrf
 
 	log_subsection "With VRF"
 	setup "yes"
 	ipv6_ping_vrf
 	setup "yes"
-	set_sysctl net.ipv4.ping_group_range='0 2147483647' 2>/dev/null
+	set_ping_group
 	ipv6_ping_vrf
 }
 
Signature · 1 line
2.39.3 (Apple Git-145)
#3 lore raw

PATCH 3/3 selftest: Show expected and actual return codes for test failures in fcnal-test

In reply to David Ahern

Capture expected and actual return codes for a test that fails in the fcnal-test suite.

---
 tools/testing/selftests/net/fcnal-test.sh | 1 +
 1 file changed, 1 insertion(+)
tools/testing/selftests/net/fcnal-test.sh +1 -0
index f590b0fb740e..d7cfb7c2b427 100755
@@ -109,6 +109,7 @@ log_test()
 	else
 		nfail=$((nfail+1))
 		printf "TEST: %-70s  [FAIL]\n" "${msg}"
+		echo "    expected rc $expected; actual rc $rc"
 		if [ "${PAUSE_ON_FAIL}" = "yes" ]; then
 			echo
 			echo "hit enter to continue, 'q' to quit"
Signature · 1 line
2.39.3 (Apple Git-145)
#4 lore raw
In reply to David Ahern
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 9 lines · On Wed, 24 Jan 2024 14:41:14 -0700 you wrote:

The first patch updates the PATH for fcnal-test.sh to find the nettest binary when invoked at the top-level directory via
make -C tools/testing/selftests TARGETS=net run_tests

Second patch fixes a bug setting the ping_group; it has a compound value and that value is not traversing the various helper functions in tact. Fix by creating a helper specific to setting it.

[...]

Here is the summary with links:
- [net-next,1/3] selftest: Update PATH for nettest in fcnal-test

    https://git.kernel.org/netdev/net-next/c/ad9b701aed48
  - [net-next,2/3] selftest: Fix set of ping_group_range in fcnal-test
    https://git.kernel.org/netdev/net-next/c/79bf0d4a07d4
  - [net-next,3/3] selftest: Show expected and actual return codes for test failures in fcnal-test
    https://git.kernel.org/netdev/net-next/c/70863c902d76

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html