summaryrefslogtreecommitdiff
path: root/tests/testwrapper.sh
diff options
context:
space:
mode:
authorExplorer09 <explorer09@gmail.com>2017-01-02 00:43:50 +0800
committerWill Estes <westes575@gmail.com>2017-01-17 21:08:42 -0500
commit8c8691c3fdb327eb45d5ee831da62e7433563004 (patch)
treef50b20abb57198cf4c6e2b8d877c709cbedbaef2 /tests/testwrapper.sh
parentbb92951c022ea135d2f9dbc51dd9803ac7cd97ad (diff)
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.
Diffstat (limited to 'tests/testwrapper.sh')
-rwxr-xr-xtests/testwrapper.sh8
1 files 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