From 0a84b335c16b9a9ae1292f8317622c6188b74b1c Mon Sep 17 00:00:00 2001 From: Florent Hivert Date: Mon, 23 Oct 2023 13:39:07 +0200 Subject: [PATCH] Run tests under asan and ubsan --- CMakeLists.txt | 2 +- tests/CMakeLists.txt | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a6c93568..ba35d3a7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -113,7 +113,7 @@ foreach (intrin ${hpcombi_intrinsics}) endif() endforeach() -add_compile_options(-mavx -mtune=native -funroll-loops -flax-vector-conversions) +add_compile_options(-mavx -mtune=native -funroll-loops -flax-vector-conversions -fsanitize=undefined -fsanitize=address) ################### # Project Structure diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 145de5f4..72843e8d 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -26,17 +26,19 @@ include_directories( add_definitions (-DBOOST_TEST_DYN_LINK) +SET(CMAKE_LINKER_FLAGS "${CMAKE_LINKER_FLAGS} -fno-omit-frame-pointer -fsanitize=address") + set(test_src test_epu.cpp test_perm16.cpp test_perm_all.cpp test_bmat8.cpp) foreach(f ${test_src}) get_filename_component(testName ${f} NAME_WE) add_executable (${testName} ${f}) - target_link_libraries(${testName} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY} ) + target_link_libraries(${testName} asan ubsan ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}) endforeach(f) # Test for multiple inclusions add_executable (test_mincl test_mincl.cpp test_mincl0.cpp test_mincl1.cpp) -target_link_libraries(test_mincl ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY} ) +target_link_libraries(test_mincl asan ubsan ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}) add_test (TestEPU test_epu) add_test (TestPerm16 test_perm16)