|
|
|
@ -2151,17 +2151,17 @@ class Interpreter(InterpreterBase, HoldableObject): |
|
|
|
|
self.generators.append(gen) |
|
|
|
|
return gen |
|
|
|
|
|
|
|
|
|
@typed_pos_args('benchmark', str, (build.Executable, build.Jar, ExternalProgram, mesonlib.File)) |
|
|
|
|
@typed_pos_args('benchmark', str, (build.Executable, build.Jar, ExternalProgram, mesonlib.File, build.CustomTarget, build.CustomTargetIndex)) |
|
|
|
|
@typed_kwargs('benchmark', *TEST_KWS) |
|
|
|
|
def func_benchmark(self, node: mparser.BaseNode, |
|
|
|
|
args: T.Tuple[str, T.Union[build.Executable, build.Jar, ExternalProgram, mesonlib.File]], |
|
|
|
|
kwargs: 'kwtypes.FuncBenchmark') -> None: |
|
|
|
|
self.add_test(node, args, kwargs, False) |
|
|
|
|
|
|
|
|
|
@typed_pos_args('test', str, (build.Executable, build.Jar, ExternalProgram, mesonlib.File)) |
|
|
|
|
@typed_pos_args('test', str, (build.Executable, build.Jar, ExternalProgram, mesonlib.File, build.CustomTarget, build.CustomTargetIndex)) |
|
|
|
|
@typed_kwargs('test', *TEST_KWS, KwargInfo('is_parallel', bool, default=True)) |
|
|
|
|
def func_test(self, node: mparser.BaseNode, |
|
|
|
|
args: T.Tuple[str, T.Union[build.Executable, build.Jar, ExternalProgram, mesonlib.File]], |
|
|
|
|
args: T.Tuple[str, T.Union[build.Executable, build.Jar, ExternalProgram, mesonlib.File, build.CustomTarget, build.CustomTargetIndex]], |
|
|
|
|
kwargs: 'kwtypes.FuncTest') -> None: |
|
|
|
|
self.add_test(node, args, kwargs, True) |
|
|
|
|
|
|
|
|
@ -2175,7 +2175,7 @@ class Interpreter(InterpreterBase, HoldableObject): |
|
|
|
|
return ENV_KW.convertor(envlist) |
|
|
|
|
|
|
|
|
|
def make_test(self, node: mparser.BaseNode, |
|
|
|
|
args: T.Tuple[str, T.Union[build.Executable, build.Jar, ExternalProgram, mesonlib.File]], |
|
|
|
|
args: T.Tuple[str, T.Union[build.Executable, build.Jar, ExternalProgram, mesonlib.File, build.CustomTarget, build.CustomTargetIndex]], |
|
|
|
|
kwargs: 'kwtypes.BaseTest') -> Test: |
|
|
|
|
name = args[0] |
|
|
|
|
if ':' in name: |
|
|
|
@ -2188,6 +2188,10 @@ class Interpreter(InterpreterBase, HoldableObject): |
|
|
|
|
raise InvalidArguments('Tried to use not-found external program as test exe') |
|
|
|
|
elif isinstance(exe, mesonlib.File): |
|
|
|
|
exe = self.find_program_impl([exe]) |
|
|
|
|
elif isinstance(exe, build.CustomTarget): |
|
|
|
|
kwargs.setdefault('depends', []).append(exe) |
|
|
|
|
elif isinstance(exe, build.CustomTargetIndex): |
|
|
|
|
kwargs.setdefault('depends', []).append(exe.target) |
|
|
|
|
|
|
|
|
|
env = self.unpack_env_kwarg(kwargs) |
|
|
|
|
|
|
|
|
@ -2218,8 +2222,11 @@ class Interpreter(InterpreterBase, HoldableObject): |
|
|
|
|
kwargs['verbose']) |
|
|
|
|
|
|
|
|
|
def add_test(self, node: mparser.BaseNode, |
|
|
|
|
args: T.Tuple[str, T.Union[build.Executable, build.Jar, ExternalProgram, mesonlib.File]], |
|
|
|
|
args: T.Tuple[str, T.Union[build.Executable, build.Jar, ExternalProgram, mesonlib.File, build.CustomTarget, build.CustomTargetIndex]], |
|
|
|
|
kwargs: T.Dict[str, T.Any], is_base_test: bool): |
|
|
|
|
if isinstance(args[1], (build.CustomTarget, build.CustomTargetIndex)): |
|
|
|
|
FeatureNew.single_use('test with CustomTarget as command', '1.4.0', self.subproject) |
|
|
|
|
|
|
|
|
|
t = self.make_test(node, args, kwargs) |
|
|
|
|
if is_base_test: |
|
|
|
|
self.build.tests.append(t) |
|
|
|
|