blob: ce715bb1daa1ab87e7095eb8cdac7cc697075049 [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
22 clang clang-headers FileCheck count not llvm-nm llvm-symbolizer
Stephen Hines86277eb2015-03-23 12:06:32 -070023 compiler-rt-headers)
24 if (COMPILER_RT_HAS_PROFILE)
25 list(APPEND SANITIZER_COMMON_LIT_TEST_DEPS profile)
26 endif()
Stephen Hines2d1fdb22014-05-28 23:58:16 -070027 endif()
28 if(UNIX)
29 list(APPEND SANITIZER_COMMON_LIT_TEST_DEPS SanitizerLintCheck)
30 endif()
31endif()
32
33# Run sanitizer tests only if we're sure that clang would produce
34# working binaries.
35if(COMPILER_RT_CAN_EXECUTE_TESTS)
Stephen Hines6d186232014-11-26 17:56:19 -080036 if(COMPILER_RT_HAS_ASAN)
Stephen Hines2d1fdb22014-05-28 23:58:16 -070037 add_subdirectory(asan)
38 endif()
Stephen Hines6d186232014-11-26 17:56:19 -080039 if(COMPILER_RT_HAS_DFSAN)
Stephen Hines2d1fdb22014-05-28 23:58:16 -070040 add_subdirectory(dfsan)
41 endif()
Stephen Hines6d186232014-11-26 17:56:19 -080042 if(COMPILER_RT_HAS_LSAN)
Stephen Hines2d1fdb22014-05-28 23:58:16 -070043 add_subdirectory(lsan)
44 endif()
Stephen Hines6d186232014-11-26 17:56:19 -080045 if(COMPILER_RT_HAS_MSAN)
Stephen Hines2d1fdb22014-05-28 23:58:16 -070046 add_subdirectory(msan)
47 endif()
Stephen Hines6d186232014-11-26 17:56:19 -080048 if(COMPILER_RT_HAS_PROFILE)
Stephen Hines2d1fdb22014-05-28 23:58:16 -070049 add_subdirectory(profile)
50 endif()
Stephen Hines6d186232014-11-26 17:56:19 -080051 if(COMPILER_RT_HAS_SANITIZER_COMMON)
Stephen Hines2d1fdb22014-05-28 23:58:16 -070052 add_subdirectory(sanitizer_common)
53 endif()
Stephen Hines6d186232014-11-26 17:56:19 -080054 if(COMPILER_RT_HAS_TSAN)
Stephen Hines2d1fdb22014-05-28 23:58:16 -070055 add_subdirectory(tsan)
56 endif()
Stephen Hines6d186232014-11-26 17:56:19 -080057 if(COMPILER_RT_HAS_UBSAN)
Stephen Hines2d1fdb22014-05-28 23:58:16 -070058 add_subdirectory(ubsan)
59 endif()
Stephen Hines86277eb2015-03-23 12:06:32 -070060 add_subdirectory(cfi)
Pirama Arumuga Nainarcdce50b2015-07-01 12:26:56 -070061 if(COMPILER_RT_HAS_SAFESTACK)
62 add_subdirectory(safestack)
63 endif()
Stephen Hines2d1fdb22014-05-28 23:58:16 -070064endif()
65
66if(COMPILER_RT_STANDALONE_BUILD)
67 # Now that we've traversed all the directories and know all the lit testsuites,
68 # introduce a rule to run to run all of them.
69 get_property(LLVM_LIT_TESTSUITES GLOBAL PROPERTY LLVM_LIT_TESTSUITES)
70 get_property(LLVM_LIT_DEPENDS GLOBAL PROPERTY LLVM_LIT_DEPENDS)
71 add_lit_target(check-all
72 "Running all regression tests"
73 ${LLVM_LIT_TESTSUITES}
74 DEPENDS ${LLVM_LIT_DEPENDS})
75endif()