summaryrefslogtreecommitdiff
path: root/ctdb
diff options
context:
space:
mode:
authorMartin Schwenke <martin@meltin.net>2018-01-20 17:05:37 +1100
committerStefan Metzmacher <metze@samba.org>2018-02-12 11:28:49 +0100
commite7af9b0baf46e90d63621c709dcc8e85af465f5c (patch)
tree5a5c48fed3af8a978ef8a16c8f4f60f894cfdbdc /ctdb
parent83b2971f002f80f7bbbd098bfe7da70e1b019607 (diff)
downloadsamba-e7af9b0baf46e90d63621c709dcc8e85af465f5c.tar.gz
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 <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com> (cherry picked from commit da3aaf972ab5b339b51ba1e802329b69885ccfe4)
Diffstat (limited to 'ctdb')
-rwxr-xr-xctdb/tests/run_tests.sh9
1 files changed, 7 insertions, 2 deletions
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" "$*"