aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mesonbuild/interpreter.py10
-rw-r--r--test cases/common/157 configure file in test/meson.build9
-rwxr-xr-xtest cases/common/157 configure file in test/test.py.in4
3 files changed, 20 insertions, 3 deletions
diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py
index 94fb649..f88c265 100644
--- a/mesonbuild/interpreter.py
+++ b/mesonbuild/interpreter.py
@@ -2297,8 +2297,12 @@ class Interpreter(InterpreterBase):
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, JarHolder, ExternalProgramHolder)):
- raise InterpreterException('Second argument must be executable.')
+ exe = args[1]
+ if not isinstance(exe, (ExecutableHolder, JarHolder, ExternalProgramHolder)):
+ if isinstance(exe, mesonlib.File):
+ exe = self.func_find_program(node, (args[1], ), {})
+ else:
+ raise InterpreterException('Second argument must be executable.')
par = kwargs.get('is_parallel', True)
if not isinstance(par, bool):
raise InterpreterException('Keyword argument is_parallel must be a boolean.')
@@ -2332,7 +2336,7 @@ class Interpreter(InterpreterBase):
suite.append(self.subproject.replace(' ', '_').replace(':', '_') + s)
else:
suite.append(self.build.project_name.replace(' ', '_').replace(':', '_') + s)
- t = Test(args[0], suite, args[1].held_object, par, cmd_args, env, should_fail, timeout, workdir)
+ t = Test(args[0], suite, exe.held_object, 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='')
diff --git a/test cases/common/157 configure file in test/meson.build b/test cases/common/157 configure file in test/meson.build
new file mode 100644
index 0000000..9028101
--- /dev/null
+++ b/test cases/common/157 configure file in test/meson.build
@@ -0,0 +1,9 @@
+project('conf file in test')
+
+test_file = configure_file(
+ input: 'test.py.in',
+ output: 'test.py',
+ configuration: configuration_data()
+)
+
+test('configure-file', test_file)
diff --git a/test cases/common/157 configure file in test/test.py.in b/test cases/common/157 configure file in test/test.py.in
new file mode 100755
index 0000000..15a61f5
--- /dev/null
+++ b/test cases/common/157 configure file in test/test.py.in
@@ -0,0 +1,4 @@
+#!/usr/bin/env python3
+
+import sys
+sys.exit(0)