Add depends keyword to test() function

pull/3314/head
Aleksey Filippov 7 years ago
parent 642df0505a
commit c18ceac040
  1. 3
      mesonbuild/backend/backends.py
  2. 13
      mesonbuild/interpreter.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):

@ -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='')

Loading…
Cancel
Save