Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[libc++/libc++abi/libunwind] Add new test configs for Clang runtime library. NFC. #82734

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

vvereschaka
Copy link
Contributor

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

…ibrary. NFC.

These configurations use the target "just-built" Clang's runtime library
(clang_rt.builtins) to link the tests.
@vvereschaka vvereschaka added libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. libc++abi libc++abi C++ Runtime Library. Not libc++. libunwind labels Feb 23, 2024
@vvereschaka vvereschaka self-assigned this Feb 23, 2024
@vvereschaka vvereschaka requested review from a team as code owners February 23, 2024 04:54
@llvmbot
Copy link
Collaborator

llvmbot commented Feb 23, 2024

@llvm/pr-subscribers-libcxx
@llvm/pr-subscribers-libunwind

@llvm/pr-subscribers-libcxxabi

Author: Vladimir Vereschaka (vvereschaka)

Changes

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 --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@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
+)

@vvereschaka
Copy link
Contributor Author

Also it fixes the llvm-libc++-static.cfg.in::mul_sat.pass.cpp test for some of the cross target builds
https://lab.llvm.org/buildbot/#/builders/143/builds/631/steps/14/logs/FAIL__llvm-libc__-static_cfg_in__mul_sat_pass_cpp

@vvereschaka
Copy link
Contributor Author

@ldionne , would take a quick look? These test configurations are based on the default llvm test configurations for the static libraries, but just added clang_rt library into the linker's command line.
Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
libc++abi libc++abi C++ Runtime Library. Not libc++. libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. libunwind
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants