summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2023-10-23 13:05:15 -0400
committerTavian Barnes <tavianator@tavianator.com>2023-10-23 13:05:15 -0400
commit62415c0d1530f271ce9d417fa075ac00b9473f1e (patch)
tree505ce7d301241a75eb9c6048346c84a1912da1ff /tests
parent63c43d7fb463529219a4de4d1fddb8953056346d (diff)
downloadbfs-62415c0d1530f271ce9d417fa075ac00b9473f1e.tar.xz
tests: Document -j
Diffstat (limited to 'tests')
-rw-r--r--tests/getopts.sh41
1 files changed, 20 insertions, 21 deletions
diff --git a/tests/getopts.sh b/tests/getopts.sh
index d34df4f..ac75140 100644
--- a/tests/getopts.sh
+++ b/tests/getopts.sh
@@ -5,14 +5,32 @@
## Argument parsing
+if command -v nproc &>/dev/null; then
+ JOBS=$(nproc)
+else
+ JOBS=1
+fi
+PATTERNS=()
+SUDO=()
+STOP=0
+CLEAN=1
+UPDATE=0
+VERBOSE_COMMANDS=0
+VERBOSE_ERRORS=0
+VERBOSE_SKIPPED=0
+VERBOSE_TESTS=0
+
# Print usage information
usage() {
local pad=$(printf "%*s" ${#0} "")
color cat <<EOF
-Usage: ${GRN}$0${RST} [${BLU}--bfs${RST}=${MAG}path/to/bfs${RST}] [${BLU}--sudo${RST}[=${BLD}COMMAND${RST}]] [${BLU}--stop${RST}]
+Usage: ${GRN}$0${RST} [${BLU}-j${RST}${BLD}N${RST}] [${BLU}--bfs${RST}=${MAG}path/to/bfs${RST}] [${BLU}--sudo${RST}[=${BLD}COMMAND${RST}]] [${BLU}--stop${RST}]
$pad [${BLU}--no-clean${RST}] [${BLU}--update${RST}] [${BLU}--verbose${RST}[=${BLD}LEVEL${RST}]] [${BLU}--help${RST}]
$pad [${BLU}--posix${RST}] [${BLU}--bsd${RST}] [${BLU}--gnu${RST}] [${BLU}--all${RST}] [${BLD}TEST${RST} [${BLD}TEST${RST} ...]]
+ [${BLU}-j${RST}${BLD}N${RST}]
+ Run ${BLD}N${RST} tests in parallel (default: ${BLD}$JOBS${RST})
+
${BLU}--bfs${RST}=${MAG}path/to/bfs${RST}
Set the path to the bfs executable to test (default: ${MAG}./bin/bfs${RST})
@@ -52,20 +70,9 @@ EOF
# Parse the command line
parse_args() {
- JOBS=0
- PATTERNS=()
- SUDO=()
- STOP=0
- CLEAN=1
- UPDATE=0
- VERBOSE_COMMANDS=0
- VERBOSE_ERRORS=0
- VERBOSE_SKIPPED=0
- VERBOSE_TESTS=0
-
for arg; do
case "$arg" in
- -j*)
+ -j?*)
JOBS="${arg#-j}"
;;
--bfs=*)
@@ -131,14 +138,6 @@ parse_args() {
esac
done
- if ((JOBS == 0)); then
- if command -v nproc &>/dev/null; then
- JOBS=$(nproc)
- else
- JOBS=1
- fi
- fi
-
# Try to resolve the path to $BFS before we cd, while also supporting
# --bfs="./bin/bfs -S ids"
read -a BFS <<<"${BFS:-$BIN/bfs}"