diff --git a/tests/integration-tests.sh b/tests/integration-tests.sh index 96769f8c6..f6582874d 100755 --- a/tests/integration-tests.sh +++ b/tests/integration-tests.sh @@ -34,10 +34,11 @@ export PATH=${BUILDDIR}:${PATH} VERBOSE=0 FILTER='*' -export NUM_SAMPLES=100 +NUM_SAMPLES=100 +TIMEOUT=1m # Parse command line arguments -while getopts ":f:l:v" OPT; do +while getopts ":f:l:t:v" OPT; do case ${OPT} in f) FILTER=${OPTARG} @@ -48,6 +49,9 @@ while getopts ":f:l:v" OPT; do l) NUM_SAMPLES=${OPTARG} ;; + t) + TIMEOUT=${OPTARG} + ;; \?) echo "Invalid option: -${OPTARG}" >&2 ;; @@ -58,6 +62,9 @@ while getopts ":f:l:v" OPT; do esac done +export VERBOSE +export NUM_SAMPLES + TESTS=${SRCDIR}/tests/integration/${FILTER}.sh # Preperations @@ -74,11 +81,10 @@ for TEST in ${TESTS}; do # Run test if (( ${VERBOSE} == 0 )); then - ${TEST} &> ${LOGDIR}/${TESTNAME}.log + timeout ${TIMEOUT} ${TEST} &> ${LOGDIR}/${TESTNAME}.log else - ${TEST} + timeout ${TIMEOUT} ${TEST} fi - RC=$? case $RC in @@ -90,6 +96,9 @@ for TEST in ${TESTS}; do echo -e "\e[93m[Skip] \e[39m ${TESTNAME}" NUM_SKIP=$((${NUM_SKIP} + 1)) ;; + 124) + echo -e "\e[31m[Timeout] \e[39m ${TESTNAME}" + ;; *) echo -e "\e[31m[Fail] \e[39m ${TESTNAME} with code $RC" NUM_FAIL=$((${NUM_FAIL} + 1))