From 8c8691c3fdb327eb45d5ee831da62e7433563004 Mon Sep 17 00:00:00 2001 From: Explorer09 Date: Mon, 2 Jan 2017 00:43:50 +0800 Subject: [PATCH] test: exit on '-1' test non-zero status. If a '-1' test program returns a non-zero status, don't go further and compare it's (numeric) output values. This allows a '-1' test to indicate a "skip" status or an otherwise error. (Currently no such '-1' test would skip like this, though.) Shell syntax note: `set -e` will not exit with the syntax like this `test $(false) = $(false);`. The exit statuses of `false` in the example will be ignored instead. But putting the output in a variable, such as `VAR=$(false)`, DOES exit. --- tests/testwrapper.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/testwrapper.sh b/tests/testwrapper.sh index e18062f..188d479 100755 --- a/tests/testwrapper.sh +++ b/tests/testwrapper.sh @@ -33,14 +33,16 @@ TESTNAME="${!OPTIND}" INPUT_NAME=${INPUT_NAME:-$INPUT_DIRECTORY/`basename ${TESTNAME%.exe}`.txt} if [ "$DO_COMPARISON" -eq "1" ] ; then - test `$TESTNAME 1 < $INPUT_NAME` -eq `$TESTNAME < $INPUT_NAME` + TEST_OUTPUT=`$TESTNAME < $INPUT_NAME` + REF_OUTPUT=`$TESTNAME 1 < $INPUT_NAME` + test "$TEST_OUTPUT" -eq "$REF_OUTPUT" exit $? - fi +fi if [ $INPUT_COUNT -gt 1 ] ; then $TESTNAME ${USE_TABLES:+${INPUT_DIRECTORY}/${TESTNAME%.exe}.tables} ${INPUT_NAME} exit $? - fi +fi if [ -f ${INPUT_NAME} ] ; then if [ $USE_REDIRECT == 1 ] ; then -- 2.40.0