]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
test: allow tests to be skipped
authorMiroslav Lichvar <mlichvar@redhat.com>
Thu, 14 Aug 2014 15:58:59 +0000 (17:58 +0200)
committerMiroslav Lichvar <mlichvar@redhat.com>
Fri, 15 Aug 2014 09:18:44 +0000 (11:18 +0200)
test/simulation/run
test/simulation/test.common

index 75fc4e4bdf1e3222154e357899deb431bfcbfbc6..cbc7b8d30ac181ee17ff3fc9b643c2623fcf5cec 100755 (executable)
@@ -2,19 +2,25 @@
 
 . test.common
 
-passed=() failed=()
+passed=() failed=() skipped=()
 
 [ $# -gt 0 ] && tests=($@) || tests=([0-9]*-*[^_])
 
 for test in "${tests[@]}"; do
        echo "$test ($[${#passed[@]} + ${#failed[@]} + 1]/${#tests[@]})"
-       ./$test && passed=(${passed[@]} $test) || failed=(${failed[@]} $test)
+       ./$test
+       case $? in
+               0) passed=(${passed[@]} $test);;
+               9) skipped=(${skipped[@]} $test);;
+               *) failed=(${failed[@]} $test);;
+       esac
        echo
 done
 
 echo "SUMMARY:"
-echo "  TOTAL  $[${#passed[@]} + ${#failed[@]}]"
+echo "  TOTAL  $[${#passed[@]} + ${#failed[@]} + ${#skipped[@]}]"
 echo "  PASSED ${#passed[@]}"
 echo "  FAILED ${#failed[@]}    (${failed[@]})"
+echo "  SKIPPED ${#skipped[@]}   (${skipped[@]})"
 
 [ ${#failed} -eq 0 ]
index 117861190d3bcd11ad0576bf36b2a7ad0a3253e9..8aee45465ace337090c703434a048dcb2c168c13 100644 (file)
@@ -101,6 +101,11 @@ test_fail() {
        exit 1
 }
 
+test_skip() {
+       echo "SKIP"
+       exit 9
+}
+
 test_ok() {
        pad_line
        echo -e "\tOK"