diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/Makefile.am | 1 | ||||
| -rwxr-xr-x | tests/run_script_test.sh | 10 | ||||
| -rwxr-xr-x | tests/run_simple_test.sh | 10 | ||||
| -rwxr-xr-x | tests/scripts/bad/6.sh | 4 | ||||
| -rwxr-xr-x | tests/scripts/simfail.sh | 40 |
5 files changed, 43 insertions, 22 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am index 06d233d..16e1e8a 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -63,7 +63,6 @@ TEST_SCRIPTS_SH += \ tests/scripts/bad/3.sh \ tests/scripts/bad/4.sh \ tests/scripts/bad/5.sh \ - tests/scripts/bad/6.sh \ tests/scripts/bad/7.sh TEST_SCRIPTS_APLWC += \ diff --git a/tests/run_script_test.sh b/tests/run_script_test.sh index cef7add..9e7d085 100755 --- a/tests/run_script_test.sh +++ b/tests/run_script_test.sh @@ -9,9 +9,17 @@ ext=${input##*.} check() { status=$1 + case $status in + 0|1) + ;; + *) + exit 99 + ;; + esac + case $expected in bad) - [ "$status" -ne 0 ] + [ "$status" -eq 1 ] ;; *) [ "$status" -eq 0 ] diff --git a/tests/run_simple_test.sh b/tests/run_simple_test.sh index 6c1d56c..e6ffc3e 100755 --- a/tests/run_simple_test.sh +++ b/tests/run_simple_test.sh @@ -11,11 +11,19 @@ expected=${input%%/*} "./testbin-$program" "$1" status=$? +case $status in + 0|1) + ;; + *) + exit 99 + ;; +esac + case $expected in good) [ "$status" -eq 0 ] ;; bad) - [ "$status" -ne 0 ] + [ "$status" -eq 1 ] ;; esac diff --git a/tests/scripts/bad/6.sh b/tests/scripts/bad/6.sh deleted file mode 100755 index 21fcc38..0000000 --- a/tests/scripts/bad/6.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh - -export APLWC_SIMULATE_FAILURE_PRINT_COUNT=1 -aplwc -x 3>&- diff --git a/tests/scripts/simfail.sh b/tests/scripts/simfail.sh index c10a7cb..75b97ab 100755 --- a/tests/scripts/simfail.sh +++ b/tests/scripts/simfail.sh @@ -1,20 +1,30 @@ #!/bin/sh -set -e +START=0 +COUNT=1 -export APLWC_SIMULATE_FAILURE_PRINT_COUNT=1 -N=$($1 3>&1 1>/dev/null 2>/dev/null) -n=1 -if [ -z "$N" ]; then - N=0 -fi - -export APLWC_SIMULATE_FAILURE_PRINT_COUNT=0 - -while [ "$n" -le "$N" ] +while true do - echo $n out of $N - export APLWC_SIMULATE_FAILURE_AT=$n - $1 #1>/dev/null 2>/dev/null - n=$((n + 1)) + echo "*** SIMFAIL (START=$START, COUNT=$COUNT) ***" + export APLWC_SIMULATE_FAILURE_START=$START + export APLWC_SIMULATE_FAILURE_COUNT=$COUNT + $1 + ret=$? + case $ret in + 99) + COUNT=$((COUNT + 1)) + ;; + 98) + COUNT=1 + START=$((START + 1)) + ;; + 0) + echo "*** SUCCESS ***" + exit 0 + ;; + *) + echo "*** FAILURE $ret ***" + exit $ret + ;; + esac done |