[clang] [clang][python] Don't add check-clang-python to check-all if cross-compiling (PR #111657)
Alex Bradbury via cfe-commits
cfe-commits at lists.llvm.org
Wed Oct 9 03:13:52 PDT 2024
https://github.com/asb created https://github.com/llvm/llvm-project/pull/111657
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>.
>From afd9488eb0b69c5375f7259a02581389c5003917 Mon Sep 17 00:00:00 2001
From: Alex Bradbury <asb at igalia.com>
Date: Wed, 9 Oct 2024 11:09:44 +0100
Subject: [PATCH] [clang][python] Don't add check-clang-python to check-all if
cross-compiling
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>.
---
clang/bindings/python/tests/CMakeLists.txt | 8 ++++++++
1 file changed, 8 insertions(+)
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)
More information about the cfe-commits
mailing list