]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/googletest/googletest/test/BUILD.bazel
MFC r345203,r345205,r345353,r345645,r345708,r345709,r345735,r345770,r346081,r346270...
[FreeBSD/FreeBSD.git] / contrib / googletest / googletest / test / BUILD.bazel
1 # Copyright 2017 Google Inc.
2 # All Rights Reserved.
3 #
4 #
5 # Redistribution and use in source and binary forms, with or without
6 # modification, are permitted provided that the following conditions are
7 # met:
8 #
9 #     * Redistributions of source code must retain the above copyright
10 # notice, this list of conditions and the following disclaimer.
11 #     * Redistributions in binary form must reproduce the above
12 # copyright notice, this list of conditions and the following disclaimer
13 # in the documentation and/or other materials provided with the
14 # distribution.
15 #     * Neither the name of Google Inc. nor the names of its
16 # contributors may be used to endorse or promote products derived from
17 # this software without specific prior written permission.
18 #
19 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 #
31 # Author: misterg@google.com (Gennadiy Civil)
32 #
33 # Bazel BUILD for The Google C++ Testing Framework (Google Test)
34
35 licenses(["notice"])
36
37 config_setting(
38     name = "windows",
39     values = {"cpu": "x64_windows"},
40 )
41
42 config_setting(
43     name = "windows_msvc",
44     values = {"cpu": "x64_windows_msvc"},
45 )
46
47 config_setting(
48     name = "has_absl",
49     values = {"define": "absl=1"},
50 )
51
52 #on windows exclude gtest-tuple.h and googletest-tuple-test.cc
53 cc_test(
54     name = "gtest_all_test",
55     size = "small",
56     srcs = glob(
57         include = [
58             "gtest-*.cc",
59             "googletest-*.cc",
60             "*.h",
61             "googletest/include/gtest/**/*.h",
62         ],
63         exclude = [
64             "gtest-unittest-api_test.cc",
65             "googletest-tuple-test.cc",
66             "googletest/src/gtest-all.cc",
67             "gtest_all_test.cc",
68             "gtest-death-test_ex_test.cc",
69             "gtest-listener_test.cc",
70             "gtest-unittest-api_test.cc",
71             "googletest-param-test-test.cc",
72             "googletest-catch-exceptions-test_.cc",
73             "googletest-color-test_.cc",
74             "googletest-env-var-test_.cc",
75             "googletest-filter-unittest_.cc",
76             "googletest-break-on-failure-unittest_.cc",
77              "googletest-listener-test.cc",
78              "googletest-output-test_.cc",
79              "googletest-list-tests-unittest_.cc",
80              "googletest-shuffle-test_.cc",
81              "googletest-uninitialized-test_.cc",
82              "googletest-death-test_ex_test.cc",
83              "googletest-param-test-test",
84              "googletest-throw-on-failure-test_.cc",
85              "googletest-param-test-invalid-name1-test_.cc",
86              "googletest-param-test-invalid-name2-test_.cc",
87
88         ],
89     ) + select({
90         "//:windows": [],
91         "//:windows_msvc": [],
92         "//conditions:default": [
93             "googletest-tuple-test.cc",
94         ],
95     }),
96     copts = select({
97         "//:windows": ["-DGTEST_USE_OWN_TR1_TUPLE=0"],
98         "//:windows_msvc": ["-DGTEST_USE_OWN_TR1_TUPLE=0"],
99         "//conditions:default": ["-DGTEST_USE_OWN_TR1_TUPLE=1"],
100     }),
101     includes = [
102         "googletest",
103         "googletest/include",
104         "googletest/include/internal",
105         "googletest/test",
106     ],
107     linkopts = select({
108         "//:windows": [],
109         "//:windows_msvc": [],
110         "//conditions:default": [
111             "-pthread",
112         ],
113     }),
114     deps = ["//:gtest_main"],
115 )
116
117
118 # Tests death tests.
119 cc_test(
120     name = "googletest-death-test-test",
121     size = "medium",
122     srcs = ["googletest-death-test-test.cc"],
123     deps = ["//:gtest_main"],
124 )
125
126 cc_test(
127     name = "gtest_test_macro_stack_footprint_test",
128     size = "small",
129     srcs = ["gtest_test_macro_stack_footprint_test.cc"],
130     deps = ["//:gtest"],
131 )
132
133 #These googletest tests have their own main()
134 cc_test(
135     name = "googletest-listener-test",
136     size = "small",
137     srcs = ["googletest-listener-test.cc"],
138     deps = ["//:gtest_main"],
139 )
140
141 cc_test(
142     name = "gtest-unittest-api_test",
143     size = "small",
144     srcs = [
145         "gtest-unittest-api_test.cc",
146     ],
147     deps = [
148         "//:gtest",
149     ],
150 )
151
152 cc_test(
153     name = "googletest-param-test-test",
154     size = "small",
155     srcs = [
156         "googletest-param-test-test.cc",
157         "googletest-param-test-test.h",
158         "googletest-param-test2-test.cc",
159     ],
160     deps = ["//:gtest"],
161 )
162
163 cc_test(
164     name = "gtest_unittest",
165     size = "small",
166     srcs = ["gtest_unittest.cc"],
167     args = ["--heap_check=strict"],
168     shard_count = 2,
169     deps = ["//:gtest_main"],
170 )
171
172 #  Py tests
173
174 py_library(
175     name = "gtest_test_utils",
176     testonly = 1,
177     srcs = ["gtest_test_utils.py"],
178 )
179
180 cc_binary(
181     name = "gtest_help_test_",
182     testonly = 1,
183     srcs = ["gtest_help_test_.cc"],
184     deps = ["//:gtest_main"],
185 )
186
187 py_test(
188     name = "gtest_help_test",
189     size = "small",
190     srcs = ["gtest_help_test.py"],
191     data = [":gtest_help_test_"],
192     deps = [":gtest_test_utils"],
193 )
194
195 cc_binary(
196     name = "googletest-output-test_",
197     testonly = 1,
198     srcs = ["googletest-output-test_.cc"],
199     deps = ["//:gtest"],
200 )
201
202
203 py_test(
204     name = "googletest-output-test",
205     size = "small",
206     srcs = ["googletest-output-test.py"],
207     args = select({
208         ":has_absl": [],
209         "//conditions:default": ["--no_stacktrace_support"],
210     }),
211     data = [
212         "googletest-output-test-golden-lin.txt",
213         ":googletest-output-test_",
214     ],
215     deps = [":gtest_test_utils"],
216 )
217
218 cc_binary(
219     name = "googletest-color-test_",
220     testonly = 1,
221     srcs = ["googletest-color-test_.cc"],
222     deps = ["//:gtest"],
223 )
224
225 py_test(
226     name = "googletest-color-test",
227     size = "small",
228     srcs = ["googletest-color-test.py"],
229     data = [":googletest-color-test_"],
230     deps = [":gtest_test_utils"],
231 )
232
233 cc_binary(
234     name = "googletest-env-var-test_",
235     testonly = 1,
236     srcs = ["googletest-env-var-test_.cc"],
237     deps = ["//:gtest"],
238 )
239
240 py_test(
241     name = "googletest-env-var-test",
242     size = "medium",
243     srcs = ["googletest-env-var-test.py"],
244     data = [":googletest-env-var-test_"],
245     deps = [":gtest_test_utils"],
246 )
247
248 cc_binary(
249     name = "googletest-filter-unittest_",
250     testonly = 1,
251     srcs = ["googletest-filter-unittest_.cc"],
252     deps = ["//:gtest"],
253 )
254
255 py_test(
256     name = "googletest-filter-unittest",
257     size = "medium",
258     srcs = ["googletest-filter-unittest.py"],
259     data = [":googletest-filter-unittest_"],
260     deps = [":gtest_test_utils"],
261 )
262
263
264 cc_binary(
265     name = "googletest-break-on-failure-unittest_",
266     testonly = 1,
267     srcs = ["googletest-break-on-failure-unittest_.cc"],
268     deps = ["//:gtest"],
269 )
270
271
272
273 py_test(
274     name = "googletest-break-on-failure-unittest",
275     size = "small",
276     srcs = ["googletest-break-on-failure-unittest.py"],
277     data = [":googletest-break-on-failure-unittest_"],
278     deps = [":gtest_test_utils"],
279 )
280
281
282 cc_test(
283     name = "gtest_assert_by_exception_test",
284     size = "small",
285     srcs = ["gtest_assert_by_exception_test.cc"],
286     deps = ["//:gtest"],
287 )
288
289
290
291 cc_binary(
292     name = "googletest-throw-on-failure-test_",
293     testonly = 1,
294     srcs = ["googletest-throw-on-failure-test_.cc"],
295     deps = ["//:gtest"],
296 )
297
298 py_test(
299     name = "googletest-throw-on-failure-test",
300     size = "small",
301     srcs = ["googletest-throw-on-failure-test.py"],
302     data = [":googletest-throw-on-failure-test_"],
303     deps = [":gtest_test_utils"],
304 )
305
306
307 cc_binary(
308     name = "googletest-list-tests-unittest_",
309     testonly = 1,
310     srcs = ["googletest-list-tests-unittest_.cc"],
311     deps = ["//:gtest"],
312 )
313
314 cc_test(
315     name = "gtest_skip_in_environment_setup_test",
316     size = "small",
317     srcs = ["gtest_skip_in_environment_setup_test.cc"],
318     deps = ["//:gtest_main"],
319 )
320
321 py_test(
322     name = "googletest-list-tests-unittest",
323     size = "small",
324     srcs = ["googletest-list-tests-unittest.py"],
325     data = [":googletest-list-tests-unittest_"],
326     deps = [":gtest_test_utils"],
327 )
328
329 cc_binary(
330     name = "googletest-shuffle-test_",
331     srcs = ["googletest-shuffle-test_.cc"],
332     deps = ["//:gtest"],
333 )
334
335 py_test(
336     name = "googletest-shuffle-test",
337     size = "small",
338     srcs = ["googletest-shuffle-test.py"],
339     data = [":googletest-shuffle-test_"],
340     deps = [":gtest_test_utils"],
341 )
342
343 cc_binary(
344     name = "googletest-catch-exceptions-no-ex-test_",
345     testonly = 1,
346     srcs = ["googletest-catch-exceptions-test_.cc"],
347     deps = ["//:gtest_main"],
348 )
349
350 cc_binary(
351     name = "googletest-catch-exceptions-ex-test_",
352     testonly = 1,
353     srcs = ["googletest-catch-exceptions-test_.cc"],
354     copts = ["-fexceptions"],
355     deps = ["//:gtest_main"],
356 )
357
358 py_test(
359     name = "googletest-catch-exceptions-test",
360     size = "small",
361     srcs = ["googletest-catch-exceptions-test.py"],
362     data = [
363         ":googletest-catch-exceptions-ex-test_",
364         ":googletest-catch-exceptions-no-ex-test_",
365     ],
366     deps = [":gtest_test_utils"],
367 )
368
369 cc_binary(
370     name = "gtest_xml_output_unittest_",
371     testonly = 1,
372     srcs = ["gtest_xml_output_unittest_.cc"],
373     deps = ["//:gtest"],
374 )
375
376 cc_test(
377     name = "gtest_no_test_unittest",
378     size = "small",
379     srcs = ["gtest_no_test_unittest.cc"],
380     deps = ["//:gtest"],
381 )
382
383 py_test(
384     name = "gtest_xml_output_unittest",
385     size = "small",
386     srcs = [
387         "gtest_xml_output_unittest.py",
388         "gtest_xml_test_utils.py",
389     ],
390     args = select({
391         ":has_absl": [],
392         "//conditions:default": ["--no_stacktrace_support"],
393     }),
394     data = [
395         # We invoke gtest_no_test_unittest to verify the XML output
396         # when the test program contains no test definition.
397         ":gtest_no_test_unittest",
398         ":gtest_xml_output_unittest_",
399     ],
400     deps = [":gtest_test_utils"],
401 )
402
403 cc_binary(
404     name = "gtest_xml_outfile1_test_",
405     testonly = 1,
406     srcs = ["gtest_xml_outfile1_test_.cc"],
407     deps = ["//:gtest_main"],
408 )
409
410 cc_binary(
411     name = "gtest_xml_outfile2_test_",
412     testonly = 1,
413     srcs = ["gtest_xml_outfile2_test_.cc"],
414     deps = ["//:gtest_main"],
415 )
416
417 py_test(
418     name = "gtest_xml_outfiles_test",
419     size = "small",
420     srcs = [
421         "gtest_xml_outfiles_test.py",
422         "gtest_xml_test_utils.py",
423     ],
424     data = [
425         ":gtest_xml_outfile1_test_",
426         ":gtest_xml_outfile2_test_",
427     ],
428     deps = [":gtest_test_utils"],
429 )
430
431 cc_binary(
432     name = "googletest-uninitialized-test_",
433     testonly = 1,
434     srcs = ["googletest-uninitialized-test_.cc"],
435     deps = ["//:gtest"],
436 )
437
438 py_test(
439     name = "googletest-uninitialized-test",
440     size = "medium",
441     srcs = ["googletest-uninitialized-test.py"],
442     data = ["googletest-uninitialized-test_"],
443     deps = [":gtest_test_utils"],
444 )
445
446 cc_binary(
447     name = "gtest_testbridge_test_",
448     testonly = 1,
449     srcs = ["gtest_testbridge_test_.cc"],
450     deps = ["//:gtest_main"],
451 )
452
453 # Tests that filtering via testbridge works
454 py_test(
455     name = "gtest_testbridge_test",
456     size = "small",
457     srcs = ["gtest_testbridge_test.py"],
458     data = [":gtest_testbridge_test_"],
459     deps = [":gtest_test_utils"],
460 )
461
462
463 py_test(
464     name = "googletest-json-outfiles-test",
465     size = "small",
466     srcs = [
467         "googletest-json-outfiles-test.py",
468         "gtest_json_test_utils.py",
469     ],
470     data = [
471         ":gtest_xml_outfile1_test_",
472         ":gtest_xml_outfile2_test_",
473     ],
474     deps = [":gtest_test_utils"],
475 )
476
477 py_test(
478     name = "googletest-json-output-unittest",
479     size = "medium",
480     srcs = [
481         "googletest-json-output-unittest.py",
482         "gtest_json_test_utils.py",
483     ],
484     data = [
485         # We invoke gtest_no_test_unittest to verify the JSON output
486         # when the test program contains no test definition.
487         ":gtest_no_test_unittest",
488         ":gtest_xml_output_unittest_",
489     ],
490     args = select({
491         ":has_absl": [],
492         "//conditions:default": ["--no_stacktrace_support"],
493     }),
494     deps = [":gtest_test_utils"],
495 )
496 # Verifies interaction of death tests and exceptions.
497 cc_test(
498     name = "googletest-death-test_ex_catch_test",
499     size = "medium",
500     srcs = ["googletest-death-test_ex_test.cc"],
501     copts = ["-fexceptions"],
502     defines = ["GTEST_ENABLE_CATCH_EXCEPTIONS_=1"],
503     deps = ["//:gtest"],
504 )
505
506 cc_binary(
507     name = "googletest-param-test-invalid-name1-test_",
508     testonly = 1,
509     srcs = ["googletest-param-test-invalid-name1-test_.cc"],
510     deps = ["//:gtest"],
511 )
512
513 cc_binary(
514     name = "googletest-param-test-invalid-name2-test_",
515     testonly = 1,
516     srcs = ["googletest-param-test-invalid-name2-test_.cc"],
517     deps = ["//:gtest"],
518 )
519
520 py_test(
521     name = "googletest-param-test-invalid-name1-test",
522     size = "small",
523     srcs = ["googletest-param-test-invalid-name1-test.py"],
524     data = [":googletest-param-test-invalid-name1-test_"],
525     deps = [":gtest_test_utils"],
526 )
527
528 py_test(
529     name = "googletest-param-test-invalid-name2-test",
530     size = "small",
531     srcs = ["googletest-param-test-invalid-name2-test.py"],
532     data = [":googletest-param-test-invalid-name2-test_"],
533     deps = [":gtest_test_utils"],
534 )