summaryrefslogtreecommitdiff
path: root/mesonbuild/mtest.py
diff options
context:
space:
mode:
authorXavier Claessens <xclaessens@netflix.com>2025-10-20 11:11:52 -0400
committerXavier Claessens <xclaesse@gmail.com>2025-10-23 16:53:21 +0100
commit59a46da49a9653caf589669eefef1b39c7a8bdd8 (patch)
tree728ccbab154607a26f736af505aa79cce3c51034 /mesonbuild/mtest.py
parentee17073ebb3f7a46a14cd3c6eca73af317df26cf (diff)
downloadmeson-59a46da49a9653caf589669eefef1b39c7a8bdd8.tar.gz
mtest: Fix test selection implementation
Omitting test()'s `suite` kwarg used to default to `test.suite==['']` because of how stringlistify() works. That had inconsistent behavior with `suite: []` which makes `test.suite==[]`. That changed when porting to typed_kwarg (#8855), which made the default `test.suite==[]`. Change `suite: []`, and missing kwarg, back to `test.suite==['']` which was the original intention. It has impact on `meson test --suite` selection, an empty `test.suite` list means that test is never going to be selected when `--suite` is used, even when we want all tests from a given subproject. It was also unclear what `--suite foo` means. Is `foo` a suite or a project name? It can now be either, it selects all tests from project `foo` as well as all tests from any project in suite `foo`.
Diffstat (limited to 'mesonbuild/mtest.py')
-rw-r--r--mesonbuild/mtest.py39
1 files changed, 16 insertions, 23 deletions
diff --git a/mesonbuild/mtest.py b/mesonbuild/mtest.py
index c0a22a248..337b70747 100644
--- a/mesonbuild/mtest.py
+++ b/mesonbuild/mtest.py
@@ -1939,29 +1939,22 @@ class TestHarness:
for prjst in test.suite:
(prj, st) = TestHarness.split_suite_string(prjst)
- # the SUITE can be passed as
- # suite_name
- # or
- # project_name:suite_name
- # so we need to select only the test belonging to project_name
-
- # this if handle the first case (i.e., SUITE == suite_name)
-
- # in this way we can run tests belonging to different
- # (sub)projects which share the same suite_name
- if not st_match and st == prj_match:
- return True
-
- # these two conditions are needed to handle the second option
- # i.e., SUITE == project_name:suite_name
-
- # in this way we select the only the tests of
- # project_name with suite_name
- if prj_match and prj != prj_match:
- continue
- if st_match and st != st_match:
- continue
- return True
+ # The SUITE can be passed as
+ # - `name` - We select tests belonging to (sub)project OR suite
+ # with the given name.
+ # - `:suite_name` - We select tests belonging to any (sub)projects
+ # and in suite_name.
+ # - `project_name:suite_name` - We select tests belonging
+ # to project_name and in suite_name.
+ if not st_match:
+ if prj_match in {prj, st}:
+ return True
+ elif not prj_match:
+ if st == st_match:
+ return True
+ else:
+ if prj == prj_match and st == st_match:
+ return True
return False
def test_suitable(self, test: TestSerialisation) -> bool: