Home | History | Annotate | Download | only in test
      1 configure_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 
      9 set(SANITIZER_COMMON_LIT_TEST_DEPS)
     10 if(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)
     14 endif()
     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.
     18 if(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-config llvm-nm llvm-objdump
     23       llvm-symbolizer compiler-rt-headers)
     24     if (COMPILER_RT_HAS_PROFILE)
     25       list(APPEND SANITIZER_COMMON_LIT_TEST_DEPS profile)
     26     endif()
     27     if (WIN32)
     28       list(APPEND SANITIZER_COMMON_LIT_TEST_DEPS KillTheDoctor)
     29     endif()
     30   endif()
     31   if(UNIX)
     32     list(APPEND SANITIZER_COMMON_LIT_TEST_DEPS SanitizerLintCheck)
     33   endif()
     34 endif()
     35 
     36 # Run sanitizer tests only if we're sure that clang would produce
     37 # working binaries.
     38 if(COMPILER_RT_CAN_EXECUTE_TESTS)
     39   if(COMPILER_RT_HAS_ASAN)
     40     add_subdirectory(asan)
     41   endif()
     42   if(COMPILER_RT_HAS_DFSAN)
     43     add_subdirectory(dfsan)
     44   endif()
     45   if(COMPILER_RT_HAS_LSAN)
     46     add_subdirectory(lsan)
     47   endif()
     48   if(COMPILER_RT_HAS_MSAN)
     49     add_subdirectory(msan)
     50   endif()
     51   if(COMPILER_RT_HAS_PROFILE)
     52     add_subdirectory(profile)
     53   endif()
     54   if(COMPILER_RT_HAS_SANITIZER_COMMON)
     55     add_subdirectory(sanitizer_common)
     56   endif()
     57   if(COMPILER_RT_HAS_TSAN)
     58     add_subdirectory(tsan)
     59   endif()
     60   if(COMPILER_RT_HAS_UBSAN)
     61     add_subdirectory(ubsan)
     62   endif()
     63   # CFI tests require diagnostic mode, which is implemented in UBSan.
     64   if(COMPILER_RT_HAS_UBSAN)
     65     add_subdirectory(cfi)
     66   endif()
     67   if(COMPILER_RT_HAS_SAFESTACK)
     68     add_subdirectory(safestack)
     69   endif()
     70 endif()
     71 
     72 if(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})
     81 endif()
     82