• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2017 gRPC authors.
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#     http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15licenses(["notice"])  # Apache v2
16
17load("//bazel:grpc_build_system.bzl", "grpc_cc_binary", "grpc_cc_library", "grpc_cc_test", "grpc_package")
18
19grpc_package(
20    name = "test/cpp/util",
21    visibility = "public",
22)
23
24grpc_cc_library(
25    name = "test_config",
26    srcs = [
27        "test_config_cc.cc",
28    ],
29    hdrs = [
30        "test_config.h",
31    ],
32    external_deps = [
33        "gflags",
34    ],
35    deps = [
36        "//:gpr",
37    ],
38)
39
40grpc_cc_library(
41    name = "grpc++_proto_reflection_desc_db",
42    srcs = [
43        "proto_reflection_descriptor_database.cc",
44    ],
45    hdrs = [
46        "proto_reflection_descriptor_database.h",
47    ],
48    deps = [
49        "//:grpc++",
50        "//:grpc++_config_proto",
51        "//src/proto/grpc/reflection/v1alpha:reflection_proto",
52    ],
53)
54
55GRPCXX_TESTUTIL_SRCS = [
56    "byte_buffer_proto_helper.cc",
57    "string_ref_helper.cc",
58    "subprocess.cc",
59]
60
61GRPCXX_TESTUTIL_HDRS = [
62    "byte_buffer_proto_helper.h",
63    "string_ref_helper.h",
64    "subprocess.h",
65]
66
67grpc_cc_library(
68    name = "test_util",
69    srcs = GRPCXX_TESTUTIL_SRCS + [
70        "create_test_channel.cc",
71        "test_credentials_provider.cc",
72    ],
73    hdrs = GRPCXX_TESTUTIL_HDRS + [
74        "create_test_channel.h",
75        "test_credentials_provider.h",
76    ],
77    external_deps = [
78        "gflags",
79        "protobuf",
80    ],
81    deps = [
82        "//:grpc++",
83        "//test/core/end2end:ssl_test_data",
84        "//test/core/util:grpc_test_util",
85    ],
86)
87
88grpc_cc_library(
89    name = "channel_trace_proto_helper",
90    testonly = 1,
91    srcs = [
92        "channel_trace_proto_helper.cc",
93    ],
94    hdrs = [
95        "channel_trace_proto_helper.h",
96    ],
97    external_deps = [
98        "gtest",
99        "protobuf",
100    ],
101    deps = [
102        "//:grpc++",
103        "//src/proto/grpc/channelz:channelz_proto",
104    ],
105)
106
107grpc_cc_library(
108    name = "test_util_unsecure",
109    srcs = GRPCXX_TESTUTIL_SRCS,
110    hdrs = GRPCXX_TESTUTIL_HDRS,
111    external_deps = [
112        "protobuf",
113    ],
114    deps = [
115        "//:grpc++_unsecure",
116        "//test/core/util:grpc_test_util_unsecure",
117    ],
118)
119
120grpc_cc_library(
121    name = "grpc_cli_utils",
122    srcs = [
123        "cli_call.cc",
124        "cli_credentials.cc",
125        "proto_file_parser.cc",
126        "service_describer.cc",
127    ],
128    hdrs = [
129        "cli_call.h",
130        "cli_credentials.h",
131        "config_grpc_cli.h",
132        "proto_file_parser.h",
133        "service_describer.h",
134    ],
135    external_deps = [
136        "gflags",
137        "protobuf",
138        "protobuf_clib",
139    ],
140    deps = [
141        ":grpc++_proto_reflection_desc_db",
142        "//:grpc++",
143        "//src/proto/grpc/reflection/v1alpha:reflection_proto",
144    ],
145)
146
147grpc_cc_library(
148    name = "grpc_cli_libs",
149    srcs = [
150        "grpc_tool.cc",
151    ],
152    hdrs = [
153        "grpc_tool.h",
154    ],
155    external_deps = [
156        "gflags",
157    ],
158    deps = [
159        ":grpc_cli_utils",
160    ],
161)
162
163grpc_cc_library(
164    name = "metrics_server_lib",
165    srcs = [
166        "metrics_server.cc",
167    ],
168    hdrs = [
169        "metrics_server.h",
170    ],
171    deps = [
172        "//:grpc++",
173        "//src/proto/grpc/testing:metrics_proto",
174    ],
175)
176
177grpc_cc_test(
178    name = "grpc_tool_test",
179    srcs = [
180        "grpc_tool_test.cc",
181    ],
182    data = [
183        "//src/core/tsi/test_creds:ca.pem",
184        "//src/core/tsi/test_creds:server1.key",
185        "//src/core/tsi/test_creds:server1.pem",
186        "//src/proto/grpc/testing:echo.proto",
187        "//src/proto/grpc/testing:echo_messages.proto",
188        "//src/proto/grpc/testing:simple_messages.proto",
189    ],
190    external_deps = [
191        "gtest",
192    ],
193    tags = [
194        "no_test_ios",
195        "no_windows",
196        "nomsan",  # death tests seem to be incompatible with msan
197    ],
198    deps = [
199        ":grpc_cli_libs",
200        ":test_util",
201        "//:grpc++_reflection",
202        "//src/proto/grpc/testing:echo_messages_proto",
203        "//src/proto/grpc/testing:echo_proto",
204        "//src/proto/grpc/testing:simple_messages_proto",
205        "//test/core/util:grpc_test_util",
206    ],
207)
208
209grpc_cc_test(
210    name = "byte_buffer_test",
211    srcs = [
212        "byte_buffer_test.cc",
213    ],
214    external_deps = [
215        "gtest",
216    ],
217    uses_polling = False,
218    deps = [
219        ":test_util",
220    ],
221)
222
223grpc_cc_test(
224    name = "slice_test",
225    srcs = [
226        "slice_test.cc",
227    ],
228    external_deps = [
229        "gtest",
230    ],
231    uses_polling = False,
232    deps = [
233        ":test_util",
234    ],
235)
236
237grpc_cc_test(
238    name = "string_ref_test",
239    srcs = [
240        "string_ref_test.cc",
241    ],
242    external_deps = [
243        "gtest",
244    ],
245    uses_polling = False,
246    deps = [
247        "//:grpc++",
248        "//test/core/util:grpc_test_util",
249    ],
250)
251
252grpc_cc_test(
253    name = "time_test",
254    srcs = [
255        "time_test.cc",
256    ],
257    external_deps = [
258        "gtest",
259    ],
260    uses_polling = False,
261    deps = [
262        ":test_util",
263    ],
264)
265
266grpc_cc_test(
267    name = "cli_call_test",
268    srcs = [
269        "cli_call_test.cc",
270    ],
271    external_deps = [
272        "gtest",
273    ],
274    deps = [
275        ":grpc_cli_libs",
276        ":test_util",
277        "//src/proto/grpc/testing:echo_proto",
278        "//test/core/util:grpc_test_util",
279    ],
280)
281
282grpc_cc_test(
283    name = "error_details_test",
284    srcs = [
285        "error_details_test.cc",
286    ],
287    external_deps = [
288        "gtest",
289    ],
290    deps = [
291        "//:grpc++_error_details",
292        "//src/proto/grpc/testing:echo_messages_proto",
293        "//test/core/util:grpc_test_util",
294    ],
295)
296
297grpc_cc_binary(
298    name = "grpc_cli",
299    srcs = [
300        "grpc_cli.cc",
301    ],
302    external_deps = [
303        "gflags",
304    ],
305    deps = [
306        ":grpc++_proto_reflection_desc_db",
307        ":grpc_cli_libs",
308        ":test_config",
309        "//:grpc++",
310        "//src/proto/grpc/reflection/v1alpha:reflection_proto",
311    ],
312)
313