[llvm-branch-commits] [compiler-rt] [compiler-rt] Allow running tests without installing first (PR #83088)

Alexander Richardson via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Mar 12 23:10:54 PDT 2024


================
@@ -168,10 +169,45 @@ def push_dynamic_library_lookup_path(config, new_path):
             r"/i386(?=-[^/]+$)", "/x86_64", config.compiler_rt_libdir
         )
 
+
+# Check if the test compiler resource dir matches the local build directory
+# (which happens with -DLLVM_ENABLE_PROJECTS=clang;compiler-rt) or if we are
+# using an installed clang to test compiler-rt standalone. In the latter case
+# we may need to override the resource dir to match the path of the just-built
+# compiler-rt libraries.
+test_cc_resource_dir, _ = get_path_from_clang(
+    shlex.split(config.target_cflags) + ["-print-resource-dir"], allow_failure=True
+)
+# Normalize the path for comparison
+if test_cc_resource_dir is not None:
+    test_cc_resource_dir = os.path.realpath(test_cc_resource_dir)
+if lit_config.debug:
+    lit_config.note(f"Resource dir for {config.clang} is {test_cc_resource_dir}")
+local_build_resource_dir = os.path.realpath(config.compiler_rt_output_dir)
+if test_cc_resource_dir != local_build_resource_dir:
+    if config.test_standalone_build_libs and config.compiler_id == "Clang":
----------------
arichardson wrote:

That absolutely makes sense and I'll add that warning. Using GCC currently already fails with obscure errors later, but having a warning before should make that less surprising :)

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


More information about the llvm-branch-commits mailing list