Skip to content

Commit

Permalink
Let CMake print TSan warning
Browse files Browse the repository at this point in the history
  • Loading branch information
j-stephan committed Sep 5, 2023
1 parent 2b2ea22 commit 75fc32d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 13 deletions.
9 changes: 7 additions & 2 deletions test/unit/core/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
#
# Copyright 2018-2020 Benjamin Worpitz, Axel Huebl, Jan Stephan
# Copyright 2023 Benjamin Worpitz, Jan Stephan, Antonio Di Pilato
# SPDX-License-Identifier: MPL-2.0
#

set(_TARGET_NAME "coreTest")

append_recursive_files_add_to_src_group("src/" "src/" "cpp" _FILES_SOURCE)

# TODO(bgruber): Revisit this in the future on a new CI image. This problem does not happen locally.
if(CMAKE_CXX_FLAGS MATCHES ".*-fsanitize=thread.*")
message(WARNING "Part of the threadpool test fails the TSan CI and is therefore disabled. See also: https://github.com/alpaka-group/alpaka/issues/2101")
set_source_files_properties("${CMAKE_CURRENT_SOURCE_DIR}/src/ThreadPool.cpp" PROPERTIES COMPILE_DEFINITIONS "ALPAKA_USES_TSAN")
endif()

alpaka_add_executable(
${_TARGET_NAME}
${_FILES_SOURCE})
Expand Down
11 changes: 1 addition & 10 deletions test/unit/core/src/ThreadPool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,6 @@

#include <catch2/catch_test_macros.hpp>

#if defined(__has_feature)
# if __has_feature(thread_sanitizer)
# define TSAN
# endif
#endif

TEST_CASE("threadpool", "[core]")
{
alpaka::core::detail::ThreadPool tp{2};
Expand All @@ -22,10 +16,7 @@ TEST_CASE("threadpool", "[core]")

CHECK_THROWS_AS(f1.get(), std::runtime_error);

#ifdef TSAN
# warning "Part of the threadpool test fails the TSAN CI and is therefore disabled."
// TODO(bgruber): Revisit this in the future on a new CI image. This problem does not happen locally.
#else
#ifndef ALPAKA_USES_TSAN
try
{
f2.get();
Expand Down
2 changes: 1 addition & 1 deletion test/unit/mem/fence/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#

if (CMAKE_CXX_FLAGS MATCHES ".*-fsanitize=thread.*")
message(WARNING "TSAN does not support memory fences yet. The fenceTest has been disabled. See also: https://github.com/google/sanitizers/issues/1352")
message(WARNING "TSan does not support memory fences yet. The fenceTest has been disabled. See also: https://github.com/google/sanitizers/issues/1352")
return()
endif()

Expand Down

0 comments on commit 75fc32d

Please sign in to comment.