diff --git a/.travis.yml b/.travis.yml index 4f49868..8f4ccac 100644 --- a/.travis.yml +++ b/.travis.yml @@ -304,15 +304,38 @@ matrix: env: TOOLSET=clang COMPILER=clang++ CXXSTD=03,11,14,1z osx_image: xcode10.1 + - os: linux + env: CMAKE_TEST=1 + script: + - mkdir __build__ && cd __build__ + - cmake -DBOOST_ENABLE_CMAKE=1 -DBoost_VERBOSE=1 -DBOOST_INCLUDE_LIBRARIES=core .. + - ctest --output-on-failure -R boost_core + - os: linux compiler: g++ env: CMAKE_SUBDIR_TEST=1 + install: + - BOOST_BRANCH=develop + - if [ "$TRAVIS_BRANCH" = "master" ]; then BOOST_BRANCH=master; fi + - git clone -b $BOOST_BRANCH https://github.com/boostorg/config.git ../config + - git clone -b $BOOST_BRANCH https://github.com/boostorg/assert.git ../assert script: - - cd libs/core/test/cmake_subdir_test && mkdir __build__ && cd __build__ + - cd test/cmake_subdir_test && mkdir __build__ && cd __build__ - cmake .. - cmake --build . - cmake --build . --target check + - os: linux + env: CMAKE_INSTALL_TEST=1 + script: + - mkdir __build__ && cd __build__ + - cmake -DBOOST_ENABLE_CMAKE=1 -DBoost_VERBOSE=1 -DBOOST_INCLUDE_LIBRARIES="assert;config;core" -DCMAKE_INSTALL_PREFIX=~/.local .. + - cmake --build . --target install + - cd ../libs/core/test/cmake_install_test && mkdir __build__ && cd __build__ + - cmake -DCMAKE_INSTALL_PREFIX=~/.local .. + - cmake --build . + - cmake --build . --target check + install: - BOOST_BRANCH=develop - if [ "$TRAVIS_BRANCH" = "master" ]; then BOOST_BRANCH=master; fi diff --git a/CMakeLists.txt b/CMakeLists.txt index c5b33e7..f085ea7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,3 +23,9 @@ if(BOOST_SUPERPROJECT_VERSION) boost_install(TARGETS boost_core HEADER_DIRECTORY include/) endif() + +if(BUILD_TESTING) + + add_subdirectory(test) + +endif() diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt new file mode 100644 index 0000000..82f1b33 --- /dev/null +++ b/test/CMakeLists.txt @@ -0,0 +1,13 @@ +# 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) + +boost_test_jamfile(FILE Jamfile.v2 LINK_LIBRARIES Boost::core Boost::static_assert Boost::type_traits Boost::throw_exception) + +endif() + +add_subdirectory(swap) diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index dfe0b6a..054dadc 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -55,10 +55,12 @@ compile-fail explicit_operator_bool_compile_fail_conv_pvoid.cpp ; compile-fail explicit_operator_bool_compile_fail_delete.cpp ; compile-fail explicit_operator_bool_compile_fail_shift.cpp ; -compile ignore_unused_test.cpp : gcc-4.8:"-Wunused-variable -Wunused-local-typedefs -Werror" - gcc:"-Wunused-variable -Werror" - clang:"-Wunused-variable -Werror" - msvc:"/we4100 /we4101" ; +compile ignore_unused_test.cpp + : extra + gcc:on + clang:on + msvc::on ; + run sp_typeinfo_test.cpp ; run sp_typeinfo_test.cpp : : : off : sp_typeinfo_test_no_rtti ; @@ -75,7 +77,8 @@ run lightweight_test_gt_ge_test.cpp ; run lightweight_test_eq_nullptr.cpp ; run lightweight_test_test3.cpp ; run lightweight_test_test4.cpp ; -run lightweight_test_test5.cpp : : : +run lightweight_test_test5.cpp + : : : extra msvc:on gcc:on @@ -112,9 +115,12 @@ run typeinfo_test.cpp : : : off : typeinfo_test_no_rtti ; run iterator_test.cpp ; run detail_iterator_test.cpp ; -run demangle_test.cpp : : : always_show_run_output ; +run demangle_test.cpp + : : : always_show_run_output ; + +run demangled_name_test.cpp + : : : always_show_run_output ; -run demangled_name_test.cpp : : : always_show_run_output ; run demangled_name_test.cpp : : : off always_show_run_output : demangled_name_test_no_rtti ; run scoped_enum.cpp ; @@ -161,8 +167,10 @@ run test_lib_typeid.cpp lib_typeid : : : static : test_lib_typeid_static ; run test_lib_typeid.cpp lib_typeid : : : shared off : test_lib_typeid_shared_no_rtti ; run test_lib_typeid.cpp lib_typeid : : : static off : test_lib_typeid_static_no_rtti ; -run uncaught_exceptions.cpp : : : on ; -run uncaught_exceptions_np.cpp : : : on ; +run uncaught_exceptions.cpp + : : : on ; +run uncaught_exceptions_np.cpp + : : : on ; run no_exceptions_support_test.cpp ; run no_exceptions_support_test.cpp : : : off : no_exceptions_support_test_nx ; diff --git a/test/cmake_install_test/CMakeLists.txt b/test/cmake_install_test/CMakeLists.txt new file mode 100644 index 0000000..f8cc1db --- /dev/null +++ b/test/cmake_install_test/CMakeLists.txt @@ -0,0 +1,17 @@ +# 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 + +cmake_minimum_required(VERSION 3.5...3.16) + +project(cmake_install_test LANGUAGES CXX) + +find_package(boost_core REQUIRED) + +add_executable(quick ../quick.cpp) +target_link_libraries(quick Boost::core) + +enable_testing() +add_test(quick quick) + +add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -C $) diff --git a/test/cmake_subdir_test/CMakeLists.txt b/test/cmake_subdir_test/CMakeLists.txt index ae24a60..8fee7b3 100644 --- a/test/cmake_subdir_test/CMakeLists.txt +++ b/test/cmake_subdir_test/CMakeLists.txt @@ -2,7 +2,7 @@ # 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 -cmake_minimum_required(VERSION 3.5) +cmake_minimum_required(VERSION 3.5...3.16) project(cmake_subdir_test LANGUAGES CXX) diff --git a/test/swap/CMakeLists.txt b/test/swap/CMakeLists.txt new file mode 100644 index 0000000..2cb9fa5 --- /dev/null +++ b/test/swap/CMakeLists.txt @@ -0,0 +1,11 @@ +# 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) + +boost_test_jamfile(FILE Jamfile.v2 LINK_LIBRARIES Boost::core) + +endif() diff --git a/test/swap/Jamfile.v2 b/test/swap/Jamfile.v2 index 091f403..2b43737 100644 --- a/test/swap/Jamfile.v2 +++ b/test/swap/Jamfile.v2 @@ -7,65 +7,31 @@ # bring in rules for testing import testing ; -local compile_tests = - root_header_1.cpp - root_header_2.cpp - lib_header_1.cpp - lib_header_2.cpp - mixed_headers_1.cpp - mixed_headers_2.cpp - ; +compile swap_root_header_1.cpp ; +compile swap_root_header_2.cpp ; +compile swap_lib_header_1.cpp ; +compile swap_lib_header_2.cpp ; +compile swap_mixed_headers_1.cpp ; +compile swap_mixed_headers_2.cpp ; -local compile_fail_tests = - const_wrapper_fail.cpp ; +compile-fail swap_const_wrapper_fail.cpp ; -local run_tests = - primitive.cpp - specialized_in_boost.cpp - specialized_in_global.cpp - specialized_in_other.cpp - specialized_in_std.cpp - specialized_in_boost_and_other.cpp - std_bitset.cpp - std_dateorder.cpp - std_string.cpp - std_typeinfo_ptr.cpp - std_vector_of_boost.cpp - std_vector_of_global.cpp - std_vector_of_other.cpp - no_ambiguity_in_boost.cpp - array_of_array_of_class.cpp - array_of_array_of_int.cpp - array_of_class.cpp - array_of_int.cpp - array_of_template.cpp - ; - -rule test_all -{ - local all_rules ; - local file ; - - for file in $(compile_tests) - { - local test_name = [ MATCH "([^.]*).cpp$" : $(file) ] ; - all_rules += [ compile $(file) : : "swap-$(test_name)" ] ; - } - - for file in $(compile_fail_tests) - { - local test_name = [ MATCH "([^.]*).cpp$" : $(file) ] ; - all_rules += [ compile-fail $(file) : : "swap-$(test_name)" ] ; - } - - for file in $(run_tests) - { - local test_name = [ MATCH "([^.]*).cpp$" : $(file) ] ; - all_rules += [ run $(file) : : : : "swap-$(test_name)" ] ; - } - - #ECHO All rules: $(all_rules) ; - return $(all_rules) ; -} - -test-suite core/swap : [ test_all r ] ; +run swap_primitive.cpp ; +run swap_specialized_in_boost.cpp ; +run swap_specialized_in_global.cpp ; +run swap_specialized_in_other.cpp ; +run swap_specialized_in_std.cpp ; +run swap_specialized_in_boost_and_other.cpp ; +run swap_std_bitset.cpp ; +run swap_std_dateorder.cpp ; +run swap_std_string.cpp ; +run swap_std_typeinfo_ptr.cpp ; +run swap_std_vector_of_boost.cpp ; +run swap_std_vector_of_global.cpp ; +run swap_std_vector_of_other.cpp ; +run swap_no_ambiguity_in_boost.cpp ; +run swap_array_of_array_of_class.cpp ; +run swap_array_of_array_of_int.cpp ; +run swap_array_of_class.cpp ; +run swap_array_of_int.cpp ; +run swap_array_of_template.cpp ; diff --git a/test/swap/array_of_array_of_class.cpp b/test/swap/swap_array_of_array_of_class.cpp similarity index 100% rename from test/swap/array_of_array_of_class.cpp rename to test/swap/swap_array_of_array_of_class.cpp diff --git a/test/swap/array_of_array_of_int.cpp b/test/swap/swap_array_of_array_of_int.cpp similarity index 100% rename from test/swap/array_of_array_of_int.cpp rename to test/swap/swap_array_of_array_of_int.cpp diff --git a/test/swap/array_of_class.cpp b/test/swap/swap_array_of_class.cpp similarity index 100% rename from test/swap/array_of_class.cpp rename to test/swap/swap_array_of_class.cpp diff --git a/test/swap/array_of_int.cpp b/test/swap/swap_array_of_int.cpp similarity index 100% rename from test/swap/array_of_int.cpp rename to test/swap/swap_array_of_int.cpp diff --git a/test/swap/array_of_template.cpp b/test/swap/swap_array_of_template.cpp similarity index 100% rename from test/swap/array_of_template.cpp rename to test/swap/swap_array_of_template.cpp diff --git a/test/swap/const_wrapper_fail.cpp b/test/swap/swap_const_wrapper_fail.cpp similarity index 100% rename from test/swap/const_wrapper_fail.cpp rename to test/swap/swap_const_wrapper_fail.cpp diff --git a/test/swap/lib_header_1.cpp b/test/swap/swap_lib_header_1.cpp similarity index 100% rename from test/swap/lib_header_1.cpp rename to test/swap/swap_lib_header_1.cpp diff --git a/test/swap/lib_header_2.cpp b/test/swap/swap_lib_header_2.cpp similarity index 100% rename from test/swap/lib_header_2.cpp rename to test/swap/swap_lib_header_2.cpp diff --git a/test/swap/mixed_headers_1.cpp b/test/swap/swap_mixed_headers_1.cpp similarity index 100% rename from test/swap/mixed_headers_1.cpp rename to test/swap/swap_mixed_headers_1.cpp diff --git a/test/swap/mixed_headers_2.cpp b/test/swap/swap_mixed_headers_2.cpp similarity index 100% rename from test/swap/mixed_headers_2.cpp rename to test/swap/swap_mixed_headers_2.cpp diff --git a/test/swap/no_ambiguity_in_boost.cpp b/test/swap/swap_no_ambiguity_in_boost.cpp similarity index 100% rename from test/swap/no_ambiguity_in_boost.cpp rename to test/swap/swap_no_ambiguity_in_boost.cpp diff --git a/test/swap/primitive.cpp b/test/swap/swap_primitive.cpp similarity index 100% rename from test/swap/primitive.cpp rename to test/swap/swap_primitive.cpp diff --git a/test/swap/root_header_1.cpp b/test/swap/swap_root_header_1.cpp similarity index 100% rename from test/swap/root_header_1.cpp rename to test/swap/swap_root_header_1.cpp diff --git a/test/swap/root_header_2.cpp b/test/swap/swap_root_header_2.cpp similarity index 100% rename from test/swap/root_header_2.cpp rename to test/swap/swap_root_header_2.cpp diff --git a/test/swap/specialized_in_boost.cpp b/test/swap/swap_specialized_in_boost.cpp similarity index 100% rename from test/swap/specialized_in_boost.cpp rename to test/swap/swap_specialized_in_boost.cpp diff --git a/test/swap/specialized_in_boost_and_other.cpp b/test/swap/swap_specialized_in_boost_and_other.cpp similarity index 100% rename from test/swap/specialized_in_boost_and_other.cpp rename to test/swap/swap_specialized_in_boost_and_other.cpp diff --git a/test/swap/specialized_in_global.cpp b/test/swap/swap_specialized_in_global.cpp similarity index 100% rename from test/swap/specialized_in_global.cpp rename to test/swap/swap_specialized_in_global.cpp diff --git a/test/swap/specialized_in_other.cpp b/test/swap/swap_specialized_in_other.cpp similarity index 100% rename from test/swap/specialized_in_other.cpp rename to test/swap/swap_specialized_in_other.cpp diff --git a/test/swap/specialized_in_std.cpp b/test/swap/swap_specialized_in_std.cpp similarity index 100% rename from test/swap/specialized_in_std.cpp rename to test/swap/swap_specialized_in_std.cpp diff --git a/test/swap/std_bitset.cpp b/test/swap/swap_std_bitset.cpp similarity index 100% rename from test/swap/std_bitset.cpp rename to test/swap/swap_std_bitset.cpp diff --git a/test/swap/std_dateorder.cpp b/test/swap/swap_std_dateorder.cpp similarity index 100% rename from test/swap/std_dateorder.cpp rename to test/swap/swap_std_dateorder.cpp diff --git a/test/swap/std_string.cpp b/test/swap/swap_std_string.cpp similarity index 100% rename from test/swap/std_string.cpp rename to test/swap/swap_std_string.cpp diff --git a/test/swap/std_typeinfo_ptr.cpp b/test/swap/swap_std_typeinfo_ptr.cpp similarity index 100% rename from test/swap/std_typeinfo_ptr.cpp rename to test/swap/swap_std_typeinfo_ptr.cpp diff --git a/test/swap/std_vector_of_boost.cpp b/test/swap/swap_std_vector_of_boost.cpp similarity index 100% rename from test/swap/std_vector_of_boost.cpp rename to test/swap/swap_std_vector_of_boost.cpp diff --git a/test/swap/std_vector_of_global.cpp b/test/swap/swap_std_vector_of_global.cpp similarity index 100% rename from test/swap/std_vector_of_global.cpp rename to test/swap/swap_std_vector_of_global.cpp diff --git a/test/swap/std_vector_of_other.cpp b/test/swap/swap_std_vector_of_other.cpp similarity index 100% rename from test/swap/std_vector_of_other.cpp rename to test/swap/swap_std_vector_of_other.cpp