[libcxx-commits] [libcxx] [libcxxabi] [libunwind] [libc++/libc++abi/libunwind] Add new test configs for Clang runtime library. NFC. (PR #82734)

via libcxx-commits libcxx-commits at lists.llvm.org
Thu Feb 22 20:54:43 PST 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libcxxabi

Author: Vladimir Vereschaka (vvereschaka)

<details>
<summary>Changes</summary>

These configurations use the target "just-built" Clang's runtime library (clang_rt.builtins) to link the tests.

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


3 Files Affected:

- (added) libcxx/test/configs/llvm-libc++-static-clang-rt.cfg.in (+32) 
- (added) libcxxabi/test/configs/llvm-libc++abi-static-clang-rt.cfg.in (+32) 
- (added) libunwind/test/configs/llvm-libunwind-static-clang-rt.cfg.in (+51) 


``````````diff
diff --git a/libcxx/test/configs/llvm-libc++-static-clang-rt.cfg.in b/libcxx/test/configs/llvm-libc++-static-clang-rt.cfg.in
new file mode 100644
index 00000000000000..ce6680ddc2908d
--- /dev/null
+++ b/libcxx/test/configs/llvm-libc++-static-clang-rt.cfg.in
@@ -0,0 +1,32 @@
+# This testing configuration handles running the test suite against LLVM's libc++
+# using a static library.
+#
+# This configuration uses a 'just-built' Clang runtime builtins library to link with
+# the tests instead of the target system library.
+#
+# Provided for testing of the LLVM/Clang toolchain builds.
+
+lit_config.load_config(config, '@CMAKE_CURRENT_BINARY_DIR@/cmake-bridge.cfg')
+
+config.substitutions.append(('%{flags}',
+    '-pthread' + (' -isysroot {}'.format('@CMAKE_OSX_SYSROOT@') if '@CMAKE_OSX_SYSROOT@' else '')
+))
+config.substitutions.append(('%{compile_flags}',
+    '-nostdinc++ -I %{include-dir} -I %{target-include-dir} -I %{libcxx-dir}/test/support'
+))
+config.substitutions.append(('%{link_flags}',
+    '-nostdlib++ -L %{lib-dir} -lclang_rt.builtins -lc++ -lc++abi'
+))
+config.substitutions.append(('%{exec}',
+    '%{executor} --execdir %T -- '
+))
+
+import os, site
+site.addsitedir(os.path.join('@LIBCXX_SOURCE_DIR@', 'utils'))
+import libcxx.test.params, libcxx.test.config
+libcxx.test.config.configure(
+    libcxx.test.params.DEFAULT_PARAMETERS,
+    libcxx.test.features.DEFAULT_FEATURES,
+    config,
+    lit_config
+)
diff --git a/libcxxabi/test/configs/llvm-libc++abi-static-clang-rt.cfg.in b/libcxxabi/test/configs/llvm-libc++abi-static-clang-rt.cfg.in
new file mode 100644
index 00000000000000..11b89e22fca9d6
--- /dev/null
+++ b/libcxxabi/test/configs/llvm-libc++abi-static-clang-rt.cfg.in
@@ -0,0 +1,32 @@
+# This testing configuration handles running the test suite against LLVM's libc++abi
+# using a static library.
+#
+# This configuration uses a 'just-built' Clang runtime builtins library to link with
+# the tests instead of the target system library.
+#
+# Provided for testing of the LLVM/Clang toolchain builds.
+
+lit_config.load_config(config, '@CMAKE_CURRENT_BINARY_DIR@/cmake-bridge.cfg')
+
+config.substitutions.append(('%{flags}',
+    '-isysroot {}'.format('@CMAKE_OSX_SYSROOT@') if '@CMAKE_OSX_SYSROOT@' else ''
+))
+config.substitutions.append(('%{compile_flags}',
+    '-nostdinc++ -I %{include} -I %{cxx-include} -I %{cxx-target-include} %{maybe-include-libunwind} -I %{libcxx}/test/support -I %{libcxx}/src -D_LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS'
+))
+config.substitutions.append(('%{link_flags}',
+    '-nostdlib++ -L %{lib} -lclang_rt.builtins -lc++ -lc++abi -pthread'
+))
+config.substitutions.append(('%{exec}',
+    '%{executor} --execdir %T -- '
+))
+
+import os, site
+site.addsitedir(os.path.join('@LIBCXXABI_LIBCXX_PATH@', 'utils'))
+import libcxx.test.params, libcxx.test.config
+libcxx.test.config.configure(
+    libcxx.test.params.DEFAULT_PARAMETERS,
+    libcxx.test.features.DEFAULT_FEATURES,
+    config,
+    lit_config
+)
diff --git a/libunwind/test/configs/llvm-libunwind-static-clang-rt.cfg.in b/libunwind/test/configs/llvm-libunwind-static-clang-rt.cfg.in
new file mode 100644
index 00000000000000..d908a5d55c891c
--- /dev/null
+++ b/libunwind/test/configs/llvm-libunwind-static-clang-rt.cfg.in
@@ -0,0 +1,51 @@
+# Configuration file for running the libunwind tests against the static library.
+#
+# This configuration uses a 'just-built' Clang runtime builtins library to link with
+# the tests instead of the target system library.
+#
+# Provided for testing of the LLVM/Clang toolchain builds.
+
+lit_config.load_config(config, '@CMAKE_CURRENT_BINARY_DIR@/cmake-bridge.cfg')
+
+compile_flags = []
+link_flags = ['-lclang_rt.builtins']
+
+if @LIBUNWIND_ENABLE_THREADS@:
+    link_flags.append('-lpthread')
+
+if @LIBUNWIND_ENABLE_CET@:
+    compile_flags.append('-fcf-protection=full')
+
+# On ELF platforms, link tests with -Wl,--export-dynamic if supported by the linker.
+if len('@CMAKE_EXE_EXPORTS_CXX_FLAG@'):
+    link_flags.append('@CMAKE_EXE_EXPORTS_CXX_FLAG@')
+
+if '@CMAKE_DL_LIBS@':
+    link_flags.append('-l at CMAKE_DL_LIBS@')
+
+# Stack unwinding tests need unwinding tables and these are not generated by default on all targets.
+compile_flags.append('-funwind-tables')
+
+local_sysroot = '@CMAKE_OSX_SYSROOT@' or '@CMAKE_SYSROOT@'
+config.substitutions.append(('%{flags}',
+    '-isysroot {}'.format(local_sysroot) if local_sysroot else ''
+))
+config.substitutions.append(('%{compile_flags}',
+    '-nostdinc++ -I %{{include}} {}'.format(' '.join(compile_flags))
+))
+config.substitutions.append(('%{link_flags}',
+    '%{{lib}}/libunwind.a {}'.format(' '.join(link_flags))
+))
+config.substitutions.append(('%{exec}',
+    '%{executor} --execdir %T -- '
+))
+
+import os, site
+site.addsitedir(os.path.join('@LIBUNWIND_LIBCXX_PATH@', 'utils'))
+import libcxx.test.params, libcxx.test.config
+libcxx.test.config.configure(
+    libcxx.test.params.DEFAULT_PARAMETERS,
+    libcxx.test.features.DEFAULT_FEATURES,
+    config,
+    lit_config
+)

``````````

</details>


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


More information about the libcxx-commits mailing list