llvmorg-github-actions[bot] wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Yihan Wang (yronglin)

<details>
<summary>Changes</summary>

Strengthen clang-repl lit tests by Avoid use `$LD_LIBRARY_PATH`. The lit's 
internal shell does not expand shell variables such as `$LD_LIBRARY_PATH`, so 
provide the current value as a lit substitution.

This PR can fix the following failures when user build llvm with non-system C++ 
standard library.
```
# executed command: env 'LD_LIBRARY_PATH=&lt;build 
dir&gt;/tools/clang/test/Interpreter/Output/cxx20-modules.cppm.tmp:$LD_LIBRARY_PATH'
 &lt;build dir&gt;/bin/clang-repl -Xcc=-std=c++20 
-Xcc=-fmodule-file=M=&lt;build 
dir&gt;/tools/clang/test/Interpreter/Output/cxx20-modules.cppm.tmp/mod.pcm 
-Xcc=--target=x86_64-linux-gnu
# .---command stderr------------
# | &lt;build dir&gt;/bin/clang-repl: /lib64/libstdc++.so.6: version 
`GLIBCXX_3.4.26' not found (required by &lt;build dir&gt;/bin/clang-repl)
# | &lt;build dir&gt;/bin/clang-repl: /lib64/libstdc++.so.6: version 
`GLIBCXX_3.4.29' not found (required by &lt;build dir&gt;/bin/clang-repl)
# | &lt;build dir&gt;/bin/clang-repl: /lib64/libstdc++.so.6: version 
`GLIBCXX_3.4.30' not found (required by &lt;build dir&gt;/bin/clang-repl)
# | &lt;build dir&gt;/bin/clang-repl: /lib64/libstdc++.so.6: version 
`CXXABI_1.3.13' not found (required by &lt;build dir&gt;/bin/clang-repl)
# `-----------------------------
```



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


3 Files Affected:

- (modified) clang/test/Interpreter/cxx20-modules.cppm (+1-1) 
- (modified) clang/test/Interpreter/dynamic-library.cpp (+1-1) 
- (modified) clang/test/Interpreter/lit.local.cfg (+8) 


``````````diff
diff --git a/clang/test/Interpreter/cxx20-modules.cppm 
b/clang/test/Interpreter/cxx20-modules.cppm
index 97744e3b25f77..aa52dabce89b6 100644
--- a/clang/test/Interpreter/cxx20-modules.cppm
+++ b/clang/test/Interpreter/cxx20-modules.cppm
@@ -9,7 +9,7 @@
 // RUN: %clang -fPIC %t/mod.pcm -c -o %t/mod.o --target=x86_64-linux-gnu
 // RUN: %clang -nostdlib -fPIC -shared %t/mod.o -o %t/libmod.so 
--target=x86_64-linux-gnu
 //
-// RUN: cat %t/import.cpp | env LD_LIBRARY_PATH=%t:$LD_LIBRARY_PATH \
+// RUN: cat %t/import.cpp | env LD_LIBRARY_PATH=%t:%ld_library_path \
 // RUN:     clang-repl -Xcc=-std=c++20 -Xcc=-fmodule-file=M=%t/mod.pcm \
 // RUN:     -Xcc=--target=x86_64-linux-gnu | FileCheck %t/import.cpp
 
diff --git a/clang/test/Interpreter/dynamic-library.cpp 
b/clang/test/Interpreter/dynamic-library.cpp
index 6c4621f729c1c..08206058cdbdf 100644
--- a/clang/test/Interpreter/dynamic-library.cpp
+++ b/clang/test/Interpreter/dynamic-library.cpp
@@ -14,7 +14,7 @@
 //
 // }
 
-// RUN: cat %s | env LD_LIBRARY_PATH=%S/Inputs:$LD_LIBRARY_PATH clang-repl | 
FileCheck %s
+// RUN: cat %s | env LD_LIBRARY_PATH=%S/Inputs:%ld_library_path clang-repl | 
FileCheck %s
 
 extern "C" int printf(const char* format, ...);
 
diff --git a/clang/test/Interpreter/lit.local.cfg 
b/clang/test/Interpreter/lit.local.cfg
index 37af5129d4eee..fa4e608deb6e3 100644
--- a/clang/test/Interpreter/lit.local.cfg
+++ b/clang/test/Interpreter/lit.local.cfg
@@ -4,3 +4,11 @@ unsupported_platforms = [ "system-aix", "system-zos" ]
 if "host-supports-jit" not in config.available_features or \
   any(up in config.available_features for up in unsupported_platforms):
     config.unsupported = True
+
+# lit's internal shell does not expand shell variables such as
+# $LD_LIBRARY_PATH, so provide the current value as a lit substitution.
+#
+# This lets tests prepend to LD_LIBRARY_PATH while preserving the entries
+# that lit already set up.
+config.substitutions.append(
+    ('%ld_library_path', config.environment.get('LD_LIBRARY_PATH', '')))

``````````

</details>


https://github.com/llvm/llvm-project/pull/208170
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to