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_ENABLE_PER_TARGET_RUNTIME_DIR
18 PPC_LINUX_DEFAULT_IEEELONGDOUBLE
19 LLVM_TOOL_LLVM_DRIVER_BUILD
22 configure_lit_site_cfg(
23 ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in
24 ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg.py
26 ${CMAKE_CURRENT_SOURCE_DIR}/lit.cfg.py
38 "CMAKE_LIBRARY_OUTPUT_DIRECTORY"
41 configure_lit_site_cfg(
42 ${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.site.cfg.py.in
43 ${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg.py
45 ${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.cfg.py
55 option(CLANG_TEST_USE_VG "Run Clang tests under Valgrind" OFF)
57 set(CLANG_TEST_EXTRA_ARGS ${CLANG_TEST_EXTRA_ARGS} "--vg")
60 list(APPEND CLANG_TEST_DEPS
64 clang-fuzzer-dictionary
65 clang-resource-headers
78 if(CLANG_ENABLE_STATIC_ANALYZER)
79 list(APPEND CLANG_TEST_DEPS
85 if (CLANG_ENABLE_ARCMT)
86 list(APPEND CLANG_TEST_DEPS
92 if(CLANG_BUILD_EXAMPLES AND CLANG_PLUGIN_SUPPORT)
93 list(APPEND CLANG_TEST_DEPS
102 set(CLANG_TEST_PARAMS
106 if( NOT CLANG_BUILT_STANDALONE )
107 list(APPEND CLANG_TEST_DEPS
138 list(APPEND CLANG_TEST_DEPS llvm-lto)
142 if(CLANG_ENABLE_STATIC_ANALYZER)
143 if(CLANG_PLUGIN_SUPPORT AND LLVM_ENABLE_PLUGINS) # Determine if we built them
144 list(APPEND CLANG_TEST_DEPS
146 CheckerDependencyHandlingAnalyzerPlugin
147 CheckerOptionHandlingAnalyzerPlugin
152 if (HAVE_CLANG_REPL_SUPPORT)
153 list(APPEND CLANG_TEST_DEPS
158 # Copy gen_ast_dump_json_test.py to the clang build dir. This allows invoking
159 # it without having to pass the --clang= argument
160 configure_file(AST/gen_ast_dump_json_test.py
161 ${CLANG_BINARY_DIR}/bin/gen_ast_dump_json_test.py COPYONLY)
163 add_custom_target(clang-test-depends DEPENDS ${CLANG_TEST_DEPS})
164 set_target_properties(clang-test-depends PROPERTIES FOLDER "Clang tests")
166 add_lit_testsuite(check-clang "Running the Clang regression tests"
167 ${CMAKE_CURRENT_BINARY_DIR}
169 PARAMS ${CLANG_TEST_PARAMS}
170 DEPENDS ${CLANG_TEST_DEPS}
171 ARGS ${CLANG_TEST_EXTRA_ARGS}
173 set_target_properties(check-clang PROPERTIES FOLDER "Clang tests")
175 add_lit_testsuites(CLANG ${CMAKE_CURRENT_SOURCE_DIR}
176 PARAMS ${CLANG_TEST_PARAMS}
177 DEPENDS ${CLANG_TEST_DEPS}
178 FOLDER "Clang tests/Suites"
181 # Add a legacy target spelling: clang-test
182 add_custom_target(clang-test)
183 add_dependencies(clang-test check-clang)
184 set_target_properties(clang-test PROPERTIES FOLDER "Clang tests")
186 # FIXME: This logic can be removed once all buildbots have moved
187 # debuginfo-test from clang/test to llvm/projects or monorepo.
188 if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/debuginfo-tests)
189 message(WARNING "Including debuginfo-tests in clang/test is deprecated. Move to llvm/projects or use monorepo.")
190 if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/debuginfo-tests/CMakeLists.txt)
191 add_subdirectory(debuginfo-tests)