Debian Codegraph @

llvm-project/utils/bazel/llvm-project-overlay/clang/unittests/BUILD.bazel

raw
1 # This file is licensed under the Apache License v2.0 with LLVM Exceptions.
2 # See https://llvm.org/LICENSE.txt for license information.
3 # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
4
5 package(
6 default_visibility = ["//visibility:public"],
7 )
8
9 licenses(["notice"])
10
11 cc_test(
12 name = "ast_tests",
13 size = "medium",
14 srcs = glob(
15 [
16 "AST/*.cpp",
17 "AST/*.h",
18 ],
19 allow_empty = False,
20 ),
21 shard_count = 20,
22 deps = [
23 "//clang:ast",
24 "//clang:ast_matchers",
25 "//clang:basic",
26 "//clang:frontend",
27 "//clang:lex",
28 "//clang:testing",
29 "//clang:tooling",
30 "//llvm:Core",
31 "//llvm:Support",
32 "//llvm:TestingAnnotations",
33 "//llvm:TestingSupport",
34 "//third-party/unittest:gmock",
35 "//third-party/unittest:gtest",
36 "//third-party/unittest:gtest_main",
37 ],
38 )
39
40 cc_library(
41 name = "ast_matchers_tests_hdrs",
42 testonly = 1,
43 hdrs = glob(
44 ["ASTMatchers/*.h"],
45 allow_empty = False,
46 ),
47 deps = [
48 "//clang:ast_matchers",
49 "//clang:frontend",
50 "//clang:testing",
51 "//clang:tooling",
52 "//third-party/unittest:gtest",
53 ],
54 )
55
56 cc_test(
57 name = "ast_matchers_tests",
58 size = "medium",
59 srcs = glob(
60 ["ASTMatchers/*.cpp"],
61 allow_empty = False,
62 ),
63 shard_count = 20,
64 deps = [
65 ":ast_matchers_tests_hdrs",
66 "//clang:ast",
67 "//clang:ast_matchers",
68 "//clang:frontend",
69 "//clang:tooling",
70 "//llvm:Support",
71 "//llvm:TestingSupport",
72 "//third-party/unittest:gtest",
73 "//third-party/unittest:gtest_main",
74 ],
75 )
76
77 cc_test(
78 name = "ast_matchers_dynamic_tests",
79 size = "small",
80 srcs = glob(
81 ["ASTMatchers/Dynamic/*.cpp"],
82 allow_empty = False,
83 ),
84 deps = [
85 ":ast_matchers_tests_hdrs",
86 "//clang:ast_matchers",
87 "//clang:ast_matchers_dynamic",
88 "//clang:frontend",
89 "//clang:tooling",
90 "//llvm:Support",
91 "//third-party/unittest:gtest",
92 "//third-party/unittest:gtest_main",
93 ],
94 )
95
96 cc_test(
97 name = "analysis_tests",
98 size = "small",
99 srcs = glob(
100 [
101 "Analysis/*.cpp",
102 "Analysis/*.h",
103 ],
104 allow_empty = False,
105 ),
106 deps = [
107 "//clang:analysis",
108 "//clang:ast",
109 "//clang:ast_matchers",
110 "//clang:basic",
111 "//clang:lex",
112 "//clang:parse",
113 "//clang:tooling",
114 "//llvm:Support",
115 "//third-party/unittest:gmock",
116 "//third-party/unittest:gtest",
117 "//third-party/unittest:gtest_main",
118 ],
119 )
120
121 cc_test(
122 name = "analysis_flow_sensitive_tests",
123 srcs = glob(
124 [
125 "Analysis/FlowSensitive/*.cpp",
126 "Analysis/FlowSensitive/*.h",
127 ],
128 allow_empty = False,
129 ),
130 deps = [
131 "//clang:analysis",
132 "//clang:ast",
133 "//clang:ast_matchers",
134 "//clang:basic",
135 "//clang:lex",
136 "//clang:serialization",
137 "//clang:tooling",
138 "//llvm:Support",
139 "//llvm:TestingADT",
140 "//llvm:TestingAnnotations",
141 "//llvm:TestingSupport",
142 "//third-party/unittest:gmock",
143 "//third-party/unittest:gtest",
144 "//third-party/unittest:gtest_main",
145 ],
146 )
147
148 cc_test(
149 name = "basic_tests",
150 size = "small",
151 srcs = glob(
152 ["Basic/*.cpp"],
153 allow_empty = False,
154 ),
155 deps = [
156 "//clang:basic",
157 "//clang:frontend",
158 "//clang:lex",
159 "//llvm:Support",
160 "//llvm:TestingSupport",
161 "//llvm:config",
162 "//third-party/unittest:gmock",
163 "//third-party/unittest:gtest",
164 "//third-party/unittest:gtest_main",
165 ],
166 )
167
168 cc_test(
169 name = "codegen_tests",
170 size = "small",
171 srcs = glob(
172 [
173 "CodeGen/*.cpp",
174 "CodeGen/*.h",
175 ],
176 allow_empty = False,
177 ),
178 deps = [
179 "//clang:ast",
180 "//clang:basic",
181 "//clang:codegen",
182 "//clang:frontend",
183 "//clang:lex",
184 "//clang:parse",
185 "//clang:sema",
186 "//llvm:Core",
187 "//llvm:Support",
188 "//third-party/unittest:gtest",
189 "//third-party/unittest:gtest_main",
190 ],
191 )
192
193 cc_test(
194 name = "format_tests",
195 size = "medium",
196 srcs = glob(
197 [
198 "Format/*.cpp",
199 "Format/*.h",
200 "Tooling/*.h",
201 ],
202 allow_empty = False,
203 ),
204 copts = ["$(STACK_FRAME_UNLIMITED)"],
205 shard_count = 20,
206 deps = [
207 "//clang:basic",
208 "//clang:format",
209 "//clang:frontend",
210 "//clang:tooling_core",
211 "//llvm:Support",
212 "//third-party/unittest:gmock",
213 "//third-party/unittest:gtest",
214 "//third-party/unittest:gtest_main",
215 ],
216 )
217
218 cc_test(
219 name = "frontend_tests",
220 size = "small",
221 srcs = glob(
222 ["Frontend/*.cpp"],
223 allow_empty = False,
224 ),
225 deps = [
226 "//clang:ast",
227 "//clang:basic",
228 "//clang:codegen",
229 "//clang:driver_options_inc_gen",
230 "//clang:frontend",
231 "//clang:frontend_tool",
232 "//clang:lex",
233 "//clang:sema",
234 "//clang:serialization",
235 "//llvm:Support",
236 "//third-party/unittest:gmock",
237 "//third-party/unittest:gtest",
238 "//third-party/unittest:gtest_main",
239 ],
240 )
241
242 cc_test(
243 name = "lex_tests",
244 size = "small",
245 srcs = glob(
246 [
247 "Lex/*.cpp",
248 "Lex/*.h",
249 ],
250 allow_empty = False,
251 ),
252 copts = ["$(STACK_FRAME_UNLIMITED)"],
253 deps = [
254 "//clang:ast",
255 "//clang:basic",
256 "//clang:lex",
257 "//clang:parse",
258 "//clang:sema",
259 "//clang:serialization",
260 "//llvm:Support",
261 "//llvm:TestingSupport",
262 "//third-party/unittest:gmock",
263 "//third-party/unittest:gtest",
264 "//third-party/unittest:gtest_main",
265 ],
266 )
267
268 # A library to carefully expose the tooling headers using the include prefix
269 # expected by the `rename_tests`.
270 cc_library(
271 name = "rename_tests_tooling_hdrs",
272 testonly = 1,
273 hdrs = glob(
274 ["Tooling/*.h"],
275 allow_empty = False,
276 ),
277 include_prefix = "unittests",
278 deps = [
279 "//clang:ast",
280 "//clang:basic",
281 "//clang:frontend",
282 "//clang:rewrite",
283 "//clang:tooling",
284 "//clang:tooling_core",
285 "//llvm:Support",
286 "//third-party/unittest:gtest",
287 ],
288 )
289
290 cc_test(
291 name = "rename_tests",
292 size = "small",
293 timeout = "moderate",
294 srcs = glob(
295 [
296 "Rename/*.cpp",
297 "Rename/*.h",
298 ],
299 allow_empty = False,
300 ),
301 shard_count = 20,
302 deps = [
303 ":rename_tests_tooling_hdrs",
304 "//clang:ast_matchers",
305 "//clang:basic",
306 "//clang:format",
307 "//clang:frontend",
308 "//clang:tooling",
309 "//clang:tooling_refactoring",
310 "//llvm:Support",
311 "//third-party/unittest:gtest",
312 "//third-party/unittest:gtest_main",
313 ],
314 )
315
316 cc_test(
317 name = "rewrite_tests",
318 size = "small",
319 srcs = glob(
320 ["Rewrite/*.cpp"],
321 allow_empty = False,
322 ),
323 deps = [
324 "//clang:rewrite",
325 "//clang:tooling",
326 "//third-party/unittest:gtest",
327 "//third-party/unittest:gtest_main",
328 ],
329 )
330
331 cc_test(
332 name = "sema_tests",
333 size = "small",
334 srcs = glob(
335 ["Sema/*.cpp"],
336 allow_empty = False,
337 ),
338 deps = [
339 ":ast_matchers_tests_hdrs",
340 "//clang:ast",
341 "//clang:ast_matchers",
342 "//clang:frontend",
343 "//clang:lex",
344 "//clang:parse",
345 "//clang:sema",
346 "//clang:tooling",
347 "//llvm:TestingAnnotations",
348 "//llvm:TestingSupport",
349 "//third-party/unittest:gmock",
350 "//third-party/unittest:gtest",
351 "//third-party/unittest:gtest_main",
352 ],
353 )
354
355 cc_library(
356 name = "static_analyzer_test_headers",
357 testonly = 1,
358 hdrs = glob(
359 ["StaticAnalyzer/*.h"],
360 allow_empty = False,
361 ),
362 deps = [
363 "//clang:ast_matchers",
364 "//clang:crosstu",
365 "//clang:frontend",
366 "//clang:static_analyzer_core",
367 "//clang:static_analyzer_frontend",
368 "//clang:testing",
369 "//clang:tooling",
370 "//third-party/unittest:gtest",
371 ],
372 )
373
374 cc_test(
375 name = "static_analyzer_tests",
376 size = "small",
377 srcs = glob(
378 ["StaticAnalyzer/*.cpp"],
379 allow_empty = False,
380 exclude = [
381 # New test has unused-variable warnings.
382 "StaticAnalyzer/ParamRegionTest.cpp",
383 ],
384 ),
385 deps = [
386 ":static_analyzer_test_headers",
387 "//clang:basic",
388 "//clang:frontend",
389 "//clang:static_analyzer_core",
390 "//clang:static_analyzer_frontend",
391 "//clang:tooling",
392 "//llvm:Support",
393 "//llvm:config",
394 "//third-party/unittest:gtest",
395 "//third-party/unittest:gtest_main",
396 ],
397 )
398
399 cc_test(
400 name = "tooling_tests",
401 size = "medium",
402 srcs = glob(
403 [
404 "Tooling/*.cpp",
405 "Tooling/*.h",
406 ],
407 allow_empty = False,
408 ),
409 shard_count = 20,
410 deps = [
411 "//clang:ast",
412 "//clang:ast_matchers",
413 "//clang:basic",
414 "//clang:format",
415 "//clang:frontend",
416 "//clang:lex",
417 "//clang:rewrite",
418 "//clang:testing",
419 "//clang:tooling",
420 "//clang:tooling_core",
421 "//clang:tooling_dependency_scanning",
422 "//clang:tooling_inclusions",
423 "//clang:tooling_refactoring",
424 "//clang:transformer",
425 "//llvm:Support",
426 "//llvm:TestingAnnotations",
427 "//llvm:TestingSupport",
428 "//third-party/unittest:gmock",
429 "//third-party/unittest:gtest",
430 "//third-party/unittest:gtest_main",
431 ],
432 )
433
434 # A library to carefully expose the tooling headers using the include prefix
435 # expected by the `tooling_recursive_ast_visitor_tests`.
436 cc_library(
437 name = "tooling_recursive_ast_visitor_tests_tooling_hdrs",
438 testonly = 1,
439 hdrs = glob(
440 ["Tooling/*.h"],
441 allow_empty = False,
442 ),
443 strip_include_prefix = "Tooling",
444 deps = [
445 "//clang:ast",
446 "//clang:basic",
447 "//clang:frontend",
448 "//clang:rewrite",
449 "//clang:tooling",
450 "//clang:tooling_core",
451 "//llvm:Support",
452 "//third-party/unittest:gtest",
453 ],
454 )
455
456 cc_test(
457 name = "tooling_recursive_ast_visitor_tests",
458 size = "medium",
459 srcs = glob(
460 ["Tooling/RecursiveASTVisitorTests/*.cpp"],
461 allow_empty = False,
462 ) + [
463 "Tooling/RecursiveASTVisitorTests/CallbacksCommon.h",
464 ],
465 deps = [
466 ":tooling_recursive_ast_visitor_tests_tooling_hdrs",
467 "//clang:ast",
468 "//clang:basic",
469 "//clang:frontend",
470 "//clang:lex",
471 "//clang:tooling",
472 "//clang:tooling_syntax",
473 "//llvm:Support",
474 "//llvm:TestingSupport",
475 "//third-party/unittest:gmock",
476 "//third-party/unittest:gtest",
477 "//third-party/unittest:gtest_main",
478 ],
479 )
480
481 cc_test(
482 name = "tooling_syntax_tests",
483 size = "medium",
484 srcs = glob(
485 [
486 "Tooling/Syntax/*.cpp",
487 "Tooling/Syntax/*.h",
488 ],
489 allow_empty = False,
490 ),
491 shard_count = 20,
492 deps = [
493 "//clang:ast",
494 "//clang:basic",
495 "//clang:frontend",
496 "//clang:lex",
497 "//clang:testing",
498 "//clang:tooling",
499 "//clang:tooling_core",
500 "//clang:tooling_syntax",
501 "//llvm:Support",
502 "//llvm:TestingAnnotations",
503 "//llvm:TestingSupport",
504 "//third-party/unittest:gmock",
505 "//third-party/unittest:gtest",
506 "//third-party/unittest:gtest_main",
507 ],
508 )
509
510 cc_test(
511 name = "libclang_tests",
512 size = "small",
513 srcs = glob(
514 ["libclang/*.cpp"],
515 allow_empty = False,
516 ) + [
517 "libclang/TestUtils.h",
518 ],
519 args = select({
520 "@bazel_tools//src/conditions:windows": [
521 # Need to disable the VFS tests that don't use Windows friendly
522 # paths. These are also disabled on Windows in the CMake build.
523 "--gtest_filter=-*VirtualFileOverlay*",
524 ],
525 "//conditions:default": [],
526 }),
527 deps = [
528 "//clang:libclang",
529 "//llvm:Support",
530 "//third-party/unittest:gtest",
531 "//third-party/unittest:gtest_main",
532 ],
533 )