X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=test%2Fscripts%2Ftest-loop.sh;h=51f5d5cef58e05c276dc6bb67c7d802374d426e4;hb=5854b43de4c04a7c52b0cf03cd548c9cac86c325;hp=9f228833c02dc634f2ecd0420d7cda43c1a36c73;hpb=799e26d5bdf6b74ab615644e0cd291de6e352989;p=vpp.git diff --git a/test/scripts/test-loop.sh b/test/scripts/test-loop.sh index 9f228833c02..51f5d5cef58 100755 --- a/test/scripts/test-loop.sh +++ b/test/scripts/test-loop.sh @@ -3,14 +3,15 @@ function usage() { echo "$0" 1>&2 echo "" 1>&2 - echo "Usage: $0 [-p ] [-m ] -- " 1>&2 + echo "Usage: $0 [-p ] [-m ] -- " 1>&2 echo "" 1>&2 echo "Parameters:" 1>&2 echo " -p - run a command before each test loop (e.g. 'git pull')" 1>&2 echo " -m - if set, email is sent to this address on failure" 1>&2 echo "" 1>&2 - echo "Example:" 1>&2 - echo " $0 -m -- test-debug TEST=l2bd" + echo "Examples:" 1>&2 + echo " $0 -m -- test-debug TEST=l2bd" 1>&2 + echo " $0 -m -- verify" 1>&2 exit 1; } @@ -44,8 +45,11 @@ shift $((OPTIND-1)) if ! echo $* | grep test >/dev/null then - echo "Error: command line doesn't look right - should contain \`test' token..." >&2 - usage + if ! echo $* | grep verify >/dev/null + then + echo "Error: command line doesn't look right - should contain \`test' or \`verify' token..." >&2 + usage + fi fi function finish { @@ -94,7 +98,7 @@ do if [[ "$PRE_EXEC_CMD" != "" ]] then echo "Executing \`$PRE_EXEC_CMD' before test.." - if ! ($PRE_EXEC_CMD 2>$TMP 1>$TMP) + if ! ($PRE_EXEC_CMD 2>&1 | tee $TMP) then echo "\`$PRE_EXEC_CMD' failed!" >&2 REASON="$PRE_EXEC_CMD failed" @@ -102,7 +106,7 @@ do fi fi echo -n "Running test iteration #$COUNT..." - if ! ($CMD 2>$TMP 1>$TMP) + if ! ($CMD >$TMP 2>&1) then AFTER=`date +%s` RUNTIME=$((AFTER-BEFORE))