diff --git a/clang/bindings/python/tests/CMakeLists.txt b/clang/bindings/python/tests/CMakeLists.txt index 2543cf739463d..a0ddabc21bb41 100644 --- a/clang/bindings/python/tests/CMakeLists.txt +++ b/clang/bindings/python/tests/CMakeLists.txt @@ -47,6 +47,19 @@ if(${LLVM_NATIVE_ARCH} MATCHES "^(AArch64|Hexagon|Sparc|SystemZ)$") set(RUN_PYTHON_TESTS FALSE) endif() +# Tests will fail if cross-compiling for a different target, as tests will try +# to use the host Python3_EXECUTABLE and make FFI calls to functions in target +# libraries. +if(CMAKE_CROSSCOMPILING) + # FIXME: Consider a solution that allows better control over these tests in + # a crosscompiling scenario. e.g. registering them with lit to allow them to + # be explicitly skipped via appropriate LIT_ARGS, or adding a mechanism to + # allow specifying a python interpreter compiled for the target that could + # be executed using qemu-user. + message(WARNING "check-clang-python not added to check-all as these tests fail in a cross-build setup") + set(RUN_PYTHON_TESTS FALSE) +endif() + if(RUN_PYTHON_TESTS) set_property(GLOBAL APPEND PROPERTY LLVM_ALL_ADDITIONAL_TEST_TARGETS check-clang-python)