Skip to contentSkip to conversation

tests/shell: Skip netdev_chain_dev_addremove on tainted kernels

PATCH In review Phil Sutter 2 participants 3 messages May 8, 2025 netfilter

lore
Share & tools
lore

Phil Sutter

author reviewer
#0 lore raw

PATCH 1/1 tests/shell: Skip netdev_chain_dev_addremove on tainted kernels

The test checks taint state to indicate success or failure. Since this won't work if the kernel is already tainted at start, skip the test instead of failing it.

Fixes 02dbf86f39410 ("tests: shell: add a test case for netdev ruleset flush + parallel link down")
---
 .../chains/netdev_chain_dev_addremove         | 21 ++++++++++---------
 1 file changed, 11 insertions(+), 10 deletions(-)
tests/shell/testcases/chains/netdev_chain_dev_addremove +11 -10
index 14260d54b778e..6103e82b10603 100755
@@ -4,6 +4,12 @@
 
 set -e
 
+read taint < /proc/sys/kernel/tainted
+if [ "$taint" -ne 0 ]; then
+	echo "Kernel already tainted up front."
+	exit 77
+fi
+
 iface_cleanup() {
         ip link del d0 &>/dev/null || :
 }
@@ -26,10 +32,6 @@ EOF
 }
 
 for i in $(seq 1 500);do
-	read taint < /proc/sys/kernel/tainted
-	if [ "$taint" -ne 0 ]; then
-		exit 1
-	fi
 	ip link add dummy0 type dummy
 	load_rules
 
@@ -37,12 +39,11 @@ for i in $(seq 1 500);do
 	$NFT flush ruleset &
 	ip link del dummy0 &
 	wait
-done
 
-read taint < /proc/sys/kernel/tainted
-
-if [ "$taint" -ne 0 ]; then
-	exit 1
-fi
+	read taint < /proc/sys/kernel/tainted
+	if [ "$taint" -ne 0 ]; then
+		exit 1
+	fi
+done
 
 exit 0
Signature · 1 line
2.49.0
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Phil Sutter

The test checks taint state to indicate success or failure. Since this won't work if the kernel is already tainted at start, skip the test instead of failing it.

Fixes 02dbf86f39410 ("tests: shell: add a test case for netdev ruleset flush + parallel link down")

Thanks, Florian made similar patch quite recently for selftests.

author reviewer
#2 lore raw
In reply to Phil Sutter
Quoted 6 lines · Phil Sutter

The test checks taint state to indicate success or failure. Since this won't work if the kernel is already tainted at start, skip the test instead of failing it.

Fixes 02dbf86f39410 ("tests: shell: add a test case for netdev ruleset flush + parallel link down")

Patch applied.