CMakeLists.txt revision 86277eb844c4983c81de62d7c050e92fe7155788
1configure_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)
10if(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
16# 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
23      compiler-rt-headers)
24    if (COMPILER_RT_HAS_PROFILE)
25      list(APPEND SANITIZER_COMMON_LIT_TEST_DEPS profile)
26    endif()
27  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)
36  if(COMPILER_RT_HAS_ASAN)
37    add_subdirectory(asan)
38  endif()
39  if(COMPILER_RT_HAS_DFSAN)
40    add_subdirectory(dfsan)
41  endif()
42  if(COMPILER_RT_HAS_LSAN)
43    add_subdirectory(lsan)
44  endif()
45  if(COMPILER_RT_HAS_MSAN)
46    add_subdirectory(msan)
47  endif()
48  if(COMPILER_RT_HAS_PROFILE)
49    add_subdirectory(profile)
50  endif()
51  if(COMPILER_RT_HAS_SANITIZER_COMMON)
52    add_subdirectory(sanitizer_common)
53  endif()
54  if(COMPILER_RT_HAS_TSAN)
55    add_subdirectory(tsan)
56  endif()
57  if(COMPILER_RT_HAS_UBSAN)
58    add_subdirectory(ubsan)
59  endif()
60  add_subdirectory(cfi)
61endif()
62
63if(COMPILER_RT_STANDALONE_BUILD)
64  # Now that we've traversed all the directories and know all the lit testsuites,
65  # introduce a rule to run to run all of them.
66  get_property(LLVM_LIT_TESTSUITES GLOBAL PROPERTY LLVM_LIT_TESTSUITES)
67  get_property(LLVM_LIT_DEPENDS GLOBAL PROPERTY LLVM_LIT_DEPENDS)
68  add_lit_target(check-all
69    "Running all regression tests"
70    ${LLVM_LIT_TESTSUITES}
71    DEPENDS ${LLVM_LIT_DEPENDS})
72endif()
73