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.
4 llvm_canonicalize_cmake_booleans(
7 CLANG_DEFAULT_PIE_ON_LINUX
9 CLANG_ENABLE_STATIC_ANALYZER
15 LLVM_BYE_LINK_INTO_TOOLS
19 LLVM_ENABLE_PER_TARGET_RUNTIME_DIR
21 LLVM_ENABLE_REVERSE_ITERATION
23 PPC_LINUX_DEFAULT_IEEELONGDOUBLE
24 LLVM_TOOL_LLVM_DRIVER_BUILD
27 configure_lit_site_cfg(
28 ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in
29 ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg.py
31 ${CMAKE_CURRENT_SOURCE_DIR}/lit.cfg.py
43 "CMAKE_LIBRARY_OUTPUT_DIRECTORY"
46 configure_lit_site_cfg(
47 ${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.site.cfg.py.in
48 ${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg.py
50 ${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.cfg.py
60 option(CLANG_TEST_USE_VG "Run Clang tests under Valgrind" OFF)
62 set(CLANG_TEST_EXTRA_ARGS ${CLANG_TEST_EXTRA_ARGS} "--vg")
65 list(APPEND CLANG_TEST_DEPS
69 clang-fuzzer-dictionary
70 clang-resource-headers
82 clang-offload-packager
88 if(CLANG_ENABLE_STATIC_ANALYZER)
89 list(APPEND CLANG_TEST_DEPS
95 if (CLANG_ENABLE_ARCMT)
96 list(APPEND CLANG_TEST_DEPS
102 if(CLANG_BUILD_EXAMPLES AND CLANG_PLUGIN_SUPPORT)
103 list(APPEND CLANG_TEST_DEPS
109 LLVMPrintFunctionNames
113 set(CLANG_TEST_PARAMS
117 if( NOT CLANG_BUILT_STANDALONE )
118 list(APPEND CLANG_TEST_DEPS
152 list(APPEND CLANG_TEST_DEPS llvm-lto)
156 if(CLANG_ENABLE_STATIC_ANALYZER)
157 if(CLANG_PLUGIN_SUPPORT AND LLVM_ENABLE_PLUGINS) # Determine if we built them
158 list(APPEND CLANG_TEST_DEPS
160 CheckerDependencyHandlingAnalyzerPlugin
161 CheckerOptionHandlingAnalyzerPlugin
166 if (HAVE_CLANG_REPL_SUPPORT)
167 list(APPEND CLANG_TEST_DEPS
172 # Copy gen_ast_dump_json_test.py to the clang build dir. This allows invoking
173 # it without having to pass the --clang= argument
174 configure_file(AST/gen_ast_dump_json_test.py
175 ${CLANG_BINARY_DIR}/bin/gen_ast_dump_json_test.py COPYONLY)
177 add_custom_target(clang-test-depends DEPENDS ${CLANG_TEST_DEPS})
178 set_target_properties(clang-test-depends PROPERTIES FOLDER "Clang/Tests")
180 add_lit_testsuite(check-clang "Running the Clang regression tests"
181 ${CMAKE_CURRENT_BINARY_DIR}
183 PARAMS ${CLANG_TEST_PARAMS}
184 DEPENDS ${CLANG_TEST_DEPS}
185 ARGS ${CLANG_TEST_EXTRA_ARGS}
188 add_lit_testsuites(CLANG ${CMAKE_CURRENT_SOURCE_DIR}
189 PARAMS ${CLANG_TEST_PARAMS}
190 DEPENDS ${CLANG_TEST_DEPS}
191 FOLDER "Clang tests/Suites"
194 # Add a legacy target spelling: clang-test
195 add_custom_target(clang-test)
196 add_dependencies(clang-test check-clang)
197 set_target_properties(clang-test PROPERTIES FOLDER "Clang/Tests")
199 # FIXME: This logic can be removed once all buildbots have moved
200 # debuginfo-test from clang/test to llvm/projects or monorepo.
201 if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/debuginfo-tests)
202 message(WARNING "Including debuginfo-tests in clang/test is deprecated. Move to llvm/projects or use monorepo.")
203 if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/debuginfo-tests/CMakeLists.txt)
204 add_subdirectory(debuginfo-tests)