Chandler Carruth | f71b73d | 2012-08-07 08:33:04 | [diff] [blame] | 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. |
Chandler Carruth | 5f8cfa7 | 2012-08-07 07:09:14 | [diff] [blame] | 3 | # |
Chandler Carruth | f71b73d | 2012-08-07 08:33:04 | [diff] [blame] | 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.. |
Chandler Carruth | 5f8cfa7 | 2012-08-07 07:09:14 | [diff] [blame] | 6 | |
Chandler Carruth | f71b73d | 2012-08-07 08:33:04 | [diff] [blame] | 7 | set(CLANG_TOOLS_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/..") |
| 8 | set(CLANG_TOOLS_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/..") |
Chandler Carruth | 5f8cfa7 | 2012-08-07 07:09:14 | [diff] [blame] | 9 | |
NAKAMURA Takumi | c3b3e5e | 2014-01-19 11:19:07 | [diff] [blame] | 10 | if (CMAKE_CFG_INTDIR STREQUAL ".") |
| 11 | set(LLVM_BUILD_MODE ".") |
| 12 | else () |
| 13 | set(LLVM_BUILD_MODE "%(build_mode)s") |
| 14 | endif () |
| 15 | |
NAKAMURA Takumi | 49007da | 2014-01-19 13:00:01 | [diff] [blame] | 16 | string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} CLANG_TOOLS_DIR ${LLVM_RUNTIME_OUTPUT_INTDIR}) |
NAKAMURA Takumi | c3b3e5e | 2014-01-19 11:19:07 | [diff] [blame] | 17 | |
Sam McCall | 79cdb5c | 2019-04-29 08:44:01 | [diff] [blame] | 18 | llvm_canonicalize_cmake_booleans(CLANG_ENABLE_STATIC_ANALYZER) |
Michal Gorny | 24952e5 | 2017-08-29 05:58:08 | [diff] [blame] | 19 | |
Edwin Vane | 08085af | 2013-02-19 19:08:10 | [diff] [blame] | 20 | configure_lit_site_cfg( |
Nico Weber | 75e7ff3 | 2019-03-29 02:46:31 | [diff] [blame] | 21 | ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in |
| 22 | ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg.py |
| 23 | MAIN_CONFIG |
| 24 | ${CMAKE_CURRENT_SOURCE_DIR}/lit.cfg.py |
Edwin Vane | 08085af | 2013-02-19 19:08:10 | [diff] [blame] | 25 | ) |
| 26 | |
Edwin Vane | d22180f | 2013-04-03 15:11:08 | [diff] [blame] | 27 | configure_lit_site_cfg( |
Nico Weber | 75e7ff3 | 2019-03-29 02:46:31 | [diff] [blame] | 28 | ${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.site.cfg.py.in |
| 29 | ${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg.py |
| 30 | MAIN_CONFIG |
| 31 | ${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.cfg.py |
Edwin Vane | d22180f | 2013-04-03 15:11:08 | [diff] [blame] | 32 | ) |
| 33 | |
Chandler Carruth | e79882e | 2013-03-07 10:09:47 | [diff] [blame] | 34 | option(CLANG_TOOLS_TEST_USE_VG "Run Clang tools' tests under Valgrind" OFF) |
| 35 | if(CLANG_TOOLS_TEST_USE_VG) |
| 36 | set(CLANG_TOOLS_TEST_EXTRA_ARGS ${CLANG_TEST_EXTRA_ARGS} "--vg") |
| 37 | endif() |
| 38 | |
Chandler Carruth | f71b73d | 2012-08-07 08:33:04 | [diff] [blame] | 39 | set(CLANG_TOOLS_TEST_DEPS |
Alex Lorenz | 8401b95 | 2017-06-30 16:58:36 | [diff] [blame] | 40 | # For the clang-apply-replacements test that uses clang-rename. |
| 41 | clang-rename |
Benjamin Kramer | d99fffa | 2016-03-03 08:58:12 | [diff] [blame] | 42 | |
Julie Hockett | 395afb1 | 2018-03-22 23:34:46 | [diff] [blame] | 43 | # For the clang-doc tests that emit bitcode files. |
| 44 | llvm-bcanalyzer |
| 45 | |
Chandler Carruth | e79882e | 2013-03-07 10:09:47 | [diff] [blame] | 46 | # Individual tools we test. |
NAKAMURA Takumi | 50fcf15 | 2013-10-31 12:46:10 | [diff] [blame] | 47 | clang-apply-replacements |
Eric Liu | f68f0cd | 2016-09-19 17:40:32 | [diff] [blame] | 48 | clang-change-namespace |
Julie Hockett | 395afb1 | 2018-03-22 23:34:46 | [diff] [blame] | 49 | clang-doc |
Benjamin Kramer | 7e310d1 | 2016-04-27 14:32:36 | [diff] [blame] | 50 | clang-include-fixer |
Haojian Wu | 53bdceb | 2016-10-04 09:05:31 | [diff] [blame] | 51 | clang-move |
Peter Collingbourne | da776c0 | 2014-02-18 19:46:01 | [diff] [blame] | 52 | clang-query |
Alexander Shaposhnikov | 3951c8f | 2016-09-02 02:56:07 | [diff] [blame] | 53 | clang-reorder-fields |
Benjamin Kramer | fa0a0e8 | 2016-05-31 12:12:19 | [diff] [blame] | 54 | find-all-symbols |
NAKAMURA Takumi | 50fcf15 | 2013-10-31 12:46:10 | [diff] [blame] | 55 | modularize |
NAKAMURA Takumi | 2ab631e | 2013-10-31 12:46:16 | [diff] [blame] | 56 | pp-trace |
Edwin Vane | d22180f | 2013-04-03 15:11:08 | [diff] [blame] | 57 | |
| 58 | # Unit tests |
| 59 | ExtraToolsUnitTests |
Stephen Kelly | 5351cf6 | 2018-10-01 20:24:22 | [diff] [blame] | 60 | |
| 61 | # For the clang-tidy libclang integration test. |
| 62 | c-index-test |
| 63 | # clang-tidy tests require it. |
Shoaib Meenai | b8e003b | 2019-03-04 21:19:53 | [diff] [blame] | 64 | clang-resource-headers |
Stephen Kelly | 5351cf6 | 2018-10-01 20:24:22 | [diff] [blame] | 65 | |
| 66 | clang-tidy |
Alexander Kornienko | ce94c06 | 2019-03-22 13:42:48 | [diff] [blame] | 67 | # Clang-tidy tests need clang for building modules. |
| 68 | clang |
Jan Korous | d05fd41 | 2019-01-16 00:24:22 | [diff] [blame] | 69 | ) |
| 70 | |
Haojian Wu | 8808550 | 2018-11-22 10:14:55 | [diff] [blame] | 71 | # Add lit test dependencies. |
| 72 | set(LLVM_UTILS_DEPS |
| 73 | FileCheck count not |
| 74 | ) |
| 75 | foreach(dep ${LLVM_UTILS_DEPS}) |
| 76 | if(TARGET ${dep}) |
Sam McCall | 591c6b5 | 2019-04-26 09:20:36 | [diff] [blame] | 77 | list(APPEND CLANG_TOOLS_TEST_DEPS ${dep}) |
Haojian Wu | 8808550 | 2018-11-22 10:14:55 | [diff] [blame] | 78 | endif() |
| 79 | endforeach() |
| 80 | |
Chandler Carruth | e79882e | 2013-03-07 10:09:47 | [diff] [blame] | 81 | add_lit_testsuite(check-clang-tools "Running the Clang extra tools' regression tests" |
Chandler Carruth | f71b73d | 2012-08-07 08:33:04 | [diff] [blame] | 82 | ${CMAKE_CURRENT_BINARY_DIR} |
| 83 | DEPENDS ${CLANG_TOOLS_TEST_DEPS} |
| 84 | ARGS ${CLANG_TOOLS_TEST_EXTRA_ARGS} |
| 85 | ) |
Chandler Carruth | e79882e | 2013-03-07 10:09:47 | [diff] [blame] | 86 | |
Kirill Bobyrev | cb0c6c5 | 2017-06-28 20:57:28 | [diff] [blame] | 87 | set_target_properties(check-clang-tools PROPERTIES FOLDER "Clang extra tools' tests") |