1# Test runner infrastructure for Clang-based tools. This configures the Clang 2# test trees for use by Lit, and delegates to LLVM's lit test handlers. 3# 4# Note that currently we don't support stand-alone builds of Clang, you must 5# be building Clang from within a combined LLVM+Clang checkout.. 6 7set(CLANG_TOOLS_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/..") 8set(CLANG_TOOLS_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/..") 9 10if (CMAKE_CFG_INTDIR STREQUAL ".") 11 set(LLVM_BUILD_MODE ".") 12else () 13 set(LLVM_BUILD_MODE "%(build_mode)s") 14endif () 15 16string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} CLANG_TOOLS_DIR ${LLVM_RUNTIME_OUTPUT_INTDIR}) 17 18llvm_canonicalize_cmake_booleans( 19 CLANG_TIDY_ENABLE_STATIC_ANALYZER 20 LIBCLANG_INCLUDE_CLANG_TOOLS_EXTRA 21 ) 22 23configure_lit_site_cfg( 24 ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in 25 ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg.py 26 MAIN_CONFIG 27 ${CMAKE_CURRENT_SOURCE_DIR}/lit.cfg.py 28 ) 29 30configure_lit_site_cfg( 31 ${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.site.cfg.py.in 32 ${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg.py 33 MAIN_CONFIG 34 ${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.cfg.py 35 ) 36 37option(CLANG_TOOLS_TEST_USE_VG "Run Clang tools' tests under Valgrind" OFF) 38if(CLANG_TOOLS_TEST_USE_VG) 39 set(CLANG_TOOLS_TEST_EXTRA_ARGS ${CLANG_TEST_EXTRA_ARGS} "--vg") 40endif() 41 42set(CLANG_TOOLS_TEST_DEPS 43 # For the clang-apply-replacements test that uses clang-rename. 44 clang-rename 45 46 # For the clang-doc tests that emit bitcode files. 47 llvm-bcanalyzer 48 49 # Individual tools we test. 50 clang-apply-replacements 51 clang-change-namespace 52 clang-doc 53 clang-include-fixer 54 clang-move 55 clang-query 56 clang-reorder-fields 57 find-all-symbols 58 modularize 59 pp-trace 60 61 # Unit tests 62 ExtraToolsUnitTests 63 64 # clang-tidy tests require it. 65 clang-resource-headers 66 67 clang-tidy 68 # Clang-tidy tests need clang for building modules. 69 clang 70) 71if (LIBCLANG_INCLUDE_CLANG_TOOLS_EXTRA) 72 # For the clang-tidy libclang integration test. 73 set(CLANG_TOOLS_TEST_DEPS ${CLANG_TOOLS_TEST_DEPS} "c-index-test") 74endif () 75 76# Add lit test dependencies. 77set(LLVM_UTILS_DEPS 78 FileCheck count not 79) 80foreach(dep ${LLVM_UTILS_DEPS}) 81 if(TARGET ${dep}) 82 list(APPEND CLANG_TOOLS_TEST_DEPS ${dep}) 83 endif() 84endforeach() 85 86add_lit_testsuite(check-clang-tools "Running the Clang extra tools' regression tests" 87 ${CMAKE_CURRENT_BINARY_DIR} 88 DEPENDS ${CLANG_TOOLS_TEST_DEPS} 89 ARGS ${CLANG_TOOLS_TEST_EXTRA_ARGS} 90 ) 91 92set_target_properties(check-clang-tools PROPERTIES FOLDER "Clang extra tools' tests") 93 94add_lit_testsuites(CLANG-EXTRA ${CMAKE_CURRENT_SOURCE_DIR} 95 DEPENDS ${CLANG_TOOLS_TEST_DEPS} 96 ) 97