]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
tests/shell: exit 77 from "run-tests.sh" if all tests were skipped
authorThomas Haller <thaller@redhat.com>
Wed, 13 Sep 2023 17:11:01 +0000 (19:11 +0200)
committerFlorian Westphal <fw@strlen.de>
Fri, 15 Sep 2023 14:14:02 +0000 (16:14 +0200)
If there are multiple tests and some of them pass and some are skipped,
the overall result should be success (zero). Because likely the user
just selected a bunch of tests (or all of them). So skipping some tests
does not mean that the entire run is not a success.

However, if all tests are skipped, then mark the overall result as
skipped too. The more common case is if you only run one single test,
then we want to know, that the test didn't run.

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

index 8f55c81fdc711fed0a5c197c1d2d368899c301cf..65bd5c1daf1e83b2d8ecd024307df7c0fa17f402 100755 (executable)
@@ -821,4 +821,10 @@ if [ "$failed" -gt 0 -o "$NFT_TEST_KEEP_LOGS" = y ] ; then
        NFT_TEST_TMPDIR=
 fi
 
-[ "$failed" -eq 0 ]
+if [ "$failed" -gt 0 ] ; then
+       exit 1
+elif [ "$ok" -eq 0 -a "$skipped" -gt 0 ] ; then
+       exit 77
+else
+       exit 0
+fi