From dc7bbab87545e73da3731194f1f856ddd42c0cb2 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Fri, 27 Dec 2019 05:12:37 +0200 Subject: [PATCH 1/5] Add CMake testing support --- .travis.yml | 11 ++++++++++- CMakeLists.txt | 8 ++++++++ test/CMakeLists.txt | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 test/CMakeLists.txt diff --git a/.travis.yml b/.travis.yml index 85fa40e62e..cc7149ac99 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,6 +18,7 @@ branches: only: - master - develop + - /feature\/.*/ env: matrix: @@ -311,10 +312,18 @@ matrix: env: TOOLSET=clang COMPILER=clang++ CXXSTD=03,11,14,1z osx_image: xcode7.3 + - os: linux + env: CMAKE=1 + script: + - mkdir __build__ && cd __build__ + - cmake -DBOOST_ENABLE_CMAKE=1 -DBoost_DEBUG=1 .. + - ctest --output-on-failure -R boost_type_traits + install: + - BOOST_BRANCH=develop && [ "$TRAVIS_BRANCH" == "master" ] && BOOST_BRANCH=master || true - cd .. - - git clone -b $TRAVIS_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root + - git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root - cd boost-root - git submodule update --init tools/build - git submodule update --init tools/boost_install diff --git a/CMakeLists.txt b/CMakeLists.txt index 8adf7802a3..cce3299651 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,3 +28,11 @@ if(BOOST_SUPERPROJECT_VERSION) boost_install(TARGETS boost_type_traits HEADER_DIRECTORY include/) endif() + +# BUILD_TESTING is the standard CTest variable that enables testing + +if(BUILD_TESTING) + + add_subdirectory(test) + +endif() diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt new file mode 100644 index 0000000000..eddad2e727 --- /dev/null +++ b/test/CMakeLists.txt @@ -0,0 +1,34 @@ +# Copyright 2018, 2019 Peter Dimov +# Distributed under the Boost Software License, Version 1.0. +# See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt + +include(BoostTestJamfile OPTIONAL RESULT_VARIABLE HAVE_BOOST_TEST) + +if(HAVE_BOOST_TEST) + + set(link_libraries Boost::type_traits Boost::core Boost::function Boost::mpl) + set(compile_definitions CI_SUPPRESS_KNOWN_ISSUES) + + file(GLOB rtests RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*_test*.cpp") + + foreach(test IN LISTS rtests) + + boost_test(TYPE run SOURCES ${test} COMPILE_DEFINITIONS ${compile_definitions} LINK_LIBRARIES ${link_libraries}) + + endforeach() + + file(GLOB cftests RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "compile_fail/*.cpp") + + foreach(test IN LISTS cftests) + + boost_test(TYPE compile-fail SOURCES ${test} COMPILE_DEFINITIONS ${compile_definitions} LINK_LIBRARIES ${link_libraries}) + + endforeach() + + foreach(test IN ITEMS has_nothrow_assign_test has_nothrow_constr_test has_nothrow_copy_test is_nothrow_move_assignable_test is_nothrow_move_constructible_test) + + boost_test(TYPE run NAME ${test}_no_intrinsics SOURCES ${test}.cpp COMPILE_DEFINITIONS BOOST_TT_DISABLE_INTRINSICS ${compile_definitions} LINK_LIBRARIES ${link_libraries}) + + endforeach() + +endif() From 445fbf5fd492c88b0d8b4cf7a6e88356b6ad2e1f Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Fri, 27 Dec 2019 07:24:06 +0200 Subject: [PATCH 2/5] Use depinst --- .travis.yml | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/.travis.yml b/.travis.yml index cc7149ac99..8228eb262d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -325,24 +325,9 @@ install: - cd .. - git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root - cd boost-root - - git submodule update --init tools/build - - git submodule update --init tools/boost_install - - git submodule update --init libs/headers - - git submodule update --init libs/config - - git submodule update --init libs/assert - - git submodule update --init libs/bind - - git submodule update --init libs/core - - git submodule update --init libs/detail - - git submodule update --init libs/function - - git submodule update --init libs/integer - - git submodule update --init libs/move - - git submodule update --init libs/mpl - - git submodule update --init libs/preprocessor - - git submodule update --init libs/static_assert - - git submodule update --init libs/throw_exception - - git submodule update --init libs/type_index - - git submodule update --init libs/utility + - git submodule update --init tools/boostdep - cp -r $TRAVIS_BUILD_DIR/* libs/type_traits + - python tools/boostdep/depinst/depinst.py type_traits - ./bootstrap.sh - ./b2 headers From dd1f936eb3c87a4e27107c8aad8d0f01ff20147d Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Sun, 29 Dec 2019 18:55:05 +0200 Subject: [PATCH 3/5] Use Boost_VERBOSE instead of Boost_DEBUG --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 8228eb262d..43c345f28c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -316,7 +316,7 @@ matrix: env: CMAKE=1 script: - mkdir __build__ && cd __build__ - - cmake -DBOOST_ENABLE_CMAKE=1 -DBoost_DEBUG=1 .. + - cmake -DBOOST_ENABLE_CMAKE=1 -DBoost_VERBOSE=1 .. - ctest --output-on-failure -R boost_type_traits From 4f742cb30d584e9c567f49aecf6f4978a4c5d791 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Sun, 29 Dec 2019 19:01:13 +0200 Subject: [PATCH 4/5] Use test globals --- test/CMakeLists.txt | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index eddad2e727..4913af09e8 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -4,31 +4,31 @@ include(BoostTestJamfile OPTIONAL RESULT_VARIABLE HAVE_BOOST_TEST) -if(HAVE_BOOST_TEST) - - set(link_libraries Boost::type_traits Boost::core Boost::function Boost::mpl) - set(compile_definitions CI_SUPPRESS_KNOWN_ISSUES) +if(NOT HAVE_BOOST_TEST) + return() +endif() - file(GLOB rtests RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*_test*.cpp") +set(BOOST_TEST_LINK_LIBRARIES Boost::type_traits Boost::core Boost::function Boost::mpl) +set(BOOST_TEST_COMPILE_DEFINITIONS CI_SUPPRESS_KNOWN_ISSUES) - foreach(test IN LISTS rtests) +file(GLOB rtests RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*_test*.cpp") - boost_test(TYPE run SOURCES ${test} COMPILE_DEFINITIONS ${compile_definitions} LINK_LIBRARIES ${link_libraries}) +foreach(test IN LISTS rtests) - endforeach() + boost_test(TYPE run SOURCES ${test}) - file(GLOB cftests RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "compile_fail/*.cpp") +endforeach() - foreach(test IN LISTS cftests) +file(GLOB cftests RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "compile_fail/*.cpp") - boost_test(TYPE compile-fail SOURCES ${test} COMPILE_DEFINITIONS ${compile_definitions} LINK_LIBRARIES ${link_libraries}) +foreach(test IN LISTS cftests) - endforeach() + boost_test(TYPE compile-fail SOURCES ${test}) - foreach(test IN ITEMS has_nothrow_assign_test has_nothrow_constr_test has_nothrow_copy_test is_nothrow_move_assignable_test is_nothrow_move_constructible_test) +endforeach() - boost_test(TYPE run NAME ${test}_no_intrinsics SOURCES ${test}.cpp COMPILE_DEFINITIONS BOOST_TT_DISABLE_INTRINSICS ${compile_definitions} LINK_LIBRARIES ${link_libraries}) +foreach(test IN ITEMS has_nothrow_assign_test has_nothrow_constr_test has_nothrow_copy_test is_nothrow_move_assignable_test is_nothrow_move_constructible_test) - endforeach() + boost_test(TYPE run NAME ${test}_no_intrinsics SOURCES ${test}.cpp COMPILE_DEFINITIONS BOOST_TT_DISABLE_INTRINSICS) -endif() +endforeach() From c035209a3c7e97541d0dffa3decdded72a68d3d5 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Mon, 30 Dec 2019 00:31:56 +0200 Subject: [PATCH 5/5] Use -DBOOST_INCLUDE_LIBRARIES=type_traits --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 43c345f28c..4b9c75fb1a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -316,7 +316,7 @@ matrix: env: CMAKE=1 script: - mkdir __build__ && cd __build__ - - cmake -DBOOST_ENABLE_CMAKE=1 -DBoost_VERBOSE=1 .. + - cmake -DBOOST_ENABLE_CMAKE=1 -DBoost_VERBOSE=1 -DBOOST_INCLUDE_LIBRARIES=type_traits .. - ctest --output-on-failure -R boost_type_traits