From: Aquila Macedo Date: Fri, 7 Mar 2025 21:40:34 +0000 (-0300) Subject: runtests: add feature-based filtering X-Git-Tag: curl-8_13_0~117 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=912efa2d1c33531561f044af72e4451e08682883;p=thirdparty%2Fcurl.git runtests: add feature-based filtering This commit introduces support for features in the test selection process by adding them to the keywords list with the `feat:` prefix. It allows users to specify features to run only tests with them, or exclude tests using `!feat:`, similar to how keywords are handled. Fixes #16533 Closes #16619 Signed-off-by: Aquila Macedo --- diff --git a/tests/runtests.md b/tests/runtests.md index 01b9182638..ef6b012eba 100644 --- a/tests/runtests.md +++ b/tests/runtests.md @@ -40,6 +40,11 @@ Prefix a test number with a tilde (~) to still run it, but ignore the results. It is also possible to specify tests based on a keyword describing the test(s) to run, like `FTPS`. The keywords are strings used in the individual tests. +Features are included as keywords with the `feat:` prefix (e.g., `feat:debug`). +Specify a feature to run only tests requiring it, or exclude tests using +`!feat:`, like `!feat:proxy`, to disable tests which depend on that +feature. + You can also specify keywords with a leading exclamation point and the keyword or phrase, like "!HTTP NTLM auth" to run all tests **except** those using this keyword. Remember that the exclamation marks and spaces need to be quoted diff --git a/tests/runtests.pl b/tests/runtests.pl index f3916738d9..e23f809eff 100755 --- a/tests/runtests.pl +++ b/tests/runtests.pl @@ -1143,24 +1143,39 @@ sub singletest_shouldrun { if(!$info_keywords[0]) { $why = "missing the section!"; } + # Only evaluate keywords if the section is present. + else { + # Prefix features with "feat:" and add to keywords list. + push @info_keywords, map { "feat:" . lc($_) } getpart("client", "features"); - my $match; - for my $k (@info_keywords) { - chomp $k; - if ($disabled_keywords{lc($k)}) { - $why = "disabled by keyword"; - } - elsif ($enabled_keywords{lc($k)}) { - $match = 1; - } - if ($ignored_keywords{lc($k)}) { - logmsg "Warning: test$testnum result is ignored due to $k\n"; - $errorreturncode = 2; + my $match; + for my $k (@info_keywords) { + chomp $k; + if ($disabled_keywords{lc($k)}) { + if ($k =~ /^feat:/) { + $why = "disabled by feature"; + } + else { + $why = "disabled by keyword"; + } + } + elsif ($enabled_keywords{lc($k)}) { + $match = 1; + } + if ($ignored_keywords{lc($k)}) { + logmsg "Warning: test$testnum result is ignored due to $k\n"; + $errorreturncode = 2; + } } - } - if(!$why && !$match && %enabled_keywords) { - $why = "disabled by missing keyword"; + if(!$why && !$match && %enabled_keywords) { + if (grep { /^feat:/ } keys %enabled_keywords) { + $why = "disabled by missing feature"; + } + else { + $why = "disabled by missing keyword"; + } + } } }