aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/interpreter.py
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2020-10-21 16:01:00 -0700
committerDylan Baker <dylan@pnwbakers.com>2021-01-05 10:23:57 -0800
commitb2c2549b93a8001d8a6d9d6da1ce756645e59160 (patch)
treea24ff1d43f538d9fde23c03786a93615d7677a0a /mesonbuild/interpreter.py
parent8d19beccb23819719b15ec4ff0c643b3486ac899 (diff)
downloadmeson-b2c2549b93a8001d8a6d9d6da1ce756645e59160.zip
meson-b2c2549b93a8001d8a6d9d6da1ce756645e59160.tar.gz
meson-b2c2549b93a8001d8a6d9d6da1ce756645e59160.tar.bz2
interpreter: split code that creates a Test instance
For modules to make use of, as they're not allowed to modify the Build instance directly.
Diffstat (limited to 'mesonbuild/interpreter.py')
-rw-r--r--mesonbuild/interpreter.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py
index 7b8a7f8..6e04235 100644
--- a/mesonbuild/interpreter.py
+++ b/mesonbuild/interpreter.py
@@ -4122,7 +4122,7 @@ This will become a hard error in the future.''' % kwargs['input'], location=self
env = env.held_object
return env
- def add_test(self, node, args, kwargs, is_base_test):
+ def make_test(self, node: mparser.BaseNode, args: T.List, kwargs: T.Dict[str, T.Any]):
if len(args) != 2:
raise InterpreterException('test expects 2 arguments, {} given'.format(len(args)))
name = args[0]
@@ -4176,14 +4176,17 @@ 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(name, prj, suite, exe.held_object, depends, par, cmd_args,
- env, should_fail, timeout, workdir, protocol, priority)
+ return Test(name, prj, suite, exe.held_object, depends, par, cmd_args,
+ env, should_fail, timeout, workdir, protocol, priority)
+
+ def add_test(self, node: mparser.BaseNode, args: T.List, kwargs: T.Dict[str, T.Any], is_base_test: bool):
+ t = self.make_test(node, args, kwargs)
if is_base_test:
self.build.tests.append(t)
- mlog.debug('Adding test', mlog.bold(name, True))
+ mlog.debug('Adding test', mlog.bold(t.name, True))
else:
self.build.benchmarks.append(t)
- mlog.debug('Adding benchmark', mlog.bold(name, True))
+ mlog.debug('Adding benchmark', mlog.bold(t.name, True))
@FeatureNewKwargs('install_headers', '0.47.0', ['install_mode'])
@permittedKwargs(permitted_kwargs['install_headers'])