Chris Bieneman | a58d065 | 2016-02-17 16:38:54 | [diff] [blame] | 1 | # Needed for lit support |
| 2 | include(AddLLVM) |
| 3 | |
Alexey Samsonov | 81a2b46 | 2014-02-14 11:00:07 | [diff] [blame] | 4 | configure_lit_site_cfg( |
| 5 | ${CMAKE_CURRENT_SOURCE_DIR}/lit.common.configured.in |
| 6 | ${CMAKE_CURRENT_BINARY_DIR}/lit.common.configured) |
| 7 | |
Erik Pilkington | 0490e1c5 | 2017-03-09 17:02:16 | [diff] [blame] | 8 | # BlocksRuntime (and most of builtins) testsuites are not yet ported to lit. |
Alexey Samsonov | 81a2b46 | 2014-02-14 11:00:07 | [diff] [blame] | 9 | # add_subdirectory(BlocksRuntime) |
Alexey Samsonov | ba869e7 | 2014-02-14 11:42:22 | [diff] [blame] | 10 | |
Alexey Samsonov | aa980c7 | 2014-02-19 10:04:29 | [diff] [blame] | 11 | set(SANITIZER_COMMON_LIT_TEST_DEPS) |
Filipe Cabecinhas | a1225be | 2015-02-20 03:41:07 | [diff] [blame] | 12 | if(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) |
| 16 | endif() |
| 17 | |
Alexey Samsonov | b73db72 | 2014-02-18 07:52:40 | [diff] [blame] | 18 | # 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 Samsonov | aa980c7 | 2014-02-19 10:04:29 | [diff] [blame] | 20 | if(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 Samsonov | e243d45 | 2015-12-07 22:43:30 | [diff] [blame] | 24 | clang clang-headers FileCheck count not llvm-config llvm-nm llvm-objdump |
Reid Kleckner | e1e344e | 2016-11-14 17:37:50 | [diff] [blame] | 25 | llvm-readobj llvm-symbolizer compiler-rt-headers sancov) |
Reid Kleckner | 04748b9 | 2014-11-21 23:09:51 | [diff] [blame] | 26 | if (COMPILER_RT_HAS_PROFILE) |
| 27 | list(APPEND SANITIZER_COMMON_LIT_TEST_DEPS profile) |
| 28 | endif() |
Peter Collingbourne | a68d90f | 2015-07-02 22:08:38 | [diff] [blame] | 29 | if (WIN32) |
| 30 | list(APPEND SANITIZER_COMMON_LIT_TEST_DEPS KillTheDoctor) |
| 31 | endif() |
Alexey Samsonov | aa980c7 | 2014-02-19 10:04:29 | [diff] [blame] | 32 | endif() |
Sean Silva | 9af2570 | 2016-04-06 23:18:09 | [diff] [blame] | 33 | if(CMAKE_HOST_UNIX) |
Alexey Samsonov | b73db72 | 2014-02-18 07:52:40 | [diff] [blame] | 34 | list(APPEND SANITIZER_COMMON_LIT_TEST_DEPS SanitizerLintCheck) |
| 35 | endif() |
| 36 | endif() |
| 37 | |
Alexey Samsonov | ba869e7 | 2014-02-14 11:42:22 | [diff] [blame] | 38 | # Run sanitizer tests only if we're sure that clang would produce |
| 39 | # working binaries. |
| 40 | if(COMPILER_RT_CAN_EXECUTE_TESTS) |
Erik Pilkington | 0490e1c5 | 2017-03-09 17:02:16 | [diff] [blame] | 41 | if(COMPILER_RT_BUILD_BUILTINS) |
| 42 | add_subdirectory(builtins) |
| 43 | endif() |
Michal Gorny | 2bcd94f | 2017-04-26 07:35:36 | [diff] [blame^] | 44 | 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 Bieneman | 5c64ddf | 2015-12-10 00:40:58 | [diff] [blame] | 85 | endif() |
Michal Gorny | 2bcd94f | 2017-04-26 07:35:36 | [diff] [blame^] | 86 | if(COMPILER_RT_BUILD_XRAY AND COMPILER_RT_HAS_XRAY) |
Dean Michael Berris | 68e7484 | 2016-08-08 03:10:22 | [diff] [blame] | 87 | add_subdirectory(xray) |
| 88 | endif() |
Alexey Samsonov | ba869e7 | 2014-02-14 11:42:22 | [diff] [blame] | 89 | endif() |
Alexey Samsonov | 04e7ad2 | 2014-02-20 12:36:26 | [diff] [blame] | 90 | |
| 91 | if(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 Bieneman | 5968c3a | 2016-08-19 22:17:48 | [diff] [blame] | 96 | add_lit_target(check-compiler-rt |
Alexey Samsonov | 04e7ad2 | 2014-02-20 12:36:26 | [diff] [blame] | 97 | "Running all regression tests" |
| 98 | ${LLVM_LIT_TESTSUITES} |
| 99 | DEPENDS ${LLVM_LIT_DEPENDS}) |
Chris Bieneman | 5968c3a | 2016-08-19 22:17:48 | [diff] [blame] | 100 | if(NOT TARGET check-all) |
| 101 | add_custom_target(check-all) |
| 102 | endif() |
Chris Bieneman | 5f25462 | 2016-09-01 18:26:51 | [diff] [blame] | 103 | add_custom_target(compiler-rt-test-depends DEPENDS ${LLVM_LIT_DEPENDS}) |
Chris Bieneman | 5968c3a | 2016-08-19 22:17:48 | [diff] [blame] | 104 | add_dependencies(check-all check-compiler-rt) |
Alexey Samsonov | 04e7ad2 | 2014-02-20 12:36:26 | [diff] [blame] | 105 | endif() |