CTest: Make ctest_test() label filters multi-value (AND)

The ctest(1) command line allows repeating -L/-LE to form an AND
filter over test labels, but the ctest_test() and ctest_memcheck()
scripting commands accepted only a single INCLUDE_LABEL/EXCLUDE_LABEL
value, so a dashboard script could not express that filter.

The label-matching engine already stores the include/exclude
expressions as vectors and applies them with AND semantics; only the
command binding was single-value.  Change both keywords to multi-value
(NonEmpty<vector<string>>) and hand the collected list straight to the
engine.  ctest_memcheck() gains the same behavior for free, since it
inherits the option set.

Fixes : #27497
This commit is contained in:
Daksh Mamodiya
2026-07-24 21:22:02 +02:00
parent 3eda12235e
commit 257865e1d4
19 changed files with 160 additions and 13 deletions

View File

@@ -11,8 +11,8 @@ Perform the :ref:`CTest MemCheck Step` as a :ref:`Dashboard Client`.
[STRIDE <stride-number>]
[EXCLUDE <exclude-regex>]
[INCLUDE <include-regex>]
[EXCLUDE_LABEL <label-exclude-regex>]
[INCLUDE_LABEL <label-include-regex>]
[EXCLUDE_LABEL <label-exclude-regex>...]
[INCLUDE_LABEL <label-include-regex>...]
[EXCLUDE_FIXTURE <regex>]
[EXCLUDE_FIXTURE_SETUP <regex>]
[EXCLUDE_FIXTURE_CLEANUP <regex>]

View File

@@ -11,8 +11,8 @@ Perform the :ref:`CTest Test Step` as a :ref:`Dashboard Client`.
[STRIDE <stride-number>]
[EXCLUDE <exclude-regex>]
[INCLUDE <include-regex>]
[EXCLUDE_LABEL <label-exclude-regex>]
[INCLUDE_LABEL <label-include-regex>]
[EXCLUDE_LABEL <label-exclude-regex>...]
[INCLUDE_LABEL <label-include-regex>...]
[EXCLUDE_FROM_FILE <filename>]
[INCLUDE_FROM_FILE <filename>]
[EXCLUDE_FIXTURE <regex>]
@@ -69,13 +69,31 @@ The options are:
Specify a regular expression matching test names to include.
Tests not matching this expression are excluded.
``EXCLUDE_LABEL <label-exclude-regex>``
``EXCLUDE_LABEL <label-exclude-regex>...``
Specify a regular expression matching test labels to exclude.
``INCLUDE_LABEL <label-include-regex>``
.. versionchanged:: 4.5
More than one ``<label-exclude-regex>`` may be given, in which case a
test is excluded only if each regular expression matches at least one
of the test's labels (i.e. the expressions form an ``AND`` relationship).
See the :ref:`Label Matching` section of the :manual:`ctest(1)` manual.
This mirrors the behavior of repeating the
:option:`ctest --label-exclude` command-line option.
``INCLUDE_LABEL <label-include-regex>...``
Specify a regular expression matching test labels to include.
Tests not matching this expression are excluded.
.. versionchanged:: 4.5
More than one ``<label-include-regex>`` may be given, in which case a
test is included only if each regular expression matches at least one
of the test's labels (i.e. the expressions form an ``AND`` relationship).
See the :ref:`Label Matching` section of the :manual:`ctest(1)` manual.
This mirrors the behavior of repeating the
:option:`ctest --label-regex` command-line option.
``EXCLUDE_FROM_FILE <filename>``
.. versionadded:: 3.29