From d129ee00a172df16c03437c2295c763f88ca182e Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Mon, 23 Nov 2020 11:45:37 -0800 Subject: [PATCH] Don't compile fish_test_helper with thread sanitizer Certain TSan versions will modify the blocked signal mask on startup, which breaks fish's test that it correctly blocks certain signals on nohup. --- CMakeLists.txt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index f6ccf784b..e740087bc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -219,6 +219,15 @@ include(cmake/Install.cmake) # Mac app. include(cmake/MacApp.cmake) +# ThreadSanitizer likes to muck with signal handlers, which interferes +# with fish_test_helper printing the ignored signal mask. +# Ensure fish_test_helper does not use TSan. +# Note the environment var is CXXFLAGS, but the CMake var is CMAKE_CXX_FLAGS. +if (CMAKE_CXX_FLAGS MATCHES ".*-fsanitize=thread.*") + target_compile_options(fish_test_helper PRIVATE "-fno-sanitize=all") + target_link_libraries(fish_test_helper "-fno-sanitize=all") +endif() + # Lint targets # This could be implemented as target properties, but the script has the useful feature of only # checking the currently-staged commands