1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00

tests: add configurable timeout for tests

This commit is contained in:
Steffen Vogel 2017-07-01 21:25:43 +02:00
parent 2ec2859b6f
commit 9b5e69bb1b

View file

@ -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))