selftests: netfilter: Ignore tainted kernels in interface stress test

Complain about kernel taint value only if it wasn't set at start
already.

Fixes: 73db1b5dab ("selftests: netfilter: Torture nftables netdev hooks")
Signed-off-by: Phil Sutter <phil@nwl.cc>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
This commit is contained in:
Phil Sutter 2025-07-23 17:17:48 +02:00 committed by Pablo Neira Ayuso
parent bf58e667af
commit 8d1c91850d

View File

@ -10,6 +10,8 @@ source lib.sh
checktool "nft --version" "run test without nft tool"
checktool "iperf3 --version" "run test without iperf3 tool"
read kernel_tainted < /proc/sys/kernel/tainted
# how many seconds to torture the kernel?
# default to 80% of max run time but don't exceed 48s
TEST_RUNTIME=$((${kselftest_timeout:-60} * 8 / 10))
@ -135,7 +137,8 @@ else
wait
fi
[[ $(</proc/sys/kernel/tainted) -eq 0 ]] || {
[[ $kernel_tainted -eq 0 && $(</proc/sys/kernel/tainted) -ne 0 ]] && {
echo "FAIL: Kernel is tainted!"
exit $ksft_fail
}