From 50d07bdeece8450ab7204a03196dcc4bbf6e4d26 Mon Sep 17 00:00:00 2001 From: Jerry Yu Date: Mon, 6 Nov 2023 10:49:01 +0800 Subject: [PATCH 1/2] Add test-suite parameter to filter tests Signed-off-by: Jerry Yu --- tests/ssl-opt.sh | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/tests/ssl-opt.sh b/tests/ssl-opt.sh index 8e8e2a165..098d17261 100755 --- a/tests/ssl-opt.sh +++ b/tests/ssl-opt.sh @@ -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 From 9e47b268c47b9822108760b66076c30916f3322a Mon Sep 17 00:00:00 2001 From: Jerry Yu Date: Mon, 6 Nov 2023 10:52:01 +0800 Subject: [PATCH 2/2] Revert "ssl-opt.sh: Make record_outcome record the ssl-opt.sh file only" This reverts commit cfe68a0cb6f5ba882c6528034a161d7ff45d0ce9. As commit 5eb2b02862, this line is used to report test suite name. Signed-off-by: Jerry Yu --- tests/ssl-opt.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/ssl-opt.sh b/tests/ssl-opt.sh index 098d17261..9c317d1fc 100755 --- a/tests/ssl-opt.sh +++ b/tests/ssl-opt.sh @@ -889,7 +889,7 @@ record_outcome() { if [ -n "$MBEDTLS_TEST_OUTCOME_FILE" ]; then printf '%s;%s;%s;%s;%s;%s\n' \ "$MBEDTLS_TEST_PLATFORM" "$MBEDTLS_TEST_CONFIGURATION" \ - "ssl-opt" "$NAME" \ + "${TEST_SUITE_NAME:-ssl-opt}" "$NAME" \ "$1" "${2-}" \ >>"$MBEDTLS_TEST_OUTCOME_FILE" fi