Skip to content

Commit 227d14d

Browse files
committed
tests: add support for 'optionsfile.ini'
Meson does not use options passed via native-file when cross-building, resulting in tests failing/98 and failing/99 suceeding when cross building, even tho they shouldn't. This patch introduces the concept of an optionsfile to the testsuite, which will, depending on the build configuration, be passed as cross or native file.
1 parent 3717010 commit 227d14d

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

run_project_tests.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -605,17 +605,21 @@ def format_parameter_file(file_basename: str, test: TestDef, test_build_dir: str
605605

606606
return destination
607607

608-
def detect_parameter_files(test: TestDef, test_build_dir: str) -> T.Tuple[Path, Path]:
608+
def detect_parameter_files(test: TestDef, test_build_dir: str) -> T.Tuple[Path, Path, Path]:
609609
nativefile = test.path / 'nativefile.ini'
610610
crossfile = test.path / 'crossfile.ini'
611+
optionsfile = test.path / 'optionsfile.ini'
611612

612613
if os.path.exists(str(test.path / 'nativefile.ini.in')):
613614
nativefile = format_parameter_file('nativefile.ini', test, test_build_dir)
614615

615616
if os.path.exists(str(test.path / 'crossfile.ini.in')):
616617
crossfile = format_parameter_file('crossfile.ini', test, test_build_dir)
617618

618-
return nativefile, crossfile
619+
if os.path.exists(str(test.path / 'optionsfile.ini.in')):
620+
optionsfile = format_parameter_file('optionsfile.ini', test, test_build_dir)
621+
622+
return nativefile, crossfile, optionsfile
619623

620624
# In previous python versions the global variables are lost in ProcessPoolExecutor.
621625
# So, we use this tuple to restore some of them
@@ -671,12 +675,14 @@ def _run_test(test: TestDef,
671675
gen_args += ['--libdir', 'lib']
672676
gen_args += [test.path.as_posix(), test_build_dir] + backend_flags + extra_args
673677

674-
nativefile, crossfile = detect_parameter_files(test, test_build_dir)
678+
nativefile, crossfile, optionsfile = detect_parameter_files(test, test_build_dir)
675679

676680
if nativefile.exists():
677681
gen_args.extend(['--native-file', nativefile.as_posix()])
678682
if crossfile.exists():
679683
gen_args.extend(['--cross-file', crossfile.as_posix()])
684+
if optionsfile.exists():
685+
gen_args.extend(['--cross-file' if '--cross-file' in extra_args else '--native-file', optionsfile.as_posix()])
680686
inprocess, res = run_configure(gen_args, env=test.env, catch_exception=True)
681687
returncode, stdo, stde = res
682688
cmd = '(inprocess) $ ' if inprocess else '$ '

0 commit comments

Comments
 (0)