From: Martin Schwenke Date: Sat, 20 Jan 2018 06:05:37 +0000 (+1100) Subject: ctdb-tests: Add timeout for individual tests, default is 10 minutes X-Git-Tag: tevent-0.9.36~278 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=da3aaf972ab5b339b51ba1e802329b69885ccfe4;p=thirdparty%2Fsamba.git ctdb-tests: Add timeout for individual tests, default is 10 minutes This will cause a hung test to time out and fail rather than letting a test run hang indefinitely. Some tests can take 5 minutes to run, so 10 minutes should be plenty. Signed-off-by: Martin Schwenke Reviewed-by: Amitay Isaacs --- diff --git a/ctdb/tests/run_tests.sh b/ctdb/tests/run_tests.sh index ffc81d405a6..d790996e5ef 100755 --- a/ctdb/tests/run_tests.sh +++ b/ctdb/tests/run_tests.sh @@ -46,8 +46,9 @@ export TEST_LOCAL_DAEMONS [ -n "$TEST_LOCAL_DAEMONS" ] || TEST_LOCAL_DAEMONS=3 export TEST_VAR_DIR="" export TEST_CLEANUP=false +export TEST_TIMEOUT=600 -temp=$(getopt -n "$prog" -o "AcCdDehHNqSvV:xX" -l help -- "$@") +temp=$(getopt -n "$prog" -o "AcCdDehHNqST:vV:xX" -l help -- "$@") [ $? != 0 ] && usage @@ -65,6 +66,7 @@ while true ; do -N) with_summary=false ; shift ;; -q) quiet=true ; shift ;; -S) socket_wrapper=true ; shift ;; + -T) TEST_TIMEOUT="$2" ; shift 2 ;; -v) TEST_VERBOSE=true ; shift ;; -V) TEST_VAR_DIR="$2" ; shift 2 ;; -x) set -x; shift ;; @@ -114,6 +116,9 @@ ctdb_test_end () interp="PASSED" statstr="" echo "ALL OK: $*" + elif [ $status -eq 124 ] ; then + interp="TIMEOUT" + statstr=" (status $status)" else interp="FAILED" statstr=" (status $status)" @@ -137,7 +142,7 @@ ctdb_test_run () $no_header || ctdb_test_begin "$name" local status=0 - "$@" || status=$? + timeout $TEST_TIMEOUT "$@" || status=$? $no_header || ctdb_test_end "$name" "$status" "$*"