blob: 684b409bb8f72f7b3da67f2784d6e8bb629ffb7b [file] [log] [blame]
Alexey Samsonov81a2b462014-02-14 11:00:07 +00001configure_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)
Alexey Samsonovba869e72014-02-14 11:42:22 +00008
Alexey Samsonovaa980c72014-02-19 10:04:29 +00009set(SANITIZER_COMMON_LIT_TEST_DEPS)
Filipe Cabecinhasa1225be2015-02-20 03:41:07 +000010if(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
Alexey Samsonovb73db722014-02-18 07:52:40 +000016# When ANDROID, we build tests with the host compiler (i.e. CMAKE_C_COMPILER),
17# and run tests with tools from the host toolchain.
Alexey Samsonovaa980c72014-02-19 10:04:29 +000018if(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
Peter Collingbourneea087052015-07-29 18:12:45 +000022 clang clang-headers FileCheck count not llvm-config llvm-nm llvm-symbolizer
Reid Kleckner04748b92014-11-21 23:09:51 +000023 compiler-rt-headers)
24 if (COMPILER_RT_HAS_PROFILE)
25 list(APPEND SANITIZER_COMMON_LIT_TEST_DEPS profile)
26 endif()
Peter Collingbournea68d90f2015-07-02 22:08:38 +000027 if (WIN32)
28 list(APPEND SANITIZER_COMMON_LIT_TEST_DEPS KillTheDoctor)
29 endif()
Alexey Samsonovaa980c72014-02-19 10:04:29 +000030 endif()
Alexey Samsonovb73db722014-02-18 07:52:40 +000031 if(UNIX)
32 list(APPEND SANITIZER_COMMON_LIT_TEST_DEPS SanitizerLintCheck)
33 endif()
34endif()
35
Alexey Samsonovba869e72014-02-14 11:42:22 +000036# Run sanitizer tests only if we're sure that clang would produce
37# working binaries.
38if(COMPILER_RT_CAN_EXECUTE_TESTS)
Alexey Samsonov68b9e742014-08-08 22:01:20 +000039 if(COMPILER_RT_HAS_ASAN)
Alexey Samsonov9f20d672014-02-14 14:06:10 +000040 add_subdirectory(asan)
41 endif()
Alexey Samsonov68b9e742014-08-08 22:01:20 +000042 if(COMPILER_RT_HAS_DFSAN)
Alexey Samsonovf6cf6ab2014-02-14 12:05:41 +000043 add_subdirectory(dfsan)
44 endif()
Alexey Samsonov68b9e742014-08-08 22:01:20 +000045 if(COMPILER_RT_HAS_LSAN)
Alexey Samsonov7eeef852014-02-14 12:26:05 +000046 add_subdirectory(lsan)
47 endif()
Alexey Samsonov68b9e742014-08-08 22:01:20 +000048 if(COMPILER_RT_HAS_MSAN)
Alexey Samsonov8434e602014-02-14 13:02:58 +000049 add_subdirectory(msan)
50 endif()
Alexey Samsonov68b9e742014-08-08 22:01:20 +000051 if(COMPILER_RT_HAS_PROFILE)
Duncan P. N. Exon Smithae2f0bb2014-03-31 22:45:37 +000052 add_subdirectory(profile)
53 endif()
Alexey Samsonov68b9e742014-08-08 22:01:20 +000054 if(COMPILER_RT_HAS_SANITIZER_COMMON)
Alexey Samsonov35a66d12014-02-20 12:18:08 +000055 add_subdirectory(sanitizer_common)
56 endif()
Alexey Samsonov68b9e742014-08-08 22:01:20 +000057 if(COMPILER_RT_HAS_TSAN)
Alexey Samsonove6a61832014-02-14 14:35:48 +000058 add_subdirectory(tsan)
59 endif()
Alexey Samsonov68b9e742014-08-08 22:01:20 +000060 if(COMPILER_RT_HAS_UBSAN)
Alexey Samsonovba869e72014-02-14 11:42:22 +000061 add_subdirectory(ubsan)
62 endif()
Alexey Samsonov4133c182015-09-29 21:43:37 +000063 # CFI tests require diagnostic mode, which is implemented in UBSan.
64 if(COMPILER_RT_HAS_UBSAN)
65 add_subdirectory(cfi)
66 endif()
Peter Collingbourneb64d0b12015-06-15 21:08:47 +000067 if(COMPILER_RT_HAS_SAFESTACK)
68 add_subdirectory(safestack)
69 endif()
Alexey Samsonovba869e72014-02-14 11:42:22 +000070endif()
Alexey Samsonov04e7ad22014-02-20 12:36:26 +000071
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()