summaryrefslogtreecommitdiffstats
path: root/tests.sh
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2022-05-13 16:08:48 -0400
committerTavian Barnes <tavianator@tavianator.com>2022-05-13 16:08:48 -0400
commitb180a0e78bd81376491ea2a9ac6349e25f7e52d4 (patch)
treea3a04026dbee30932eb7f2a96e6adb815dfa742a /tests.sh
parent28608a595ef572de15ae89e8f64e110aed67101c (diff)
downloadbfs-b180a0e78bd81376491ea2a9ac6349e25f7e52d4.tar.xz
tests: New --stop flag to stop after the first failure
Diffstat (limited to 'tests.sh')
-rwxr-xr-xtests.sh10
1 files changed, 9 insertions, 1 deletions
diff --git a/tests.sh b/tests.sh
index af45466..52507a0 100755
--- a/tests.sh
+++ b/tests.sh
@@ -82,7 +82,7 @@ function usage() {
local pad=$(printf "%*s" ${#0} "")
cat <<EOF
Usage: ${GRN}$0${RST} [${BLU}--bfs${RST}=${MAG}path/to/bfs${RST}] [${BLU}--posix${RST}] [${BLU}--bsd${RST}] [${BLU}--gnu${RST}] [${BLU}--all${RST}] [${BLU}--sudo${RST}]
- $pad [${BLU}--noclean${RST}] [${BLU}--update${RST}] [${BLU}--verbose${RST}[=${BLD}LEVEL${RST}]] [${BLU}--help${RST}]
+ $pad [${BLU}--stop${RST}] [${BLU}--noclean${RST}] [${BLU}--update${RST}] [${BLU}--verbose${RST}[=${BLD}LEVEL${RST}]] [${BLU}--help${RST}]
$pad [${BLD}test_*${RST} [${BLD}test_*${RST} ...]]
${BLU}--bfs${RST}=${MAG}path/to/bfs${RST}
@@ -94,6 +94,9 @@ Usage: ${GRN}$0${RST} [${BLU}--bfs${RST}=${MAG}path/to/bfs${RST}] [${BLU}--posix
${BLU}--sudo${RST}
Run tests that require root
+ ${BLU}--stop${RST}
+ Stop when the first error occurs
+
${BLU}--noclean${RST}
Keep the test directories around after the run
@@ -125,6 +128,7 @@ BSD=
GNU=
ALL=
SUDO=
+STOP=
CLEAN=yes
UPDATE=
VERBOSE_COMMANDS=
@@ -164,6 +168,9 @@ for arg; do
--sudo)
SUDO=yes
;;
+ --stop)
+ STOP=yes
+ ;;
--noclean)
CLEAN=
;;
@@ -3412,6 +3419,7 @@ for test in "${enabled_tests[@]}"; do
((++failed))
[ "$VERBOSE_ERRORS" ] || cat "$TMP/stderr" >&2
printf "${BOL}${RED}%s failed!${RST}\n" "$test"
+ [ "$STOP" ] && break
fi
done