CI: Error when Windows CMake test fails and fix RTTI flags in CMake (#43)

Only the exit code of the last command is considered, so make sure CTest is last
This commit is contained in:
Alexander Grund
2025-10-14 11:58:35 +02:00
committed by GitHub
parent 898c212ff2
commit a33e418f39
3 changed files with 32 additions and 42 deletions

View File

@@ -102,7 +102,7 @@ jobs:
cd ..
rm -rf __build
- name: Run modules tests wihtout 'import std;'
- name: Run modules tests without 'import std;'
if: ${{matrix.toolset == 'clang-19'}}
run: |
cd ../boost-root/libs/type_index
@@ -213,46 +213,37 @@ jobs:
if: ${{matrix.toolset == 'msvc-14.3'}}
shell: cmd
run: |
choco install --no-progress ninja
call "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Auxiliary/Build/vcvarsall.bat" x64
cd ../boost-root/
mkdir __build
cd __build
cmake -DBUILD_TESTING=1 -DBOOST_INCLUDE_LIBRARIES=type_index ..
cd ../boost-root
mkdir __build_cmake
cd __build_cmake
cmake -DBUILD_TESTING=1 -DBOOST_INCLUDE_LIBRARIES=type_index -G Ninja ..
cmake --build . --target tests --config Debug
ctest --output-on-failure --no-tests=error -C Debug
cd ..
rm -rf __build
- name: Run modules tests
if: ${{matrix.toolset == 'msvc-14.3'}}
shell: cmd
run: |
choco install --no-progress ninja
call "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Auxiliary/Build/vcvarsall.bat" x64
cd ../boost-root/libs/type_index
mkdir build_module
cd build_module
cmake -DBOOST_USE_MODULES=1 -DBUILD_TESTING=1 -DCMAKE_CXX_STANDARD=23 -DCMAKE_EXPERIMENTAL_CXX_IMPORT_STD=0e5b6991-d74f-4b3d-a41c-cf096e0b2508 -G Ninja ../test/cmake_subdir_test/
cd ../boost-root
mkdir __build_modules
cd __build_modules
cmake -DBOOST_USE_MODULES=1 -DBUILD_TESTING=1 -DCMAKE_CXX_STANDARD=23 -DCMAKE_EXPERIMENTAL_CXX_IMPORT_STD=0e5b6991-d74f-4b3d-a41c-cf096e0b2508 -G Ninja ../libs/type_index/test/cmake_subdir_test
cmake --build .
ctest --no-tests=error -V
cd ..
rm -rf build_module
- name: Run modules tests without 'import std;'
if: ${{matrix.toolset == 'msvc-14.3'}}
shell: cmd
run: |
choco install --no-progress ninja
call "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Auxiliary/Build/vcvarsall.bat" x64
cd ../boost-root/libs/type_index
mkdir build_module
cd build_module
cmake -DBOOST_USE_MODULES=1 -DBUILD_TESTING=1 -DCMAKE_CXX_STANDARD=20 -G Ninja ../test/cmake_subdir_test/
cd ../boost-root
mkdir __build_modules_std
cd __build_modules_std
cmake -DBOOST_USE_MODULES=1 -DBUILD_TESTING=1 -DCMAKE_CXX_STANDARD=20 -G Ninja ../libs/type_index/test/cmake_subdir_test
cmake --build .
ctest --no-tests=error -V
cd ..
rm -rf build_module
- name: Run tests
shell: cmd

View File

@@ -49,11 +49,11 @@ set(BOOST_TEST_LINK_LIBRARIES Boost::type_index Boost::core)
boost_test(TYPE run SOURCES type_index_test.cpp)
boost_test(TYPE run SOURCES type_index_runtime_cast_test.cpp LINK_LIBRARIES Boost::smart_ptr)
boost_test(TYPE run SOURCES type_index_constexpr_test.cpp)
boost_test(TYPE run SOURCES type_index_test.cpp COMPILE_OPTIONS -fno-rtti NAME type_index_test_no_rtti)
boost_test(TYPE run SOURCES type_index_test.cpp COMPILE_OPTIONS ${BOOST_TYPEINDEX_DETAIL_NO_RTTI} NAME type_index_test_no_rtti)
boost_test(TYPE run SOURCES ctti_print_name.cpp)
boost_test(TYPE run SOURCES testing_crossmodule.cpp LINK_LIBRARIES boost_type_index_test_lib_rtti)
boost_test(TYPE run SOURCES testing_crossmodule.cpp LINK_LIBRARIES boost_type_index_test_lib_nortti COMPILE_OPTIONS -fno-rtti NAME testing_crossmodule_no_rtti)
boost_test(TYPE run SOURCES testing_crossmodule.cpp LINK_LIBRARIES boost_type_index_test_lib_nortti COMPILE_OPTIONS ${BOOST_TYPEINDEX_DETAIL_NO_RTTI} NAME testing_crossmodule_no_rtti)
boost_test(TYPE run SOURCES testing_crossmodule_anonymous.cpp LINK_LIBRARIES boost_type_index_test_lib_anonymous_rtti)
boost_test(TYPE run SOURCES compare_ctti_stl.cpp)
@@ -64,10 +64,10 @@ boost_test(TYPE compile-fail SOURCES type_index_test_ctti_construct_fail.cpp)
boost_test(TYPE compile SOURCES type_index_test_ctti_alignment.cpp)
# Mixing RTTI on and off
boost_test(TYPE link-fail SOURCES testing_crossmodule.cpp LINK_LIBRARIES boost_type_index_test_lib_rtti COMPILE_OPTIONS -fno-rtti NAME link_fail_nortti_rtti)
boost_test(TYPE link-fail SOURCES testing_crossmodule.cpp LINK_LIBRARIES boost_type_index_test_lib_rtti COMPILE_OPTIONS ${BOOST_TYPEINDEX_DETAIL_NO_RTTI} NAME link_fail_nortti_rtti)
boost_test(TYPE link-fail SOURCES testing_crossmodule.cpp LINK_LIBRARIES boost_type_index_test_lib_nortti NAME link_fail_rtti_nortti)
boost_test(TYPE run SOURCES testing_crossmodule.cpp LINK_LIBRARIES boost_type_index_test_lib_rtti_compat COMPILE_OPTIONS -fno-rtti NAME testing_crossmodule_nortti_rtti_compat)
boost_test(TYPE run SOURCES testing_crossmodule.cpp LINK_LIBRARIES boost_type_index_test_lib_rtti_compat COMPILE_OPTIONS ${BOOST_TYPEINDEX_DETAIL_NO_RTTI} NAME testing_crossmodule_nortti_rtti_compat)
boost_test(TYPE run SOURCES testing_crossmodule.cpp LINK_LIBRARIES boost_type_index_test_lib_nortti_compat NAME testing_crossmodule_rtti_nortti_compat)
file(GLOB EXAMPLE_FILES "../examples/*.cpp")
@@ -76,6 +76,6 @@ foreach (testsourcefile ${EXAMPLE_FILES})
get_filename_component(testname ${testsourcefile} NAME_WE)
if(NOT testname STREQUAL "table_of_names")
boost_test(TYPE run SOURCES ${testsourcefile} NAME ${testname}_no_rtti COMPILE_OPTIONS -fno-rtti INCLUDE_DIRECTORIES ../examples LINK_LIBRARIES Boost::unordered)
boost_test(TYPE run SOURCES ${testsourcefile} NAME ${testname}_no_rtti COMPILE_OPTIONS ${BOOST_TYPEINDEX_DETAIL_NO_RTTI} INCLUDE_DIRECTORIES ../examples LINK_LIBRARIES Boost::unordered)
endif()
endforeach()

View File

@@ -6,21 +6,20 @@ cmake_minimum_required(VERSION 3.5...4.0)
project(type_index_subdir_test LANGUAGES CXX)
add_subdirectory(../../../assert boostorg/assert)
add_subdirectory(../../../core boostorg/core)
add_subdirectory(../../../config boostorg/config)
add_subdirectory(../../../container_hash boostorg/container_hash)
add_subdirectory(../../../describe boostorg/describe)
add_subdirectory(../../../detail boostorg/detail)
add_subdirectory(../../../integer boostorg/integer)
add_subdirectory(../../../move boostorg/move)
add_subdirectory(../../../mp11 boostorg/mp11)
add_subdirectory(../../../preprocessor boostorg/preprocessor)
add_subdirectory(../../../smart_ptr boostorg/smart_ptr)
add_subdirectory(../../../static_assert boostorg/static_assert)
add_subdirectory(../../../throw_exception boostorg/throw_exception)
add_subdirectory(../../../type_traits boostorg/type_traits)
foreach(dep IN ITEMS
assert
config
core
container_hash
describe
mp11
smart_ptr
static_assert
throw_exception
unordered
predef)
add_subdirectory(../../../${dep} boostorg/${dep})
endforeach()
add_subdirectory(../../ boostorg/type_index)
enable_testing()