From 496fc2aaecb1f0683787410f8bb0da4d230a6dd1 Mon Sep 17 00:00:00 2001 From: Florian Sattler Date: Wed, 5 May 2021 15:56:04 +0200 Subject: [PATCH] Only add TSAN for testing when compatible Only add TSAN when compiled with clang and ASAN is not active. --- .../PhasarLLVM/DataFlowSolver/IfdsIde/CMakeLists.txt | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/unittests/PhasarLLVM/DataFlowSolver/IfdsIde/CMakeLists.txt b/unittests/PhasarLLVM/DataFlowSolver/IfdsIde/CMakeLists.txt index adf54d701..d6d239a2a 100644 --- a/unittests/PhasarLLVM/DataFlowSolver/IfdsIde/CMakeLists.txt +++ b/unittests/PhasarLLVM/DataFlowSolver/IfdsIde/CMakeLists.txt @@ -12,9 +12,13 @@ set(ThreadedIfdsIdeSources EdgeFunctionSingletonFactoryTest.cpp ) -if(UNIX) - # Append -fno-omit-frame-pointer to get better stack traces. - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-omit-frame-pointer -fsanitize=thread") +if(UNIX AND CMAKE_CXX_COMPILER_ID MATCHES "^(Apple)?Clang$") + # Only add thread sanitizer for the test if asan is disabled because both + # cannot be active at the same time. + if (NOT "${LLVM_USE_SANITIZER}" MATCHES ".*Address.*") + # Append -fno-omit-frame-pointer to get better stack traces. + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-omit-frame-pointer -fsanitize=thread") + endif() endif() foreach(TEST_SRC ${ThreadedIfdsIdeSources})