[libc++] Add a testing configuration specific to Apple's libc++

Apple's libc++ has a few differences with the LLVM libc++, and it is
necessary to use a custom configuration file to test it properly.

Differential Revision: https://reviews.llvm.org/D110777
This commit is contained in:
Louis Dionne 2021-09-29 14:56:42 -04:00
parent 0781461959
commit c15bbdeaff
3 changed files with 74 additions and 3 deletions

View File

@ -0,0 +1,70 @@
@AUTO_GEN_COMMENT@
@SERIALIZED_LIT_PARAMS@
#
# Testing configuration for Apple's system libc++.
#
# This configuration differs from a normal LLVM shared library configuration in
# that we must use DYLD_LIBRARY_PATH to run the tests against the just-built library,
# since Apple's libc++ has an absolute install_name.
#
# We also don't use a per-target include directory layout, so we have only one
# include directory for the libc++ headers.
#
LIBCXX_ROOT = "@LIBCXX_SOURCE_DIR@"
INSTALL_ROOT = "@CMAKE_BINARY_DIR@"
COMPILER = "@CMAKE_CXX_COMPILER@"
EXEC_ROOT = "@LIBCXX_BINARY_DIR@"
CMAKE_OSX_SYSROOT = "@CMAKE_OSX_SYSROOT@"
INCLUDE_DIR = "@LIBCXX_INSTALL_INCLUDE_DIR@"
LIBRARY_DIR = "@LIBCXX_INSTALL_LIBRARY_DIR@"
import os
import pipes
import site
import sys
site.addsitedir(os.path.join(LIBCXX_ROOT, 'utils'))
import libcxx.test.features
import libcxx.test.format
import libcxx.test.newconfig
import libcxx.test.params
# Configure basic properties of the test suite
config.name = 'libcxx-trunk-shared'
config.test_source_root = os.path.join(LIBCXX_ROOT, 'test')
config.test_format = libcxx.test.format.CxxStandardLibraryTest()
config.recursiveExpansionLimit = 10
config.test_exec_root = EXEC_ROOT
# Configure basic substitutions
runPy = os.path.join(LIBCXX_ROOT, 'utils', 'run.py')
config.substitutions.append(('%{cxx}', COMPILER))
config.substitutions.append(('%{flags}',
'-isysroot {}'.format(CMAKE_OSX_SYSROOT) if CMAKE_OSX_SYSROOT else ''
))
config.substitutions.append(('%{compile_flags}',
'-nostdinc++ -isystem {} -I {}'.format(
os.path.join(INSTALL_ROOT, INCLUDE_DIR),
os.path.join(LIBCXX_ROOT, 'test', 'support'))
))
config.substitutions.append(('%{link_flags}',
'-nostdlib++ -L {} -lc++'.format(
os.path.join(INSTALL_ROOT, LIBRARY_DIR))
))
config.substitutions.append(('%{exec}',
'{} {} --execdir %T --env DYLD_LIBRARY_PATH={} -- '.format(
pipes.quote(sys.executable),
pipes.quote(runPy),
pipes.quote(os.path.join(INSTALL_ROOT, LIBRARY_DIR)))
))
config.substitutions.append(('%{install}', INSTALL_ROOT))
# Add parameters and features to the config
libcxx.test.newconfig.configure(
libcxx.test.params.DEFAULT_PARAMETERS,
libcxx.test.features.DEFAULT_FEATURES,
config,
lit_config
)

View File

@ -121,7 +121,8 @@ for arch in ${architectures}; do
-DCMAKE_INSTALL_NAME_DIR="/usr/lib" \
-DCMAKE_OSX_ARCHITECTURES="${arch}" \
-DLIBCXXABI_LIBRARY_VERSION="${version}" \
-DLIBCXX_INCLUDE_BENCHMARKS=OFF
-DLIBCXX_INCLUDE_BENCHMARKS=OFF \
-DLIBCXX_TEST_CONFIG="${llvm_root}/libcxx/test/configs/apple-libc++-shared.cfg.in"
)
xcrun --sdk "${sdk}" cmake --build "${build_dir}/${arch}" --target install-cxx install-cxxabi -- -v

View File

@ -362,7 +362,7 @@ generic-no-unicode)
x86_64-apple-system)
clean
generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Apple.cmake" \
-DLIBCXX_TEST_CONFIG="${MONOREPO_ROOT}/libcxx/test/configs/llvm-libc++-shared.cfg.in"
-DLIBCXX_TEST_CONFIG="${MONOREPO_ROOT}/libcxx/test/configs/apple-libc++-shared.cfg.in"
check-cxx-cxxabi
;;
x86_64-apple-system-noexceptions)
@ -370,7 +370,7 @@ x86_64-apple-system-noexceptions)
generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Apple.cmake" \
-DLIBCXX_ENABLE_EXCEPTIONS=OFF \
-DLIBCXXABI_ENABLE_EXCEPTIONS=OFF \
-DLIBCXX_TEST_CONFIG="${MONOREPO_ROOT}/libcxx/test/configs/llvm-libc++-shared.cfg.in"
-DLIBCXX_TEST_CONFIG="${MONOREPO_ROOT}/libcxx/test/configs/apple-libc++-shared.cfg.in"
check-cxx-cxxabi
;;
x86_64-apple-system-backdeployment-*)