]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
tests/shell: don't show the exit status for failed tests
authorThomas Haller <thaller@redhat.com>
Mon, 18 Sep 2023 18:45:20 +0000 (20:45 +0200)
committerFlorian Westphal <fw@strlen.de>
Mon, 18 Sep 2023 20:07:02 +0000 (22:07 +0200)
Previously, for failed tests we would print the exit code

  W: [FAILED]     2/2 tests/shell/testcases/listing/0013objects_0: got 1

This doesn't seem very useful. For one, we have special exit codes like
0 (OK), 77 (SKIPPED), 124 (DUMP FAIL), 123 (TAINTED), 122 (VALGRIND).
Any other exit code is just an arbitrary failure. We don't define any
special codes, and printing them is not useful.

Note that further exit codes (118 - 121) are reserved, and could be
special purposed, when there is a use.

You can find the real exit code from the test in the result data in the
"rc-failed" file.

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

index 79c818cb0f11d8592faa1b52d603997f8de561fa..418fab95da945df359dea9b2410e1a8a1b408a62 100755 (executable)
@@ -704,7 +704,6 @@ print_test_header() {
        local testfile="$2"
        local testidx_completed="$3"
        local status="$4"
-       local suffix="$5"
        local text
        local s_idx
 
@@ -713,7 +712,7 @@ print_test_header() {
        s_idx="$text/${#TESTS[@]}"
 
        align_text text left 12 "[$status]"
-       _msg "$msglevel" "$text $s_idx $testfile${suffix:+: $suffix}"
+       _msg "$msglevel" "$text $s_idx $testfile"
 }
 
 print_test_result() {
@@ -722,7 +721,6 @@ print_test_result() {
        local rc_got="$3"
 
        local result_msg_level="I"
-       local result_msg_suffix=""
        local result_msg_files=( "$NFT_TEST_TESTTMPDIR/testout.log" "$NFT_TEST_TESTTMPDIR/ruleset-diff" )
        local result_msg_status
 
@@ -743,13 +741,12 @@ print_test_result() {
                        result_msg_status="DUMP FAIL"
                else
                        result_msg_status="FAILED"
-                       result_msg_suffix="got $rc_got"
                fi
                result_msg_status="$RED$result_msg_status$RESET"
                result_msg_files=( "$NFT_TEST_TESTTMPDIR/testout.log" )
        fi
 
-       print_test_header "$result_msg_level" "$testfile" "$((ok + skipped + failed))" "$result_msg_status" "$result_msg_suffix"
+       print_test_header "$result_msg_level" "$testfile" "$((ok + skipped + failed))" "$result_msg_status"
 
        if [ "$VERBOSE" = "y" ] ; then
                local f
@@ -773,7 +770,7 @@ job_start() {
        local testidx="$2"
 
        if [ "$NFT_TEST_JOBS" -le 1 ] ; then
-               print_test_header I "$testfile" "$testidx" "EXECUTING" ""
+               print_test_header I "$testfile" "$testidx" "EXECUTING"
        fi
 
        NFT_TEST_TESTTMPDIR="${JOBS_TEMPDIR["$testfile"]}" \