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

Commit 7211d2c

Browse files
tests: run concurrent map gdb test only on gcc
This test doesn't work properly with Clang compiler (rbreak seems to not work), Since it works well with gcc it's better to run it only on gcc and print a warning otherwise, so user doesn't run it accidentally. Fixes #968
1 parent 2979a95 commit 7211d2c

1 file changed

Lines changed: 20 additions & 8 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)

0 commit comments

Comments
 (0)