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
@@ -1085,7 +1087,7 @@ def should_skip_wayland() -> bool:
10851087 return True
10861088 return False
10871089
1088- def detect_tests_to_run (only : T .Dict [str , T .List [str ]], use_tmp : bool ) -> T .List [T .Tuple [str , T .List [TestDef ], bool ]]:
1090+ 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 ]]:
10891091 """
10901092 Parameters
10911093 ----------
@@ -1129,8 +1131,7 @@ def __init__(self, category: str, subdir: str, skip: bool = False, stdout_mandat
11291131 TestCategory ('platform-osx' , 'osx' , not mesonlib .is_osx ()),
11301132 TestCategory ('platform-windows' , 'windows' , not mesonlib .is_windows () and not mesonlib .is_cygwin ()),
11311133 TestCategory ('platform-linux' , 'linuxlike' , mesonlib .is_osx () or mesonlib .is_windows ()),
1132- # FIXME, does not actually run in CI, change to run the test if an Android cross toolchain is detected.
1133- TestCategory ('platform-android' , 'android' , not mesonlib .is_android ()),
1134+ TestCategory ('platform-android' , 'android' , not host_machine .is_android ()),
11341135 TestCategory ('java' , 'java' , backend is not Backend .ninja or not have_java ()),
11351136 TestCategory ('C#' , 'csharp' , skip_csharp (backend )),
11361137 TestCategory ('vala' , 'vala' , backend is not Backend .ninja or not shutil .which (os .environ .get ('VALAC' , 'valac' ))),
@@ -1695,6 +1696,13 @@ def setup_symlinks() -> None:
16951696 script_dir = os .path .split (__file__ )[0 ]
16961697 if script_dir != '' :
16971698 os .chdir (script_dir )
1699+
1700+ if options .cross_file is not None :
1701+ config = parse_machine_files ([options .cross_file ], script_dir )
1702+ host_machine = MachineInfo .from_literal (config ['host_machine' ]) if 'host_machine' in config else detect_machine_info ()
1703+ else :
1704+ host_machine = detect_machine_info ()
1705+
16981706 check_meson_commands_work (options .use_tmpdir , options .extra_args )
16991707 only = collections .defaultdict (list )
17001708 for i in options .only :
@@ -1704,7 +1712,7 @@ def setup_symlinks() -> None:
17041712 except ValueError :
17051713 only [i ].append ('' )
17061714 try :
1707- all_tests = detect_tests_to_run (only , options .use_tmpdir )
1715+ all_tests = detect_tests_to_run (only , options .use_tmpdir , host_machine )
17081716 res = run_tests (all_tests , 'meson-test-run' , options .failfast , options .extra_args , options .use_tmpdir , options .num_workers )
17091717 (passing_tests , failing_tests , skipped_tests ) = res
17101718 except StopException :
0 commit comments