From e46c1743ce2b0dbf722acac5412d95c64888b33b Mon Sep 17 00:00:00 2001 From: Jussi Pakkanen Date: Fri, 27 Mar 2015 19:09:26 +0200 Subject: [PATCH] Allow use of external test executables. Closes #89. --- backends.py | 7 ++++++- interpreter.py | 2 +- meson_test.py | 12 ++++++------ 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/backends.py b/backends.py index cb594531e..47df757e0 100644 --- a/backends.py +++ b/backends.py @@ -15,6 +15,7 @@ import mparser import os, re, pickle import build +import dependencies from coredata import MesonException def do_replacement(regex, line, confdata): @@ -309,7 +310,11 @@ class Backend(): def write_test_file(self, datafile): arr = [] for t in self.build.get_tests(): - fname = os.path.join(self.environment.get_build_dir(), self.get_target_filename(t.get_exe())) + exe = t.get_exe() + if isinstance(exe, dependencies.ExternalProgram): + fname = exe.fullpath + else: + fname = [os.path.join(self.environment.get_build_dir(), self.get_target_filename(t.get_exe()))] is_cross = self.environment.is_cross_build() if is_cross: exe_wrapper = self.environment.cross_info.get('exe_wrapper', None) diff --git a/interpreter.py b/interpreter.py index 48e1e3cb5..319aeaded 100644 --- a/interpreter.py +++ b/interpreter.py @@ -1281,7 +1281,7 @@ class Interpreter(): raise InterpreterException('Incorrect number of arguments') if not isinstance(args[0], str): raise InterpreterException('First argument of test must be a string.') - if not isinstance(args[1], ExecutableHolder) and not isinstance(args[1], JarHolder): + if not isinstance(args[1], (ExecutableHolder, JarHolder, ExternalProgramHolder)): raise InterpreterException('Second argument must be executable.') par = kwargs.get('is_parallel', True) if not isinstance(par, bool): diff --git a/meson_test.py b/meson_test.py index 51a7db6c6..65f9899fe 100755 --- a/meson_test.py +++ b/meson_test.py @@ -65,10 +65,10 @@ def run_with_mono(fname): def run_single_test(wrap, test): global tests_failed - if test.fname.endswith('.jar'): - cmd = ['java', '-jar', test.fname] - elif run_with_mono(test.fname): - cmd = ['mono', test.fname] + if test.fname[0].endswith('.jar'): + cmd = ['java', '-jar'] + test.fname + elif run_with_mono(test.fname[0]): + cmd = ['mono'] + test.fname else: if test.is_cross: if test.exe_runner is None: @@ -76,9 +76,9 @@ def run_single_test(wrap, test): # because there is no execute wrapper. cmd = None else: - cmd = [test.exe_runner, test.fname] + cmd = [test.exe_runner] + test.fname else: - cmd = [test.fname] + cmd = test.fname if len(wrap) > 0 and 'valgrind' in wrap[0]: wrap += test.valgrind_args if cmd is None: