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
83 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
151 list(APPEND CLANG_TEST_DEPS llvm-lto)
155 if(CLANG_ENABLE_STATIC_ANALYZER)
156 if(CLANG_PLUGIN_SUPPORT AND LLVM_ENABLE_PLUGINS) # Determine if we built them
157 list(APPEND CLANG_TEST_DEPS
159 CheckerDependencyHandlingAnalyzerPlugin
160 CheckerOptionHandlingAnalyzerPlugin
165 if (HAVE_CLANG_REPL_SUPPORT)
166 list(APPEND CLANG_TEST_DEPS
171 # Copy gen_ast_dump_json_test.py to the clang build dir. This allows invoking
172 # it without having to pass the --clang= argument
173 configure_file(AST/gen_ast_dump_json_test.py
174 ${CLANG_BINARY_DIR}/bin/gen_ast_dump_json_test.py COPYONLY)
176 add_custom_target(clang-test-depends DEPENDS ${CLANG_TEST_DEPS})
177 set_target_properties(clang-test-depends PROPERTIES FOLDER "Clang/Tests")
179 add_lit_testsuite(check-clang "Running the Clang regression tests"
180 ${CMAKE_CURRENT_BINARY_DIR}
182 PARAMS ${CLANG_TEST_PARAMS}
183 DEPENDS ${CLANG_TEST_DEPS}
184 ARGS ${CLANG_TEST_EXTRA_ARGS}
187 add_lit_testsuites(CLANG ${CMAKE_CURRENT_SOURCE_DIR}
188 PARAMS ${CLANG_TEST_PARAMS}
189 DEPENDS ${CLANG_TEST_DEPS}
190 FOLDER "Clang tests/Suites"
193 # Add a legacy target spelling: clang-test
194 add_custom_target(clang-test)
195 add_dependencies(clang-test check-clang)
196 set_target_properties(clang-test PROPERTIES FOLDER "Clang/Tests")
198 # FIXME: This logic can be removed once all buildbots have moved
199 # debuginfo-test from clang/test to llvm/projects or monorepo.
200 if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/debuginfo-tests)
201 message(WARNING "Including debuginfo-tests in clang/test is deprecated. Move to llvm/projects or use monorepo.")
202 if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/debuginfo-tests/CMakeLists.txt)
203 add_subdirectory(debuginfo-tests)