summaryrefslogtreecommitdiff
path: root/tests/scripts
diff options
context:
space:
mode:
authorpeter <peter@pmikkelsen.com>2026-09-26 18:00:37 +0000
committerpeter <peter@pmikkelsen.com>2026-09-26 18:00:37 +0000
commit1b9a3117c6d37ca9e31629a9f7014860ffb23d8c (patch)
tree85b65ae0dd53d51a1b65aad377a74abce30d475d /tests/scripts
parent405509a7db6a2c7da227a9a75f222e7d9b32f6b0 (diff)
Improve the failure simulation test/code.
Right now, a lot of test cases fail because if this. Next up: fixing them :) FossilOrigin-Name: 6dd2985bcae86ed3f7c5651e2ce7bc848b80516bf4c1d5482b6095c18dfcc058
Diffstat (limited to 'tests/scripts')
-rwxr-xr-xtests/scripts/bad/6.sh4
-rwxr-xr-xtests/scripts/simfail.sh40
2 files changed, 25 insertions, 19 deletions
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