3939from mesonbuild import mtest
4040from mesonbuild .compilers import compiler_from_language
4141from mesonbuild .build import ConfigurationData
42+ from mesonbuild .envconfig import MachineInfo , detect_machine_info
43+ from mesonbuild .machinefile import parse_machine_files
4244from mesonbuild .mesonlib import MachineChoice , Popen_safe , TemporaryDirectoryWinProof , setup_vsenv
4345from mesonbuild .mlog import blue , bold , cyan , green , red , yellow , normal_green
4446from mesonbuild .coredata import version as meson_version
@@ -1079,7 +1081,7 @@ def should_skip_wayland() -> bool:
10791081 return True
10801082 return False
10811083
1082- def detect_tests_to_run (only : T .Dict [str , T .List [str ]], use_tmp : bool ) -> T .List [T .Tuple [str , T .List [TestDef ], bool ]]:
1084+ def detect_tests_to_run (only : T .Dict [str , T .List [str ]], use_tmp : bool , host_machine : MachineInfo ) -> T .List [T .Tuple [str , T .List [TestDef ], bool ]]:
10831085 """
10841086 Parameters
10851087 ----------
@@ -1123,8 +1125,7 @@ def __init__(self, category: str, subdir: str, skip: bool = False, stdout_mandat
11231125 TestCategory ('platform-osx' , 'osx' , not mesonlib .is_osx ()),
11241126 TestCategory ('platform-windows' , 'windows' , not mesonlib .is_windows () and not mesonlib .is_cygwin ()),
11251127 TestCategory ('platform-linux' , 'linuxlike' , mesonlib .is_osx () or mesonlib .is_windows ()),
1126- # FIXME, does not actually run in CI, change to run the test if an Android cross toolchain is detected.
1127- TestCategory ('platform-android' , 'android' , not mesonlib .is_android ()),
1128+ TestCategory ('platform-android' , 'android' , not host_machine .is_android ()),
11281129 TestCategory ('java' , 'java' , backend is not Backend .ninja or not have_java ()),
11291130 TestCategory ('C#' , 'csharp' , skip_csharp (backend )),
11301131 TestCategory ('vala' , 'vala' , backend is not Backend .ninja or not shutil .which (os .environ .get ('VALAC' , 'valac' ))),
@@ -1689,6 +1690,13 @@ def setup_symlinks() -> None:
16891690 script_dir = os .path .split (__file__ )[0 ]
16901691 if script_dir != '' :
16911692 os .chdir (script_dir )
1693+
1694+ if options .cross_file is not None :
1695+ config = parse_machine_files ([options .cross_file ], script_dir )
1696+ host_machine = MachineInfo .from_literal (config ['host_machine' ]) if 'host_machine' in config else detect_machine_info ()
1697+ else :
1698+ host_machine = detect_machine_info ()
1699+
16921700 check_meson_commands_work (options .use_tmpdir , options .extra_args )
16931701 only = collections .defaultdict (list )
16941702 for i in options .only :
@@ -1698,7 +1706,7 @@ def setup_symlinks() -> None:
16981706 except ValueError :
16991707 only [i ].append ('' )
17001708 try :
1701- all_tests = detect_tests_to_run (only , options .use_tmpdir )
1709+ all_tests = detect_tests_to_run (only , options .use_tmpdir , host_machine )
17021710 res = run_tests (all_tests , 'meson-test-run' , options .failfast , options .extra_args , options .use_tmpdir , options .num_workers )
17031711 (passing_tests , failing_tests , skipped_tests ) = res
17041712 except StopException :
0 commit comments