* [PATCH V3 0/4] Oe-selftest for Clang, LLVM, LLD
@ 2026-03-02 10:43 Deepesh.Varatharajan
2026-03-02 10:43 ` [PATCH V3 1/4] clang-tools-extra: disable tests Deepesh.Varatharajan
` (4 more replies)
0 siblings, 5 replies; 7+ messages in thread
From: Deepesh.Varatharajan @ 2026-03-02 10:43 UTC (permalink / raw)
To: openembedded-core; +Cc: Randy.Macleod, Sundeep.Kokkonda, Deepesh.Varatharajan
From: Deepesh Varatharajan <Deepesh.Varatharajan@windriver.com>
This patch series introduces a test framework to run selftests for
target builds of Clang, LLVM, and LLD.
v3 changes:
- llvm_sysroot_preprocess_testsuite function needs be added to
llvm:class-target not llvm:class-nativesdk.
v2 changes:
- Enable required CMake flags only when running the testsuite.
- Ensure default build time and package sizes remain unaffected.
Summary of changes:
-Patch 1: Disable clang-tools-extra tests, as Clang's CMake cannot
detect the llvm-bcanalyzer target.
-Patch 2: Enabled the necessary CMake flags for clang, llvm & lld tests
when CLANG_ENABLE_TESTSUITE is set to "1".
-Patch 3: Selftest script for Clang, LLVM, and LLD including exclude list
-Patch 4: Fix rust build failure by replacing target llvm-config with native
Testing:
1. The test suite has been successfully validated on x86-64, arm64, riscv64
and arm32 for all Clang, LLD & LLVM components.
2. Clang and LLD tests passed successfully on x86. LLVM tests are skipped
on x86 since it's broken. A follow-up bug will be filed and addressed.
3. Clang, LLVM & LLD all together ~80K tests are there and we currently
~250 tests to exclude list which are failing (0.32%).
Impact on build time:
These builds were executed in a controlled environment without poky-sstate
enabled.
Default(without changes):
+-----------+------------+------------+------------+----------------+
| Target | Run 1 | Run 2 | Run 3 | Average |
| --------- | ---------- | ---------- | ---------- | -------------- |
| llvm | 22m18.441s | 22m31.905s | 22m23.718s | 22m24.688s |
| clang | 30m09.774s | 30m22.680s | 30m15.312s | 30m15.922s |
| lld | 1m26.994s | 1m30.415s | 1m29.006s | 1m28.805s |
+-----------+------------+------------+------------+----------------+
With the testsuite changes applied:
+-----------+------------+------------+------------+----------------+
| Target | Run 1 | Run 2 | Run 3 | Average |
| --------- | ---------- | ---------- | ---------- | -------------- |
| llvm | 23m32.104s | 23m45.887s | 23m38.157s | 23m38.716s |
| clang | 30m31.402s | 30m46.198s | 30m39.445s | 30m39.015s |
| lld | 1m29.845s | 1m34.212s | 1m31.925s | 1m31.994s |
+-----------+------------+------------+------------+----------------+
Comparison:
The additional overhead is minimal and primarily due to enabling
test-related build configurations.
+-----------+-------------+------------------+------------------+
| Target | Default Avg | With Changes Avg | **Diff** |
| --------- | ----------- | ---------------- | ---------------- |
| llvm | 22m24.688s | 23m38.716s | +1m14.028s |
| clang | 30m15.922s | 30m39.015s | +0m23.093s |
| lld | 1m28.805s | 1m31.994s | +0m3.189s |
+-----------+-------------+------------------+------------------+
Impact on package size and Fix:
The testsuite changes has a negative impact on certain package sizes,
as below:
+---------------------+----------+----------+-----------+------------+
| Package | Old (MB) | New (MB) | Diff (MB) | Change (%) |
+=====================+==========+==========+===========+============+
| clang/clang-dbg | 44.99 | 59.79 | +14.81 | +32.92% |
| clang/clang-dev | 30.22 | 30.22 | -0.00 | -0.00% |
| clang/clang-tools | 5.05 | 29.58 | +24.53 | +485.87% |
| llvm/llvm-bin | 16.40 | 71.77 | +55.36 | +337.50% |
| llvm/llvm-dbg | 386.79 | 646.12 | +259.33 | +67.05% |
| llvm/llvm-dev | 32.67 | 33.67 | +1.00 | +3.05% |
| llvm/llvm-src | 387.54 | 389.44 | +1.90 | +0.49% |
| llvm/llvm-staticdev | 609.68 | 616.80 | +7.12 | +1.17% |
+---------------------+----------+----------+-----------+------------+
FIX:
All testsuite-related changes are now gated by the CLANG_ENABLE_TESTSUITE
variable (default "0"), ensuring:
- Test-specific CMake flags are applied only during test execution.
- Standard builds remain fully unaffected in both build time and package size.
Deepesh Varatharajan (4):
clang-tools-extra: disable tests
clang: Use CLANG_ENABLE_TESTSUITE to enable LLVM, Clang, and LLD tests
oeqa/selftest/clang: Add oe-seltests for Clang/LLVM/LLD
rust: Fix rust build failure
meta/lib/oeqa/selftest/cases/clang.py | 299 ++++++++++++++++++
.../0042-guard-clang-tools-extra-test.patch | 74 +++++
meta/recipes-devtools/clang/clang_git.bb | 8 +
meta/recipes-devtools/clang/common.inc | 1 +
meta/recipes-devtools/clang/lld_git.bb | 5 +
meta/recipes-devtools/clang/llvm_git.bb | 18 +-
meta/recipes-devtools/rust/rust_1.93.0.bb | 5 +-
7 files changed, 407 insertions(+), 3 deletions(-)
create mode 100644 meta/lib/oeqa/selftest/cases/clang.py
create mode 100644 meta/recipes-devtools/clang/clang/0042-guard-clang-tools-extra-test.patch
--
2.49.0
^ permalink raw reply [flat|nested] 7+ messages in thread* [PATCH V3 1/4] clang-tools-extra: disable tests 2026-03-02 10:43 [PATCH V3 0/4] Oe-selftest for Clang, LLVM, LLD Deepesh.Varatharajan @ 2026-03-02 10:43 ` Deepesh.Varatharajan 2026-03-02 10:43 ` [PATCH V3 2/4] clang: Use CLANG_ENABLE_TESTSUITE to enable LLVM, Clang, and LLD tests Deepesh.Varatharajan ` (3 subsequent siblings) 4 siblings, 0 replies; 7+ messages in thread From: Deepesh.Varatharajan @ 2026-03-02 10:43 UTC (permalink / raw) To: openembedded-core; +Cc: Randy.Macleod, Sundeep.Kokkonda, Deepesh.Varatharajan From: Deepesh Varatharajan <Deepesh.Varatharajan@windriver.com> clang-tools-extra tests depend on the llvm-bcanalyzer CMake target, which exists in LLVM's CMake project but is not visible when Clang is built separately. To run clang tests, disable clang-tools-extra tests for now. Signed-off-by: Deepesh Varatharajan <Deepesh.Varatharajan@windriver.com> --- .../0042-guard-clang-tools-extra-test.patch | 74 +++++++++++++++++++ meta/recipes-devtools/clang/common.inc | 1 + 2 files changed, 75 insertions(+) create mode 100644 meta/recipes-devtools/clang/clang/0042-guard-clang-tools-extra-test.patch diff --git a/meta/recipes-devtools/clang/clang/0042-guard-clang-tools-extra-test.patch b/meta/recipes-devtools/clang/clang/0042-guard-clang-tools-extra-test.patch new file mode 100644 index 0000000000..a37ab65975 --- /dev/null +++ b/meta/recipes-devtools/clang/clang/0042-guard-clang-tools-extra-test.patch @@ -0,0 +1,74 @@ +clang-tools-extra tests depend on the llvm-bcanalyzer CMake target, which +exists in LLVM's CMake project but is not visible when Clang is built +separately. To run clang tests, disable clang-tools-extra tests for now. + +Without this patch when CLANG_INCLUDE_TESTS is ON got the following error + +-------------------------------------------------------------------------------- +| CMake Error at ../clang/21.1.8/recipe-sysroot/usr/lib/cmake/llvm/AddLLVM.cmake:2113 (add_dependencies): +| The dependency target "llvm-bcanalyzer" of target +| "check-clang-extra-clang-tidy-infrastructure-header-filter-from-config-file-simple" +| does not exist. +| Call Stack (most recent call first): +| ../clang/21.1.8/recipe-sysroot/usr/lib/cmake/llvm/AddLLVM.cmake:2221 (add_lit_target) +| tools/extra/test/CMakeLists.txt:87 (add_lit_testsuites) +| +| CMake Error at ../clang/21.1.8/recipe-sysroot/usr/lib/cmake/llvm/AddLLVM.cmake:2113 (add_dependencies): +| The dependency target "llvm-bcanalyzer" of target +| "check-clang-extra-modularize" does not exist. +| Call Stack (most recent call first): +| ../clang/21.1.8/recipe-sysroot/usr/lib/cmake/llvm/AddLLVM.cmake:2221 (add_lit_target) +| tools/extra/test/CMakeLists.txt:87 (add_lit_testsuites) +------------------------------------------------------------------------------- + +Upstream-Status: Inappropriate [OE-Specific] +Signed-off-by: Deepesh Varatharajan <Deepesh.Varatharajan@windriver.com> + +diff --git a/clang-tools-extra/CMakeLists.txt b/clang-tools-extra/CMakeLists.txt +index 6b6f2b1..26e4c10 100644 +--- a/clang-tools-extra/CMakeLists.txt ++++ b/clang-tools-extra/CMakeLists.txt +@@ -6,7 +6,7 @@ include(GNUInstallDirs) + option(CLANG_TIDY_ENABLE_STATIC_ANALYZER + "Include static analyzer checks in clang-tidy" ON) + +-if(CLANG_INCLUDE_TESTS) ++if(CLANG_TOOLS_EXTRA_INCLUDE_TESTS) + umbrella_lit_testsuite_begin(check-clang-tools) + + option(CLANG_TOOLS_TEST_USE_VG "Run Clang tools' tests under Valgrind" OFF) +@@ -43,7 +43,7 @@ if (CLANG_ENABLE_CLANGD) + endif() + + # Add the common testsuite after all the tools. +-if(CLANG_INCLUDE_TESTS) ++if(CLANG_TOOLS_EXTRA_INCLUDE_TESTS) + add_subdirectory(test) + add_subdirectory(unittests) + umbrella_lit_testsuite_end(check-clang-tools) +diff --git a/clang-tools-extra/include-cleaner/CMakeLists.txt b/clang-tools-extra/include-cleaner/CMakeLists.txt +index dc147f9..4855577 100644 +--- a/clang-tools-extra/include-cleaner/CMakeLists.txt ++++ b/clang-tools-extra/include-cleaner/CMakeLists.txt +@@ -1,7 +1,7 @@ + include_directories(include) + add_subdirectory(lib) + add_subdirectory(tool) +-if(CLANG_INCLUDE_TESTS) ++if(CLANG_TOOLS_EXTRA_INCLUDE_TESTS) + add_subdirectory(test) + add_subdirectory(unittests) + endif() +diff --git a/clang-tools-extra/clangd/CMakeLists.txt b/clang-tools-extra/clangd/CMakeLists.txt +index a1e9da4..94dcb96 100644 +--- a/clang-tools-extra/clangd/CMakeLists.txt ++++ b/clang-tools-extra/clangd/CMakeLists.txt +@@ -213,7 +213,7 @@ endif() + option(CLANGD_BUILD_DEXP "Build the dexp tool as part of Clangd" ON) + llvm_canonicalize_cmake_booleans(CLANGD_BUILD_DEXP) + +-if(CLANG_INCLUDE_TESTS) ++if(CLANG_TOOLS_EXTRA_INCLUDE_TESTS) + add_subdirectory(test) + add_subdirectory(unittests) + endif() diff --git a/meta/recipes-devtools/clang/common.inc b/meta/recipes-devtools/clang/common.inc index 1e70e9c64b..c5f607aa21 100644 --- a/meta/recipes-devtools/clang/common.inc +++ b/meta/recipes-devtools/clang/common.inc @@ -65,6 +65,7 @@ SRC_URI = "\ file://0001-dont-expose-LLVM_HAVE_OPT_VIEWER_MODULES.patch \ file://0001-clang-Support-building-native-tools-when-cross-compi.patch \ file://clang-no-tblgen.patch \ + file://0042-guard-clang-tools-extra-test.patch \ " # Fallback to no-PIE if not set GCCPIE ??= "" -- 2.49.0 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH V3 2/4] clang: Use CLANG_ENABLE_TESTSUITE to enable LLVM, Clang, and LLD tests 2026-03-02 10:43 [PATCH V3 0/4] Oe-selftest for Clang, LLVM, LLD Deepesh.Varatharajan 2026-03-02 10:43 ` [PATCH V3 1/4] clang-tools-extra: disable tests Deepesh.Varatharajan @ 2026-03-02 10:43 ` Deepesh.Varatharajan 2026-03-02 10:43 ` [PATCH V3 3/4] oeqa/selftest/clang: Add oe-seltests for Clang/LLVM/LLD Deepesh.Varatharajan ` (2 subsequent siblings) 4 siblings, 0 replies; 7+ messages in thread From: Deepesh.Varatharajan @ 2026-03-02 10:43 UTC (permalink / raw) To: openembedded-core; +Cc: Randy.Macleod, Sundeep.Kokkonda, Deepesh.Varatharajan From: Deepesh Varatharajan <Deepesh.Varatharajan@windriver.com> Introduce the CLANG_ENABLE_TESTSUITE variable to control building and running tests for LLVM, Clang, and LLD. When enabled, the necessary CMake flags are applied, and LLVM target tools required to run tests. Signed-off-by: Deepesh Varatharajan <Deepesh.Varatharajan@windriver.com> --- meta/recipes-devtools/clang/clang_git.bb | 8 ++++++++ meta/recipes-devtools/clang/lld_git.bb | 5 +++++ meta/recipes-devtools/clang/llvm_git.bb | 18 +++++++++++++++++- 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/meta/recipes-devtools/clang/clang_git.bb b/meta/recipes-devtools/clang/clang_git.bb index e10c327a2a..c3eeb34159 100644 --- a/meta/recipes-devtools/clang/clang_git.bb +++ b/meta/recipes-devtools/clang/clang_git.bb @@ -77,6 +77,14 @@ EXTRA_OECMAKE += "-DLLVM_ENABLE_ASSERTIONS=OFF \ -DCMAKE_STRIP=${STAGING_BINDIR_NATIVE}/llvm-strip \ " +CLANG_ENABLE_TESTSUITE ??= "0" +CLANG_TESTSUITE_FLAGS = "\ + -DCLANG_INCLUDE_TESTS=ON \ + -DLLVM_INCLUDE_TESTS=ON \ +" + +EXTRA_OECMAKE:append:class-target = " ${@bb.utils.contains('CLANG_ENABLE_TESTSUITE', '1', d.getVar('CLANG_TESTSUITE_FLAGS'), '', d)}" + DEPENDS = "llvm-tblgen-native llvm-native llvm binutils zlib zstd libffi libxml2 libxml2-native" DEPENDS:append:class-target = " ${@bb.utils.contains('TC_CXX_RUNTIME', 'llvm', 'compiler-rt libcxx', '', d)}" diff --git a/meta/recipes-devtools/clang/lld_git.bb b/meta/recipes-devtools/clang/lld_git.bb index ba36942790..8960cac2d3 100644 --- a/meta/recipes-devtools/clang/lld_git.bb +++ b/meta/recipes-devtools/clang/lld_git.bb @@ -19,4 +19,9 @@ OECMAKE_SOURCEPATH = "${S}/lld" EXTRA_OECMAKE += "-DLLVM_INCLUDE_TESTS=OFF -DLLVM_USE_SYMLINKS=ON \ -DLLVM_TABLEGEN_EXE=${STAGING_BINDIR_NATIVE}/llvm-tblgen" +CLANG_ENABLE_TESTSUITE ??= "0" +LLD_TESTSUITE_FLAGS = "-DLLVM_INCLUDE_TESTS=ON" + +EXTRA_OECMAKE:append:class-target = " ${@bb.utils.contains('CLANG_ENABLE_TESTSUITE', '1', d.getVar('LLD_TESTSUITE_FLAGS'), '', d)}" + BBCLASSEXTEND = "native nativesdk" diff --git a/meta/recipes-devtools/clang/llvm_git.bb b/meta/recipes-devtools/clang/llvm_git.bb index 96ea383731..e7823154b9 100644 --- a/meta/recipes-devtools/clang/llvm_git.bb +++ b/meta/recipes-devtools/clang/llvm_git.bb @@ -80,6 +80,18 @@ PACKAGECONFIG[opt-viewer] = "-DLLVM_TOOL_OPT_VIEWER_BUILD=ON,-DLLVM_TOOL_OPT_VIE PACKAGECONFIG[lto] = "-DLLVM_ENABLE_LTO=Full -DLLVM_BINUTILS_INCDIR=${STAGING_INCDIR},,binutils," PACKAGECONFIG[thin-lto] = "-DLLVM_ENABLE_LTO=Thin -DLLVM_BINUTILS_INCDIR=${STAGING_INCDIR},,binutils," +CLANG_ENABLE_TESTSUITE ??= "0" +LLVM_TESTSUITE_FLAGS = "\ + -DLLVM_BUILD_TESTS=ON \ + -DLLVM_INSTALL_GTEST=ON \ + -DLLVM_INCLUDE_TESTS=ON \ + -DLLVM_TOOL_LLVM_EXEGESIS_BUILD=ON \ + -DLLVM_TOOL_OBJ2YAML_BUILD=ON \ + -DLLVM_TOOL_YAML2OBJ_BUILD=ON \ + " + +EXTRA_OECMAKE:append:class-target = " ${@bb.utils.contains('CLANG_ENABLE_TESTSUITE', '1', d.getVar('LLVM_TESTSUITE_FLAGS'), '', d) } " + # LLVM debug symbols are very large (several gigabytes), reduce the debug level # so they're just hundreds of megabytes. DEBUG_LEVELFLAG = "-g1" @@ -118,7 +130,7 @@ do_install:append:class-native() { rm ${D}${bindir}/*-tblgen } -SYSROOT_PREPROCESS_FUNCS:append:class-target = " llvm_sysroot_preprocess" +SYSROOT_PREPROCESS_FUNCS:append:class-target = " llvm_sysroot_preprocess ${@bb.utils.contains('CLANG_ENABLE_TESTSUITE', '1', 'llvm_sysroot_preprocess_testsuite', '', d) }" SYSROOT_PREPROCESS_FUNCS:append:class-nativesdk = " llvm_sysroot_preprocess" llvm_sysroot_preprocess() { @@ -126,6 +138,10 @@ llvm_sysroot_preprocess() { install -m 0755 ${S}/llvm/tools/llvm-config/llvm-config ${SYSROOT_DESTDIR}${bindir_crossscripts}/ } +llvm_sysroot_preprocess_testsuite() { + install -m 0755 ${B}/bin/* ${SYSROOT_DESTDIR}${bindir}/ +} + FILES:${PN}-dev += "${libdir}/llvm-config" BBCLASSEXTEND = "native nativesdk" -- 2.49.0 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH V3 3/4] oeqa/selftest/clang: Add oe-seltests for Clang/LLVM/LLD 2026-03-02 10:43 [PATCH V3 0/4] Oe-selftest for Clang, LLVM, LLD Deepesh.Varatharajan 2026-03-02 10:43 ` [PATCH V3 1/4] clang-tools-extra: disable tests Deepesh.Varatharajan 2026-03-02 10:43 ` [PATCH V3 2/4] clang: Use CLANG_ENABLE_TESTSUITE to enable LLVM, Clang, and LLD tests Deepesh.Varatharajan @ 2026-03-02 10:43 ` Deepesh.Varatharajan 2026-03-02 10:43 ` [PATCH V3 4/4] rust: Fix rust build failure Deepesh.Varatharajan 2026-03-04 18:28 ` [OE-core] [PATCH V3 0/4] Oe-selftest for Clang, LLVM, LLD Mathieu Dubois-Briand 4 siblings, 0 replies; 7+ messages in thread From: Deepesh.Varatharajan @ 2026-03-02 10:43 UTC (permalink / raw) To: openembedded-core; +Cc: Randy.Macleod, Sundeep.Kokkonda, Deepesh.Varatharajan From: Deepesh Varatharajan <Deepesh.Varatharajan@windriver.com> Introduce selftests to validate LLVM, Clang, and LLD test suites using llvm-lit for target builds. The tests cover: - Target tests execution under QEMU via NFS using llvm-lit - Architecture and OS-specific test filtering - Known failing test exclusions - LLVM testing is skipped for x86 Signed-off-by: Deepesh Varatharajan <Deepesh.Varatharajan@windriver.com> --- meta/lib/oeqa/selftest/cases/clang.py | 299 ++++++++++++++++++++++++++ 1 file changed, 299 insertions(+) create mode 100644 meta/lib/oeqa/selftest/cases/clang.py diff --git a/meta/lib/oeqa/selftest/cases/clang.py b/meta/lib/oeqa/selftest/cases/clang.py new file mode 100644 index 0000000000..4a3ed25f1b --- /dev/null +++ b/meta/lib/oeqa/selftest/cases/clang.py @@ -0,0 +1,299 @@ +# +# Copyright (c) 2026 by Wind River Systems, Inc. +# +# SPDX-License-Identifier: MIT +# +import time +import contextlib +import subprocess +from oeqa.core.decorator import OETestTag +from oeqa.core.decorator.data import skipIfArch +from oeqa.selftest.case import OESelftestTestCase +from oeqa.utils.commands import bitbake, get_bb_var, runqemu +from oeqa.utils.nfs import unfs_server + +class ClangFamilyBase(OESelftestTestCase): + + ALL_ARCHS = [ + "aarch64", "arm", "i386", "x86_64", "x86", + "mips", "riscv", "riscv64", "ppc", "ppc64", + "hexagon", "sparc", "sparcv9", "msp430", + "loongarch" + ] + + EXCLUDE_OS = [ + "Mac", "macho", "Darwin", "OSX", "wasm", + "Windows", "Win", "MinGW", "COFF", "zos", + "FreeBSD", "aix", "fuchsia", "ve" + ] + + DEFAULT_PACKAGES = [ + "libgcc", + "libstdc++", + "llvm", + "python3", + "python3-core", + "python3-modules", + "nfs-utils", + ] + + def setUp(self): + super().setUp() + self.target_arch = get_bb_var("TARGET_ARCH") + self.tmpdir = get_bb_var("TMPDIR") + arches = [a for a in self.ALL_ARCHS if a != self.target_arch] + self.filter_out = "|".join(arches + self.EXCLUDE_OS) + self.write_config('CLANG_ENABLE_TESTSUITE = "1"') + + def build_core_image(self): + features = [ + 'IMAGE_FEATURES += "ssh-server-openssh"', + 'CORE_IMAGE_EXTRA_INSTALL += "{}"'.format(" ".join(self.DEFAULT_PACKAGES)) + ] + self.write_config("\n".join(features)) + bitbake("core-image-minimal") + + def start_qemu_nfs(self): + ctx = contextlib.ExitStack() + s = ctx.__enter__() + nfsport, mountport = s.enter_context(unfs_server(self.tmpdir, udp=False)) + qemu = s.enter_context( + runqemu("core-image-minimal", runqemuparams="nographic", qemuparams="-m 3072") + ) + + status, _ = qemu.run("uname") + if status != 0: + raise AssertionError("QEMU SSH check failed") + + status, _ = qemu.run(f"mkdir -p {self.tmpdir}") + if status != 0: + raise AssertionError("Failed to create TMPDIR on target") + + mountcmd = ( + f"mount -o noac,nfsvers=3,port={nfsport},mountport={mountport} " + f"\"{qemu.server_ip}:{self.tmpdir}\" \"{self.tmpdir}\"" + ) + status, output = qemu.run(mountcmd) + if status != 0: + raise AssertionError(f"NFS mount failed: {output}") + return ctx, qemu + + def run_llvm_lit(self, recipe, extra_filter=None, timeout=None): + build_dir = get_bb_var("B", recipe) + workdir = get_bb_var("WORKDIR", recipe) + lit_bin = f"{build_dir}/bin/llvm-lit" + test_dir = f"{build_dir}/test" + guest_result = f"/tmp/{recipe}-target-results.json" + host_result = f"{workdir}/{recipe}-target-results.log" + + filter_regex = self.filter_out + if extra_filter: + filter_regex += "|" + "|".join(extra_filter) + + cmd = ( + f"cd {build_dir}/bin && " + f"python3 ./llvm-lit --filter-out '{filter_regex}' ../test -o {guest_result}" + ) + + return cmd, guest_result, host_result + +@OETestTag("toolchain-system") +@OETestTag("toolchain-user") +@OETestTag("runqemu") +class LLVMSelfTestSystemEmulated(ClangFamilyBase): + + LLVM_EXTRA_EXCLUDE = [ + "BugPoint/compile-custom\\.ll$", + "BugPoint/replace-funcs-with-null\\.ll$", + "CodeGen/AMDGPU/lds-run-twice-absolute-md\\.ll$", + "CodeGen/AMDGPU/lds-run-twice\\.ll$", + "CodeGen/Generic/fp128-math-libcalls\\.ll$", + "CodeGen/Thumb/2009-08-20-ISelBug\\.ll$", + "CodeGen/Thumb/2010-07-15-debugOrdering\\.ll$", + "CodeGen/Thumb/2014-06-10-thumb1-ldst-opt-bug\\.ll$", + "CodeGen/Thumb/PR17309\\.ll$", + "CodeGen/Thumb/dyn-stackalloc\\.ll$", + "CodeGen/Thumb/frame-access\\.ll$", + "CodeGen/Thumb/ldm-merge-call\\.ll$", + "CodeGen/Thumb/pop\\.ll$", + "CodeGen/Thumb/pr35836\\.ll$", + "CodeGen/Thumb/pr35836_2\\.ll$", + "CodeGen/Thumb/smul_fix\\.ll$", + "CodeGen/Thumb/stack-guard-xo\\.ll$", + "CodeGen/Thumb/stm-deprecated\\.ll$", + "CodeGen/Thumb/stm-merge\\.ll$", + "CodeGen/Thumb/thumb-ldm\\.ll$", + "CodeGen/Thumb/ucmp\\.ll$", + "CodeGen/Thumb/vargs\\.ll$", + "CodeGen/Thumb2/2009-08-21-PostRAKill4\\.ll$", + "CodeGen/Thumb2/2009-09-01-PostRAProlog\\.ll$", + "CodeGen/Thumb2/constant-islands\\.ll$", + "CodeGen/Thumb2/ldr-str-imm12\\.ll$", + "CodeGen/Thumb2/pacbti-m-varargs-1\\.ll$", + "CodeGen/Thumb2/pacbti-m-varargs-2\\.ll$", + "CodeGen/Thumb2/thumb2-ldm\\.ll$", + "ExecutionEngine/MCJIT/.*", + "Other/spirv-sim/.*", + "Transforms/LoopLoadElim/.*", + "tools/llvm-cgdata/merge-combined-funcmap-hashtree\\.test$", + "tools/llvm-cgdata/merge-funcmap-concat\\.test$", + "tools/llvm-cgdata/merge-funcmap-double\\.test$", + "tools/llvm-cgdata/merge-funcmap-single\\.test$", + "tools/llvm-cgdata/merge-hashtree-concat\\.test$", + "tools/llvm-cgdata/merge-hashtree-double\\.test$", + "tools/llvm-cgdata/merge-hashtree-single\\.test$", + "tools/llvm-locstats/locstats\\.ll$", + "tools/llvm-locstats/no_scope_bytes\\.ll$", + "tools/llvm-objcopy/ELF/basic-binary-copy\\.test$", + "tools/llvm-objcopy/ELF/binary-first-seg-offset-zero\\.test$", + "tools/llvm-objcopy/ELF/binary-no-paddr\\.test$", + "tools/llvm-objcopy/ELF/binary-paddr\\.test$", + "tools/llvm-objcopy/ELF/binary-segment-layout\\.test$", + "tools/llvm-objcopy/ELF/check-addr-offset-align-binary\\.test$", + "tools/llvm-objcopy/ELF/dump-section\\.test$", + "tools/llvm-objcopy/ELF/gap-fill\\.test$", + "tools/llvm-objcopy/ELF/pad-to\\.test$", + "tools/llvm-objcopy/ELF/parent-loop-check\\.test$", + "tools/llvm-objcopy/ELF/strip-all-gnu\\.test$", + "tools/llvm-objcopy/ELF/strip-sections-keep\\.test$", + "tools/llvm-objcopy/ELF/strip-sections-only-section\\.test$", + "tools/llvm-objcopy/ELF/strip-sections\\.test$", + "tools/llvm-objcopy/ELF/update-section\\.test$", + "tools/llvm-original-di-preservation/basic\\.test$", + "tools/llvm-reduce/temporary-files-as-bitcode-split\\.ll$", + "tools/opt-viewer/.*", + "tools/UpdateTestChecks/.*", + "tools/yaml2obj/ELF/custom-fill\\.yaml$", + "tools/yaml2obj/ELF/header-elfdatanone\\.yaml$", + "tools/yaml2obj/ELF/header-sh-fields\\.yaml$", + "tools/yaml2obj/GOFF/GOFF-header-end\\.yaml$", + "tools/yaml2obj/GOFF/GOFF-header-settings\\.yaml$", + ] + + #Fixme LLVM module testing is broken for x86 + @skipIfArch(['i686']) + def test_llvm(self): + bitbake("llvm -c install") + self.build_core_image() + ctx, qemu = self.start_qemu_nfs() + with ctx: + cmd, guest_result, host_result = self.run_llvm_lit( + "llvm", extra_filter=self.LLVM_EXTRA_EXCLUDE + ) + status, output = qemu.run(cmd, timeout=7200) + if status != 0: + raise AssertionError(f"llvm-lit failed for LLVM: {output}") + status, _ = qemu.run(f"cp {guest_result} {host_result}") + if status != 0: + raise AssertionError("Failed to copy LLVM lit results back to host") + +@OETestTag("toolchain-system") +@OETestTag("toolchain-user") +@OETestTag("runqemu") +class ClangSelfTestSystemEmulated(ClangFamilyBase): + + CLANG_EXTRA_EXCLUDE = [ + "APINotes/yaml-roundtrip-2\\.test$", + "APINotes/yaml-roundtrip\\.test$", + "AST/ByteCode/builtin-bit-cast-long-double\\.cpp$", + "AST/ByteCode/builtin-bit-cast\\.cpp$", + "AST/ByteCode/builtin-functions\\.cpp$", + "AST/ByteCode/c\\.c$", + "AST/ByteCode/codegen\\.cpp$", + "AST/ByteCode/complex\\.c$", + "AST/ByteCode/complex\\.cpp$", + "AST/ByteCode/const-fpfeatures\\.cpp$", + "AST/ByteCode/constexpr\\.c$", + "AST/ByteCode/fixed-point\\.cpp$", + "AST/ByteCode/floats\\.cpp$", + "AST/ByteCode/functions\\.cpp$", + "AST/ByteCode/intap\\.cpp$", + "AST/ByteCode/invalid\\.cpp$", + "AST/ByteCode/lambda\\.cpp$", + "AST/ByteCode/literals\\.cpp$", + "AST/ByteCode/placement-new\\.cpp$", + "AST/ByteCode/records\\.cpp$", + "AST/ByteCode/spaceship\\.cpp$", + "AST/ByteCode/unions\\.cpp$", + "Analysis/dead-stores\\.c$", + "Analysis/exploded-graph-rewriter/.*", + "Analysis/scan-build/cxx-name\\.test$", + "Analysis/scan-build/deduplication\\.test$", + "Analysis/scan-build/exclude_directories\\.test$", + "Analysis/scan-build/help\\.test$", + "Analysis/scan-build/html_output\\.test$", + "Analysis/scan-build/plist_html_output\\.test$", + "Analysis/scan-build/plist_output\\.test$", + "Analysis/scan-build/rebuild_index/rebuild_index\\.test$", + "Analysis/scan-build/silence-core-checkers\\.test$", + "Analysis/virtualcall-fixits\\.cpp$", + "C/C23/n3018\\.c$", + "ClangScanDeps/module.*", + "ClangScanDeps/multiple-commands\\.c$", + "ClangScanDeps/optimize-vfs-edgecases\\.m$", + "ClangScanDeps/optimize-vfs-pch\\.m$", + "ClangScanDeps/visible-modules\\.c$", + "ClangScanDeps/Wsystem-headers-in-module\\.c$", + "CodeGen/compound-literal\\.c$", + "CodeGenOpenCLCXX/constexpr\\.clcpp$", + "Format/docs_updated\\.test$", + "Interpreter/cxx20-modules\\.cppm$", + "Modules/double-quotes\\.m$", + "Modules/framework-public-includes-private\\.m$", + "Modules/implicit-module-header-maps\\.cpp$", + "Preprocessor/header-search-crash\\.c$", + "Preprocessor/headermap-rel\\.c$", + "Preprocessor/headermap-rel2\\.c$", + "Preprocessor/include-header-missing-in-framework-with-headermap\\.c$", + "Preprocessor/search-path-usage\\.m$", + "Sema/arithmetic-fence-builtin\\.c$", + "Sema/atomic-expr\\.c$", + "Sema/builtin-expect-with-probability\\.cpp$", + "Sema/constant-builtins-fmax\\.cpp$", + "Sema/constant-builtins-fmaximum-num\\.cpp$", + "Sema/constant-builtins-fmin\\.cpp$", + "Sema/constant-builtins-fminimum-num\\.cpp$", + ] + + def test_clang(self): + bitbake("clang -c install") + self.build_core_image() + ctx, qemu = self.start_qemu_nfs() + with ctx: + cmd, guest_result, host_result = self.run_llvm_lit( + "clang", extra_filter=self.CLANG_EXTRA_EXCLUDE + ) + status, output = qemu.run(cmd, timeout=3600) + if status != 0: + raise AssertionError(f"llvm-lit failed for Clang: {output}") + status, _ = qemu.run(f"cp {guest_result} {host_result}") + if status != 0: + raise AssertionError("Failed to copy Clang lit results back to host") + +@OETestTag("toolchain-system") +@OETestTag("toolchain-user") +@OETestTag("runqemu") +class LLDSelfTestSystemEmulated(ClangFamilyBase): + + LLD_EXTRA_EXCLUDE = [ + "ELF/fill-trap\\.s$", + "ELF/oformat-binary-ttext\\.s$", + "ELF/oformat-binary\\.s$", + "ELF/partition-synthetic-sections\\.s$", + "ELF/reproduce\\.s$", + ] + + def test_lld(self): + bitbake("lld -c install") + self.build_core_image() + ctx, qemu = self.start_qemu_nfs() + with ctx: + cmd, guest_result, host_result = self.run_llvm_lit( + "lld", extra_filter=self.LLD_EXTRA_EXCLUDE + ) + status, output = qemu.run(cmd, timeout=3600) + if status != 0: + raise AssertionError(f"llvm-lit failed for LLD: {output}") + status, _ = qemu.run(f"cp {guest_result} {host_result}") + if status != 0: + raise AssertionError("Failed to copy LLD lit results back to host") -- 2.49.0 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH V3 4/4] rust: Fix rust build failure 2026-03-02 10:43 [PATCH V3 0/4] Oe-selftest for Clang, LLVM, LLD Deepesh.Varatharajan ` (2 preceding siblings ...) 2026-03-02 10:43 ` [PATCH V3 3/4] oeqa/selftest/clang: Add oe-seltests for Clang/LLVM/LLD Deepesh.Varatharajan @ 2026-03-02 10:43 ` Deepesh.Varatharajan 2026-03-04 18:28 ` [OE-core] [PATCH V3 0/4] Oe-selftest for Clang, LLVM, LLD Mathieu Dubois-Briand 4 siblings, 0 replies; 7+ messages in thread From: Deepesh.Varatharajan @ 2026-03-02 10:43 UTC (permalink / raw) To: openembedded-core; +Cc: Randy.Macleod, Sundeep.Kokkonda, Deepesh.Varatharajan From: Deepesh Varatharajan <Deepesh.Varatharajan@windriver.com> Target LLVM tools are installed in the sysroot because they are needed for llvm-lit to run tests. However, this leads Rust to pick up a target llvm-config that cannot run on the host. Overwrite it with the native llvm-config so Rust can execute it correctly. Signed-off-by: Deepesh Varatharajan <Deepesh.Varatharajan@windriver.com> --- meta/recipes-devtools/rust/rust_1.93.0.bb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/meta/recipes-devtools/rust/rust_1.93.0.bb b/meta/recipes-devtools/rust/rust_1.93.0.bb index 2be0bd8d89..86da4f99d4 100644 --- a/meta/recipes-devtools/rust/rust_1.93.0.bb +++ b/meta/recipes-devtools/rust/rust_1.93.0.bb @@ -236,9 +236,10 @@ rust_runx () { # Copy the natively built llvm-config into the target so we can run it. Horrible, # but works! - if [ ${RUST_ALTERNATE_EXE_PATH_NATIVE} != ${RUST_ALTERNATE_EXE_PATH} -a ! -f ${RUST_ALTERNATE_EXE_PATH} ]; then + if [ ${RUST_ALTERNATE_EXE_PATH_NATIVE} != ${RUST_ALTERNATE_EXE_PATH} ]; then mkdir -p `dirname ${RUST_ALTERNATE_EXE_PATH}` - cp ${RUST_ALTERNATE_EXE_PATH_NATIVE} ${RUST_ALTERNATE_EXE_PATH} + rm -f ${RUST_ALTERNATE_EXE_PATH} + cp -f ${RUST_ALTERNATE_EXE_PATH_NATIVE} ${RUST_ALTERNATE_EXE_PATH} patchelf --remove-rpath ${RUST_ALTERNATE_EXE_PATH} fi -- 2.49.0 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [OE-core] [PATCH V3 0/4] Oe-selftest for Clang, LLVM, LLD 2026-03-02 10:43 [PATCH V3 0/4] Oe-selftest for Clang, LLVM, LLD Deepesh.Varatharajan ` (3 preceding siblings ...) 2026-03-02 10:43 ` [PATCH V3 4/4] rust: Fix rust build failure Deepesh.Varatharajan @ 2026-03-04 18:28 ` Mathieu Dubois-Briand 2026-03-05 6:37 ` Mathieu Dubois-Briand 4 siblings, 1 reply; 7+ messages in thread From: Mathieu Dubois-Briand @ 2026-03-04 18:28 UTC (permalink / raw) To: deepesh.varatharajan, openembedded-core Cc: Randy.Macleod, Sundeep.Kokkonda, Deepesh.Varatharajan On Mon Mar 2, 2026 at 11:43 AM CET, Deepesh via lists.openembedded.org Varatharajan wrote: > From: Deepesh Varatharajan <Deepesh.Varatharajan@windriver.com> > > This patch series introduces a test framework to run selftests for > target builds of Clang, LLVM, and LLD. > > v3 changes: > - llvm_sysroot_preprocess_testsuite function needs be added to > llvm:class-target not llvm:class-nativesdk. > > v2 changes: > - Enable required CMake flags only when running the testsuite. > - Ensure default build time and package sizes remain unaffected. > > Summary of changes: > -Patch 1: Disable clang-tools-extra tests, as Clang's CMake cannot > detect the llvm-bcanalyzer target. > -Patch 2: Enabled the necessary CMake flags for clang, llvm & lld tests > when CLANG_ENABLE_TESTSUITE is set to "1". > -Patch 3: Selftest script for Clang, LLVM, and LLD including exclude list > -Patch 4: Fix rust build failure by replacing target llvm-config with native > Hi Deepesh, Thanks for the new version. While it runs correctly on the autobuilder, I'm noting it takes quite a bit of time to run the tests. I'm not really against merging them, I just want: - to make everybody aware of that. - to confirm with you these are some expected timings. Taking some random build in my branch: 2026-03-03 21:20:21,805 - oe-selftest - INFO - clang.LLDSelfTestSystemEmulated.test_lld (subunit.RemotedTestCase) 2026-03-03 21:20:21,805 - oe-selftest - INFO - ... ok 2026-03-03 21:20:21,805 - oe-selftest - INFO - 2: 1/1 18/21 (7205.57s) (0 failed) (clang.LLDSelfTestSystemEmulated.test_lld) ... 2026-03-04 00:56:44,671 - oe-selftest - INFO - clang.ClangSelfTestSystemEmulated.test_clang (subunit.RemotedTestCase) 2026-03-04 00:56:44,671 - oe-selftest - INFO - ... ok 2026-03-04 00:56:44,671 - oe-selftest - INFO - 1: 1/1 20/21 (20188.43s) (0 failed) (clang.ClangSelfTestSystemEmulated.test_clang) 2026-03-04 01:37:34,036 - oe-selftest - INFO - clang.LLVMSelfTestSystemEmulated.test_llvm (subunit.RemotedTestCase) 2026-03-04 01:37:34,036 - oe-selftest - INFO - ... ok 2026-03-04 01:37:34,036 - oe-selftest - INFO - 3: 1/1 21/21 (22637.80s) (0 failed) (clang.LLVMSelfTestSystemEmulated.test_llvm) https://autobuilder.yoctoproject.org/valkyrie/#/builders/5/builds/3230 So first, we only had a few builds so far, maybe we just were a bit unlucky (looking at the test, I believe sstate will not have any impact in later builds). Also we already had some quite long tests in there, but in some builds the test_clang / test_llvm really seems to take a longer time. Thanks, Mathieu -- Mathieu Dubois-Briand, Bootlin Embedded Linux and Kernel engineering https://bootlin.com ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [OE-core] [PATCH V3 0/4] Oe-selftest for Clang, LLVM, LLD 2026-03-04 18:28 ` [OE-core] [PATCH V3 0/4] Oe-selftest for Clang, LLVM, LLD Mathieu Dubois-Briand @ 2026-03-05 6:37 ` Mathieu Dubois-Briand 0 siblings, 0 replies; 7+ messages in thread From: Mathieu Dubois-Briand @ 2026-03-05 6:37 UTC (permalink / raw) To: deepesh.varatharajan, openembedded-core Cc: Randy.Macleod, Sundeep.Kokkonda, Deepesh.Varatharajan On Wed Mar 4, 2026 at 7:28 PM CET, Mathieu Dubois-Briand wrote: > On Mon Mar 2, 2026 at 11:43 AM CET, Deepesh via lists.openembedded.org Varatharajan wrote: >> From: Deepesh Varatharajan <Deepesh.Varatharajan@windriver.com> >> >> This patch series introduces a test framework to run selftests for >> target builds of Clang, LLVM, and LLD. >> >> v3 changes: >> - llvm_sysroot_preprocess_testsuite function needs be added to >> llvm:class-target not llvm:class-nativesdk. >> >> v2 changes: >> - Enable required CMake flags only when running the testsuite. >> - Ensure default build time and package sizes remain unaffected. >> >> Summary of changes: >> -Patch 1: Disable clang-tools-extra tests, as Clang's CMake cannot >> detect the llvm-bcanalyzer target. >> -Patch 2: Enabled the necessary CMake flags for clang, llvm & lld tests >> when CLANG_ENABLE_TESTSUITE is set to "1". >> -Patch 3: Selftest script for Clang, LLVM, and LLD including exclude list >> -Patch 4: Fix rust build failure by replacing target llvm-config with native >> > > Hi Deepesh, > > Thanks for the new version. > > While it runs correctly on the autobuilder, I'm noting it takes quite a > bit of time to run the tests. I'm not really against merging them, I > just want: > - to make everybody aware of that. > - to confirm with you these are some expected timings. > > Taking some random build in my branch: > > 2026-03-03 21:20:21,805 - oe-selftest - INFO - clang.LLDSelfTestSystemEmulated.test_lld (subunit.RemotedTestCase) > 2026-03-03 21:20:21,805 - oe-selftest - INFO - ... ok > 2026-03-03 21:20:21,805 - oe-selftest - INFO - 2: 1/1 18/21 (7205.57s) (0 failed) (clang.LLDSelfTestSystemEmulated.test_lld) > ... > 2026-03-04 00:56:44,671 - oe-selftest - INFO - clang.ClangSelfTestSystemEmulated.test_clang (subunit.RemotedTestCase) > 2026-03-04 00:56:44,671 - oe-selftest - INFO - ... ok > 2026-03-04 00:56:44,671 - oe-selftest - INFO - 1: 1/1 20/21 (20188.43s) (0 failed) (clang.ClangSelfTestSystemEmulated.test_clang) > 2026-03-04 01:37:34,036 - oe-selftest - INFO - clang.LLVMSelfTestSystemEmulated.test_llvm (subunit.RemotedTestCase) > 2026-03-04 01:37:34,036 - oe-selftest - INFO - ... ok > 2026-03-04 01:37:34,036 - oe-selftest - INFO - 3: 1/1 21/21 (22637.80s) (0 failed) (clang.LLVMSelfTestSystemEmulated.test_llvm) > > https://autobuilder.yoctoproject.org/valkyrie/#/builders/5/builds/3230 > > So first, we only had a few builds so far, maybe we just were a bit > unlucky (looking at the test, I believe sstate will not have any impact > in later builds). Also we already had some quite long tests in there, > but in some builds the test_clang / test_llvm really seems to take a > longer time. > > Thanks, > Mathieu I'm only realizing now, this series is also linked with this intermitent issue: https://bugzilla.yoctoproject.org/show_bug.cgi?id=16188. We should probably keep it aside for a few days, until we get something better. Thanks, Mathieu -- Mathieu Dubois-Briand, Bootlin Embedded Linux and Kernel engineering https://bootlin.com ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2026-03-05 6:37 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2026-03-02 10:43 [PATCH V3 0/4] Oe-selftest for Clang, LLVM, LLD Deepesh.Varatharajan 2026-03-02 10:43 ` [PATCH V3 1/4] clang-tools-extra: disable tests Deepesh.Varatharajan 2026-03-02 10:43 ` [PATCH V3 2/4] clang: Use CLANG_ENABLE_TESTSUITE to enable LLVM, Clang, and LLD tests Deepesh.Varatharajan 2026-03-02 10:43 ` [PATCH V3 3/4] oeqa/selftest/clang: Add oe-seltests for Clang/LLVM/LLD Deepesh.Varatharajan 2026-03-02 10:43 ` [PATCH V3 4/4] rust: Fix rust build failure Deepesh.Varatharajan 2026-03-04 18:28 ` [OE-core] [PATCH V3 0/4] Oe-selftest for Clang, LLVM, LLD Mathieu Dubois-Briand 2026-03-05 6:37 ` Mathieu Dubois-Briand
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox