Skip to content

Commit a33e418

Browse files
authored
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
1 parent 898c212 commit a33e418

File tree

3 files changed

+32
-42
lines changed

3 files changed

+32
-42
lines changed

.github/workflows/ci.yml

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ jobs:
102102
cd ..
103103
rm -rf __build
104104
105-
- name: Run modules tests wihtout 'import std;'
105+
- name: Run modules tests without 'import std;'
106106
if: ${{matrix.toolset == 'clang-19'}}
107107
run: |
108108
cd ../boost-root/libs/type_index
@@ -213,46 +213,37 @@ jobs:
213213
if: ${{matrix.toolset == 'msvc-14.3'}}
214214
shell: cmd
215215
run: |
216-
choco install --no-progress ninja
217216
call "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Auxiliary/Build/vcvarsall.bat" x64
218-
cd ../boost-root/
219-
mkdir __build
220-
cd __build
221-
cmake -DBUILD_TESTING=1 -DBOOST_INCLUDE_LIBRARIES=type_index ..
217+
cd ../boost-root
218+
mkdir __build_cmake
219+
cd __build_cmake
220+
cmake -DBUILD_TESTING=1 -DBOOST_INCLUDE_LIBRARIES=type_index -G Ninja ..
222221
cmake --build . --target tests --config Debug
223222
ctest --output-on-failure --no-tests=error -C Debug
224-
cd ..
225-
rm -rf __build
226223
227224
- name: Run modules tests
228225
if: ${{matrix.toolset == 'msvc-14.3'}}
229226
shell: cmd
230227
run: |
231-
choco install --no-progress ninja
232228
call "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Auxiliary/Build/vcvarsall.bat" x64
233-
cd ../boost-root/libs/type_index
234-
mkdir build_module
235-
cd build_module
236-
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/
229+
cd ../boost-root
230+
mkdir __build_modules
231+
cd __build_modules
232+
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
237233
cmake --build .
238234
ctest --no-tests=error -V
239-
cd ..
240-
rm -rf build_module
241235
242236
- name: Run modules tests without 'import std;'
243237
if: ${{matrix.toolset == 'msvc-14.3'}}
244238
shell: cmd
245239
run: |
246-
choco install --no-progress ninja
247240
call "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Auxiliary/Build/vcvarsall.bat" x64
248-
cd ../boost-root/libs/type_index
249-
mkdir build_module
250-
cd build_module
251-
cmake -DBOOST_USE_MODULES=1 -DBUILD_TESTING=1 -DCMAKE_CXX_STANDARD=20 -G Ninja ../test/cmake_subdir_test/
241+
cd ../boost-root
242+
mkdir __build_modules_std
243+
cd __build_modules_std
244+
cmake -DBOOST_USE_MODULES=1 -DBUILD_TESTING=1 -DCMAKE_CXX_STANDARD=20 -G Ninja ../libs/type_index/test/cmake_subdir_test
252245
cmake --build .
253246
ctest --no-tests=error -V
254-
cd ..
255-
rm -rf build_module
256247
257248
- name: Run tests
258249
shell: cmd

test/CMakeLists.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,11 @@ set(BOOST_TEST_LINK_LIBRARIES Boost::type_index Boost::core)
4949
boost_test(TYPE run SOURCES type_index_test.cpp)
5050
boost_test(TYPE run SOURCES type_index_runtime_cast_test.cpp LINK_LIBRARIES Boost::smart_ptr)
5151
boost_test(TYPE run SOURCES type_index_constexpr_test.cpp)
52-
boost_test(TYPE run SOURCES type_index_test.cpp COMPILE_OPTIONS -fno-rtti NAME type_index_test_no_rtti)
52+
boost_test(TYPE run SOURCES type_index_test.cpp COMPILE_OPTIONS ${BOOST_TYPEINDEX_DETAIL_NO_RTTI} NAME type_index_test_no_rtti)
5353
boost_test(TYPE run SOURCES ctti_print_name.cpp)
5454

5555
boost_test(TYPE run SOURCES testing_crossmodule.cpp LINK_LIBRARIES boost_type_index_test_lib_rtti)
56-
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)
56+
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)
5757
boost_test(TYPE run SOURCES testing_crossmodule_anonymous.cpp LINK_LIBRARIES boost_type_index_test_lib_anonymous_rtti)
5858

5959
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)
6464
boost_test(TYPE compile SOURCES type_index_test_ctti_alignment.cpp)
6565

6666
# Mixing RTTI on and off
67-
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)
67+
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)
6868
boost_test(TYPE link-fail SOURCES testing_crossmodule.cpp LINK_LIBRARIES boost_type_index_test_lib_nortti NAME link_fail_rtti_nortti)
6969

70-
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)
70+
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)
7171
boost_test(TYPE run SOURCES testing_crossmodule.cpp LINK_LIBRARIES boost_type_index_test_lib_nortti_compat NAME testing_crossmodule_rtti_nortti_compat)
7272

7373
file(GLOB EXAMPLE_FILES "../examples/*.cpp")
@@ -76,6 +76,6 @@ foreach (testsourcefile ${EXAMPLE_FILES})
7676

7777
get_filename_component(testname ${testsourcefile} NAME_WE)
7878
if(NOT testname STREQUAL "table_of_names")
79-
boost_test(TYPE run SOURCES ${testsourcefile} NAME ${testname}_no_rtti COMPILE_OPTIONS -fno-rtti INCLUDE_DIRECTORIES ../examples LINK_LIBRARIES Boost::unordered)
79+
boost_test(TYPE run SOURCES ${testsourcefile} NAME ${testname}_no_rtti COMPILE_OPTIONS ${BOOST_TYPEINDEX_DETAIL_NO_RTTI} INCLUDE_DIRECTORIES ../examples LINK_LIBRARIES Boost::unordered)
8080
endif()
8181
endforeach()

test/cmake_subdir_test/CMakeLists.txt

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,20 @@ cmake_minimum_required(VERSION 3.5...4.0)
66

77
project(type_index_subdir_test LANGUAGES CXX)
88

9-
add_subdirectory(../../../assert boostorg/assert)
10-
add_subdirectory(../../../core boostorg/core)
11-
add_subdirectory(../../../config boostorg/config)
12-
add_subdirectory(../../../container_hash boostorg/container_hash)
13-
add_subdirectory(../../../describe boostorg/describe)
14-
add_subdirectory(../../../detail boostorg/detail)
15-
add_subdirectory(../../../integer boostorg/integer)
16-
add_subdirectory(../../../move boostorg/move)
17-
add_subdirectory(../../../mp11 boostorg/mp11)
18-
add_subdirectory(../../../preprocessor boostorg/preprocessor)
19-
add_subdirectory(../../../smart_ptr boostorg/smart_ptr)
20-
add_subdirectory(../../../static_assert boostorg/static_assert)
21-
add_subdirectory(../../../throw_exception boostorg/throw_exception)
22-
add_subdirectory(../../../type_traits boostorg/type_traits)
23-
9+
foreach(dep IN ITEMS
10+
assert
11+
config
12+
core
13+
container_hash
14+
describe
15+
mp11
16+
smart_ptr
17+
static_assert
18+
throw_exception
19+
unordered
20+
predef)
21+
add_subdirectory(../../../${dep} boostorg/${dep})
22+
endforeach()
2423
add_subdirectory(../../ boostorg/type_index)
2524

2625
enable_testing()

0 commit comments

Comments
 (0)