ctdb-tests: Add handling for skipped tests
authorMartin Schwenke <martin@meltin.net>
Wed, 18 Sep 2019 02:36:05 +0000 (12:36 +1000)
committerAmitay Isaacs <amitay@samba.org>
Fri, 4 Oct 2019 09:41:28 +0000 (09:41 +0000)
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb/tests/run_tests.sh
ctdb/tests/scripts/common.sh

index 3c13df36f4c392a47b774cc1c80522ab31683788..a97ce63e3d54057bafe7045ef6bac604f58d50f5 100755 (executable)
@@ -140,6 +140,10 @@ ctdb_test_run ()
                interp="PASSED"
                tests_passed=$((tests_passed + 1))
                ;;
+       77)
+               interp="SKIPPED"
+               tests_skipped=$((tests_skipped + 1))
+               ;;
        99)
                interp="ERROR"
                tests_failed=$((tests_failed + 1))
@@ -173,6 +177,7 @@ ctdb_test_run ()
 
 tests_total=0
 tests_passed=0
+tests_skipped=0
 tests_failed=0
 
 if ! type mktemp >/dev/null 2>&1 ; then
@@ -356,8 +361,14 @@ if $with_summary ; then
        if [ $status -eq 0 ] || ! $exit_on_fail ; then
                echo
                cat "$summary_file"
+
                echo
-               echo "${tests_passed}/${tests_total} tests passed"
+               tests_run=$((tests_total - tests_skipped))
+               printf '%d/%d tests passed' $tests_passed $tests_run
+               if [ $tests_skipped -gt 0 ] ; then
+                       printf ' (%d skipped)' $tests_skipped
+               fi
+               printf '\n'
        fi
 fi
 rm -f "$summary_file"
index 1efb1f34e013eba5e76cd9edfa9a37fcb8b4b814..326f136d638b4af706675f0bd2c93a4f0386d53d 100644 (file)
@@ -44,7 +44,7 @@ ctdb_test_skip ()
        if [ $# -gt 0 ] ; then
                echo "$*"
        fi
-       exit 0
+       exit 77
 }
 
 # Wait until either timeout expires or command succeeds.  The command