123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590 |
- # Copyright 2017 Google Inc.
- # All Rights Reserved.
- #
- #
- # Redistribution and use in source and binary forms, with or without
- # modification, are permitted provided that the following conditions are
- # met:
- #
- # * Redistributions of source code must retain the above copyright
- # notice, this list of conditions and the following disclaimer.
- # * Redistributions in binary form must reproduce the above
- # copyright notice, this list of conditions and the following disclaimer
- # in the documentation and/or other materials provided with the
- # distribution.
- # * Neither the name of Google Inc. nor the names of its
- # contributors may be used to endorse or promote products derived from
- # this software without specific prior written permission.
- #
- # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- #
- # Bazel BUILD for The Google C++ Testing Framework (Google Test)
- load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_test")
- load("@rules_python//python:defs.bzl", "py_library", "py_test")
- licenses(["notice"])
- package(default_visibility = ["//:__subpackages__"])
- #on windows exclude gtest-tuple.h
- cc_test(
- name = "gtest_all_test",
- size = "small",
- srcs = glob(
- include = [
- "gtest-*.cc",
- "googletest-*.cc",
- "*.h",
- "googletest/include/gtest/**/*.h",
- ],
- exclude = [
- "gtest-unittest-api_test.cc",
- "googletest/src/gtest-all.cc",
- "gtest_all_test.cc",
- "gtest-death-test_ex_test.cc",
- "gtest-listener_test.cc",
- "gtest-unittest-api_test.cc",
- "googletest-param-test-test.cc",
- "googletest-param-test2-test.cc",
- "googletest-catch-exceptions-test_.cc",
- "googletest-color-test_.cc",
- "googletest-env-var-test_.cc",
- "googletest-failfast-unittest_.cc",
- "googletest-filter-unittest_.cc",
- "googletest-global-environment-unittest_.cc",
- "googletest-break-on-failure-unittest_.cc",
- "googletest-listener-test.cc",
- "googletest-output-test_.cc",
- "googletest-list-tests-unittest_.cc",
- "googletest-shuffle-test_.cc",
- "googletest-setuptestsuite-test_.cc",
- "googletest-uninitialized-test_.cc",
- "googletest-death-test_ex_test.cc",
- "googletest-param-test-test",
- "googletest-throw-on-failure-test_.cc",
- "googletest-param-test-invalid-name1-test_.cc",
- "googletest-param-test-invalid-name2-test_.cc",
- ],
- ) + select({
- "//:windows": [],
- "//conditions:default": [],
- }),
- copts = select({
- "//:windows": ["-DGTEST_USE_OWN_TR1_TUPLE=0"],
- "//conditions:default": ["-DGTEST_USE_OWN_TR1_TUPLE=1"],
- }) + select({
- # Ensure MSVC treats source files as UTF-8 encoded.
- "//:msvc_compiler": ["-utf-8"],
- "//conditions:default": [],
- }),
- includes = [
- "googletest",
- "googletest/include",
- "googletest/include/internal",
- "googletest/test",
- ],
- linkopts = select({
- "//:windows": [],
- "//conditions:default": ["-pthread"],
- }),
- deps = ["//:gtest_main"],
- )
- # Tests death tests.
- cc_test(
- name = "googletest-death-test-test",
- size = "medium",
- srcs = ["googletest-death-test-test.cc"],
- deps = ["//:gtest_main"],
- )
- cc_test(
- name = "gtest_test_macro_stack_footprint_test",
- size = "small",
- srcs = ["gtest_test_macro_stack_footprint_test.cc"],
- deps = ["//:gtest"],
- )
- #These googletest tests have their own main()
- cc_test(
- name = "googletest-listener-test",
- size = "small",
- srcs = ["googletest-listener-test.cc"],
- deps = ["//:gtest_main"],
- )
- cc_test(
- name = "gtest-unittest-api_test",
- size = "small",
- srcs = [
- "gtest-unittest-api_test.cc",
- ],
- deps = [
- "//:gtest",
- ],
- )
- cc_test(
- name = "googletest-param-test-test",
- size = "small",
- srcs = [
- "googletest-param-test-test.cc",
- "googletest-param-test-test.h",
- "googletest-param-test2-test.cc",
- ],
- deps = ["//:gtest"],
- )
- cc_test(
- name = "gtest_unittest",
- size = "small",
- srcs = ["gtest_unittest.cc"],
- shard_count = 2,
- deps = ["//:gtest_main"],
- )
- # Py tests
- py_library(
- name = "gtest_test_utils",
- testonly = 1,
- srcs = ["gtest_test_utils.py"],
- imports = ["."],
- )
- cc_binary(
- name = "gtest_help_test_",
- testonly = 1,
- srcs = ["gtest_help_test_.cc"],
- deps = ["//:gtest_main"],
- )
- py_test(
- name = "gtest_help_test",
- size = "small",
- srcs = ["gtest_help_test.py"],
- data = [":gtest_help_test_"],
- deps = [":gtest_test_utils"],
- )
- cc_binary(
- name = "googletest-output-test_",
- testonly = 1,
- srcs = ["googletest-output-test_.cc"],
- deps = ["//:gtest"],
- )
- py_test(
- name = "googletest-output-test",
- size = "small",
- srcs = ["googletest-output-test.py"],
- args = select({
- "//:has_absl": [],
- "//conditions:default": ["--no_stacktrace_support"],
- }),
- data = [
- "googletest-output-test-golden-lin.txt",
- ":googletest-output-test_",
- ],
- deps = [":gtest_test_utils"],
- )
- cc_binary(
- name = "googletest-color-test_",
- testonly = 1,
- srcs = ["googletest-color-test_.cc"],
- deps = ["//:gtest"],
- )
- py_test(
- name = "googletest-color-test",
- size = "small",
- srcs = ["googletest-color-test.py"],
- data = [":googletest-color-test_"],
- deps = [":gtest_test_utils"],
- )
- cc_binary(
- name = "googletest-env-var-test_",
- testonly = 1,
- srcs = ["googletest-env-var-test_.cc"],
- deps = ["//:gtest"],
- )
- py_test(
- name = "googletest-env-var-test",
- size = "medium",
- srcs = ["googletest-env-var-test.py"],
- data = [":googletest-env-var-test_"],
- deps = [":gtest_test_utils"],
- )
- cc_binary(
- name = "googletest-failfast-unittest_",
- testonly = 1,
- srcs = ["googletest-failfast-unittest_.cc"],
- deps = ["//:gtest"],
- )
- py_test(
- name = "googletest-failfast-unittest",
- size = "medium",
- srcs = ["googletest-failfast-unittest.py"],
- data = [":googletest-failfast-unittest_"],
- deps = [":gtest_test_utils"],
- )
- cc_binary(
- name = "googletest-filter-unittest_",
- testonly = 1,
- srcs = ["googletest-filter-unittest_.cc"],
- deps = ["//:gtest"],
- )
- py_test(
- name = "googletest-filter-unittest",
- size = "medium",
- srcs = ["googletest-filter-unittest.py"],
- data = [":googletest-filter-unittest_"],
- deps = [":gtest_test_utils"],
- )
- cc_binary(
- name = "googletest-global-environment-unittest_",
- testonly = 1,
- srcs = ["googletest-global-environment-unittest_.cc"],
- deps = ["//:gtest"],
- )
- py_test(
- name = "googletest-global-environment-unittest",
- size = "medium",
- srcs = ["googletest-global-environment-unittest.py"],
- data = [":googletest-global-environment-unittest_"],
- deps = [":gtest_test_utils"],
- )
- cc_binary(
- name = "googletest-break-on-failure-unittest_",
- testonly = 1,
- srcs = ["googletest-break-on-failure-unittest_.cc"],
- deps = ["//:gtest"],
- )
- py_test(
- name = "googletest-break-on-failure-unittest",
- size = "small",
- srcs = ["googletest-break-on-failure-unittest.py"],
- data = [":googletest-break-on-failure-unittest_"],
- deps = [":gtest_test_utils"],
- )
- cc_test(
- name = "gtest_assert_by_exception_test",
- size = "small",
- srcs = ["gtest_assert_by_exception_test.cc"],
- deps = ["//:gtest"],
- )
- cc_binary(
- name = "googletest-throw-on-failure-test_",
- testonly = 1,
- srcs = ["googletest-throw-on-failure-test_.cc"],
- deps = ["//:gtest"],
- )
- py_test(
- name = "googletest-throw-on-failure-test",
- size = "small",
- srcs = ["googletest-throw-on-failure-test.py"],
- data = [":googletest-throw-on-failure-test_"],
- deps = [":gtest_test_utils"],
- )
- cc_binary(
- name = "googletest-list-tests-unittest_",
- testonly = 1,
- srcs = ["googletest-list-tests-unittest_.cc"],
- deps = ["//:gtest"],
- )
- cc_test(
- name = "gtest_skip_test",
- size = "small",
- srcs = ["gtest_skip_test.cc"],
- deps = ["//:gtest_main"],
- )
- cc_test(
- name = "gtest_skip_in_environment_setup_test",
- size = "small",
- srcs = ["gtest_skip_in_environment_setup_test.cc"],
- deps = ["//:gtest_main"],
- )
- py_test(
- name = "gtest_skip_check_output_test",
- size = "small",
- srcs = ["gtest_skip_check_output_test.py"],
- data = [":gtest_skip_test"],
- deps = [":gtest_test_utils"],
- )
- py_test(
- name = "gtest_skip_environment_check_output_test",
- size = "small",
- srcs = ["gtest_skip_environment_check_output_test.py"],
- data = [
- ":gtest_skip_in_environment_setup_test",
- ],
- deps = [":gtest_test_utils"],
- )
- py_test(
- name = "googletest-list-tests-unittest",
- size = "small",
- srcs = ["googletest-list-tests-unittest.py"],
- data = [":googletest-list-tests-unittest_"],
- deps = [":gtest_test_utils"],
- )
- cc_binary(
- name = "googletest-shuffle-test_",
- srcs = ["googletest-shuffle-test_.cc"],
- deps = ["//:gtest"],
- )
- py_test(
- name = "googletest-shuffle-test",
- size = "small",
- srcs = ["googletest-shuffle-test.py"],
- data = [":googletest-shuffle-test_"],
- deps = [":gtest_test_utils"],
- )
- cc_binary(
- name = "googletest-catch-exceptions-no-ex-test_",
- testonly = 1,
- srcs = ["googletest-catch-exceptions-test_.cc"],
- deps = ["//:gtest_main"],
- )
- cc_binary(
- name = "googletest-catch-exceptions-ex-test_",
- testonly = 1,
- srcs = ["googletest-catch-exceptions-test_.cc"],
- copts = ["-fexceptions"],
- deps = ["//:gtest_main"],
- )
- py_test(
- name = "googletest-catch-exceptions-test",
- size = "small",
- srcs = ["googletest-catch-exceptions-test.py"],
- data = [
- ":googletest-catch-exceptions-ex-test_",
- ":googletest-catch-exceptions-no-ex-test_",
- ],
- deps = [":gtest_test_utils"],
- )
- cc_binary(
- name = "gtest_xml_output_unittest_",
- testonly = 1,
- srcs = ["gtest_xml_output_unittest_.cc"],
- deps = ["//:gtest"],
- )
- cc_test(
- name = "gtest_no_test_unittest",
- size = "small",
- srcs = ["gtest_no_test_unittest.cc"],
- deps = ["//:gtest"],
- )
- py_test(
- name = "gtest_xml_output_unittest",
- size = "small",
- srcs = [
- "gtest_xml_output_unittest.py",
- "gtest_xml_test_utils.py",
- ],
- args = select({
- "//:has_absl": [],
- "//conditions:default": ["--no_stacktrace_support"],
- }),
- data = [
- # We invoke gtest_no_test_unittest to verify the XML output
- # when the test program contains no test definition.
- ":gtest_no_test_unittest",
- ":gtest_xml_output_unittest_",
- ],
- deps = [":gtest_test_utils"],
- )
- cc_binary(
- name = "gtest_xml_outfile1_test_",
- testonly = 1,
- srcs = ["gtest_xml_outfile1_test_.cc"],
- deps = ["//:gtest_main"],
- )
- cc_binary(
- name = "gtest_xml_outfile2_test_",
- testonly = 1,
- srcs = ["gtest_xml_outfile2_test_.cc"],
- deps = ["//:gtest_main"],
- )
- py_test(
- name = "gtest_xml_outfiles_test",
- size = "small",
- srcs = [
- "gtest_xml_outfiles_test.py",
- "gtest_xml_test_utils.py",
- ],
- data = [
- ":gtest_xml_outfile1_test_",
- ":gtest_xml_outfile2_test_",
- ],
- deps = [":gtest_test_utils"],
- )
- cc_binary(
- name = "googletest-setuptestsuite-test_",
- testonly = 1,
- srcs = ["googletest-setuptestsuite-test_.cc"],
- deps = ["//:gtest_main"],
- )
- py_test(
- name = "googletest-setuptestsuite-test",
- size = "medium",
- srcs = ["googletest-setuptestsuite-test.py"],
- data = [":googletest-setuptestsuite-test_"],
- deps = [":gtest_test_utils"],
- )
- cc_binary(
- name = "googletest-uninitialized-test_",
- testonly = 1,
- srcs = ["googletest-uninitialized-test_.cc"],
- deps = ["//:gtest"],
- )
- py_test(
- name = "googletest-uninitialized-test",
- size = "medium",
- srcs = ["googletest-uninitialized-test.py"],
- data = ["googletest-uninitialized-test_"],
- deps = [":gtest_test_utils"],
- )
- cc_binary(
- name = "gtest_testbridge_test_",
- testonly = 1,
- srcs = ["gtest_testbridge_test_.cc"],
- deps = ["//:gtest_main"],
- )
- # Tests that filtering via testbridge works
- py_test(
- name = "gtest_testbridge_test",
- size = "small",
- srcs = ["gtest_testbridge_test.py"],
- data = [":gtest_testbridge_test_"],
- deps = [":gtest_test_utils"],
- )
- py_test(
- name = "googletest-json-outfiles-test",
- size = "small",
- srcs = [
- "googletest-json-outfiles-test.py",
- "gtest_json_test_utils.py",
- ],
- data = [
- ":gtest_xml_outfile1_test_",
- ":gtest_xml_outfile2_test_",
- ],
- deps = [":gtest_test_utils"],
- )
- py_test(
- name = "googletest-json-output-unittest",
- size = "medium",
- srcs = [
- "googletest-json-output-unittest.py",
- "gtest_json_test_utils.py",
- ],
- args = select({
- "//:has_absl": [],
- "//conditions:default": ["--no_stacktrace_support"],
- }),
- data = [
- # We invoke gtest_no_test_unittest to verify the JSON output
- # when the test program contains no test definition.
- ":gtest_no_test_unittest",
- ":gtest_xml_output_unittest_",
- ],
- deps = [":gtest_test_utils"],
- )
- # Verifies interaction of death tests and exceptions.
- cc_test(
- name = "googletest-death-test_ex_catch_test",
- size = "medium",
- srcs = ["googletest-death-test_ex_test.cc"],
- copts = ["-fexceptions"],
- defines = ["GTEST_ENABLE_CATCH_EXCEPTIONS_=1"],
- deps = ["//:gtest"],
- )
- cc_binary(
- name = "googletest-param-test-invalid-name1-test_",
- testonly = 1,
- srcs = ["googletest-param-test-invalid-name1-test_.cc"],
- deps = ["//:gtest"],
- )
- cc_binary(
- name = "googletest-param-test-invalid-name2-test_",
- testonly = 1,
- srcs = ["googletest-param-test-invalid-name2-test_.cc"],
- deps = ["//:gtest"],
- )
- py_test(
- name = "googletest-param-test-invalid-name1-test",
- size = "small",
- srcs = ["googletest-param-test-invalid-name1-test.py"],
- data = [":googletest-param-test-invalid-name1-test_"],
- tags = [
- "no_test_msvc2015",
- "no_test_msvc2017",
- ],
- deps = [":gtest_test_utils"],
- )
- py_test(
- name = "googletest-param-test-invalid-name2-test",
- size = "small",
- srcs = ["googletest-param-test-invalid-name2-test.py"],
- data = [":googletest-param-test-invalid-name2-test_"],
- tags = [
- "no_test_msvc2015",
- "no_test_msvc2017",
- ],
- deps = [":gtest_test_utils"],
- )
|