| 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 |
load("//bazel:grpc_build_system.bzl", "grpc_cc_binary", "grpc_cc_library", "grpc_cc_test", "grpc_package") |
| 16 |
|
| 17 |
licenses(["notice"]) |
| 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 |
"absl/flags:parse", |
| 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 |
"absl/flags:flag", |
| 79 |
"protobuf", |
| 80 |
], |
| 81 |
deps = [ |
| 82 |
"//:grpc++", |
| 83 |
"//test/core/end2end:ssl_test_data", |
| 84 |
"//test/core/util:grpc_test_util", |
| 85 |
"//test/core/util:grpc_test_util_base", |
| 86 |
], |
| 87 |
) |
| 88 |
|
| 89 |
grpc_cc_library( |
| 90 |
name = "channel_trace_proto_helper", |
| 91 |
testonly = 1, |
| 92 |
srcs = [ |
| 93 |
"channel_trace_proto_helper.cc", |
| 94 |
], |
| 95 |
hdrs = [ |
| 96 |
"channel_trace_proto_helper.h", |
| 97 |
], |
| 98 |
external_deps = [ |
| 99 |
"gtest", |
| 100 |
"protobuf", |
| 101 |
], |
| 102 |
deps = [ |
| 103 |
"//:grpc++", |
| 104 |
"//src/proto/grpc/channelz:channelz_proto", |
| 105 |
], |
| 106 |
) |
| 107 |
|
| 108 |
grpc_cc_library( |
| 109 |
name = "test_util_unsecure", |
| 110 |
srcs = GRPCXX_TESTUTIL_SRCS, |
| 111 |
hdrs = GRPCXX_TESTUTIL_HDRS, |
| 112 |
external_deps = [ |
| 113 |
"protobuf", |
| 114 |
], |
| 115 |
deps = [ |
| 116 |
"//:grpc++_unsecure", |
| 117 |
"//test/core/util:grpc_test_util_base", |
| 118 |
"//test/core/util:grpc_test_util_unsecure", |
| 119 |
], |
| 120 |
) |
| 121 |
|
| 122 |
grpc_cc_library( |
| 123 |
name = "grpc_cli_utils", |
| 124 |
srcs = [ |
| 125 |
"cli_call.cc", |
| 126 |
"cli_credentials.cc", |
| 127 |
"proto_file_parser.cc", |
| 128 |
"service_describer.cc", |
| 129 |
], |
| 130 |
hdrs = [ |
| 131 |
"cli_call.h", |
| 132 |
"cli_credentials.h", |
| 133 |
"config_grpc_cli.h", |
| 134 |
"proto_file_parser.h", |
| 135 |
"service_describer.h", |
| 136 |
], |
| 137 |
external_deps = [ |
| 138 |
"absl/flags:flag", |
| 139 |
"protobuf", |
| 140 |
"protobuf_clib", |
| 141 |
], |
| 142 |
deps = [ |
| 143 |
":grpc++_proto_reflection_desc_db", |
| 144 |
"//:grpc++", |
| 145 |
"//src/proto/grpc/reflection/v1alpha:reflection_proto", |
| 146 |
], |
| 147 |
) |
| 148 |
|
| 149 |
grpc_cc_library( |
| 150 |
name = "grpc_cli_libs", |
| 151 |
srcs = [ |
| 152 |
"grpc_tool.cc", |
| 153 |
], |
| 154 |
hdrs = [ |
| 155 |
"grpc_tool.h", |
| 156 |
], |
| 157 |
external_deps = [ |
| 158 |
"absl/flags:flag", |
| 159 |
], |
| 160 |
deps = [ |
| 161 |
":grpc_cli_utils", |
| 162 |
], |
| 163 |
) |
| 164 |
|
| 165 |
grpc_cc_library( |
| 166 |
name = "metrics_server_lib", |
| 167 |
srcs = [ |
| 168 |
"metrics_server.cc", |
| 169 |
], |
| 170 |
hdrs = [ |
| 171 |
"metrics_server.h", |
| 172 |
], |
| 173 |
deps = [ |
| 174 |
"//:grpc++", |
| 175 |
"//src/proto/grpc/testing:metrics_proto", |
| 176 |
], |
| 177 |
) |
| 178 |
|
| 179 |
grpc_cc_test( |
| 180 |
name = "grpc_tool_test", |
| 181 |
srcs = [ |
| 182 |
"grpc_tool_test.cc", |
| 183 |
], |
| 184 |
data = [ |
| 185 |
"//src/core/tsi/test_creds:ca.pem", |
| 186 |
"//src/core/tsi/test_creds:server1.key", |
| 187 |
"//src/core/tsi/test_creds:server1.pem", |
| 188 |
"//src/proto/grpc/testing:echo.proto", |
| 189 |
"//src/proto/grpc/testing:echo_messages.proto", |
| 190 |
"//src/proto/grpc/testing:simple_messages.proto", |
| 191 |
"//src/proto/grpc/testing/xds/v3:orca_load_report.proto", |
| 192 |
], |
| 193 |
external_deps = [ |
| 194 |
"absl/flags:flag", |
| 195 |
"gtest", |
| 196 |
], |
| 197 |
tags = [ |
| 198 |
"no_mac", |
| 199 |
"no_test_ios", |
| 200 |
"no_windows", |
| 201 |
"nomsan", # death tests seem to be incompatible with msan |
| 202 |
], |
| 203 |
deps = [ |
| 204 |
":grpc_cli_libs", |
| 205 |
":test_util", |
| 206 |
"//:grpc++_reflection", |
| 207 |
"//src/proto/grpc/testing:echo_messages_proto", |
| 208 |
"//src/proto/grpc/testing:echo_proto", |
| 209 |
"//src/proto/grpc/testing:simple_messages_proto", |
| 210 |
"//src/proto/grpc/testing/xds/v3:orca_load_report_proto", |
| 211 |
"//test/core/util:grpc_test_util", |
| 212 |
"//test/cpp/util:test_config", |
| 213 |
], |
| 214 |
) |
| 215 |
|
| 216 |
grpc_cc_test( |
| 217 |
name = "byte_buffer_test", |
| 218 |
srcs = [ |
| 219 |
"byte_buffer_test.cc", |
| 220 |
], |
| 221 |
external_deps = [ |
| 222 |
"gtest", |
| 223 |
], |
| 224 |
uses_event_engine = False, |
| 225 |
uses_polling = False, |
| 226 |
deps = [ |
| 227 |
":test_util", |
| 228 |
], |
| 229 |
) |
| 230 |
|
| 231 |
grpc_cc_test( |
| 232 |
name = "slice_test", |
| 233 |
srcs = [ |
| 234 |
"slice_test.cc", |
| 235 |
], |
| 236 |
external_deps = [ |
| 237 |
"gtest", |
| 238 |
], |
| 239 |
uses_event_engine = False, |
| 240 |
uses_polling = False, |
| 241 |
deps = [ |
| 242 |
":test_util", |
| 243 |
], |
| 244 |
) |
| 245 |
|
| 246 |
grpc_cc_test( |
| 247 |
name = "string_ref_test", |
| 248 |
srcs = [ |
| 249 |
"string_ref_test.cc", |
| 250 |
], |
| 251 |
external_deps = [ |
| 252 |
"gtest", |
| 253 |
], |
| 254 |
uses_event_engine = False, |
| 255 |
uses_polling = False, |
| 256 |
deps = [ |
| 257 |
"//:grpc++", |
| 258 |
"//test/core/util:grpc_test_util", |
| 259 |
], |
| 260 |
) |
| 261 |
|
| 262 |
grpc_cc_test( |
| 263 |
name = "time_test", |
| 264 |
srcs = [ |
| 265 |
"time_test.cc", |
| 266 |
], |
| 267 |
external_deps = [ |
| 268 |
"gtest", |
| 269 |
], |
| 270 |
uses_event_engine = False, |
| 271 |
uses_polling = False, |
| 272 |
deps = [ |
| 273 |
":test_util", |
| 274 |
], |
| 275 |
) |
| 276 |
|
| 277 |
grpc_cc_test( |
| 278 |
name = "cli_call_test", |
| 279 |
srcs = [ |
| 280 |
"cli_call_test.cc", |
| 281 |
], |
| 282 |
external_deps = [ |
| 283 |
"gtest", |
| 284 |
], |
| 285 |
deps = [ |
| 286 |
":grpc_cli_libs", |
| 287 |
":test_util", |
| 288 |
"//src/proto/grpc/testing:echo_proto", |
| 289 |
"//test/core/util:grpc_test_util", |
| 290 |
], |
| 291 |
) |
| 292 |
|
| 293 |
grpc_cc_test( |
| 294 |
name = "error_details_test", |
| 295 |
srcs = [ |
| 296 |
"error_details_test.cc", |
| 297 |
], |
| 298 |
external_deps = [ |
| 299 |
"gtest", |
| 300 |
], |
| 301 |
tags = ["no_test_ios"], |
| 302 |
deps = [ |
| 303 |
"//:grpc++_error_details", |
| 304 |
"//src/proto/grpc/status:status_proto", |
| 305 |
"//src/proto/grpc/testing:echo_messages_proto", |
| 306 |
"//test/core/util:grpc_test_util", |
| 307 |
], |
| 308 |
) |
| 309 |
|
| 310 |
grpc_cc_binary( |
| 311 |
name = "grpc_cli", |
| 312 |
srcs = [ |
| 313 |
"grpc_cli.cc", |
| 314 |
], |
| 315 |
external_deps = [ |
| 316 |
"absl/flags:flag", |
| 317 |
], |
| 318 |
visibility = [ |
| 319 |
"@grpc:cli", |
| 320 |
], |
| 321 |
deps = [ |
| 322 |
":grpc++_proto_reflection_desc_db", |
| 323 |
":grpc_cli_libs", |
| 324 |
":test_config", |
| 325 |
"//:grpc++", |
| 326 |
"//src/proto/grpc/reflection/v1alpha:reflection_proto", |
| 327 |
], |
| 328 |
) |
| 329 |
|
| 330 |
grpc_cc_binary( |
| 331 |
name = "channelz_sampler", |
| 332 |
srcs = ["channelz_sampler.cc"], |
| 333 |
external_deps = [ |
| 334 |
"absl/flags:flag", |
| 335 |
"absl/strings", |
| 336 |
], |
| 337 |
language = "c++", |
| 338 |
tags = [ |
| 339 |
"no_windows", # unistd.h |
| 340 |
], |
| 341 |
deps = [ |
| 342 |
"//:gpr", |
| 343 |
"//:grpc++", |
| 344 |
"//:grpcpp_channelz", |
| 345 |
"//src/proto/grpc/channelz:channelz_proto", |
| 346 |
"//test/cpp/util:test_config", |
| 347 |
"//test/cpp/util:test_util", |
| 348 |
], |
| 349 |
) |
| 350 |
|
| 351 |
grpc_cc_test( |
| 352 |
name = "channelz_sampler_test", |
| 353 |
srcs = [ |
| 354 |
"channelz_sampler_test.cc", |
| 355 |
], |
| 356 |
data = [ |
| 357 |
":channelz_sampler", |
| 358 |
], |
| 359 |
external_deps = [ |
| 360 |
"gtest", |
| 361 |
], |
| 362 |
flaky = True, |
| 363 |
tags = [ |
| 364 |
"no_mac", # cmake does not build channelz_sampler in Basic Tests C/C++ MacOS test |
| 365 |
"no_test_android", # android_cc_test doesn't work with data dependency. |
| 366 |
"no_test_ios", |
| 367 |
"no_windows", # unistd.h |
| 368 |
], |
| 369 |
deps = [ |
| 370 |
"//:gpr", |
| 371 |
"//:grpc", |
| 372 |
"//:grpc++", |
| 373 |
"//:grpcpp_channelz", |
| 374 |
"//src/proto/grpc/channelz:channelz_proto", |
| 375 |
"//src/proto/grpc/testing:test_proto", |
| 376 |
"//test/core/util:grpc_test_util", |
| 377 |
"//test/cpp/util:test_util", |
| 378 |
], |
| 379 |
) |
| 380 |
|
| 381 |
grpc_cc_library( |
| 382 |
name = "tls_test_utils", |
| 383 |
srcs = [ |
| 384 |
"tls_test_utils.cc", |
| 385 |
], |
| 386 |
hdrs = [ |
| 387 |
"tls_test_utils.h", |
| 388 |
], |
| 389 |
deps = [ |
| 390 |
"//:gpr", |
| 391 |
"//:grpc", |
| 392 |
"//:grpc++", |
| 393 |
"//test/core/util:grpc_test_util", |
| 394 |
], |
| 395 |
) |