summaryrefslogtreecommitdiff
path: root/ctdb
diff options
context:
space:
mode:
authorMartin Schwenke <martin@meltin.net>2018-01-20 17:05:37 +1100
committerAmitay Isaacs <amitay@samba.org>2018-01-24 05:49:55 +0100
commitda3aaf972ab5b339b51ba1e802329b69885ccfe4 (patch)
tree924046bd613acf2a5b90855de25ce3711cc8286e /ctdb
parent7ea5d38a69660bf5e086ff03d18b4a4e9eb75cce (diff)
downloadsamba-da3aaf972ab5b339b51ba1e802329b69885ccfe4.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>
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" "$*"