Allow use of external test executables. Closes #89.

pull/96/head
Jussi Pakkanen 10 years ago
parent 00e07e4b3a
commit e46c1743ce
  1. 7
      backends.py
  2. 2
      interpreter.py
  3. 12
      meson_test.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)

@ -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):

@ -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:

Loading…
Cancel
Save