From fb6607c097e34e36570aad78b1f1dbde2cf26592 Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Tue, 28 Nov 2023 20:20:05 +0300 Subject: [PATCH] Removed CMake self-test. Added running tests through CMake in GHA CI. Running tests via CMake should be enough of a verification that the library CMakeLists.txt is correct. It also verifies that test/CMakeLists.txt is correct. --- .github/workflows/ci.yml | 17 ++++++++++------- test/test_cmake/CMakeLists.txt | 21 --------------------- test/test_cmake/main.cpp | 22 ---------------------- 3 files changed, 10 insertions(+), 50 deletions(-) delete mode 100644 test/test_cmake/CMakeLists.txt delete mode 100644 test/test_cmake/main.cpp diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 054d701..4460b1f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -487,17 +487,20 @@ jobs: B2_ARGS+=("libs/$LIBRARY/test") ./b2 "${B2_ARGS[@]}" - - name: Run CMake tests + - name: Build CMake tests if: matrix.cmake_tests run: | cd ../boost-root mkdir __build_static__ && cd __build_static__ - cmake ../libs/$LIBRARY/test/test_cmake - cmake --build . --target boost_${LIBRARY}_cmake_self_test -j $BUILD_JOBS - cd .. - mkdir __build_shared__ && cd __build_shared__ - cmake -DBUILD_SHARED_LIBS=On ../libs/$LIBRARY/test/test_cmake - cmake --build . --target boost_${LIBRARY}_cmake_self_test -j $BUILD_JOBS + cmake -DBOOST_INCLUDE_LIBRARIES=$LIBRARY -DBUILD_TESTING=ON .. + cmake --build . --target tests -j $BUILD_JOBS + + - name: Run CMake tests + if: matrix.cmake_tests + run: | + cd ../boost-root + cd __build_static__ + ctest --output-on-failure --no-tests=error windows: strategy: diff --git a/test/test_cmake/CMakeLists.txt b/test/test_cmake/CMakeLists.txt deleted file mode 100644 index 6a53ae7..0000000 --- a/test/test_cmake/CMakeLists.txt +++ /dev/null @@ -1,21 +0,0 @@ -# Copyright 2023 Andrey Semashev -# -# Distributed under the Boost Software License, Version 1.0. -# (See accompanying file LICENSE_1_0.txt or copy at -# https://www.boost.org/LICENSE_1_0.txt) -# -# NOTE: This does NOT run the unit tests for Boost.Scope. -# It only tests if the CMakeLists.txt file in it's root works as expected. - -cmake_minimum_required(VERSION 3.5) - -project(BoostScopeCMakeSelfTest) - -# Use experimental superproject to pull library dependencies recursively -set(BOOST_ENABLE_CMAKE 1) -add_subdirectory(../../../.. "${CMAKE_CURRENT_BINARY_DIR}/boost_superproject") - -add_definitions(-DBOOST_ALL_NO_LIB) - -add_executable(boost_scope_cmake_self_test main.cpp) -target_link_libraries(boost_scope_cmake_self_test Boost::scope) diff --git a/test/test_cmake/main.cpp b/test/test_cmake/main.cpp deleted file mode 100644 index 864e109..0000000 --- a/test/test_cmake/main.cpp +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Distributed under the Boost Software License, Version 1.0. - * (See accompanying file LICENSE_1_0.txt or copy at - * https://www.boost.org/LICENSE_1_0.txt) - * - * Copyright (c) 2023 Andrey Semashev - */ - -#include - -struct exit_func -{ - void operator()() const noexcept - { - } -}; - -int main() -{ - boost::scope::scope_exit< exit_func > guard{ exit_func() }; - return 0; -}