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#   Bazel Build for Google C++ Testing Framework(Google Test)-googlemock
32
33load("@rules_python//python:defs.bzl", "py_library", "py_test")
34
35licenses(["notice"])
36
37# Tests for GMock itself
38cc_test(
39    name = "gmock_all_test",
40    size = "small",
41    srcs = glob(include = ["gmock-*.cc"]) + ["gmock-matchers_test.h"],
42    linkopts = select({
43        "//:qnx": [],
44        "//:windows": [],
45        "//conditions:default": ["-pthread"],
46    }),
47    deps = ["//:gtest"],
48)
49
50# Python tests
51py_library(
52    name = "gmock_test_utils",
53    testonly = 1,
54    srcs = ["gmock_test_utils.py"],
55    deps = [
56        "//googletest/test:gtest_test_utils",
57    ],
58)
59
60cc_binary(
61    name = "gmock_leak_test_",
62    testonly = 1,
63    srcs = ["gmock_leak_test_.cc"],
64    deps = ["//:gtest_main"],
65)
66
67py_test(
68    name = "gmock_leak_test",
69    size = "medium",
70    srcs = ["gmock_leak_test.py"],
71    data = [
72        ":gmock_leak_test_",
73        ":gmock_test_utils",
74    ],
75    tags = [
76        "no_test_msvc2015",
77        "no_test_msvc2017",
78    ],
79)
80
81cc_test(
82    name = "gmock_link_test",
83    size = "small",
84    srcs = [
85        "gmock_link2_test.cc",
86        "gmock_link_test.cc",
87        "gmock_link_test.h",
88    ],
89    deps = ["//:gtest_main"],
90)
91
92cc_binary(
93    name = "gmock_output_test_",
94    srcs = ["gmock_output_test_.cc"],
95    deps = ["//:gtest"],
96)
97
98py_test(
99    name = "gmock_output_test",
100    size = "medium",
101    srcs = ["gmock_output_test.py"],
102    data = [
103        ":gmock_output_test_",
104        ":gmock_output_test_golden.txt",
105    ],
106    tags = [
107        "no_test_msvc2015",
108        "no_test_msvc2017",
109    ],
110    deps = [":gmock_test_utils"],
111)
112
113cc_test(
114    name = "gmock_test",
115    size = "small",
116    srcs = ["gmock_test.cc"],
117    deps = ["//:gtest_main"],
118)
119