bb1ca868ffb2a4c960eb799c836232ec3934cfc0
[platform/upstream/grpc.git] / test / cpp / util / BUILD
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
15 licenses(["notice"])  # Apache v2
16
17 load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_binary", "grpc_cc_test", "grpc_package")
18
19 grpc_package(
20     name = "test/cpp/util",
21     visibility = "public",
22 )
23
24 grpc_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
40 grpc_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
55 GRPCXX_TESTUTIL_SRCS = [
56     "byte_buffer_proto_helper.cc",
57     "string_ref_helper.cc",
58     "subprocess.cc",
59 ]
60
61 GRPCXX_TESTUTIL_HDRS = [
62     "byte_buffer_proto_helper.h",
63     "string_ref_helper.h",
64     "subprocess.h",
65 ]
66
67 grpc_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         "protobuf",
79     ],
80     deps = [
81         "//:grpc++",
82         "//test/core/end2end:ssl_test_data",
83         "//test/core/util:grpc_test_util",
84     ],
85 )
86
87 grpc_cc_library(
88     name = "channel_trace_proto_helper",
89     testonly = 1,
90     srcs = [
91         "channel_trace_proto_helper.cc",
92     ],
93     hdrs = [
94         "channel_trace_proto_helper.h",
95     ],
96     external_deps = [
97         "gtest",
98         "protobuf",
99     ],
100     deps = [
101         "//:grpc++",
102         "//src/proto/grpc/channelz:channelz_proto",
103     ],
104 )
105
106 grpc_cc_library(
107     name = "test_util_unsecure",
108     srcs = GRPCXX_TESTUTIL_SRCS,
109     hdrs = GRPCXX_TESTUTIL_HDRS,
110     external_deps = [
111         "protobuf",
112     ],
113     deps = [
114         "//:grpc++_unsecure",
115         "//test/core/util:grpc_test_util_unsecure",
116     ],
117 )
118
119 grpc_cc_library(
120     name = "grpc_cli_utils",
121     srcs = [
122         "cli_call.cc",
123         "cli_credentials.cc",
124         "proto_file_parser.cc",
125         "service_describer.cc",
126     ],
127     hdrs = [
128         "cli_call.h",
129         "cli_credentials.h",
130         "config_grpc_cli.h",
131         "proto_file_parser.h",
132         "service_describer.h",
133     ],
134     external_deps = [
135         "gflags",
136         "protobuf",
137         "protobuf_clib",
138     ],
139     deps = [
140         ":grpc++_proto_reflection_desc_db",
141         "//:grpc++",
142         "//src/proto/grpc/reflection/v1alpha:reflection_proto",
143     ],
144 )
145
146 grpc_cc_library(
147     name = "grpc_cli_libs",
148     srcs = [
149         "grpc_tool.cc",
150     ],
151     hdrs = [
152         "grpc_tool.h",
153     ],
154     external_deps = [
155         "gflags",
156     ],
157     deps = [
158         ":grpc_cli_utils",
159     ],
160 )
161
162 grpc_cc_library(
163     name = "metrics_server_lib",
164     srcs = [
165         "metrics_server.cc",
166     ],
167     hdrs = [
168         "metrics_server.h",
169     ],
170     deps = [
171         "//:grpc++",
172         "//src/proto/grpc/testing:metrics_proto",
173     ],
174 )
175
176 grpc_cc_test(
177     name = "grpc_tool_test",
178     srcs = [
179         "grpc_tool_test.cc",
180     ],
181     data = [
182         "//src/proto/grpc/testing:echo.proto",
183         "//src/proto/grpc/testing:echo_messages.proto",
184         "//src/proto/grpc/testing:simple_messages.proto",
185     ],
186     external_deps = [
187         "gtest",
188     ],
189     tags = ["nomsan"],  # death tests seem to be incompatible with msan
190     deps = [
191         ":grpc_cli_libs",
192         ":test_util",
193         "//:grpc++_reflection",
194         "//src/proto/grpc/testing:echo_messages_proto",
195         "//src/proto/grpc/testing:echo_proto",
196         "//src/proto/grpc/testing:simple_messages_proto",
197         "//test/core/end2end:ssl_test_data",
198         "//test/core/util:grpc_test_util",
199     ],
200 )
201
202 grpc_cc_test(
203     name = "byte_buffer_test",
204     srcs = [
205         "byte_buffer_test.cc",
206     ],
207     external_deps = [
208         "gtest",
209     ],
210     deps = [
211         ":test_util",
212     ],
213 )
214
215 grpc_cc_test(
216     name = "slice_test",
217     srcs = [
218         "slice_test.cc",
219     ],
220     external_deps = [
221         "gtest",
222     ],
223     deps = [
224         ":test_util",
225     ],
226 )
227
228 grpc_cc_test(
229     name = "string_ref_test",
230     srcs = [
231         "string_ref_test.cc",
232     ],
233     external_deps = [
234         "gtest",
235     ],
236     deps = [
237         "//:grpc++",
238         "//test/core/util:grpc_test_util",
239     ],
240 )
241
242 grpc_cc_test(
243     name = "time_test",
244     srcs = [
245         "time_test.cc",
246     ],
247     external_deps = [
248         "gtest",
249     ],
250     deps = [
251         ":test_util",
252     ],
253 )
254
255 grpc_cc_test(
256     name = "cli_call_test",
257     srcs = [
258         "cli_call_test.cc",
259     ],
260     external_deps = [
261         "gtest",
262     ],
263     deps = [
264         ":grpc_cli_libs",
265         ":test_util",
266         "//src/proto/grpc/testing:echo_proto",
267         "//test/core/util:grpc_test_util",
268     ],
269 )
270
271 grpc_cc_test(
272     name = "error_details_test",
273     srcs = [
274         "error_details_test.cc",
275     ],
276     external_deps = [
277         "gtest",
278     ],
279     deps = [
280         "//:grpc++_error_details",
281         "//src/proto/grpc/testing:echo_messages_proto",
282         "//test/core/util:grpc_test_util",
283     ],
284 )
285
286 grpc_cc_binary(
287     name = "grpc_cli",
288     srcs = [
289         "grpc_cli.cc",
290     ],
291     external_deps = [
292         "gflags",
293     ],
294     deps = [
295         ":grpc++_proto_reflection_desc_db",
296         ":grpc_cli_libs",
297         ":test_config",
298         "//:grpc++",
299         "//src/proto/grpc/reflection/v1alpha:reflection_proto",
300     ],
301 )