Debian Codegraph @

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