[Lldb-commits] [lldb] [lldb] Only run libc++ tests when the architecture matches (PR #204267)

via lldb-commits lldb-commits at lists.llvm.org
Tue Jun 16 16:51:48 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lldb

Author: Alex Langford (bulbazord)

<details>
<summary>Changes</summary>

It does not make sense to run the libc++ tests when the libc++ dylib has an architecture that does not match the test binary.

I ran into this when running the test suite with arm64e test binaries and the locally-built libc++ is built arm64.

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


1 Files Affected:

- (modified) lldb/packages/Python/lldbsuite/test/dotest.py (+16) 


``````````diff
diff --git a/lldb/packages/Python/lldbsuite/test/dotest.py b/lldb/packages/Python/lldbsuite/test/dotest.py
index b1857780f1680..e630db7bca7e5 100644
--- a/lldb/packages/Python/lldbsuite/test/dotest.py
+++ b/lldb/packages/Python/lldbsuite/test/dotest.py
@@ -814,6 +814,22 @@ def canRunLibcxxTests():
     if lldbplatformutil.platformIsDarwin():
         if not configuration.libcxx_include_dir or not configuration.libcxx_library_dir:
             return False, "libc++ tests require a locally built libc++"
+
+        # Check that the libc++ architecture matches the test architecture.
+        test_architecture = lldbplatformutil.getArchitecture()
+
+        libcxx_dylib_path = os.path.join(
+            configuration.libcxx_library_dir, "libc++.dylib"
+        )
+        try:
+            libcxx_arch_list = subprocess.check_output(
+                ["lipo", "-archs", libcxx_dylib_path], encoding="utf-8"
+            ).split(" ")
+            if test_architecture not in libcxx_arch_list:
+                return False, f"libc++ dylib missing {test_architecture} slice"
+        except subprocess.CalledProcessError:
+            return False, "libc++ dylib is not present"
+
         return True, "libc++ present"
 
     if platform == "linux":

``````````

</details>


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


More information about the lldb-commits mailing list