]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
tests/shell: cleanup print_test_result() and show TAINTED error code
authorThomas Haller <thaller@redhat.com>
Thu, 7 Sep 2023 22:07:14 +0000 (00:07 +0200)
committerFlorian Westphal <fw@strlen.de>
Fri, 8 Sep 2023 09:50:41 +0000 (11:50 +0200)
We will add more special error codes (122 for VALGRIND). Minor refactor
of print_test_result() to make it easier to extend for that.

Also, we will soon colorize the output. This preparation patch makes
that easier too.

Signed-off-by: Thomas Haller <thaller@redhat.com>
Signed-off-by: Florian Westphal <fw@strlen.de>
tests/shell/run-tests.sh

index 423c5465c4d45cf6d32314e4e761a0522f8fc608..e0adb27ad1049d7f289e76ff21fbd8ccc5a7ff7d 100755 (executable)
@@ -471,25 +471,27 @@ print_test_result() {
        shift 3
 
        local result_msg_level="I"
-       local result_msg_status="OK"
        local result_msg_suffix=""
        local result_msg_files=( "$NFT_TEST_TESTTMPDIR/testout.log" "$NFT_TEST_TESTTMPDIR/ruleset-diff" )
+       local result_msg_status
 
        if [ "$rc_got" -eq 0 ] ; then
                ((ok++))
-       elif [ "$rc_got" -eq 124 ] ; then
-               ((failed++))
-               result_msg_level="W"
-               result_msg_status="DUMP FAIL"
+               result_msg_status="OK"
        elif [ "$rc_got" -eq 77 ] ; then
                ((skipped++))
-               result_msg_level="I"
                result_msg_status="SKIPPED"
        else
                ((failed++))
                result_msg_level="W"
-               result_msg_status="FAILED"
-               result_msg_suffix="got $rc_got"
+               if [ "$rc_got" -eq 123 ] ; then
+                       result_msg_status="TAINTED"
+               elif [ "$rc_got" -eq 124 ] ; then
+                       result_msg_status="DUMP FAIL"
+               else
+                       result_msg_status="FAILED"
+                       result_msg_suffix="got $rc_got"
+               fi
                result_msg_files=( "$NFT_TEST_TESTTMPDIR/testout.log" )
        fi