summaryrefslogtreecommitdiffstats
path: root/tests/getopts.sh
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2024-02-01 12:11:41 -0500
committerTavian Barnes <tavianator@tavianator.com>2024-02-03 13:50:08 -0500
commit4d0d84f935159c395ccf3b95d5727a3553003b68 (patch)
treeb2db29ab66d4ac6d88ee9f1e94598e34996718f2 /tests/getopts.sh
parentc4334184502c25a41b5cab060681229b2b570c0a (diff)
downloadbfs-4d0d84f935159c395ccf3b95d5727a3553003b68.tar.xz
tests: Implement jobserver inheritance
Diffstat (limited to 'tests/getopts.sh')
-rw-r--r--tests/getopts.sh22
1 files changed, 16 insertions, 6 deletions
diff --git a/tests/getopts.sh b/tests/getopts.sh
index ac75140..5214e9f 100644
--- a/tests/getopts.sh
+++ b/tests/getopts.sh
@@ -10,6 +10,7 @@ if command -v nproc &>/dev/null; then
else
JOBS=1
fi
+MAKE=
PATTERNS=()
SUDO=()
STOP=0
@@ -24,15 +25,19 @@ VERBOSE_TESTS=0
usage() {
local pad=$(printf "%*s" ${#0} "")
color cat <<EOF
-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} ...]]
+Usage: ${GRN}$0${RST}
+ [${BLU}-j${RST}${BLD}N${RST}] [${BLU}--make${RST}=${BLD}MAKE${RST}] [${BLU}--bfs${RST}=${BLD}path/to/bfs${RST}] [${BLU}--sudo${RST}[=${BLD}COMMAND${RST}]]
+ [${BLU}--stop${RST}] [${BLU}--no-clean${RST}] [${BLU}--update${RST}] [${BLU}--verbose${RST}[=${BLD}LEVEL${RST}]] [${BLU}--help${RST}]
+ [${BLU}--posix${RST}] [${BLU}--bsd${RST}] [${BLU}--gnu${RST}] [${BLU}--all${RST}] [${BLD}TEST${RST} [${BLD}TEST${RST} ...]]
- [${BLU}-j${RST}${BLD}N${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})
+ ${BLU}--make${RST}=${BLD}MAKE${RST}
+ Use the jobserver from ${BLD}MAKE${RST}, e.g. ${BLU}--make${RST}=${BLD}"make -j$JOBS"${RST}
+
+ ${BLU}--bfs${RST}=${BLD}path/to/bfs${RST}
+ Set the path to the bfs executable to test (default: ${BLD}./bin/bfs${RST})
${BLU}--sudo${RST}[=${BLD}COMMAND${RST}]
Run tests that require root using ${GRN}sudo${RST} or the given ${BLD}COMMAND${RST}
@@ -75,6 +80,9 @@ parse_args() {
-j?*)
JOBS="${arg#-j}"
;;
+ --make=*)
+ MAKE="${arg#*=}"
+ ;;
--bfs=*)
BFS="${arg#*=}"
;;
@@ -138,6 +146,8 @@ parse_args() {
esac
done
+ read -a MAKE <<<"$MAKE"
+
# Try to resolve the path to $BFS before we cd, while also supporting
# --bfs="./bin/bfs -S ids"
read -a BFS <<<"${BFS:-$BIN/bfs}"