mtest: support --exclude

Support `--exclude name` where `name` is a full test name, optionally
including the subproject name. Wildcards are not currently supported.

Accept both `name` for the main project and `subproject:name`. We want `name`
for convenience so users don't have to write out their project name when
no subprojects are involved.

Extended matching could be added in future, but the primary usecase for
this is where distributions want to skip known-buggy or irrelevant tests,
rather than developers working on their own project.

The test changes are a bit noisy because needed to add a test with
the same name in the main project and a subproject to check that --exclude
w/ an unqualified name only affected the main parent, but adding 2 new failing
tests required all the numbers to be adjusted.

Closes: https://github.com/mesonbuild/meson/pull/11502
Closes: https://github.com/mesonbuild/meson/issues/6999
Signed-off-by: Sam James <sam@gentoo.org>
This commit is contained in:
Sam James
2026-04-24 01:57:09 +01:00
parent dd2c4203e9
commit 16a7472802
7 changed files with 83 additions and 25 deletions

View File

@@ -216,6 +216,32 @@ into `n` slices and execute the `ith` such slice. This allows you to distribute
a set of long-running tests across multiple machines to decrease the overall
runtime of tests.
Since version *1.12.0*, you can pass `--exclude NAME` to skip processing
of named tests:
```console
$ meson test --list
m:basic
m:buggy
$ meson test
...
1/2 m:basic OK 0.01s
2/2 m:buggy FAIL 0.00s ...
Ok: 1
Fail: 1
$ meson test --exclude buggy
...
1/1 m:basic OK 0.00s
Ok: 1
Fail: 0
```
For unqualified names (no subproject specified), `--exclude NAME` matches
the main project.
### Other test options
Sometimes you need to run the tests multiple times, which is done like this:

View File

@@ -0,0 +1,6 @@
## `meson test` now accepts `--exclude`
`meson test` has a new `--exclude` argument to allow skipping named
tests. It takes a full test name and can be specified repeatedly. This
should help distributions that need to skip tests irrelevant for them
or known to be buggy.