diff --git a/libcxx/utils/ci/apple-install-libcxx.sh b/libcxx/utils/ci/apple-install-libcxx.sh --- a/libcxx/utils/ci/apple-install-libcxx.sh +++ b/libcxx/utils/ci/apple-install-libcxx.sh @@ -122,7 +122,8 @@ -DCMAKE_OSX_ARCHITECTURES="${arch}" \ -DLIBCXXABI_LIBRARY_VERSION="${version}" \ -DLIBCXX_INCLUDE_BENCHMARKS=OFF \ - -DLIBCXX_TEST_CONFIG="apple-libc++-shared.cfg.in" + -DLIBCXX_TEST_CONFIG="apple-libc++-shared.cfg.in" \ + -DLIBCXXABI_TEST_CONFIG="apple-libc++abi-shared.cfg.in" ) xcrun --sdk "${sdk}" cmake --build "${build_dir}/${arch}" --target install-cxx install-cxxabi -- -v diff --git a/libcxx/utils/ci/run-buildbot b/libcxx/utils/ci/run-buildbot --- a/libcxx/utils/ci/run-buildbot +++ b/libcxx/utils/ci/run-buildbot @@ -373,7 +373,8 @@ x86_64-apple-system) clean generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Apple.cmake" \ - -DLIBCXX_TEST_CONFIG="apple-libc++-shared.cfg.in" + -DLIBCXX_TEST_CONFIG="apple-libc++-shared.cfg.in" \ + -DLIBCXXABI_TEST_CONFIG="apple-libc++abi-shared.cfg.in" check-runtimes ;; x86_64-apple-system-backdeployment-*) diff --git a/libcxxabi/CMakeLists.txt b/libcxxabi/CMakeLists.txt --- a/libcxxabi/CMakeLists.txt +++ b/libcxxabi/CMakeLists.txt @@ -178,9 +178,9 @@ set(LIBCXXABI_TEST_CONFIG "${CMAKE_CURRENT_SOURCE_DIR}/test/lit.site.cfg.in" CACHE STRING "The path to the Lit testing configuration to use when running the tests. - If a relative path is provided, it is assumed to be relative to '/libcxx/test/configs'.") + If a relative path is provided, it is assumed to be relative to '/libcxxabi/test/configs'.") if (NOT IS_ABSOLUTE "${LIBCXXABI_TEST_CONFIG}") - set(LIBCXXABI_TEST_CONFIG "${LIBCXXABI_LIBCXX_PATH}/test/configs/${LIBCXXABI_TEST_CONFIG}") + set(LIBCXXABI_TEST_CONFIG "${CMAKE_CURRENT_SOURCE_DIR}/test/configs/${LIBCXXABI_TEST_CONFIG}") endif() set(LIBCXXABI_TEST_PARAMS "" CACHE STRING "A list of parameters to run the Lit test suite with.") diff --git a/libcxxabi/test/CMakeLists.txt b/libcxxabi/test/CMakeLists.txt --- a/libcxxabi/test/CMakeLists.txt +++ b/libcxxabi/test/CMakeLists.txt @@ -100,6 +100,10 @@ serialize_lit_param("${name}" "\"${value}\"") endforeach() +configure_file("${CMAKE_CURRENT_SOURCE_DIR}/configs/cmake-bridge.cfg.in" + "${CMAKE_CURRENT_BINARY_DIR}/cmake-bridge.cfg" + @ONLY) + configure_lit_site_cfg( "${LIBCXXABI_TEST_CONFIG}" ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg diff --git a/libcxxabi/test/configs/apple-libc++abi-shared.cfg.in b/libcxxabi/test/configs/apple-libc++abi-shared.cfg.in new file mode 100644 --- /dev/null +++ b/libcxxabi/test/configs/apple-libc++abi-shared.cfg.in @@ -0,0 +1,29 @@ +# Testing configuration for Apple's system libc++abi. + +import sys + +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++ -isystem %{install}/include/c++/v1 -DLIBCXXABI_NO_TIMER -D_LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS ' + + '-I %{libcxx}/test/support -I %{libcxx}/src' +)) +config.substitutions.append(('%{link_flags}', + '-nostdlib++ -L %{install}/lib -lc++ -lc++abi' +)) +config.substitutions.append(('%{exec}', + '{} %{{libcxx}}/utils/run.py --execdir %T --env DYLD_LIBRARY_PATH=%{{install}}/lib -- '.format(sys.executable) +)) + +import os, site +site.addsitedir(os.path.join('@LIBCXXABI_LIBCXX_PATH@', 'utils')) +import libcxx.test.params, libcxx.test.newconfig, libcxx.test.newconfig +libcxx.test.newconfig.configure( + libcxx.test.params.DEFAULT_PARAMETERS, + libcxx.test.features.DEFAULT_FEATURES, + config, + lit_config +) diff --git a/libcxxabi/test/configs/cmake-bridge.cfg.in b/libcxxabi/test/configs/cmake-bridge.cfg.in new file mode 100644 --- /dev/null +++ b/libcxxabi/test/configs/cmake-bridge.cfg.in @@ -0,0 +1,31 @@ +@AUTO_GEN_COMMENT@ + +@SERIALIZED_LIT_PARAMS@ + +# +# This file performs the bridge between the CMake configuration and the Lit +# configuration files by setting up the LitConfig object and various Lit +# substitutions from CMake variables. +# +# Individual configuration files can take advantage of this bridge by +# loading the file and then setting up the remaining Lit substitutions. +# + +import os, site +site.addsitedir(os.path.join('@LIBCXXABI_LIBCXX_PATH@', 'utils')) +site.addsitedir(os.path.join('@LIBCXXABI_SOURCE_DIR@', 'test')) +import libcxx.test.format + +# Basic configuration of the test suite +config.name = os.path.basename('@LIBCXXABI_TEST_CONFIG@') +config.test_source_root = os.path.join('@LIBCXXABI_SOURCE_DIR@', 'test') +config.test_format = libcxx.test.format.CxxStandardLibraryTest() +config.recursiveExpansionLimit = 10 +config.test_exec_root = '@CMAKE_BINARY_DIR@' + +# TODO: This is a non-standard Lit attribute and we should have another way of accessing this. +config.host_triple = '@LLVM_HOST_TRIPLE@' + +config.substitutions.append(('%{cxx}', '@CMAKE_CXX_COMPILER@')) +config.substitutions.append(('%{libcxx}', '@LIBCXXABI_LIBCXX_PATH@')) +config.substitutions.append(('%{install}', '@CMAKE_BINARY_DIR@'))