| 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 |
|
| 7 |
set(CLANG_TOOLS_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/..") |
| 8 |
set(CLANG_TOOLS_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/..") |
| 9 |
|
| 10 |
llvm_canonicalize_cmake_booleans( |
| 11 |
CLANG_TIDY_ENABLE_STATIC_ANALYZER |
| 12 |
CLANG_PLUGIN_SUPPORT |
| 13 |
LLVM_INSTALL_TOOLCHAIN_ONLY |
| 14 |
) |
| 15 |
|
| 16 |
configure_lit_site_cfg( |
| 17 |
${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in |
| 18 |
${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg.py |
| 19 |
MAIN_CONFIG |
| 20 |
${CMAKE_CURRENT_SOURCE_DIR}/lit.cfg.py |
| 21 |
) |
| 22 |
|
| 23 |
configure_lit_site_cfg( |
| 24 |
${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.site.cfg.py.in |
| 25 |
${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg.py |
| 26 |
MAIN_CONFIG |
| 27 |
${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.cfg.py |
| 28 |
) |
| 29 |
|
| 30 |
set(CLANG_TOOLS_TEST_DEPS |
| 31 |
# For the clang-apply-replacements test that uses clang-rename. |
| 32 |
clang-rename |
| 33 |
|
| 34 |
# For the clang-doc tests that emit bitcode files. |
| 35 |
llvm-bcanalyzer |
| 36 |
|
| 37 |
# Individual tools we test. |
| 38 |
clang-apply-replacements |
| 39 |
clang-change-namespace |
| 40 |
clang-doc |
| 41 |
clang-include-fixer |
| 42 |
clang-move |
| 43 |
clang-query |
| 44 |
clang-reorder-fields |
| 45 |
find-all-symbols |
| 46 |
modularize |
| 47 |
pp-trace |
| 48 |
|
| 49 |
# Unit tests |
| 50 |
ExtraToolsUnitTests |
| 51 |
|
| 52 |
# clang-tidy tests require it. |
| 53 |
clang-resource-headers |
| 54 |
|
| 55 |
clang-tidy |
| 56 |
# Clang-tidy tests need clang for building modules. |
| 57 |
clang |
| 58 |
) |
| 59 |
|
| 60 |
# Add lit test dependencies. |
| 61 |
set(LLVM_UTILS_DEPS |
| 62 |
FileCheck count not |
| 63 |
) |
| 64 |
foreach(dep ${LLVM_UTILS_DEPS}) |
| 65 |
if(TARGET ${dep}) |
| 66 |
list(APPEND CLANG_TOOLS_TEST_DEPS ${dep}) |
| 67 |
endif() |
| 68 |
endforeach() |
| 69 |
|
| 70 |
if (NOT WIN32 OR NOT LLVM_LINK_LLVM_DYLIB) |
| 71 |
llvm_add_library( |
| 72 |
CTTestTidyModule |
| 73 |
MODULE clang-tidy/CTTestTidyModule.cpp |
| 74 |
PLUGIN_TOOL clang-tidy) |
| 75 |
endif() |
| 76 |
|
| 77 |
if(TARGET CTTestTidyModule) |
| 78 |
list(APPEND CLANG_TOOLS_TEST_DEPS CTTestTidyModule) |
| 79 |
target_include_directories(CTTestTidyModule PUBLIC BEFORE "${CLANG_TOOLS_SOURCE_DIR}") |
| 80 |
if(CLANG_PLUGIN_SUPPORT AND (WIN32 OR CYGWIN)) |
| 81 |
set(LLVM_LINK_COMPONENTS |
| 82 |
Support |
| 83 |
) |
| 84 |
endif() |
| 85 |
endif() |
| 86 |
|
| 87 |
add_lit_testsuite(check-clang-extra "Running clang-tools-extra/test" |
| 88 |
${CMAKE_CURRENT_BINARY_DIR} |
| 89 |
DEPENDS ${CLANG_TOOLS_TEST_DEPS} |
| 90 |
) |
| 91 |
|
| 92 |
add_lit_testsuites(CLANG-EXTRA ${CMAKE_CURRENT_SOURCE_DIR} |
| 93 |
DEPENDS ${CLANG_TOOLS_TEST_DEPS} |
| 94 |
) |