diff options
author | Aleksey Filippov <alekseyf@google.com> | 2018-03-25 01:20:19 +0000 |
---|---|---|
committer | Aleksey Filippov <alekseyf@google.com> | 2018-03-25 01:33:33 +0000 |
commit | c18ceac040df356fe58b045fe9d9ebbe07270bb8 (patch) | |
tree | 7664c712ca22c5d75c654095bb92812e523ebbf0 | |
parent | 642df0505adaa0ba3f4b964665887278df099629 (diff) | |
download | meson-c18ceac040df356fe58b045fe9d9ebbe07270bb8.zip meson-c18ceac040df356fe58b045fe9d9ebbe07270bb8.tar.gz meson-c18ceac040df356fe58b045fe9d9ebbe07270bb8.tar.bz2 |
Add depends keyword to test() function
-rw-r--r-- | mesonbuild/backend/backends.py | 3 | ||||
-rw-r--r-- | mesonbuild/interpreter.py | 13 |
2 files changed, 13 insertions, 3 deletions
diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py index ad45204..e0663b6 100644 --- a/mesonbuild/backend/backends.py +++ b/mesonbuild/backend/backends.py @@ -709,6 +709,9 @@ class Backend: if not isinstance(arg, (build.CustomTarget, build.BuildTarget)): continue result[arg.get_id()] = arg + for dep in t.depends: + assert isinstance(dep, (build.CustomTarget, build.BuildTarget)) + result[dep.get_id()] = dep return result def get_custom_target_provided_libraries(self, target): diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py index 13cfb2e..1b680df 100644 --- a/mesonbuild/interpreter.py +++ b/mesonbuild/interpreter.py @@ -653,12 +653,14 @@ class RunTargetHolder(InterpreterObject, ObjectHolder): return r.format(self.__class__.__name__, h.get_id(), h.command) class Test(InterpreterObject): - def __init__(self, name, project, suite, exe, is_parallel, cmd_args, env, should_fail, timeout, workdir): + def __init__(self, name, project, suite, exe, depends, is_parallel, + cmd_args, env, should_fail, timeout, workdir): InterpreterObject.__init__(self) self.name = name self.suite = suite self.project_name = project self.exe = exe + self.depends = depends self.is_parallel = is_parallel self.cmd_args = cmd_args self.env = env @@ -1512,7 +1514,7 @@ permitted_kwargs = {'add_global_arguments': {'language'}, 'static_library': stlib_kwargs, 'subdir': {'if_found'}, 'subproject': {'version', 'default_options'}, - 'test': {'args', 'env', 'is_parallel', 'should_fail', 'timeout', 'workdir', 'suite'}, + 'test': {'args', 'depends', 'env', 'is_parallel', 'should_fail', 'timeout', 'workdir', 'suite'}, 'vcs_tag': {'input', 'output', 'fallback', 'command', 'replace_string'}, } @@ -2721,7 +2723,12 @@ root and issuing %s. if len(s) > 0: s = ':' + s suite.append(prj.replace(' ', '_').replace(':', '_') + s) - t = Test(args[0], prj, suite, exe.held_object, par, cmd_args, env, should_fail, timeout, workdir) + depends = extract_as_list(kwargs, 'depends', unholder=True) + for dep in depends: + if not isinstance(dep, (build.CustomTarget, build.BuildTarget)): + raise InterpreterException('Depends items must be build targets.') + t = Test(args[0], prj, suite, exe.held_object, depends, par, cmd_args, + env, should_fail, timeout, workdir) if is_base_test: self.build.tests.append(t) mlog.debug('Adding test "', mlog.bold(args[0]), '".', sep='') |