Skip to content

Commit

Permalink
Do no use sanitizers in tests by default (#735)
Browse files Browse the repository at this point in the history
* Run gtest_test_discovery pre test instead of post build

The current behavior does not work well with parallel builds using `make`.

* Disable sanitizers for testing by default.

They lead to segfaults and issues with dynamic loading sometimes ...
  • Loading branch information
niklas-uhl authored Jun 13, 2024
1 parent c13a45a commit 4b60a3e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ if (NOT N EQUAL 0)
)
endif ()

option(KAMPING_TEST_ENABLE_SANITIZERS "Enable undefined behavior sanitizer and address sanitizer." ON)
option(KAMPING_TEST_ENABLE_SANITIZERS "Enable undefined behavior sanitizer and address sanitizer." OFF)

# Registering tests without MPI:
kamping_register_test(test_checking_casts FILES checking_casts_test.cpp)
Expand Down
2 changes: 1 addition & 1 deletion tests/cmake/KampingTestHelper.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ function (kamping_register_test KAMPING_TARGET_NAME)
add_executable(${KAMPING_TARGET_NAME} ${KAMPING_FILES})
target_link_libraries(${KAMPING_TARGET_NAME} PRIVATE gtest gtest_main gmock kamping_base)
target_compile_options(${KAMPING_TARGET_NAME} PRIVATE ${KAMPING_WARNING_FLAGS})
gtest_discover_tests(${KAMPING_TARGET_NAME} WORKING_DIRECTORY ${PROJECT_DIR})
gtest_discover_tests(${KAMPING_TARGET_NAME} WORKING_DIRECTORY ${PROJECT_DIR} DISCOVERY_MODE PRE_TEST)
kamping_set_kassert_flags(${KAMPING_TARGET_NAME} ${ARGN})
if (NOT ${KAMPING_NO_GLIBCXX_DEBUG_CONTAINERS})
target_compile_definitions(${KAMPING_TARGET_NAME} PRIVATE -D_GLIBCXX_DEBUG)
Expand Down

0 comments on commit 4b60a3e

Please sign in to comment.