summaryrefslogtreecommitdiff
path: root/tests/scripts/simfail.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tests/scripts/simfail.sh')
-rwxr-xr-xtests/scripts/simfail.sh40
1 files changed, 25 insertions, 15 deletions
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