]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
ctdb-tests: Continue running if a testcase is not executable
authorMartin Schwenke <martin@meltin.net>
Thu, 11 Jan 2018 05:17:19 +0000 (16:17 +1100)
committerAmitay Isaacs <amitay@samba.org>
Sat, 12 May 2018 04:11:17 +0000 (06:11 +0200)
At the moment the whole test run aborts without printing a summary of
results but inexplicably succeeds.  Instead, generate a clear failure
for a non-executable testcase.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb/tests/run_tests.sh

index 3649d76e34e13c2b0c65d1179badd0c577f12f37..be7b0f9c8ae6575e0a01f877264fd7e9bee9f569 100755 (executable)
@@ -29,6 +29,12 @@ die ()
     echo "$1" >&2 ; exit ${2:-1}
 }
 
+# Print a message and return failure
+fail ()
+{
+    echo "$1" >&2 ; return ${2:-1}
+}
+
 ######################################################################
 
 with_summary=true
@@ -186,10 +192,13 @@ run_one_test ()
 {
     local f="$1"
 
-    [ -x "$f" ] || die "test \"$f\" is not executable"
     tests_total=$(($tests_total + 1))
 
-    ctdb_test_run "$f" | tee "$tf" | show_progress
+    if [ -x "$f" ] ; then
+       ctdb_test_run "$f" | tee "$tf" | show_progress
+    else
+       ctdb_test_run "$f" fail "TEST NOT EXECUTABLE"
+    fi
     status=$?
     if [ $status -eq 0 ] ; then
        tests_passed=$(($tests_passed + 1))