blob: 7685fb3f426f1161a995c66df8011006d9305714 [file] [log] [blame]
Chris Bienemana58d0652016-02-17 16:38:541# Needed for lit support
2include(AddLLVM)
3
Alexey Samsonov81a2b462014-02-14 11:00:074configure_lit_site_cfg(
5 ${CMAKE_CURRENT_SOURCE_DIR}/lit.common.configured.in
6 ${CMAKE_CURRENT_BINARY_DIR}/lit.common.configured)
7
Erik Pilkington0490e1c52017-03-09 17:02:168# BlocksRuntime (and most of builtins) testsuites are not yet ported to lit.
Alexey Samsonov81a2b462014-02-14 11:00:079# add_subdirectory(BlocksRuntime)
Alexey Samsonovba869e72014-02-14 11:42:2210
Alexey Samsonovaa980c72014-02-19 10:04:2911set(SANITIZER_COMMON_LIT_TEST_DEPS)
Filipe Cabecinhasa1225be2015-02-20 03:41:0712if(COMPILER_RT_STANDALONE_BUILD)
13 add_executable(FileCheck IMPORTED GLOBAL)
14 set_property(TARGET FileCheck PROPERTY IMPORTED_LOCATION ${LLVM_TOOLS_BINARY_DIR}/FileCheck)
15 list(APPEND SANITIZER_COMMON_LIT_TEST_DEPS FileCheck)
16endif()
17
Alexey Samsonovb73db722014-02-18 07:52:4018# When ANDROID, we build tests with the host compiler (i.e. CMAKE_C_COMPILER),
19# and run tests with tools from the host toolchain.
Alexey Samsonovaa980c72014-02-19 10:04:2920if(NOT ANDROID)
21 if(NOT COMPILER_RT_STANDALONE_BUILD)
22 # Use LLVM utils and Clang from the same build tree.
23 list(APPEND SANITIZER_COMMON_LIT_TEST_DEPS
Alexey Samsonove243d452015-12-07 22:43:3024 clang clang-headers FileCheck count not llvm-config llvm-nm llvm-objdump
Reid Klecknere1e344e2016-11-14 17:37:5025 llvm-readobj llvm-symbolizer compiler-rt-headers sancov)
Reid Kleckner04748b92014-11-21 23:09:5126 if (COMPILER_RT_HAS_PROFILE)
27 list(APPEND SANITIZER_COMMON_LIT_TEST_DEPS profile)
28 endif()
Peter Collingbournea68d90f2015-07-02 22:08:3829 if (WIN32)
30 list(APPEND SANITIZER_COMMON_LIT_TEST_DEPS KillTheDoctor)
31 endif()
Alexey Samsonovaa980c72014-02-19 10:04:2932 endif()
Sean Silva9af25702016-04-06 23:18:0933 if(CMAKE_HOST_UNIX)
Alexey Samsonovb73db722014-02-18 07:52:4034 list(APPEND SANITIZER_COMMON_LIT_TEST_DEPS SanitizerLintCheck)
35 endif()
36endif()
37
Alexey Samsonovba869e72014-02-14 11:42:2238# Run sanitizer tests only if we're sure that clang would produce
39# working binaries.
40if(COMPILER_RT_CAN_EXECUTE_TESTS)
Erik Pilkington0490e1c52017-03-09 17:02:1641 if(COMPILER_RT_BUILD_BUILTINS)
42 add_subdirectory(builtins)
43 endif()
Michal Gorny2bcd94f2017-04-26 07:35:3644 if(COMPILER_RT_BUILD_SANITIZERS)
45 if(COMPILER_RT_HAS_ASAN)
46 add_subdirectory(asan)
47 endif()
48 if(COMPILER_RT_HAS_DFSAN)
49 add_subdirectory(dfsan)
50 endif()
51 if (COMPILER_RT_HAS_INTERCEPTION)
52 add_subdirectory(interception)
53 endif()
54 if(COMPILER_RT_HAS_LSAN)
55 add_subdirectory(lsan)
56 endif()
57 if(COMPILER_RT_HAS_MSAN)
58 add_subdirectory(msan)
59 endif()
60 if(COMPILER_RT_HAS_PROFILE)
61 add_subdirectory(profile)
62 endif()
63 if(COMPILER_RT_HAS_SANITIZER_COMMON)
64 add_subdirectory(sanitizer_common)
65 endif()
66 if(COMPILER_RT_HAS_TSAN)
67 add_subdirectory(tsan)
68 endif()
69 if(COMPILER_RT_HAS_UBSAN)
70 add_subdirectory(ubsan)
71 endif()
72 # CFI tests require diagnostic mode, which is implemented in UBSan.
73 if(COMPILER_RT_HAS_UBSAN)
74 add_subdirectory(cfi)
75 endif()
76 if(COMPILER_RT_HAS_SAFESTACK)
77 add_subdirectory(safestack)
78 endif()
79 if(COMPILER_RT_HAS_ESAN)
80 add_subdirectory(esan)
81 endif()
82 if(COMPILER_RT_HAS_SCUDO)
83 add_subdirectory(scudo)
84 endif()
Chris Bieneman5c64ddf2015-12-10 00:40:5885 endif()
Michal Gorny2bcd94f2017-04-26 07:35:3686 if(COMPILER_RT_BUILD_XRAY AND COMPILER_RT_HAS_XRAY)
Dean Michael Berris68e74842016-08-08 03:10:2287 add_subdirectory(xray)
88 endif()
Alexey Samsonovba869e72014-02-14 11:42:2289endif()
Alexey Samsonov04e7ad22014-02-20 12:36:2690
91if(COMPILER_RT_STANDALONE_BUILD)
92 # Now that we've traversed all the directories and know all the lit testsuites,
93 # introduce a rule to run to run all of them.
94 get_property(LLVM_LIT_TESTSUITES GLOBAL PROPERTY LLVM_LIT_TESTSUITES)
95 get_property(LLVM_LIT_DEPENDS GLOBAL PROPERTY LLVM_LIT_DEPENDS)
Chris Bieneman5968c3a2016-08-19 22:17:4896 add_lit_target(check-compiler-rt
Alexey Samsonov04e7ad22014-02-20 12:36:2697 "Running all regression tests"
98 ${LLVM_LIT_TESTSUITES}
99 DEPENDS ${LLVM_LIT_DEPENDS})
Chris Bieneman5968c3a2016-08-19 22:17:48100 if(NOT TARGET check-all)
101 add_custom_target(check-all)
102 endif()
Chris Bieneman5f254622016-09-01 18:26:51103 add_custom_target(compiler-rt-test-depends DEPENDS ${LLVM_LIT_DEPENDS})
Chris Bieneman5968c3a2016-08-19 22:17:48104 add_dependencies(check-all check-compiler-rt)
Alexey Samsonov04e7ad22014-02-20 12:36:26105endif()