Skip to content
This repository was archived by the owner on Mar 22, 2023. It is now read-only.

Commit 7cc2f38

Browse files
authored
Merge pull request #1048 from lukaszstolarczuk/tests-gdb
tests: run concurrent map gdb test only on gcc
2 parents 515f097 + 0a00a60 commit 7cc2f38

2 files changed

Lines changed: 26 additions & 11 deletions

File tree

tests/CMakeLists.txt

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,21 @@ add_library(valgrind_internal STATIC valgrind_internal.cpp)
9292
add_executable(check_is_pmem check_is_pmem/check_is_pmem.cpp)
9393
target_link_libraries(check_is_pmem ${LIBPMEM_LIBRARIES})
9494

95+
# Set variable to know if debug tests can be run
96+
if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
97+
set(DEBUG_BUILD_TESTS 1)
98+
endif()
99+
100+
# Set variable if currently used compiler is GNU (gcc)
101+
if("${CMAKE_C_COMPILER_ID}" MATCHES "GNU" AND "${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")
102+
set(GCC_COMPILER_IN_USE 1)
103+
endif()
104+
105+
# Produce general warnings, e.g. when a command/tool is missing
106+
if(NOT GDB_FOUND)
107+
message(WARNING "GDB was not found - skipping some tests. To fix, make sure `gdb` command is OS-wide accesible.")
108+
endif()
109+
95110
# ----------------------------------------------------------------- #
96111
## Tests
97112
# ----------------------------------------------------------------- #
@@ -583,8 +598,6 @@ if(TEST_CONCURRENT_HASHMAP)
583598
add_test_generic(NAME concurrent_hash_map_rehash_break CASE ${TESTCASE} TRACERS none)
584599
endforeach()
585600
endif()
586-
else()
587-
message(WARNING "Skipping concurrent_hash_map_rehash_break test because GDB was not found")
588601
endif()
589602

590603
if(NOT TESTS_TBB)
@@ -634,8 +647,6 @@ if(TEST_CONCURRENT_HASHMAP)
634647
configure_file("${CMAKE_SCRIPT}.cmake.in" "${CMAKE_SCRIPT}_${case}.cmake" @ONLY)
635648
add_test_generic(NAME ${TEST} CASE ${case} TRACERS none)
636649
endforeach()
637-
else()
638-
message(WARNING "Skipping concurrent_hash_map_pmreorder_break_insert test because GDB was not found")
639650
endif()
640651
else()
641652
message(WARNING "Skipping pmreorder tests because of no pmreorder support")
@@ -902,16 +913,17 @@ if(TEST_CONCURRENT_MAP)
902913
add_test_generic(NAME concurrent_map_find_lower_lower_eq TRACERS none memcheck pmemcheck)
903914

904915
if(TESTS_CONCURRENT_GDB AND GDB_FOUND)
905-
if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
916+
# This test is confirmed to run on gcc (and not on clang)
917+
if(DEBUG_BUILD_TESTS AND GCC_COMPILER_IN_USE)
906918
build_test(concurrent_map_mt_gdb concurrent_map_mt_gdb/concurrent_map_mt_gdb.cpp)
907919
add_test_generic(NAME concurrent_map_mt_gdb TRACERS none CASE 0 SCRIPT concurrent_map_mt_gdb/concurrent_map_mt_gdb_0.cmake)
908920
add_test_generic(NAME concurrent_map_mt_gdb TRACERS none CASE 1 SCRIPT concurrent_map_mt_gdb/concurrent_map_mt_gdb_1.cmake)
909921
add_test_generic(NAME concurrent_map_mt_gdb TRACERS none CASE 2 SCRIPT concurrent_map_mt_gdb/concurrent_map_mt_gdb_2.cmake)
922+
elseif(NOT DEBUG_BUILD_TESTS)
923+
message(WARNING "TESTS_CONCURRENT_GDB is set, but it's a non-debug build - concurrent_map_mt_gdb test will be skipped.")
910924
else()
911-
message(WARNING "Skipping concurrent_map_mt_gdb test because it is non-debug build")
925+
message(WARNING "TESTS_CONCURRENT_GDB is set, but current compiler is not gcc (concurrent_map_mt_gdb seems to work only with it). Skipping.")
912926
endif()
913-
elseif(TESTS_CONCURRENT_GDB)
914-
message(WARNING "Skipping concurrent_map_mt_gdb test because GDB was not found")
915927
endif()
916928

917929
build_test(concurrent_map_insert_reopen concurrent_map/concurrent_map_insert_reopen.cpp)

utils/docker/run-build.sh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ function tests_clang_debug_cpp17_no_valgrind() {
4848
-DTESTS_PMREORDER=${TESTS_PMREORDER} \
4949
-DTEST_DIR=${TEST_DIR} \
5050
-DTESTS_USE_FORCED_PMEM=${TESTS_USE_FORCED_PMEM} \
51-
-DTESTS_COMPATIBILITY=1
51+
-DTESTS_COMPATIBILITY=1 \
52+
-DTESTS_CONCURRENT_GDB=1
5253

5354
make -j$(nproc)
5455
ctest --output-on-failure -E "_pmreorder" --timeout ${TEST_TIMEOUT}
@@ -82,7 +83,8 @@ function tests_clang_release_cpp11_no_valgrind() {
8283
-DTESTS_PMREORDER=${TESTS_PMREORDER} \
8384
-DTEST_DIR=${TEST_DIR} \
8485
-DTESTS_USE_FORCED_PMEM=${TESTS_USE_FORCED_PMEM} \
85-
-DTESTS_COMPATIBILITY=1
86+
-DTESTS_COMPATIBILITY=1 \
87+
-DTESTS_CONCURRENT_GDB=1
8688

8789
make -j$(nproc)
8890
ctest --output-on-failure -E "_pmreorder" --timeout ${TEST_TIMEOUT}
@@ -182,7 +184,8 @@ function tests_gcc_release_cpp17_no_valgrind() {
182184
-DTESTS_PMREORDER=${TESTS_PMREORDER} \
183185
-DTEST_DIR=${TEST_DIR} \
184186
-DBUILD_EXAMPLES=0 \
185-
-DTESTS_USE_FORCED_PMEM=${TESTS_USE_FORCED_PMEM}
187+
-DTESTS_USE_FORCED_PMEM=${TESTS_USE_FORCED_PMEM} \
188+
-DTESTS_CONCURRENT_GDB=1
186189

187190
make -j$(nproc)
188191
ctest --output-on-failure --timeout ${TEST_TIMEOUT}

0 commit comments

Comments
 (0)