aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/interpreter.py
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2020-08-13 21:35:31 +0530
committerJussi Pakkanen <jpakkane@gmail.com>2020-10-13 19:01:15 +0300
commit55cf399ff8b9c15300f26dd1a46045dda7d49f98 (patch)
treef0091f06afbd07c800306ea2a1237897e3e6f897 /mesonbuild/interpreter.py
parentdccff1f2bcf6e7b8e42fa7bea63b8532ad29b43a (diff)
downloadmeson-55cf399ff8b9c15300f26dd1a46045dda7d49f98.zip
meson-55cf399ff8b9c15300f26dd1a46045dda7d49f98.tar.gz
meson-55cf399ff8b9c15300f26dd1a46045dda7d49f98.tar.bz2
mtest: Allow filtering tests by subproject
You could always specify a list of tests to run by passing the names as arguments to `meson test`. If there were multiple tests with that name (in the same project or different subprojects), all of them would be run. Now you can: 1. Run all tests with the specified name from a specific subproject: `meson test subprojname:testname` 1. Run all tests defined in a specific subproject: `meson test subprojectname:` Also forbid ':' in test names. We already forbid this elsewhere, so should not be a big deal.
Diffstat (limited to 'mesonbuild/interpreter.py')
-rw-r--r--mesonbuild/interpreter.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py
index ca1411e..be19af3 100644
--- a/mesonbuild/interpreter.py
+++ b/mesonbuild/interpreter.py
@@ -4074,8 +4074,13 @@ This will become a hard error in the future.''' % kwargs['input'], location=self
def add_test(self, node, args, kwargs, is_base_test):
if len(args) != 2:
raise InterpreterException('test expects 2 arguments, {} given'.format(len(args)))
- if not isinstance(args[0], str):
+ name = args[0]
+ if not isinstance(name, str):
raise InterpreterException('First argument of test must be a string.')
+ if ':' in name:
+ mlog.deprecation('":" is not allowed in test name "{}", it has been replaced with "_"'.format(name),
+ location=node)
+ name = name.replace(':', '_')
exe = args[1]
if not isinstance(exe, (ExecutableHolder, JarHolder, ExternalProgramHolder)):
if isinstance(exe, mesonlib.File):
@@ -4120,14 +4125,14 @@ This will become a hard error in the future.''' % kwargs['input'], location=self
priority = kwargs.get('priority', 0)
if not isinstance(priority, int):
raise InterpreterException('Keyword argument priority must be an integer.')
- t = Test(args[0], prj, suite, exe.held_object, depends, par, cmd_args,
+ t = Test(name, prj, suite, exe.held_object, depends, par, cmd_args,
env, should_fail, timeout, workdir, protocol, priority)
if is_base_test:
self.build.tests.append(t)
- mlog.debug('Adding test', mlog.bold(args[0], True))
+ mlog.debug('Adding test', mlog.bold(name, True))
else:
self.build.benchmarks.append(t)
- mlog.debug('Adding benchmark', mlog.bold(args[0], True))
+ mlog.debug('Adding benchmark', mlog.bold(name, True))
@FeatureNewKwargs('install_headers', '0.47.0', ['install_mode'])
@permittedKwargs(permitted_kwargs['install_headers'])