From: Phil Sutter Date: Thu, 8 May 2025 10:08:39 +0000 (+0200) Subject: tests/shell: Skip netdev_chain_dev_addremove on tainted kernels X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0a500c710e9807d622533062747dae80d1e5b235;p=thirdparty%2Fnftables.git 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") Signed-off-by: Phil Sutter Reviewed-by: Pablo Neira Ayuso --- diff --git a/tests/shell/testcases/chains/netdev_chain_dev_addremove b/tests/shell/testcases/chains/netdev_chain_dev_addremove index 14260d54..6103e82b 100755 --- a/tests/shell/testcases/chains/netdev_chain_dev_addremove +++ b/tests/shell/testcases/chains/netdev_chain_dev_addremove @@ -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