]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
tests: shell: check for a tainted kernel
authorFlorian Westphal <fw@strlen.de>
Thu, 11 Aug 2022 11:19:44 +0000 (13:19 +0200)
committerFlorian Westphal <fw@strlen.de>
Thu, 11 Aug 2022 14:21:21 +0000 (16:21 +0200)
If a test case results in a kernel taint (WARN splat for example), make
sure the test script indicates this.

Signed-off-by: Florian Westphal <fw@strlen.de>
tests/shell/run-tests.sh

index 33006d2c63fe5741613e310fcf3131014c08f483..931bba967b37039ee0870ee6f1328ddd8264dbc1 100755 (executable)
@@ -109,8 +109,22 @@ find_tests() {
 echo ""
 ok=0
 failed=0
+taint=0
+
+check_taint()
+{
+       read taint_now < /proc/sys/kernel/tainted
+       if [ $taint -ne $taint_now ] ; then
+               msg_warn "[FAILED]      kernel is tainted: $taint  -> $taint_now"
+               ((failed++))
+       fi
+}
+
+check_taint
+
 for testfile in $(find_tests)
 do
+       read taint < /proc/sys/kernel/tainted
        kernel_cleanup
 
        msg_info "[EXECUTING]   $testfile"
@@ -155,6 +169,8 @@ do
                        msg_warn "[FAILED]      $testfile"
                fi
        fi
+
+       check_taint
 done
 
 echo ""