[libcxx] Add Testing Configuration for LLVM libc
This patch adds a CMake cache, and the testing configs to build libc++ and run the tests against LLVM libc. Reviewers: ldionne, philnik777, jtstogel Pull Request: https://github.com/llvm/llvm-project/pull/165120
This commit is contained in:
62
libcxx/cmake/caches/Generic-llvm-libc.cmake
Normal file
62
libcxx/cmake/caches/Generic-llvm-libc.cmake
Normal file
@@ -0,0 +1,62 @@
|
||||
set(LIBUNWIND_ENABLE_SHARED OFF CACHE BOOL "")
|
||||
set(LIBUNWIND_INSTALL_LIBRARY ON CACHE BOOL "")
|
||||
set(LIBUNWIND_USE_COMPILER_RT ON CACHE BOOL "")
|
||||
|
||||
set(LIBCXXABI_ENABLE_SHARED OFF CACHE BOOL "")
|
||||
set(COMPILER_RT_CXX_LIBRARY "libcxx" CACHE STRING "")
|
||||
|
||||
set(COMPILER_RT_USE_LLVM_UNWINDER OFF CACHE BOOL "")
|
||||
set(COMPILER_RT_BUILD_BUILTINS ON CACHE BOOL "")
|
||||
set(COMPILER_RT_BUILD_CRT ON CACHE BOOL "")
|
||||
set(COMPILER_RT_BUILD_STANDALONE_LIBATOMIC OFF CACHE BOOL "")
|
||||
set(COMPILER_RT_HAS_FNO_BUILTIN_FLAG ON CACHE BOOL "")
|
||||
set(COMPILER_RT_BUILTINS_HIDE_SYMBOLS ON CACHE BOOL "")
|
||||
set(COMPILER_RT_HAS_VISIBILITY_HIDDEN_FLAG ON CACHE BOOL "")
|
||||
set(COMPILER_RT_BUILD_MEMPROF OFF CACHE BOOL "")
|
||||
set(COMPILER_RT_BUILD_PROFILE OFF CACHE BOOL "")
|
||||
set(COMPILER_RT_BUILD_SANITIZERS ON CACHE BOOL "")
|
||||
set(COMPILER_RT_BUILD_XRAY OFF CACHE BOOL "")
|
||||
set(COMPILER_RT_BUILD_ORC OFF CACHE BOOL "")
|
||||
set(COMPILER_RT_BUILD_LIBFUZZER OFF CACHE BOOL "")
|
||||
set(COMPILER_RT_DEBUG OFF CACHE BOOL "")
|
||||
set(COMPILER_RT_CRT_USE_EH_FRAME_REGISTRY ON CACHE BOOL "")
|
||||
|
||||
set(LIBCXXABI_USE_COMPILER_RT ON CACHE BOOL "")
|
||||
set(LIBCXXABI_USE_LLVM_UNWINDER OFF CACHE BOOL "")
|
||||
set(LIBCXX_ENABLE_SHARED OFF CACHE BOOL "")
|
||||
set(LIBCXX_USE_COMPILER_RT ON CACHE BOOL "")
|
||||
set(LIBCXX_INCLUDE_BENCHMARKS OFF CACHE BOOL "")
|
||||
|
||||
set(LIBCXX_ENABLE_STATIC ON CACHE BOOL "")
|
||||
set(LIBCXX_INSTALL_LIBRARY ON CACHE BOOL "")
|
||||
set(LIBCXX_CXX_ABI libcxxabi CACHE STRING "")
|
||||
|
||||
# Not yet fully implemented.
|
||||
set(LIBCXX_ENABLE_LOCALIZATION OFF CACHE BOOL "")
|
||||
set(LIBCXX_ENABLE_WIDE_CHARACTERS OFF CACHE BOOL "")
|
||||
|
||||
# Still missing some components.
|
||||
set(LIBCXX_ENABLE_FILESYSTEM OFF CACHE BOOL "")
|
||||
|
||||
# Still needs validation before turning on.
|
||||
set(LIBCXX_ENABLE_RANDOM_DEVICE OFF CACHE BOOL "")
|
||||
|
||||
# Still missing some components.
|
||||
set(LIBCXX_ENABLE_MONOTONIC_CLOCK OFF CACHE BOOL "")
|
||||
|
||||
# requires LIBCXX_ENABLE_MONOTONIC_CLOCK=ON
|
||||
set(LIBCXX_ENABLE_THREADS OFF CACHE BOOL "")
|
||||
set(LIBCXXABI_ENABLE_THREADS OFF CACHE BOOL "")
|
||||
|
||||
set(LIBCXX_ENABLE_UNICODE ON CACHE BOOL "")
|
||||
set(LIBCXX_ENABLE_EXCEPTIONS OFF CACHE BOOL "")
|
||||
set(LIBCXXABI_ENABLE_EXCEPTIONS OFF CACHE BOOL "")
|
||||
set(LIBCXX_ENABLE_RTTI OFF CACHE BOOL "")
|
||||
set(RUNTIMES_USE_LIBC "llvm-libc" CACHE STRING "")
|
||||
|
||||
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "")
|
||||
set(LLVM_ENABLE_RUNTIMES "compiler-rt;libc;libunwind;libcxxabi;libcxx" CACHE STRING "")
|
||||
set(LLVM_LIBC_FULL_BUILD ON CACHE BOOL "")
|
||||
set(LLVM_LIBC_INCLUDE_SCUDO ON CACHE BOOL "")
|
||||
set(COMPILER_RT_BUILD_GWP_ASAN OFF CACHE BOOL "")
|
||||
set(COMPILER_RT_BUILD_SCUDO_STANDALONE_WITH_LLVM_LIBC ON CACHE BOOL "")
|
||||
27
libcxx/test/configs/llvm-libc++-llvm-libc.cfg.in
Normal file
27
libcxx/test/configs/llvm-libc++-llvm-libc.cfg.in
Normal file
@@ -0,0 +1,27 @@
|
||||
# This testing configuration handles running the test suite against LLVM's libc++
|
||||
# using a static library.
|
||||
|
||||
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}',
|
||||
'-nostdlibinc -I %{include-dir} -I %{target-include-dir} -I @CMAKE_BINARY_DIR@/libc/include -I %{libcxx-dir}/test/support -idirafter @LIBC_KERNEL_HEADERS@'
|
||||
))
|
||||
config.substitutions.append(('%{link_flags}',
|
||||
'-nodefaultlibs -nostartfiles -L %{lib-dir} -lc++ -lc++abi @CMAKE_BINARY_DIR@/libc/startup/linux/crt1.o @CMAKE_BINARY_DIR@/libc/lib/libc.a @CMAKE_BINARY_DIR@/libc/lib/libm.a -static -fno-use-cxa-atexit @CMAKE_BINARY_DIR@/compiler-rt/lib/linux/libclang_rt.builtins-x86_64.a'
|
||||
))
|
||||
config.substitutions.append(('%{exec}',
|
||||
'%{executor} --execdir %{temp} -- '
|
||||
))
|
||||
|
||||
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
|
||||
)
|
||||
@@ -448,6 +448,26 @@ generic-hardening-mode-debug)
|
||||
check-runtimes
|
||||
check-abi-list
|
||||
;;
|
||||
generic-llvm-libc)
|
||||
clean
|
||||
|
||||
# Install kernel headers from a known-good Linux kernel version to ensure
|
||||
# the test is hermetic.
|
||||
export LINUX_VERSION=7.0.1
|
||||
mkdir -p "${BUILD_DIR}"
|
||||
curl -L "https://cdn.kernel.org/pub/linux/kernel/v7.x/linux-${LINUX_VERSION}.tar.xz" --output "${BUILD_DIR}/linux.tar.xz"
|
||||
tar -xf "${BUILD_DIR}/linux.tar.xz" -C "${BUILD_DIR}"
|
||||
make LLVM=1 INSTALL_HDR_PATH="${BUILD_DIR}/linux-install" -C "${BUILD_DIR}/linux-${LINUX_VERSION}" headers_install
|
||||
|
||||
generate-cmake-base -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-llvm-libc.cmake" \
|
||||
-DLIBCXX_TEST_CONFIG="llvm-libc++-llvm-libc.cfg.in" \
|
||||
-DLIBCXXABI_TEST_CONFIG="llvm-libc++abi-llvm-libc.cfg.in" \
|
||||
-DLIBC_KERNEL_HEADERS="${BUILD_DIR}/linux-install/include"
|
||||
# Ensure we have the builtins archive built as we pass it in explicitly in
|
||||
# the test config.
|
||||
ninja -vC "${BUILD_DIR}" libclang_rt.builtins-x86_64.a
|
||||
check-runtimes
|
||||
;;
|
||||
#
|
||||
# Module builds
|
||||
#
|
||||
|
||||
27
libcxxabi/test/configs/llvm-libc++abi-llvm-libc.cfg.in
Normal file
27
libcxxabi/test/configs/llvm-libc++abi-llvm-libc.cfg.in
Normal file
@@ -0,0 +1,27 @@
|
||||
# This testing configuration handles running the test suite against LLVM's libc++abi
|
||||
# using a static library.
|
||||
|
||||
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}',
|
||||
'-nodefaultlibs -nostartfiles -L %{lib} -lc++ -lc++abi -pthread @CMAKE_BINARY_DIR@/libc/startup/linux/crt1.o @CMAKE_BINARY_DIR@/libc/lib/libc.a -static -fno-use-cxa-atexit'
|
||||
))
|
||||
config.substitutions.append(('%{exec}',
|
||||
'%{executor} --execdir %{temp} -- '
|
||||
))
|
||||
|
||||
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
|
||||
)
|
||||
Reference in New Issue
Block a user