diff options
-rw-r--r-- | mesonbuild/backend/backends.py | 5 | ||||
-rwxr-xr-x | run_unittests.py | 25 | ||||
-rw-r--r-- | test cases/unit/71 cross test passed/meson.build | 12 | ||||
-rw-r--r-- | test cases/unit/71 cross test passed/script.py | 7 | ||||
-rw-r--r-- | test cases/unit/71 cross test passed/src/main.c | 6 |
5 files changed, 44 insertions, 11 deletions
diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py index 9d527cb..5ef7f44 100644 --- a/mesonbuild/backend/backends.py +++ b/mesonbuild/backend/backends.py @@ -810,6 +810,11 @@ class Backend: cmd_args.append(a) elif isinstance(a, str): cmd_args.append(a) + elif isinstance(a, build.Executable): + p = self.construct_target_rel_path(a, t.workdir) + if p == a.get_filename(): + p = './' + p + cmd_args.append(p) elif isinstance(a, build.Target): cmd_args.append(self.construct_target_rel_path(a, t.workdir)) else: diff --git a/run_unittests.py b/run_unittests.py index 7467107..f8ca253 100755 --- a/run_unittests.py +++ b/run_unittests.py @@ -7560,19 +7560,28 @@ class CrossFileTests(BasePlatformTests): c = '/usr/bin/{}' ar = '/usr/bin/ar' strip = '/usr/bin/ar' + {} [properties] needs_exe_wrapper = {} - {} [host_machine] system = 'linux' cpu_family = 'x86' cpu = 'i686' endian = 'little' - """.format(cc, needs_exe_wrapper, - 'exe_wrapper = {}'.format(str(exe_wrapper)) - if exe_wrapper is not None else '')) + """.format(cc, + 'exe_wrapper = {}'.format(str(exe_wrapper)) if exe_wrapper is not None else '', + needs_exe_wrapper)) + + def _stub_exe_wrapper(self) -> str: + return textwrap.dedent('''\ + #!/usr/bin/env python3 + import subprocess + import sys + + sys.exit(subprocess.run(sys.argv[1:]).returncode) + ''') def test_needs_exe_wrapper_true(self): testdir = os.path.join(self.common_test_dir, '1 trivial') @@ -7599,13 +7608,7 @@ class CrossFileTests(BasePlatformTests): with tempfile.TemporaryDirectory() as d: s = Path(d) / 'wrapper.py' with s.open('wt') as f: - f.write(textwrap.dedent(''' - #!/usr/bin/env python3 - import subprocess - import sys - - return subprocess.run(sys.argv[1:]).returnncode - ''')) + f.write(self._stub_exe_wrapper()) p = Path(d) / 'crossfile' with p.open('wt') as f: f.write(self._cross_file_generator( diff --git a/test cases/unit/71 cross test passed/meson.build b/test cases/unit/71 cross test passed/meson.build new file mode 100644 index 0000000..cb3bb6d --- /dev/null +++ b/test cases/unit/71 cross test passed/meson.build @@ -0,0 +1,12 @@ +project( + 'cross test passed', + 'c', + version : '>= 0.51' +) + +e = executable('exec', 'src/main.c') + +py = import('python').find_installation() + +test('root', e) +test('main', py, args : [meson.current_source_dir() / 'script.py', e]) diff --git a/test cases/unit/71 cross test passed/script.py b/test cases/unit/71 cross test passed/script.py new file mode 100644 index 0000000..257cd30 --- /dev/null +++ b/test cases/unit/71 cross test passed/script.py @@ -0,0 +1,7 @@ +#!/usr/bin/env python3 + +import subprocess +import sys + +if __name__ == "__main__": + sys.exit(subprocess.run(sys.argv[1:]).returncode) diff --git a/test cases/unit/71 cross test passed/src/main.c b/test cases/unit/71 cross test passed/src/main.c new file mode 100644 index 0000000..490b4a6 --- /dev/null +++ b/test cases/unit/71 cross test passed/src/main.c @@ -0,0 +1,6 @@ +#include <stdio.h> + +int main(int argc, char const *argv[]) +{ + return 0; +} |