]> granicus.if.org Git - flex/commitdiff
test: exit on '-1' test non-zero status.
authorExplorer09 <explorer09@gmail.com>
Sun, 1 Jan 2017 16:43:50 +0000 (00:43 +0800)
committerWill Estes <westes575@gmail.com>
Wed, 18 Jan 2017 02:08:42 +0000 (21:08 -0500)
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

index e18062f4d5bad4014eeb42fcb76d741e0f9a5737..188d479d302e5a21ffb5e09666f4b67e4349063e 100755 (executable)
@@ -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