CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
97 lines
3.1 KiB
CMake
97 lines
3.1 KiB
CMake
include_directories(../rtl)
|
|
|
|
add_custom_target(TsanUnitTests)
|
|
set_target_properties(TsanUnitTests PROPERTIES
|
|
FOLDER "Compiler-RT Tests")
|
|
|
|
set(TSAN_UNITTEST_CFLAGS
|
|
${COMPILER_RT_UNITTEST_CFLAGS}
|
|
${COMPILER_RT_GTEST_CFLAGS}
|
|
${SANITIZER_TEST_CXX_CFLAGS}
|
|
-I${COMPILER_RT_SOURCE_DIR}/include
|
|
-I${COMPILER_RT_SOURCE_DIR}/lib
|
|
-I${COMPILER_RT_SOURCE_DIR}/lib/tsan/rtl
|
|
-DSANITIZER_COMMON_NO_REDEFINE_BUILTINS
|
|
-DGTEST_HAS_RTTI=0
|
|
-fno-rtti
|
|
)
|
|
|
|
if(COMPILER_RT_TSAN_DEBUG_OUTPUT)
|
|
# Need to match these flags with the runtime.
|
|
list(APPEND TSAN_UNITTEST_CFLAGS -DTSAN_COLLECT_STATS=1
|
|
-DTSAN_DEBUG_OUTPUT=2)
|
|
endif()
|
|
|
|
append_list_if(COMPILER_RT_HAS_MSSE4_2_FLAG -msse4.2 TSAN_UNITTEST_CFLAGS)
|
|
|
|
set(TSAN_TEST_ARCH ${TSAN_SUPPORTED_ARCH})
|
|
|
|
set(TSAN_UNITTEST_LINK_FLAGS
|
|
${COMPILER_RT_UNITTEST_LINK_FLAGS}
|
|
${COMPILER_RT_UNWINDER_LINK_LIBS}
|
|
${SANITIZER_TEST_CXX_LIBRARIES})
|
|
|
|
if(APPLE)
|
|
|
|
# Create a static library for test dependencies.
|
|
set(TSAN_TEST_RUNTIME_OBJECTS
|
|
$<TARGET_OBJECTS:RTTsan_dynamic.osx>
|
|
$<TARGET_OBJECTS:RTInterception.osx>
|
|
$<TARGET_OBJECTS:RTSanitizerCommon.osx>
|
|
$<TARGET_OBJECTS:RTSanitizerCommonLibc.osx>
|
|
$<TARGET_OBJECTS:RTSanitizerCommonCoverage.osx>
|
|
$<TARGET_OBJECTS:RTSanitizerCommonSymbolizer.osx>
|
|
$<TARGET_OBJECTS:RTUbsan.osx>)
|
|
set(TSAN_TEST_RUNTIME RTTsanTest)
|
|
add_library(${TSAN_TEST_RUNTIME} STATIC ${TSAN_TEST_RUNTIME_OBJECTS})
|
|
set_target_properties(${TSAN_TEST_RUNTIME} PROPERTIES
|
|
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
|
|
|
darwin_filter_host_archs(TSAN_SUPPORTED_ARCH TSAN_TEST_ARCH)
|
|
list(APPEND TSAN_UNITTEST_CFLAGS ${DARWIN_osx_CFLAGS})
|
|
|
|
list(APPEND TSAN_UNITTEST_LINK_FLAGS ${DARWIN_osx_LINK_FLAGS})
|
|
add_weak_symbols("ubsan" TSAN_UNITTEST_LINK_FLAGS)
|
|
add_weak_symbols("sanitizer_common" TSAN_UNITTEST_LINK_FLAGS)
|
|
else()
|
|
list(APPEND TSAN_UNITTEST_LINK_FLAGS -fsanitize=thread)
|
|
list(APPEND TSAN_UNITTEST_LINK_FLAGS -lm)
|
|
list(APPEND TSAN_UNITTEST_LINK_FLAGS ${COMPILER_RT_TEST_LIBDISPATCH_CFLAGS})
|
|
endif()
|
|
|
|
set(TSAN_RTL_HEADERS)
|
|
foreach (header ${TSAN_HEADERS})
|
|
list(APPEND TSAN_RTL_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/../${header})
|
|
endforeach()
|
|
|
|
set(TSAN_DEPS tsan)
|
|
# TSan uses C++ standard library headers.
|
|
if (TARGET cxx-headers OR HAVE_LIBCXX)
|
|
list(APPEND TSAN_DEPS cxx-headers)
|
|
endif()
|
|
|
|
# add_tsan_unittest(<name>
|
|
# SOURCES <sources list>
|
|
# HEADERS <extra headers list>)
|
|
macro(add_tsan_unittest testname)
|
|
cmake_parse_arguments(TEST "" "" "SOURCES;HEADERS" ${ARGN})
|
|
if(UNIX)
|
|
foreach(arch ${TSAN_TEST_ARCH})
|
|
set(TsanUnitTestsObjects)
|
|
generate_compiler_rt_tests(TsanUnitTestsObjects TsanUnitTests
|
|
"${testname}-${arch}-Test" ${arch}
|
|
SOURCES ${TEST_SOURCES} ${COMPILER_RT_GTEST_SOURCE}
|
|
RUNTIME ${TSAN_TEST_RUNTIME}
|
|
COMPILE_DEPS ${TEST_HEADERS} ${TSAN_RTL_HEADERS}
|
|
DEPS ${TSAN_DEPS}
|
|
CFLAGS ${TSAN_UNITTEST_CFLAGS}
|
|
LINK_FLAGS ${TSAN_UNITTEST_LINK_FLAGS})
|
|
endforeach()
|
|
endif()
|
|
endmacro()
|
|
|
|
if(COMPILER_RT_CAN_EXECUTE_TESTS AND NOT ANDROID)
|
|
add_subdirectory(rtl)
|
|
add_subdirectory(unit)
|
|
endif()
|