diff --git a/libcxx/CMakeLists.txt b/libcxx/CMakeLists.txt --- a/libcxx/CMakeLists.txt +++ b/libcxx/CMakeLists.txt @@ -872,8 +872,8 @@ endif() if (LIBCXX_INCLUDE_TESTS) - add_subdirectory(test) add_subdirectory(lib/abi) + add_subdirectory(test) endif() if (LIBCXX_INCLUDE_DOCS) diff --git a/libcxx/lib/abi/CMakeLists.txt b/libcxx/lib/abi/CMakeLists.txt --- a/libcxx/lib/abi/CMakeLists.txt +++ b/libcxx/lib/abi/CMakeLists.txt @@ -55,26 +55,15 @@ ) if (TARGET cxx_shared) - set(abi_list_file "${CMAKE_CURRENT_SOURCE_DIR}/${abi_list_identifier}.abilist") - - if (EXISTS "${abi_list_file}") - add_custom_target(check-cxx-abilist - "${Python3_EXECUTABLE}" "${LIBCXX_SOURCE_DIR}/utils/sym_diff.py" - --only-stdlib-symbols - --strict "${abi_list_file}" - $ - DEPENDS cxx_shared - COMMENT "Testing libc++'s exported symbols against the ABI list") - else() - message(STATUS "ABI list file not generated for configuration ${abi_list_identifier}, `check-cxx-abilist` will not be available.") - endif() - - add_custom_target(generate-cxx-abilist - COMMAND "${Python3_EXECUTABLE}" "${LIBCXX_SOURCE_DIR}/utils/generate_abi_list.py" - --output "${abi_list_file}" - "$" - DEPENDS cxx_shared - COMMENT "Generating the ABI list file for configuration ${abi_list_identifier}") -else() - message(STATUS "Not building a shared library for libc++ -- the ABI list targets will not be available.") + set(abi_list_file "${CMAKE_CURRENT_SOURCE_DIR}/${abi_list_identifier}.abilist" PARENT_SCOPE) + add_custom_target(generate-cxx-abilist + if (NOT EXISTS "${abi_list_file}") + COMMAND "${Python3_EXECUTABLE}" "${LIBCXX_SOURCE_DIR}/../runtimes/utils/generate_abi_list.py" + --output "${abi_list_file}" + "$" + DEPENDS cxx_shared + COMMENT "Generating the ABI list file for configuration ${abi_list_identifier}") + else() + message(STATUS "Not building the ABI list targets - file already exists.") + endif() endif() diff --git a/libcxx/test/configs/cmake-bridge.cfg.in b/libcxx/test/configs/cmake-bridge.cfg.in --- a/libcxx/test/configs/cmake-bridge.cfg.in +++ b/libcxx/test/configs/cmake-bridge.cfg.in @@ -31,3 +31,5 @@ config.substitutions.append(('%{lib}', '@LIBCXX_LIBRARY_DIR@')) config.substitutions.append(('%{executor}', '@LIBCXX_EXECUTOR@')) config.substitutions.append(('%{test-tools}', '@LIBCXX_TEST_TOOLS_PATH@')) +config.substitutions.append(('%{abi-list-file}', '@abi_list_file@')) +config.substitutions.append(('%{shared-lib-name}', 'lib@LIBCXX_SHARED_OUTPUT_NAME@@CMAKE_SHARED_LIBRARY_SUFFIX@')) diff --git a/libcxx/test/libcxx/symbols/check_cxx_abilist.sh.cpp b/libcxx/test/libcxx/symbols/check_cxx_abilist.sh.cpp new file mode 100644 --- /dev/null +++ b/libcxx/test/libcxx/symbols/check_cxx_abilist.sh.cpp @@ -0,0 +1,6 @@ +// RUN: %{python} %{libcxx}/../runtimes/utils/sym_diff.py \ +// RUN: --only-stdlib-symbols \ +// RUN: --strict \ +// RUN: %{abi-list-file} \ +// RUN: %{lib}/%{shared-lib-name} \ +// RUN: 2>&1 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 @@ -145,15 +145,9 @@ ${NINJA} -vC "${BUILD_DIR}" check-unwind } -# TODO: The goal is to test this against all configurations. We should also move -# this to the Lit test suite instead of being a separate CMake target. -function check-abi-list() { - echo "+++ Running the libc++ ABI list test" - ${NINJA} -vC "${BUILD_DIR}" check-cxx-abilist || ( - echo "+++ Generating the libc++ ABI list after failed check" - ${NINJA} -vC "${BUILD_DIR}" generate-cxx-abilist - false - ) +function generate-abi-list() { + echo "+++ Generating the libc++ ABI list" + ${NINJA} -vC "${BUILD_DIR}" generate-cxx-abilist } function check-cxx-benchmarks() { @@ -241,43 +235,43 @@ clean generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx03.cmake" check-runtimes - check-abi-list + generate-abi-list ;; generic-cxx11) clean generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx11.cmake" check-runtimes - check-abi-list + generate-abi-list ;; generic-cxx14) clean generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx14.cmake" check-runtimes - check-abi-list + generate-abi-list ;; generic-cxx17) clean generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx17.cmake" check-runtimes - check-abi-list + generate-abi-list ;; generic-cxx20) clean generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx20.cmake" check-runtimes - check-abi-list + generate-abi-list ;; generic-cxx23) clean generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx23.cmake" check-runtimes - check-abi-list + generate-abi-list ;; generic-cxx26) clean generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx26.cmake" check-runtimes - check-abi-list + generate-abi-list ;; # # Other compiler support @@ -366,7 +360,7 @@ clean generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-assertions.cmake" check-runtimes - check-abi-list + generate-abi-list ;; generic-debug-mode) clean @@ -383,13 +377,13 @@ clean generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-modules.cmake" check-runtimes - check-abi-list + generate-abi-list ;; generic-modules-lsv) clean generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-modules-lsv.cmake" check-runtimes - check-abi-list + generate-abi-list ;; # # Parts removed @@ -428,13 +422,13 @@ clean generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-experimental.cmake" check-runtimes - check-abi-list + generate-abi-list ;; generic-no-exceptions) clean generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-exceptions.cmake" check-runtimes - check-abi-list + generate-abi-list ;; # # Other miscellaneous jobs @@ -647,7 +641,7 @@ -DLIBCXX_TEST_CONFIG="ibm-libc++-shared.cfg.in" \ -DLIBCXXABI_TEST_CONFIG="ibm-libc++abi-shared.cfg.in" \ -DLIBUNWIND_TEST_CONFIG="ibm-libunwind-shared.cfg.in" - check-abi-list + generate-abi-list check-runtimes ;; #################################################################