aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/markdown/Unit-tests.md35
-rw-r--r--mesonbuild/mtest.py6
2 files changed, 36 insertions, 5 deletions
diff --git a/docs/markdown/Unit-tests.md b/docs/markdown/Unit-tests.md
index 694c190..3c27732 100644
--- a/docs/markdown/Unit-tests.md
+++ b/docs/markdown/Unit-tests.md
@@ -71,10 +71,23 @@ The simplest thing to do is just to run all tests, which is equivalent to runnin
$ meson test
```
-You can also run only a single test by giving its name:
+### Run subsets of tests
+
+For clarity, consider the meson.build containing:
+
+```meson
+
+test('A', ..., suite: 'foo')
+test('B', ..., suite: 'foo')
+test('C', ..., suite: 'bar')
+test('D', ..., suite: 'baz')
+
+```
+
+Specify test(s) by name like:
```console
-$ meson test testname
+$ meson test A D
```
Tests belonging to a suite `suite` can be run as follows
@@ -85,6 +98,18 @@ $ meson test --suite (sub)project_name:suite
Since version *0.46*, `(sub)project_name` can be omitted if it is the top-level project.
+Multiple suites are specified like:
+
+```console
+$ meson test --suite foo --suite bar
+```
+
+NOTE: If you choose to specify both suite(s) and specific test name(s), the
+test name(s) must be contained in the suite(s). This however is redundant--
+it would be more useful to specify either specific test names or suite(s).
+
+### Other test options
+
Sometimes you need to run the tests multiple times, which is done like this:
```console
@@ -127,4 +152,8 @@ Meson will report the output produced by the failing tests along with other usef
For further information see the command line help of Meson by running `meson test -h`.
-**NOTE:** If `meson test` does not work for you, you likely have a old version of Meson. In that case you should call `mesontest` instead. If `mesontest` doesn't work either you have a very old version prior to 0.37.0 and should upgrade.
+## Legacy notes
+
+If `meson test` does not work for you, you likely have a old version of Meson.
+In that case you should call `mesontest` instead. If `mesontest` doesn't work
+either you have a very old version prior to 0.37.0 and should upgrade.
diff --git a/mesonbuild/mtest.py b/mesonbuild/mtest.py
index 1d194c2..dc5c9d1 100644
--- a/mesonbuild/mtest.py
+++ b/mesonbuild/mtest.py
@@ -834,8 +834,9 @@ Timeout: %4d
return False
def test_suitable(self, test: 'TestSerialisation') -> bool:
- return (not self.options.include_suites or TestHarness.test_in_suites(test, self.options.include_suites)) \
- and not TestHarness.test_in_suites(test, self.options.exclude_suites)
+ return ((not self.options.include_suites or
+ TestHarness.test_in_suites(test, self.options.include_suites)) and not
+ TestHarness.test_in_suites(test, self.options.exclude_suites))
def get_tests(self) -> typing.List['TestSerialisation']:
if not self.tests:
@@ -850,6 +851,7 @@ Timeout: %4d
else:
tests = self.tests
+ # allow specifying test names like "meson test foo1 foo2", where test('foo1', ...)
if self.options.args:
tests = [t for t in tests if t.name in self.options.args]