Skip to content

Commit 0998b37

Browse files
committed
Add '--help' flag to testing script.
1 parent db598be commit 0998b37

File tree

1 file changed

+31
-3
lines changed

1 file changed

+31
-3
lines changed

scripts/test.sh

+31-3
Original file line numberDiff line numberDiff line change
@@ -200,14 +200,42 @@ function run_testbench() {
200200
indir "${TESTBENCH_ROOT}" $CARGO run $@
201201
}
202202

203+
# The kind of test we'll be running.
204+
TEST_KIND="default"
205+
KINDS=("default" "all" "core" "contrib" "examples" "benchmarks" "testbench" "ui")
206+
207+
function print_help() {
208+
echo "USAGE:"
209+
echo " $0 [+<TOOLCHAIN>] [--help|-h] [--<TEST>]"
210+
echo ""
211+
echo "OPTIONS:"
212+
echo " +<TOOLCHAIN> Forwarded to Cargo to select toolchain."
213+
echo " --help, -h Print this help message and exit."
214+
echo " --<TEST> Run the specified test suite."
215+
echo " (Run without --<TEST> to run default tests.)"
216+
217+
echo ""
218+
echo "AVAILABLE <TEST> OPTIONS:"
219+
for kind in "${KINDS[@]}"; do
220+
echo " ${kind}"
221+
done
222+
223+
echo ""
224+
echo "EXAMPLES:"
225+
echo " $0 # Run default tests on current toolchain."
226+
echo " $0 +stable --all # Run all tests on stable toolchain."
227+
echo " $0 --ui # Run UI tests on current toolchain."
228+
}
229+
203230
if [[ $1 == +* ]]; then
204231
CARGO="$CARGO $1"
205232
shift
206233
fi
207234

208-
# The kind of test we'll be running.
209-
TEST_KIND="default"
210-
KINDS=("contrib" "benchmarks" "testbench" "core" "examples" "default" "ui" "all")
235+
if [[ $1 == "--help" ]] || [[ $1 == "-h" ]]; then
236+
print_help
237+
exit 0
238+
fi
211239

212240
if [[ " ${KINDS[@]} " =~ " ${1#"--"} " ]]; then
213241
TEST_KIND=${1#"--"}

0 commit comments

Comments
 (0)