Skip to content

Commit af41c6d

Browse files
Harrison-Boothhackorum
authored andcommitted
meson: Honor executable wrappers for regression tests
Meson only sets MESON_EXE_WRAPPER for tests it recognizes as cross-built. Regression tests invoke their host runner through the native Python testwrap script, but passing runner.full_path() as a string hides the cross-built executable from Meson. Pass the executable target to test(), resolve Meson's build-relative argument before testwrap changes directories, and invoke the runner through MESON_EXE_WRAPPER when it is set.
1 parent b597835 commit af41c6d

2 files changed

Lines changed: 15 additions & 2 deletions

File tree

meson.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3985,7 +3985,7 @@ foreach test_dir : tests
39853985
fallback_dbname.format(test_dir['name']))
39863986

39873987
test_command_base = [
3988-
runner.full_path(),
3988+
runner,
39893989
'--inputdir', t.get('inputdir', test_dir['sd']),
39903990
'--expecteddir', t.get('expecteddir', test_dir['sd']),
39913991
'--bindir', '',

src/tools/testwrap

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/usr/bin/env python3
22

33
import argparse
4+
import shlex
45
import shutil
56
import subprocess
67
import os
@@ -20,6 +21,9 @@ parser.add_argument('test_command', nargs='*')
2021

2122
args = parser.parse_args()
2223

24+
if args.test_command and not os.path.isabs(args.test_command[0]):
25+
args.test_command[0] = os.path.join(args.basedir, args.test_command[0])
26+
2327
testdir = '{}/testrun/{}/{}'.format(
2428
args.basedir, args.testgroup, args.testname)
2529

@@ -61,7 +65,16 @@ else:
6165
if args.tests:
6266
args.test_command.extend(args.tests)
6367

64-
sp = subprocess.Popen(args.test_command, env=env_dict, stdout=subprocess.PIPE)
68+
test_command = args.test_command
69+
exe_wrapper = env_dict.get('MESON_EXE_WRAPPER')
70+
if exe_wrapper:
71+
if os.name == 'nt':
72+
test_command = '{} {}'.format(
73+
exe_wrapper, subprocess.list2cmdline(test_command))
74+
else:
75+
test_command = shlex.split(exe_wrapper) + test_command
76+
77+
sp = subprocess.Popen(test_command, env=env_dict, stdout=subprocess.PIPE)
6578
# Meson categorizes a passing TODO test point as bad
6679
# (https://github.com/mesonbuild/meson/issues/13183). Remove the TODO
6780
# directive, so Meson computes the file result like Perl does. This could

0 commit comments

Comments
 (0)