diff options
-rw-r--r-- | backends.py | 7 | ||||
-rw-r--r-- | interpreter.py | 2 | ||||
-rw-r--r-- | test cases/common/48 test args/meson.build | 1 | ||||
-rwxr-xr-x | test cases/common/48 test args/tester.py | 6 | ||||
-rw-r--r-- | test cases/common/48 test args/testfile.txt | 1 |
5 files changed, 15 insertions, 2 deletions
diff --git a/backends.py b/backends.py index 760bc52..05e4429 100644 --- a/backends.py +++ b/backends.py @@ -267,8 +267,13 @@ class Backend(): extra_paths = self.determine_windows_extra_paths(exe) else: extra_paths = [] + cmd_args = [] + for a in t.cmd_args: + if isinstance(a, mesonlib.File): + a = os.path.join(self.environment.get_build_dir(), a.rel_to_builddir(self.build_to_src)) + cmd_args.append(a) ts = TestSerialisation(t.get_name(), fname, is_cross, exe_wrapper, - t.is_parallel, t.cmd_args, t.env, t.should_fail, t.valgrind_args, + t.is_parallel, cmd_args, t.env, t.should_fail, t.valgrind_args, t.timeout, extra_paths) arr.append(ts) pickle.dump(arr, datafile) diff --git a/interpreter.py b/interpreter.py index 76964a6..bc2f6f3 100644 --- a/interpreter.py +++ b/interpreter.py @@ -1467,7 +1467,7 @@ class Interpreter(): if not isinstance(cmd_args, list): cmd_args = [cmd_args] for i in cmd_args: - if not isinstance(i, str): + if not isinstance(i, (str, mesonlib.File)): raise InterpreterException('Command line arguments must be strings') envlist = kwargs.get('env', []) if not isinstance(envlist, list): diff --git a/test cases/common/48 test args/meson.build b/test cases/common/48 test args/meson.build index 1243c21..f81450c 100644 --- a/test cases/common/48 test args/meson.build +++ b/test cases/common/48 test args/meson.build @@ -5,3 +5,4 @@ e2 = executable('envvars', 'envvars.c') test('command line arguments', e1, args : ['first', 'second']) test('environment variables', e2, env : ['first=val1', 'second=val2']) +test('file arg', find_program('tester.py'), args : files('testfile.txt')) diff --git a/test cases/common/48 test args/tester.py b/test cases/common/48 test args/tester.py new file mode 100755 index 0000000..36e510d --- /dev/null +++ b/test cases/common/48 test args/tester.py @@ -0,0 +1,6 @@ +#!/usr/bin/env python3 + +import sys + +if open(sys.argv[1]).read() != 'contents\n': + sys.exit(1) diff --git a/test cases/common/48 test args/testfile.txt b/test cases/common/48 test args/testfile.txt new file mode 100644 index 0000000..12f00e9 --- /dev/null +++ b/test cases/common/48 test args/testfile.txt @@ -0,0 +1 @@ +contents |