diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2018-12-17 17:11:30 -0500 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2018-12-17 17:13:27 -0500 |
commit | 6b2494424fc8e6c49d6816294b5df5b1fe7f4c74 (patch) | |
tree | 7dcae589d2ce98b7c2f46cf10cf3392f1fc5deb1 | |
parent | e95ec269efdfbd97b5d0ee85dda38e7bae498181 (diff) | |
download | bfs-6b2494424fc8e6c49d6816294b5df5b1fe7f4c74.tar.xz |
tests.sh: Add a --help with usage information
-rwxr-xr-x | tests.sh | 37 |
1 files changed, 36 insertions, 1 deletions
@@ -606,6 +606,36 @@ bfs_tests=( test_deep_strict ) +function usage() { + local pad=$(printf "%*s" ${#0} "") + cat <<EOF +Usage: $0 [--bfs=path/to/bfs] [--posix|--bsd|--gnu|--all] + $pad [--noclean] [--update] [--verbose] [--help] + $pad [test_* [test_* ...]] + + --bfs=path/to/bfs + Set the path to the bfs executable to test (default: ./bfs) + + --posix|--bsd|--gnu|--all + Restrict the set of test cases to run + + --noclean + Keep the test directories around after the run + + --update + Update the expected outputs for the test cases + + --verbose + Log the commands that get executed + + --help + This message + + test_* + Select individual test cases to run +EOF +} + BSD=yes GNU=yes ALL=yes @@ -650,12 +680,17 @@ for arg; do --verbose) VERBOSE=yes ;; + --help) + usage + exit 0 + ;; test_*) EXPLICIT=yes enable_tests "$arg" ;; *) - echo "Unrecognized option '$arg'." >&2 + printf "Unrecognized option '%s'.\n\n" "$arg" >&2 + usage >&2 exit 1 ;; esac |