diff --git a/libcxx/cmake/caches/AIX.cmake b/libcxx/cmake/caches/AIX.cmake --- a/libcxx/cmake/caches/AIX.cmake +++ b/libcxx/cmake/caches/AIX.cmake @@ -14,3 +14,6 @@ set(LIBCXXABI_ENABLE_SHARED ON CACHE BOOL "") set(LIBCXXABI_ENABLE_STATIC OFF CACHE BOOL "") set(LIBCXX_CXX_ABI libcxxabi CACHE STRING "") +set(LIBCXXABI_USE_LLVM_UNWINDER ON CACHE BOOL "") +set(LIBUNWIND_ENABLE_SHARED ON CACHE BOOL "") +set(LIBUNWIND_ENABLE_STATIC OFF CACHE BOOL "") 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 @@ -603,10 +603,10 @@ generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/AIX.cmake" \ -DLIBCXX_TEST_CONFIG="ibm-libc++-shared.cfg.in" \ -DLIBCXXABI_TEST_CONFIG="ibm-libc++abi-shared.cfg.in" \ - -DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi" - # TODO: use check-runtimes once libunwind builds cleanly on AIX. - ${NINJA} -vC "${BUILD_DIR}" install-cxx install-cxxabi - ${NINJA} -vC "${BUILD_DIR}" check-cxx check-cxxabi + -DLIBUNWIND_TEST_CONFIG="ibm-libunwind-shared.cfg.in" \ + -DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi;libunwind" + ${NINJA} -vC "${BUILD_DIR}" install-cxx install-cxxabi install-unwind + check-runtimes ;; ################################################################# # Insert vendor-specific internal configurations below. diff --git a/libunwind/test/CMakeLists.txt b/libunwind/test/CMakeLists.txt --- a/libunwind/test/CMakeLists.txt +++ b/libunwind/test/CMakeLists.txt @@ -48,6 +48,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( "${LIBUNWIND_TEST_CONFIG}" ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg diff --git a/libunwind/test/configs/cmake-bridge.cfg.in b/libunwind/test/configs/cmake-bridge.cfg.in new file mode 100644 --- /dev/null +++ b/libunwind/test/configs/cmake-bridge.cfg.in @@ -0,0 +1,36 @@ +@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('@LIBUNWIND_LIBCXX_PATH@', 'utils')) +site.addsitedir(os.path.join('@LIBUNWIND_SOURCE_DIR@', 'test')) +import libcxx.test.format + +# Basic configuration of the test suite +config.name = os.path.basename('@LIBUNWIND_TEST_CONFIG@') +config.test_source_root = os.path.join('@LIBUNWIND_SOURCE_DIR@', 'test') +config.test_format = libcxx.test.format.CxxStandardLibraryTest() +config.recursiveExpansionLimit = 10 +config.test_exec_root = '@CMAKE_BINARY_DIR@' +config.target_info = "@LIBUNWIND_TARGET_INFO@" + +# 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(('%{include}', '@LIBUNWIND_SOURCE_DIR@/include')) +config.substitutions.append(('%{cxx-include}', '@LIBCXXABI_HEADER_DIR@/include/c++/v1')) +config.substitutions.append(('%{cxx-target-include}', '@LIBCXXABI_HEADER_DIR@/%{triple}/include/c++/v1')) +config.substitutions.append(('%{lib}', '@LIBUNWIND_LIBRARY_DIR@')) +config.substitutions.append(('%{executor}', '@LIBUNWIND_EXECUTOR@')) diff --git a/libunwind/test/configs/ibm-libunwind-shared.cfg.in b/libunwind/test/configs/ibm-libunwind-shared.cfg.in new file mode 100644 --- /dev/null +++ b/libunwind/test/configs/ibm-libunwind-shared.cfg.in @@ -0,0 +1,34 @@ +@AUTO_GEN_COMMENT@ + +@SERIALIZED_LIT_PARAMS@ + +# +# Testing configuration for libunwind on AIX. +# +# This file is a lot simpler than the ones for libc++ and libc++abi because +# while libunwind is written in C++, it doesn't use the C++ Standard Library +# so we don't need to set that up to run the tests correctly. +# + +lit_config.load_config(config, '@CMAKE_CURRENT_BINARY_DIR@/cmake-bridge.cfg') + +config.substitutions.append(('%{flags}', '')) +config.substitutions.append(('%{compile_flags}', + '-nostdinc++ -I %{include} -I %{cxx-include}' +)) +config.substitutions.append(('%{link_flags}', + '-nostdlib++ -L %{lib} -lunwind -ldl -Wl,-bbigtoc' +)) +config.substitutions.append(('%{exec}', + '%{executor} --execdir %T --env LIBPATH=%{lib} -- ' +)) + +import os, site +site.addsitedir(os.path.join('@LIBUNWIND_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/libunwind/test/configs/llvm-libunwind-shared.cfg.in b/libunwind/test/configs/llvm-libunwind-shared.cfg.in --- a/libunwind/test/configs/llvm-libunwind-shared.cfg.in +++ b/libunwind/test/configs/llvm-libunwind-shared.cfg.in @@ -10,17 +10,7 @@ # so we don't need to set that up to run the tests correctly. # -import os, site -site.addsitedir(os.path.join('@LIBUNWIND_LIBCXX_PATH@', 'utils')) -import libcxx.test.format - -# Basic configuration of the test suite -config.name = os.path.basename('@LIBUNWIND_TEST_CONFIG@') -config.test_source_root = os.path.join('@LIBUNWIND_SOURCE_DIR@', 'test') -config.test_format = libcxx.test.format.CxxStandardLibraryTest() -config.recursiveExpansionLimit = 10 -config.test_exec_root = '@CMAKE_BINARY_DIR@' -config.target_info = "@LIBUNWIND_TARGET_INFO@" +lit_config.load_config(config, '@CMAKE_CURRENT_BINARY_DIR@/cmake-bridge.cfg') compile_flags = [] link_flags = [] @@ -39,9 +29,6 @@ # Stack unwinding tests need unwinding tables and these are not generated by default on all targets. compile_flags.append('-funwind-tables') -config.substitutions.append(('%{executor}', '@LIBUNWIND_EXECUTOR@')) - -config.substitutions.append(('%{cxx}', '@CMAKE_CXX_COMPILER@')) local_sysroot = '@CMAKE_OSX_SYSROOT@' or '@CMAKE_SYSROOT@' config.substitutions.append(('%{flags}', '-isysroot {}'.format(local_sysroot) if local_sysroot else '' diff --git a/libunwind/test/configs/llvm-libunwind-static.cfg.in b/libunwind/test/configs/llvm-libunwind-static.cfg.in --- a/libunwind/test/configs/llvm-libunwind-static.cfg.in +++ b/libunwind/test/configs/llvm-libunwind-static.cfg.in @@ -10,17 +10,7 @@ # so we don't need to set that up to run the tests correctly. # -import os, site -site.addsitedir(os.path.join('@LIBUNWIND_LIBCXX_PATH@', 'utils')) -import libcxx.test.format - -# Basic configuration of the test suite -config.name = os.path.basename('@LIBUNWIND_TEST_CONFIG@') -config.test_source_root = os.path.join('@LIBUNWIND_SOURCE_DIR@', 'test') -config.test_format = libcxx.test.format.CxxStandardLibraryTest() -config.recursiveExpansionLimit = 10 -config.test_exec_root = '@CMAKE_BINARY_DIR@' -config.target_info = "@LIBUNWIND_TARGET_INFO@" +lit_config.load_config(config, '@CMAKE_CURRENT_BINARY_DIR@/cmake-bridge.cfg') compile_flags = [] link_flags = [] @@ -43,10 +33,6 @@ # Stack unwinding tests need unwinding tables and these are not generated by default on all targets. compile_flags.append('-funwind-tables') -config.substitutions.append(('%{executor}', '@LIBUNWIND_EXECUTOR@')) - -config.substitutions.append(('%{cxx}', '@CMAKE_CXX_COMPILER@')) - local_sysroot = '@CMAKE_OSX_SYSROOT@' or '@CMAKE_SYSROOT@' config.substitutions.append(('%{flags}', '-isysroot {}'.format(local_sysroot) if local_sysroot else ''