2014-02-20 17:47:18 +08:00
|
|
|
set(TSAN_TEST_DEPS ${SANITIZER_COMMON_LIT_TEST_DEPS})
|
2015-12-09 05:54:39 +08:00
|
|
|
if(${COMPILER_RT_DEFAULT_TARGET_ARCH} MATCHES "x86_64")
|
2015-04-10 17:45:22 +08:00
|
|
|
list(APPEND TSAN_TEST_DEPS GotsanRuntimeCheck)
|
|
|
|
endif()
|
2014-02-20 17:47:18 +08:00
|
|
|
if(NOT COMPILER_RT_STANDALONE_BUILD)
|
|
|
|
list(APPEND TSAN_TEST_DEPS tsan)
|
|
|
|
endif()
|
2014-05-17 02:22:04 +08:00
|
|
|
if(COMPILER_RT_HAS_LIBCXX_SOURCES AND
|
2015-11-09 17:53:38 +08:00
|
|
|
COMPILER_RT_TEST_COMPILER_ID STREQUAL "Clang"
|
|
|
|
AND NOT APPLE)
|
2014-05-14 06:30:16 +08:00
|
|
|
list(APPEND TSAN_TEST_DEPS libcxx_tsan)
|
|
|
|
set(TSAN_HAS_LIBCXX True)
|
|
|
|
else()
|
|
|
|
set(TSAN_HAS_LIBCXX False)
|
|
|
|
endif()
|
|
|
|
|
2016-02-03 02:43:53 +08:00
|
|
|
set(TSAN_TESTSUITES)
|
|
|
|
|
2016-02-03 06:42:25 +08:00
|
|
|
set(TSAN_TEST_ARCH ${TSAN_SUPPORTED_ARCH})
|
|
|
|
if(APPLE)
|
|
|
|
darwin_filter_host_archs(TSAN_SUPPORTED_ARCH TSAN_TEST_ARCH)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
foreach(arch ${TSAN_TEST_ARCH})
|
2016-02-23 09:34:17 +08:00
|
|
|
set(TSAN_TEST_TARGET_ARCH ${arch})
|
2016-02-03 02:43:53 +08:00
|
|
|
string(TOLOWER "-${arch}" TSAN_TEST_CONFIG_SUFFIX)
|
|
|
|
if(ANDROID OR ${arch} MATCHES "arm|aarch64")
|
|
|
|
# This is only true if we are cross-compiling.
|
|
|
|
# Build all tests with host compiler and use host tools.
|
|
|
|
set(TSAN_TEST_TARGET_CC ${COMPILER_RT_TEST_COMPILER})
|
|
|
|
set(TSAN_TEST_TARGET_CFLAGS ${COMPILER_RT_TEST_COMPILER_CFLAGS})
|
|
|
|
else()
|
|
|
|
get_target_flags_for_arch(${arch} TSAN_TEST_TARGET_CFLAGS)
|
|
|
|
string(REPLACE ";" " " TSAN_TEST_TARGET_CFLAGS "${TSAN_TEST_TARGET_CFLAGS}")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
string(TOUPPER ${arch} ARCH_UPPER_CASE)
|
|
|
|
set(CONFIG_NAME ${ARCH_UPPER_CASE}Config)
|
|
|
|
|
|
|
|
configure_lit_site_cfg(
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME}/lit.site.cfg)
|
|
|
|
list(APPEND TSAN_TESTSUITES ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME})
|
|
|
|
endforeach()
|
2014-02-14 22:35:48 +08:00
|
|
|
|
2014-02-19 19:18:47 +08:00
|
|
|
if(COMPILER_RT_INCLUDE_TESTS)
|
2014-02-14 22:35:48 +08:00
|
|
|
configure_lit_site_cfg(
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.site.cfg.in
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg)
|
|
|
|
list(APPEND TSAN_TEST_DEPS TsanUnitTests)
|
2016-02-18 03:35:51 +08:00
|
|
|
list(APPEND TSAN_TESTSUITES ${CMAKE_CURRENT_BINARY_DIR}/Unit)
|
2014-02-14 22:35:48 +08:00
|
|
|
endif()
|
|
|
|
|
|
|
|
add_lit_testsuite(check-tsan "Running ThreadSanitizer tests"
|
2016-02-18 03:35:51 +08:00
|
|
|
${TSAN_TESTSUITES}
|
2014-02-14 22:35:48 +08:00
|
|
|
DEPENDS ${TSAN_TEST_DEPS})
|
|
|
|
set_target_properties(check-tsan PROPERTIES FOLDER "TSan tests")
|