blob: e5c51c8cd47493f82f18131d56bc2c97c3a66ae3 [file] [log] [blame]
Stephen Hines2d1fdb22014-05-28 23:58:16 -07001configure_lit_site_cfg(
2 ${CMAKE_CURRENT_SOURCE_DIR}/lit.common.configured.in
3 ${CMAKE_CURRENT_BINARY_DIR}/lit.common.configured)
4
5# BlocksRuntime and builtins testsuites are not yet ported to lit.
6# add_subdirectory(BlocksRuntime)
7# add_subdirectory(builtins)
8
9set(SANITIZER_COMMON_LIT_TEST_DEPS)
Stephen Hines86277eb2015-03-23 12:06:32 -070010if(COMPILER_RT_STANDALONE_BUILD)
11 add_executable(FileCheck IMPORTED GLOBAL)
12 set_property(TARGET FileCheck PROPERTY IMPORTED_LOCATION ${LLVM_TOOLS_BINARY_DIR}/FileCheck)
13 list(APPEND SANITIZER_COMMON_LIT_TEST_DEPS FileCheck)
14endif()
15
Stephen Hines2d1fdb22014-05-28 23:58:16 -070016# When ANDROID, we build tests with the host compiler (i.e. CMAKE_C_COMPILER),
17# and run tests with tools from the host toolchain.
18if(NOT ANDROID)
19 if(NOT COMPILER_RT_STANDALONE_BUILD)
20 # Use LLVM utils and Clang from the same build tree.
21 list(APPEND SANITIZER_COMMON_LIT_TEST_DEPS
Pirama Arumuga Nainar799172d2016-03-03 15:50:30 -080022 clang clang-headers FileCheck count not llvm-config llvm-nm llvm-objdump
23 llvm-symbolizer compiler-rt-headers)
Stephen Hines86277eb2015-03-23 12:06:32 -070024 if (COMPILER_RT_HAS_PROFILE)
25 list(APPEND SANITIZER_COMMON_LIT_TEST_DEPS profile)
26 endif()
Pirama Arumuga Nainar799172d2016-03-03 15:50:30 -080027 if (WIN32)
28 list(APPEND SANITIZER_COMMON_LIT_TEST_DEPS KillTheDoctor)
29 endif()
Stephen Hines2d1fdb22014-05-28 23:58:16 -070030 endif()
31 if(UNIX)
32 list(APPEND SANITIZER_COMMON_LIT_TEST_DEPS SanitizerLintCheck)
33 endif()
34endif()
35
36# Run sanitizer tests only if we're sure that clang would produce
37# working binaries.
38if(COMPILER_RT_CAN_EXECUTE_TESTS)
Stephen Hines6d186232014-11-26 17:56:19 -080039 if(COMPILER_RT_HAS_ASAN)
Stephen Hines2d1fdb22014-05-28 23:58:16 -070040 add_subdirectory(asan)
41 endif()
Stephen Hines6d186232014-11-26 17:56:19 -080042 if(COMPILER_RT_HAS_DFSAN)
Stephen Hines2d1fdb22014-05-28 23:58:16 -070043 add_subdirectory(dfsan)
44 endif()
Stephen Hines6d186232014-11-26 17:56:19 -080045 if(COMPILER_RT_HAS_LSAN)
Stephen Hines2d1fdb22014-05-28 23:58:16 -070046 add_subdirectory(lsan)
47 endif()
Stephen Hines6d186232014-11-26 17:56:19 -080048 if(COMPILER_RT_HAS_MSAN)
Stephen Hines2d1fdb22014-05-28 23:58:16 -070049 add_subdirectory(msan)
50 endif()
Stephen Hines6d186232014-11-26 17:56:19 -080051 if(COMPILER_RT_HAS_PROFILE)
Stephen Hines2d1fdb22014-05-28 23:58:16 -070052 add_subdirectory(profile)
53 endif()
Stephen Hines6d186232014-11-26 17:56:19 -080054 if(COMPILER_RT_HAS_SANITIZER_COMMON)
Stephen Hines2d1fdb22014-05-28 23:58:16 -070055 add_subdirectory(sanitizer_common)
56 endif()
Stephen Hines6d186232014-11-26 17:56:19 -080057 if(COMPILER_RT_HAS_TSAN)
Stephen Hines2d1fdb22014-05-28 23:58:16 -070058 add_subdirectory(tsan)
59 endif()
Stephen Hines6d186232014-11-26 17:56:19 -080060 if(COMPILER_RT_HAS_UBSAN)
Stephen Hines2d1fdb22014-05-28 23:58:16 -070061 add_subdirectory(ubsan)
62 endif()
Pirama Arumuga Nainar799172d2016-03-03 15:50:30 -080063 # CFI tests require diagnostic mode, which is implemented in UBSan.
64 if(COMPILER_RT_HAS_UBSAN)
65 add_subdirectory(cfi)
66 endif()
Pirama Arumuga Nainarcdce50b2015-07-01 12:26:56 -070067 if(COMPILER_RT_HAS_SAFESTACK)
68 add_subdirectory(safestack)
69 endif()
Stephen Hines2d1fdb22014-05-28 23:58:16 -070070endif()
71
72if(COMPILER_RT_STANDALONE_BUILD)
73 # Now that we've traversed all the directories and know all the lit testsuites,
74 # introduce a rule to run to run all of them.
75 get_property(LLVM_LIT_TESTSUITES GLOBAL PROPERTY LLVM_LIT_TESTSUITES)
76 get_property(LLVM_LIT_DEPENDS GLOBAL PROPERTY LLVM_LIT_DEPENDS)
77 add_lit_target(check-all
78 "Running all regression tests"
79 ${LLVM_LIT_TESTSUITES}
80 DEPENDS ${LLVM_LIT_DEPENDS})
81endif()