Add '--help' flag to testing script.

This commit is contained in:
Sergio Benitez 2024-08-09 18:48:11 -07:00
parent db598be3a8
commit 0998b37aeb
1 changed files with 31 additions and 3 deletions

View File

@ -200,14 +200,42 @@ function run_testbench() {
indir "${TESTBENCH_ROOT}" $CARGO run $@ indir "${TESTBENCH_ROOT}" $CARGO run $@
} }
# The kind of test we'll be running.
TEST_KIND="default"
KINDS=("default" "all" "core" "contrib" "examples" "benchmarks" "testbench" "ui")
function print_help() {
echo "USAGE:"
echo " $0 [+<TOOLCHAIN>] [--help|-h] [--<TEST>]"
echo ""
echo "OPTIONS:"
echo " +<TOOLCHAIN> Forwarded to Cargo to select toolchain."
echo " --help, -h Print this help message and exit."
echo " --<TEST> Run the specified test suite."
echo " (Run without --<TEST> to run default tests.)"
echo ""
echo "AVAILABLE <TEST> OPTIONS:"
for kind in "${KINDS[@]}"; do
echo " ${kind}"
done
echo ""
echo "EXAMPLES:"
echo " $0 # Run default tests on current toolchain."
echo " $0 +stable --all # Run all tests on stable toolchain."
echo " $0 --ui # Run UI tests on current toolchain."
}
if [[ $1 == +* ]]; then if [[ $1 == +* ]]; then
CARGO="$CARGO $1" CARGO="$CARGO $1"
shift shift
fi fi
# The kind of test we'll be running. if [[ $1 == "--help" ]] || [[ $1 == "-h" ]]; then
TEST_KIND="default" print_help
KINDS=("contrib" "benchmarks" "testbench" "core" "examples" "default" "ui" "all") exit 0
fi
if [[ " ${KINDS[@]} " =~ " ${1#"--"} " ]]; then if [[ " ${KINDS[@]} " =~ " ${1#"--"} " ]]; then
TEST_KIND=${1#"--"} TEST_KIND=${1#"--"}