]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
tests/shell: interpret an exit code of 77 from scripts as "skipped"
authorThomas Haller <thaller@redhat.com>
Wed, 6 Sep 2023 11:52:11 +0000 (13:52 +0200)
committerFlorian Westphal <fw@strlen.de>
Thu, 7 Sep 2023 17:35:20 +0000 (19:35 +0200)
Allow scripts to indicate that a test could not run by exiting 77.

"77" is chosen as exit code from automake's testsuites ([1]). Compare to
git-bisect which chooses 125 to indicate skipped.

[1] https://www.gnu.org/software/automake/manual/html_node/Scripts_002dbased-Testsuites.html

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

index f811b44aab0dbdb759d2755c6cc3a753f7f71578..0cf37f4080039a02467d2c1255f0974ac4e7e33f 100755 (executable)
@@ -14,6 +14,8 @@ rc_test=0
 
 if [ "$rc_test" -eq 0 ] ; then
        echo "$rc_test" > "$NFT_TEST_TESTTMPDIR/rc_test-ok"
+elif [ "$rc_test" -eq 77 ] ; then
+       echo "$rc_test" > "$NFT_TEST_TESTTMPDIR/rc_test-skipped"
 else
        echo "$rc_test" > "$NFT_TEST_TESTTMPDIR/rc_test-failed"
 fi
index f083773c231064e3d9ed7d66974da3270cf806f8..fec9e7743226a6ea96b11359e682d4b3c4ce3448 100755 (executable)
@@ -323,6 +323,7 @@ fi
 
 echo ""
 ok=0
+skipped=0
 failed=0
 taint=0
 
@@ -423,6 +424,14 @@ for testfile in "${TESTS[@]}" ; do
                                msg_warn "[DUMP FAIL]   $testfile"
                        fi
                fi
+       elif [ "$rc_got" -eq 77 ] ; then
+               ((skipped++))
+               if [ "$VERBOSE" == "y" ] ; then
+                       msg_warn "[SKIPPED]     $testfile"
+                       [ ! -z "$test_output" ] && echo "$test_output"
+               else
+                       msg_warn "[SKIPPED]     $testfile"
+               fi
        else
                ((failed++))
                if [ "$VERBOSE" == "y" ] ; then
@@ -447,7 +456,7 @@ echo ""
 kmemleak_found=0
 check_kmemleak_force
 
-msg_info "results: [OK] $ok [FAILED] $failed [TOTAL] $((ok+failed))"
+msg_info "results: [OK] $ok [SKIPPED] $skipped [FAILED] $failed [TOTAL] $((ok+skipped+failed))"
 
 kernel_cleanup