[clang] [clang][python] Don't add check-clang-python to check-all if cross-compiling (PR #111657)

via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 9 03:14:26 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Alex Bradbury (asb)

<details>
<summary>Changes</summary>

Consistent with other cases for these tests, we opt not to add the target to check-all if they're known to fail. The tests fail when cross compiling for a different architecture because the host Python3_EXECUTABLE is used to run them, and FFI calls will of course fail against the libraries compiled for the target.

This is an alternate take on
<https://github.com/llvm/llvm-project/pull/111367>.

---
Full diff: https://github.com/llvm/llvm-project/pull/111657.diff


1 Files Affected:

- (modified) clang/bindings/python/tests/CMakeLists.txt (+8) 


``````````diff
diff --git a/clang/bindings/python/tests/CMakeLists.txt b/clang/bindings/python/tests/CMakeLists.txt
index 2543cf739463d9..de75d303aca7bb 100644
--- a/clang/bindings/python/tests/CMakeLists.txt
+++ b/clang/bindings/python/tests/CMakeLists.txt
@@ -47,6 +47,14 @@ 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_CROSS_COMPILING)
+  message(WARNING "check-clang-python-tests not added to check-all as they 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)

``````````

</details>


https://github.com/llvm/llvm-project/pull/111657


More information about the cfe-commits mailing list