From: Martin Schwenke Date: Thu, 11 Jan 2018 05:17:19 +0000 (+1100) Subject: ctdb-tests: Continue running if a testcase is not executable X-Git-Tag: ldb-1.4.0~290 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=36e7043fb16ac996793545022147f696caedee9c;p=thirdparty%2Fsamba.git ctdb-tests: Continue running if a testcase is not executable 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 Reviewed-by: Amitay Isaacs --- diff --git a/ctdb/tests/run_tests.sh b/ctdb/tests/run_tests.sh index 3649d76e34e..be7b0f9c8ae 100755 --- a/ctdb/tests/run_tests.sh +++ b/ctdb/tests/run_tests.sh @@ -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))