1set(TSAN_TEST_DEPS ${SANITIZER_COMMON_LIT_TEST_DEPS})
2if(NOT ${LLVM_NATIVE_ARCH} STREQUAL "Mips")
3  list(APPEND TSAN_TEST_DEPS GotsanRuntimeCheck)
4endif()
5if(NOT COMPILER_RT_STANDALONE_BUILD)
6  list(APPEND TSAN_TEST_DEPS tsan)
7endif()
8if(COMPILER_RT_HAS_LIBCXX_SOURCES AND
9   COMPILER_RT_TEST_COMPILER_ID STREQUAL "Clang")
10  list(APPEND TSAN_TEST_DEPS libcxx_tsan)
11  set(TSAN_HAS_LIBCXX True)
12else()
13  set(TSAN_HAS_LIBCXX False)
14endif()
15
16configure_lit_site_cfg(
17  ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in
18  ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg)
19
20if(COMPILER_RT_INCLUDE_TESTS)
21  configure_lit_site_cfg(
22    ${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.site.cfg.in
23    ${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg)
24  list(APPEND TSAN_TEST_DEPS TsanUnitTests)
25endif()
26
27add_lit_testsuite(check-tsan "Running ThreadSanitizer tests"
28  ${CMAKE_CURRENT_BINARY_DIR}
29  DEPENDS ${TSAN_TEST_DEPS})
30set_target_properties(check-tsan PROPERTIES FOLDER "TSan tests")
31