Debian Codegraph @

tests/testwrapper.sh

raw symbols SCIP
1 #!/bin/shscip-shell filesystem . . `/bin/sh`.
2 echoscip-shell system . . echo. 'set -euvx'
3 set -euvx
4
5 # testwrapper.sh: run a flex test, typically called by a Makefile
6
7 # Each test will exercise some feature or aspect of flex. Run the test with any
8 # input it may need.
9
10 INPUT_DIRECTORY=""
11 INPUT_NAME=""
12 INPUT_COUNT=0
13 USE_REDIRECT=0
14 DO_COMPARISON=0
15
16 while getopts :d:i:rt1 OPTION ; do
17 case $OPTION in
18 d) INPUT_DIRECTORY=$OPTARG ;;
19 i)
20 if [scip-shell system . . `[`. "$INPUT_NAME" = "" ] ; then
21 INPUT_NAME="$OPTARG"
22 else
23 INPUT_NAME="$INPUT_NAME $OPTARG"
24 fi
25 INPUT_COUNT=$(($INPUT_COUNT+1))
26 ;;
27 r) USE_REDIRECT=1 ;;
28 t) USE_TABLES=1 ;;
29 1) DO_COMPARISON=1 ;;
30 esac
31 done
32
33 shift $(($OPTIND-1))
34 TESTNAME=$1
35
36 INPUT_NAME=${INPUT_NAME:-$INPUT_DIRECTORY/`basenamescip-shell system . . basename. "${TESTNAME%.exe}"`.txt}
37
38 if [scip-shell system . . `[`. $DO_COMPARISON = 1 ] ; then
39 TEST_OUTPUT=`$TESTNAME < $INPUT_NAME`
40 REF_OUTPUT=`$TESTNAME 1 < $INPUT_NAME`
41 testscip-shell system . . test. "$TEST_OUTPUT" -eq "$REF_OUTPUT"
42 exit $?
43 fi
44
45 if [scip-shell system . . `[`. $INPUT_COUNT -gt 1 ] ; then
46 $TESTNAME ${USE_TABLES:+${INPUT_DIRECTORY}/${TESTNAME%.exe}.tables} ${INPUT_NAME}
47 exit $?
48 fi
49
50 if [scip-shell system . . `[`. -f ${INPUT_NAME} ] ; then
51 if [scip-shell system . . `[`. $USE_REDIRECT = 1 ] ; then
52 $TESTNAME ${USE_TABLES:+${INPUT_DIRECTORY}/${TESTNAME%.exe}.tables} < $INPUT_NAME
53 else
54 $TESTNAME ${USE_TABLES:+${INPUT_DIRECTORY}/${TESTNAME%.exe}.tables} $INPUT_NAME
55 fi
56 else
57 $TESTNAME
58 fi