1# Test runner infrastructure for Clang. This configures the Clang test trees 2# for use by Lit, and delegates to LLVM's lit test handlers. 3 4if (CMAKE_CFG_INTDIR STREQUAL ".") 5 set(LLVM_BUILD_MODE ".") 6else () 7 set(LLVM_BUILD_MODE "%(build_mode)s") 8endif () 9 10string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} CLANG_TOOLS_DIR ${LLVM_RUNTIME_OUTPUT_INTDIR}) 11 12configure_lit_site_cfg( 13 ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in 14 ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg 15 ) 16 17configure_lit_site_cfg( 18 ${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.site.cfg.in 19 ${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg 20 ) 21 22option(CLANG_TEST_USE_VG "Run Clang tests under Valgrind" OFF) 23if(CLANG_TEST_USE_VG) 24 set(CLANG_TEST_EXTRA_ARGS ${CLANG_TEST_EXTRA_ARGS} "--vg") 25endif () 26 27list(APPEND CLANG_TEST_DEPS 28 clang clang-headers 29 c-index-test diagtool arcmt-test c-arcmt-test 30 clang-check clang-format 31 clang-tblgen 32 ) 33 34if (ENABLE_CLANG_EXAMPLES) 35 list(APPEND CLANG_TEST_DEPS 36 clang-interpreter 37 PrintFunctionNames 38 SampleAnalyzerPlugin 39 ) 40endif () 41 42set(CLANG_TEST_PARAMS 43 clang_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg 44 ) 45 46if( NOT CLANG_BUILT_STANDALONE ) 47 list(APPEND CLANG_TEST_DEPS 48 llvm-config 49 llc opt FileCheck count not llvm-symbolizer llvm-profdata 50 ) 51endif() 52 53add_lit_testsuite(check-clang "Running the Clang regression tests" 54 ${CMAKE_CURRENT_BINARY_DIR} 55 #LIT ${LLVM_LIT} 56 PARAMS ${CLANG_TEST_PARAMS} 57 DEPENDS ${CLANG_TEST_DEPS} 58 ARGS ${CLANG_TEST_EXTRA_ARGS} 59 ) 60set_target_properties(check-clang PROPERTIES FOLDER "Clang tests") 61 62# Add a legacy target spelling: clang-test 63add_custom_target(clang-test) 64add_dependencies(clang-test check-clang) 65set_target_properties(clang-test PROPERTIES FOLDER "Clang tests") 66