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