1*7c3d14c8STreehugger Robot# Needed for lit support 2*7c3d14c8STreehugger Robotinclude(AddLLVM) 3*7c3d14c8STreehugger Robot 4*7c3d14c8STreehugger Robotconfigure_lit_site_cfg( 5*7c3d14c8STreehugger Robot ${CMAKE_CURRENT_SOURCE_DIR}/lit.common.configured.in 6*7c3d14c8STreehugger Robot ${CMAKE_CURRENT_BINARY_DIR}/lit.common.configured) 7*7c3d14c8STreehugger Robot 8*7c3d14c8STreehugger Robot# BlocksRuntime and builtins testsuites are not yet ported to lit. 9*7c3d14c8STreehugger Robot# add_subdirectory(BlocksRuntime) 10*7c3d14c8STreehugger Robot# add_subdirectory(builtins) 11*7c3d14c8STreehugger Robot 12*7c3d14c8STreehugger Robotset(SANITIZER_COMMON_LIT_TEST_DEPS) 13*7c3d14c8STreehugger Robotif(COMPILER_RT_STANDALONE_BUILD) 14*7c3d14c8STreehugger Robot add_executable(FileCheck IMPORTED GLOBAL) 15*7c3d14c8STreehugger Robot set_property(TARGET FileCheck PROPERTY IMPORTED_LOCATION ${LLVM_TOOLS_BINARY_DIR}/FileCheck) 16*7c3d14c8STreehugger Robot list(APPEND SANITIZER_COMMON_LIT_TEST_DEPS FileCheck) 17*7c3d14c8STreehugger Robotendif() 18*7c3d14c8STreehugger Robot 19*7c3d14c8STreehugger Robot# When ANDROID, we build tests with the host compiler (i.e. CMAKE_C_COMPILER), 20*7c3d14c8STreehugger Robot# and run tests with tools from the host toolchain. 21*7c3d14c8STreehugger Robotif(NOT ANDROID) 22*7c3d14c8STreehugger Robot if(NOT COMPILER_RT_STANDALONE_BUILD) 23*7c3d14c8STreehugger Robot # Use LLVM utils and Clang from the same build tree. 24*7c3d14c8STreehugger Robot list(APPEND SANITIZER_COMMON_LIT_TEST_DEPS 25*7c3d14c8STreehugger Robot clang clang-headers FileCheck count not llvm-config llvm-nm llvm-objdump 26*7c3d14c8STreehugger Robot llvm-symbolizer compiler-rt-headers sancov) 27*7c3d14c8STreehugger Robot if (COMPILER_RT_HAS_PROFILE) 28*7c3d14c8STreehugger Robot list(APPEND SANITIZER_COMMON_LIT_TEST_DEPS profile) 29*7c3d14c8STreehugger Robot endif() 30*7c3d14c8STreehugger Robot if (WIN32) 31*7c3d14c8STreehugger Robot list(APPEND SANITIZER_COMMON_LIT_TEST_DEPS KillTheDoctor) 32*7c3d14c8STreehugger Robot endif() 33*7c3d14c8STreehugger Robot endif() 34*7c3d14c8STreehugger Robot if(CMAKE_HOST_UNIX) 35*7c3d14c8STreehugger Robot list(APPEND SANITIZER_COMMON_LIT_TEST_DEPS SanitizerLintCheck) 36*7c3d14c8STreehugger Robot endif() 37*7c3d14c8STreehugger Robotendif() 38*7c3d14c8STreehugger Robot 39*7c3d14c8STreehugger Robot# Run sanitizer tests only if we're sure that clang would produce 40*7c3d14c8STreehugger Robot# working binaries. 41*7c3d14c8STreehugger Robotif(COMPILER_RT_CAN_EXECUTE_TESTS) 42*7c3d14c8STreehugger Robot if(COMPILER_RT_HAS_ASAN) 43*7c3d14c8STreehugger Robot add_subdirectory(asan) 44*7c3d14c8STreehugger Robot endif() 45*7c3d14c8STreehugger Robot if(COMPILER_RT_HAS_DFSAN) 46*7c3d14c8STreehugger Robot add_subdirectory(dfsan) 47*7c3d14c8STreehugger Robot endif() 48*7c3d14c8STreehugger Robot if(COMPILER_RT_HAS_LSAN) 49*7c3d14c8STreehugger Robot add_subdirectory(lsan) 50*7c3d14c8STreehugger Robot endif() 51*7c3d14c8STreehugger Robot if(COMPILER_RT_HAS_MSAN) 52*7c3d14c8STreehugger Robot add_subdirectory(msan) 53*7c3d14c8STreehugger Robot endif() 54*7c3d14c8STreehugger Robot if(COMPILER_RT_HAS_PROFILE) 55*7c3d14c8STreehugger Robot add_subdirectory(profile) 56*7c3d14c8STreehugger Robot endif() 57*7c3d14c8STreehugger Robot if(COMPILER_RT_HAS_SANITIZER_COMMON) 58*7c3d14c8STreehugger Robot add_subdirectory(sanitizer_common) 59*7c3d14c8STreehugger Robot endif() 60*7c3d14c8STreehugger Robot if(COMPILER_RT_HAS_TSAN) 61*7c3d14c8STreehugger Robot add_subdirectory(tsan) 62*7c3d14c8STreehugger Robot endif() 63*7c3d14c8STreehugger Robot if(COMPILER_RT_HAS_UBSAN) 64*7c3d14c8STreehugger Robot add_subdirectory(ubsan) 65*7c3d14c8STreehugger Robot endif() 66*7c3d14c8STreehugger Robot # CFI tests require diagnostic mode, which is implemented in UBSan. 67*7c3d14c8STreehugger Robot if(COMPILER_RT_HAS_UBSAN) 68*7c3d14c8STreehugger Robot add_subdirectory(cfi) 69*7c3d14c8STreehugger Robot endif() 70*7c3d14c8STreehugger Robot if(COMPILER_RT_HAS_SAFESTACK) 71*7c3d14c8STreehugger Robot add_subdirectory(safestack) 72*7c3d14c8STreehugger Robot endif() 73*7c3d14c8STreehugger Robot if(COMPILER_RT_HAS_ESAN) 74*7c3d14c8STreehugger Robot add_subdirectory(esan) 75*7c3d14c8STreehugger Robot endif() 76*7c3d14c8STreehugger Robot if(COMPILER_RT_HAS_SCUDO) 77*7c3d14c8STreehugger Robot add_subdirectory(scudo) 78*7c3d14c8STreehugger Robot endif() 79*7c3d14c8STreehugger Robotendif() 80*7c3d14c8STreehugger Robot 81*7c3d14c8STreehugger Robotif(COMPILER_RT_STANDALONE_BUILD) 82*7c3d14c8STreehugger Robot # Now that we've traversed all the directories and know all the lit testsuites, 83*7c3d14c8STreehugger Robot # introduce a rule to run to run all of them. 84*7c3d14c8STreehugger Robot get_property(LLVM_LIT_TESTSUITES GLOBAL PROPERTY LLVM_LIT_TESTSUITES) 85*7c3d14c8STreehugger Robot get_property(LLVM_LIT_DEPENDS GLOBAL PROPERTY LLVM_LIT_DEPENDS) 86*7c3d14c8STreehugger Robot add_lit_target(check-all 87*7c3d14c8STreehugger Robot "Running all regression tests" 88*7c3d14c8STreehugger Robot ${LLVM_LIT_TESTSUITES} 89*7c3d14c8STreehugger Robot DEPENDS ${LLVM_LIT_DEPENDS}) 90*7c3d14c8STreehugger Robotendif() 91