Add test-suite parameter to filter tests

Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
This commit is contained in:
Jerry Yu 2023-11-06 10:49:01 +08:00
parent 8b6b41f6cd
commit 50d07bdeec

View File

@ -113,6 +113,7 @@ EXCLUDE='^$'
SHOW_TEST_NUMBER=0
LIST_TESTS=0
RUN_TEST_NUMBER=''
RUN_TEST_SUITE=''
PRESERVE_LOGS=0
@ -137,6 +138,8 @@ print_usage() {
printf " --port \tTCP/UDP port (default: randomish 1xxxx)\n"
printf " --proxy-port\tTCP/UDP proxy port (default: randomish 2xxxx)\n"
printf " --seed \tInteger seed value to use for this test run\n"
printf " --test-suite\tOnly matching test suites are executed\n"
printf " \t(comma-separated, e.g. 'ssl-opt,tls13-compat')\n\n"
}
get_options() {
@ -175,6 +178,9 @@ get_options() {
--seed)
shift; SEED="$1"
;;
--test-suite)
shift; RUN_TEST_SUITE="$1"
;;
-h|--help)
print_usage
exit 0
@ -1590,6 +1596,13 @@ run_test() {
return
fi
# Use ssl-opt as default test suite name. Also see record_outcome function
if is_excluded_test_suite "${TEST_SUITE_NAME:-ssl-opt}"; then
# Do not skip next test and skip current test.
SKIP_NEXT="NO"
return
fi
print_name "$NAME"
# Do we only run numbered tests?
@ -1837,6 +1850,21 @@ else
}
fi
# Filter tests according to TEST_SUITE_NAME
is_excluded_test_suite () {
if [ -n "$RUN_TEST_SUITE" ]
then
case ",$RUN_TEST_SUITE," in
*",$1,"*) false;;
*) true;;
esac
else
false
fi
}
if [ "$LIST_TESTS" -eq 0 ];then
# sanity checks, avoid an avalanche of errors