]> git.ipfire.org Git - thirdparty/ipset.git/commitdiff
tests: runtest.sh: Keep running, print summary of failed tests
authorPhil Sutter <phil@nwl.cc>
Thu, 12 Dec 2024 12:47:33 +0000 (13:47 +0100)
committerJozsef Kadlecsik <kadlec@netfilter.org>
Sun, 15 Dec 2024 16:08:42 +0000 (17:08 +0100)
Do not exit at each failure.

Signed-off-by: Phil Sutter <phil@nwl.cc>
Signed-off-by: Jozsef Kadlecsik <kadlec@netfilter.org>
tests/runtest.sh

index 7afa1dd0eb20d66bc77b296b2467e49b442e23c2..fc4fd3c13dc6bbb1dca529d7e768a1c2e829a207 100755 (executable)
@@ -76,6 +76,7 @@ fi
 # Make sure the scripts are executable
 chmod a+x check_* *.sh
 
+failcount=0
 for types in $tests; do
     $ipset -X test >/dev/null 2>&1
     if [ -f $types ]; then
@@ -116,7 +117,8 @@ for types in $tests; do
                echo "FAILED"
                echo "Failed test: $cmd"
                cat .foo.err
-               exit 1
+               let "failcount++"
+               break
        fi
        # sleep 1
     done < $filename
@@ -136,5 +138,9 @@ for x in $tests; do
 done
 rmmod ip_set >/dev/null 2>&1
 rm -f .foo*
-echo "All tests are passed"
-
+if [ "$failcount" -eq 0 ]; then
+       echo "All tests are passed"
+else
+       echo "$failcount tests have failed"
+       exit 1
+fi