diff mbox series

[2/3] clang/llvm: Point lit at the target python for the test suite

Message ID 20261110061608.4043909-3-sunilkumar.dora@windriver.com
State Under Review
Headers show
Series clang/llvm: Upgrade to 23.1.5 | expand

Commit Message

Dora, Sunil Kumar Nov. 10, 2026, 6:16 a.m. UTC
From: Sunil Dora <sunilkumar.dora@windriver.com>

lit.site.cfg.py records the python cmake found on the build host, but
the test suite runs on the target. Any test calling that python directly
fails there. In llvm the extract_symbols tests, new in 23.1.4, do this
and fail on all the -tc builders. In clang, %deps-to-rsp,
%scan-deps-filter, %hmaptool and %check_analyzer_fixit are built the
same way, which is why the ClangScanDeps tests got excluded in
0e7f898dc4.

Rewrite the recorded path after configure in both recipes. Changing
Python3_EXECUTABLE itself is not an option, cmake.bbclass needs it for
the build.

The extract_symbols config is being changed upstream to use the python
running lit, https://github.com/llvm/llvm-project/pull/240530. That
covers only those two tests though, the clang substitutions and the
other llvm ones still use the configured python, so this is done in the
recipes for all of them rather than by carrying the upstream patch.

Signed-off-by: Sunil Dora <sunilkumar.dora@windriver.com>
---
 meta/recipes-devtools/clang/clang_git.bb | 12 ++++++++++++
 meta/recipes-devtools/clang/llvm_git.bb  |  9 +++++++++
 2 files changed, 21 insertions(+)
diff mbox series

Patch

diff --git a/meta/recipes-devtools/clang/clang_git.bb b/meta/recipes-devtools/clang/clang_git.bb
index 90076f9d6d..6c149945fd 100644
--- a/meta/recipes-devtools/clang/clang_git.bb
+++ b/meta/recipes-devtools/clang/clang_git.bb
@@ -100,6 +100,18 @@  do_configure:prepend() {
   ln -srf ${S}/clang-tools-extra ${S}/clang/tools/extra
 }
 
+# The tests run on the target, so lit must use the target python.
+clang_lit_target_python() {
+    sed -i 's|^config.python_executable = .*|config.python_executable = "${bindir}/python3"|' \
+        ${B}/test/lit.site.cfg.py
+}
+
+do_configure:append:class-target() {
+    if [ "${CLANG_ENABLE_TESTSUITE}" = "1" ]; then
+        clang_lit_target_python
+    fi
+}
+
 do_install:append() {
     oe_multilib_header clang/Config/config.h
 }
diff --git a/meta/recipes-devtools/clang/llvm_git.bb b/meta/recipes-devtools/clang/llvm_git.bb
index bec7e93eab..a61ddcb7ef 100644
--- a/meta/recipes-devtools/clang/llvm_git.bb
+++ b/meta/recipes-devtools/clang/llvm_git.bb
@@ -105,8 +105,17 @@  reproducible_build_variables() {
         ${B}/tools/llvm-config/BuildVariables.inc
 }
 
+# The tests run on the target, so lit must use the target python.
+llvm_lit_target_python() {
+    sed -i 's|^config.python_executable = .*|config.python_executable = "${bindir}/python3"|' \
+        ${B}/test/lit.site.cfg.py
+}
+
 do_configure:append:class-target() {
     reproducible_build_variables
+    if [ "${CLANG_ENABLE_TESTSUITE}" = "1" ]; then
+        llvm_lit_target_python
+    fi
 }
 do_configure:append:class-nativesdk() {
     reproducible_build_variables