1 set(CLANG_TEST_DIRECTORIES 2 "Analysis" 3 "CodeCompletion" 4 "CodeGen" 5 "CodeGenCUDA" 6 "CodeGenCXX" 7 "CodeGenObjC" 8 "CodeGenOpenCL" 9 "Coverage" 10 "CXX" 11 "Driver" 12 "FixIt" 13 "Frontend" 14 "Headers" 15 "Index" 16 "Lexer" 17 "Misc" 18 "PCH" 19 "Parser" 20 "Preprocessor" 21 "Rewriter" 22 "Sema" 23 "SemaCUDA" 24 "SemaCXX" 25 "SemaObjC" 26 "SemaObjCXX" 27 "SemaOpenCL" 28 "SemaTemplate") 29 30 set(LLVM_SOURCE_DIR "${LLVM_MAIN_SRC_DIR}") 31 set(LLVM_BINARY_DIR "${LLVM_BINARY_DIR}") 32 set(LLVM_BUILD_MODE "%(build_mode)s") 33 set(LLVM_TOOLS_DIR "${LLVM_TOOLS_BINARY_DIR}/%(build_config)s") 34 set(LLVM_LIBS_DIR "${LLVM_BINARY_DIR}/lib/%(build_config)s") 35 set(CLANG_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/..") 36 set(CLANG_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/..") 37 if(BUILD_SHARED_LIBS) 38 set(ENABLE_SHARED 1) 39 else() 40 set(ENABLE_SHARED 0) 41 endif(BUILD_SHARED_LIBS) 42 43 configure_file( 44 ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in 45 ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg) 46 47 configure_file( 48 ${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.site.cfg.in 49 ${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg 50 @ONLY) 51 52 include(FindPythonInterp) 53 if(PYTHONINTERP_FOUND) 54 if( LLVM_MAIN_SRC_DIR ) 55 set(LIT "${LLVM_SOURCE_DIR}/utils/lit/lit.py") 56 else() 57 set(LIT "${PATH_TO_LLVM_BUILD}/bin/${CMAKE_CFG_INTDIR}/llvm-lit") 58 # Installed LLVM does not contain ${CMAKE_CFG_INTDIR} in paths. 59 if( NOT EXISTS ${LIT} ) 60 set(LIT "${PATH_TO_LLVM_BUILD}/bin/llvm-lit") 61 endif() 62 endif() 63 64 if( PATH_TO_LLVM_BUILD ) 65 set(CLANG_TEST_EXTRA_ARGS "--path=${CLANG_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}") 66 endif() 67 68 option(CLANG_TEST_USE_VG "Run Clang tests under Valgrind" OFF) 69 if(CLANG_TEST_USE_VG) 70 set(CLANG_TEST_EXTRA_ARGS ${CLANG_TEST_EXTRA_ARGS} "--vg") 71 endif () 72 73 set(LIT_ARGS "${CLANG_TEST_EXTRA_ARGS} ${LLVM_LIT_ARGS}") 74 separate_arguments(LIT_ARGS) 75 76 add_custom_target(clang-test.deps) 77 set_target_properties(clang-test.deps PROPERTIES FOLDER "Clang tests") 78 79 add_custom_target(clang-test 80 COMMAND ${PYTHON_EXECUTABLE} 81 ${LIT} 82 --param clang_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg 83 --param clang_unit_site_config=${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg 84 --param build_config=${CMAKE_CFG_INTDIR} 85 --param build_mode=${RUNTIME_BUILD_MODE} 86 ${LIT_ARGS} 87 ${CMAKE_CURRENT_BINARY_DIR} 88 COMMENT "Running Clang regression tests") 89 90 if( NOT CLANG_BUILT_STANDALONE ) 91 add_custom_target(check-all 92 COMMAND ${PYTHON_EXECUTABLE} 93 ${LIT} 94 --param build_config=${CMAKE_CFG_INTDIR} 95 --param build_mode=${RUNTIME_BUILD_MODE} 96 ${LIT_ARGS} 97 ${LLVM_BINARY_DIR}/test 98 ${CMAKE_CURRENT_BINARY_DIR} 99 COMMENT "Running Clang and LLVM regression tests") 100 add_dependencies(check-all clang-test.deps) 101 if ( LLVM_INCLUDE_TESTS ) 102 add_dependencies(clang-test.deps ClangUnitTests) 103 add_dependencies(check-all check.deps) 104 endif ( LLVM_INCLUDE_TESTS ) 105 add_dependencies(clang-test.deps 106 llvm-dis llc opt 107 FileCheck count not 108 ) 109 endif() 110 111 add_dependencies(clang-test clang-test.deps) 112 add_dependencies(clang-test.deps 113 clang clang-headers c-index-test diagtool arcmt-test c-arcmt-test 114 clang-check 115 ) 116 117 endif() 118