BUILD 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383
  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. load("//bazel:grpc_build_system.bzl", "grpc_cc_binary", "grpc_cc_library", "grpc_cc_test", "grpc_package")
  15. licenses(["notice"])
  16. grpc_package(
  17. name = "test/cpp/util",
  18. visibility = "public",
  19. )
  20. grpc_cc_library(
  21. name = "test_config",
  22. srcs = [
  23. "test_config_cc.cc",
  24. ],
  25. hdrs = [
  26. "test_config.h",
  27. ],
  28. external_deps = [
  29. "absl/flags:parse",
  30. ],
  31. deps = [
  32. "//:gpr",
  33. ],
  34. )
  35. grpc_cc_library(
  36. name = "grpc++_proto_reflection_desc_db",
  37. srcs = [
  38. "proto_reflection_descriptor_database.cc",
  39. ],
  40. hdrs = [
  41. "proto_reflection_descriptor_database.h",
  42. ],
  43. deps = [
  44. "//:grpc++",
  45. "//:grpc++_config_proto",
  46. "//src/proto/grpc/reflection/v1alpha:reflection_proto",
  47. ],
  48. )
  49. GRPCXX_TESTUTIL_SRCS = [
  50. "byte_buffer_proto_helper.cc",
  51. "string_ref_helper.cc",
  52. "subprocess.cc",
  53. ]
  54. GRPCXX_TESTUTIL_HDRS = [
  55. "byte_buffer_proto_helper.h",
  56. "string_ref_helper.h",
  57. "subprocess.h",
  58. ]
  59. grpc_cc_library(
  60. name = "test_util",
  61. srcs = GRPCXX_TESTUTIL_SRCS + [
  62. "create_test_channel.cc",
  63. "test_credentials_provider.cc",
  64. ],
  65. hdrs = GRPCXX_TESTUTIL_HDRS + [
  66. "create_test_channel.h",
  67. "test_credentials_provider.h",
  68. ],
  69. external_deps = [
  70. "absl/flags:flag",
  71. "protobuf",
  72. ],
  73. deps = [
  74. "//:grpc++",
  75. "//test/core/end2end:ssl_test_data",
  76. "//test/core/util:grpc_test_util",
  77. ],
  78. )
  79. grpc_cc_library(
  80. name = "channel_trace_proto_helper",
  81. testonly = 1,
  82. srcs = [
  83. "channel_trace_proto_helper.cc",
  84. ],
  85. hdrs = [
  86. "channel_trace_proto_helper.h",
  87. ],
  88. external_deps = [
  89. "gtest",
  90. "protobuf",
  91. ],
  92. deps = [
  93. "//:grpc++",
  94. "//src/proto/grpc/channelz:channelz_proto",
  95. ],
  96. )
  97. grpc_cc_library(
  98. name = "test_util_unsecure",
  99. srcs = GRPCXX_TESTUTIL_SRCS,
  100. hdrs = GRPCXX_TESTUTIL_HDRS,
  101. external_deps = [
  102. "protobuf",
  103. ],
  104. deps = [
  105. "//:grpc++_unsecure",
  106. "//test/core/util:grpc_test_util_unsecure",
  107. ],
  108. )
  109. grpc_cc_library(
  110. name = "grpc_cli_utils",
  111. srcs = [
  112. "cli_call.cc",
  113. "cli_credentials.cc",
  114. "proto_file_parser.cc",
  115. "service_describer.cc",
  116. ],
  117. hdrs = [
  118. "cli_call.h",
  119. "cli_credentials.h",
  120. "config_grpc_cli.h",
  121. "proto_file_parser.h",
  122. "service_describer.h",
  123. ],
  124. external_deps = [
  125. "absl/flags:flag",
  126. "protobuf",
  127. "protobuf_clib",
  128. ],
  129. deps = [
  130. ":grpc++_proto_reflection_desc_db",
  131. "//:grpc++",
  132. "//src/proto/grpc/reflection/v1alpha:reflection_proto",
  133. ],
  134. )
  135. grpc_cc_library(
  136. name = "grpc_cli_libs",
  137. srcs = [
  138. "grpc_tool.cc",
  139. ],
  140. hdrs = [
  141. "grpc_tool.h",
  142. ],
  143. external_deps = [
  144. "absl/flags:flag",
  145. ],
  146. deps = [
  147. ":grpc_cli_utils",
  148. ],
  149. )
  150. grpc_cc_library(
  151. name = "metrics_server_lib",
  152. srcs = [
  153. "metrics_server.cc",
  154. ],
  155. hdrs = [
  156. "metrics_server.h",
  157. ],
  158. deps = [
  159. "//:grpc++",
  160. "//src/proto/grpc/testing:metrics_proto",
  161. ],
  162. )
  163. grpc_cc_test(
  164. name = "grpc_tool_test",
  165. srcs = [
  166. "grpc_tool_test.cc",
  167. ],
  168. data = [
  169. "//src/core/tsi/test_creds:ca.pem",
  170. "//src/core/tsi/test_creds:server1.key",
  171. "//src/core/tsi/test_creds:server1.pem",
  172. "//src/proto/grpc/testing:echo.proto",
  173. "//src/proto/grpc/testing:echo_messages.proto",
  174. "//src/proto/grpc/testing:simple_messages.proto",
  175. ],
  176. external_deps = [
  177. "absl/flags:flag",
  178. "gtest",
  179. ],
  180. tags = [
  181. "no_mac",
  182. "no_test_ios",
  183. "no_windows",
  184. "nomsan", # death tests seem to be incompatible with msan
  185. ],
  186. deps = [
  187. ":grpc_cli_libs",
  188. ":test_util",
  189. "//:grpc++_reflection",
  190. "//src/proto/grpc/testing:echo_messages_proto",
  191. "//src/proto/grpc/testing:echo_proto",
  192. "//src/proto/grpc/testing:simple_messages_proto",
  193. "//test/core/util:grpc_test_util",
  194. "//test/cpp/util:test_config",
  195. ],
  196. )
  197. grpc_cc_test(
  198. name = "byte_buffer_test",
  199. srcs = [
  200. "byte_buffer_test.cc",
  201. ],
  202. external_deps = [
  203. "gtest",
  204. ],
  205. uses_polling = False,
  206. deps = [
  207. ":test_util",
  208. ],
  209. )
  210. grpc_cc_test(
  211. name = "slice_test",
  212. srcs = [
  213. "slice_test.cc",
  214. ],
  215. external_deps = [
  216. "gtest",
  217. ],
  218. uses_polling = False,
  219. deps = [
  220. ":test_util",
  221. ],
  222. )
  223. grpc_cc_test(
  224. name = "string_ref_test",
  225. srcs = [
  226. "string_ref_test.cc",
  227. ],
  228. external_deps = [
  229. "gtest",
  230. ],
  231. uses_polling = False,
  232. deps = [
  233. "//:grpc++",
  234. "//test/core/util:grpc_test_util",
  235. ],
  236. )
  237. grpc_cc_test(
  238. name = "time_test",
  239. srcs = [
  240. "time_test.cc",
  241. ],
  242. external_deps = [
  243. "gtest",
  244. ],
  245. uses_polling = False,
  246. deps = [
  247. ":test_util",
  248. ],
  249. )
  250. grpc_cc_test(
  251. name = "cli_call_test",
  252. srcs = [
  253. "cli_call_test.cc",
  254. ],
  255. external_deps = [
  256. "gtest",
  257. ],
  258. deps = [
  259. ":grpc_cli_libs",
  260. ":test_util",
  261. "//src/proto/grpc/testing:echo_proto",
  262. "//test/core/util:grpc_test_util",
  263. ],
  264. )
  265. grpc_cc_test(
  266. name = "error_details_test",
  267. srcs = [
  268. "error_details_test.cc",
  269. ],
  270. external_deps = [
  271. "gtest",
  272. ],
  273. tags = ["no_test_ios"],
  274. deps = [
  275. "//:grpc++_error_details",
  276. "//src/proto/grpc/status:status_proto",
  277. "//src/proto/grpc/testing:echo_messages_proto",
  278. "//test/core/util:grpc_test_util",
  279. ],
  280. )
  281. grpc_cc_binary(
  282. name = "grpc_cli",
  283. srcs = [
  284. "grpc_cli.cc",
  285. ],
  286. external_deps = [
  287. "absl/flags:flag",
  288. ],
  289. deps = [
  290. ":grpc++_proto_reflection_desc_db",
  291. ":grpc_cli_libs",
  292. ":test_config",
  293. "//:grpc++",
  294. "//src/proto/grpc/reflection/v1alpha:reflection_proto",
  295. ],
  296. )
  297. grpc_cc_binary(
  298. name = "channelz_sampler",
  299. srcs = ["channelz_sampler.cc"],
  300. external_deps = [
  301. "absl/flags:flag",
  302. ],
  303. language = "c++",
  304. tags = [
  305. "no_windows", # unistd.h
  306. ],
  307. deps = [
  308. "//:gpr",
  309. "//:grpc++",
  310. "//:grpcpp_channelz",
  311. "//src/proto/grpc/channelz:channelz_proto",
  312. "//test/cpp/util:test_config",
  313. "//test/cpp/util:test_util",
  314. ],
  315. )
  316. grpc_cc_test(
  317. name = "channelz_sampler_test",
  318. srcs = [
  319. "channelz_sampler_test.cc",
  320. ],
  321. data = [
  322. ":channelz_sampler",
  323. ],
  324. external_deps = [
  325. "gtest",
  326. ],
  327. tags = [
  328. "no_mac", # cmake does not build channelz_sampler in Basic Tests C/C++ MacOS test
  329. "no_test_android", # android_cc_test doesn't work with data dependency.
  330. "no_test_ios",
  331. "no_windows", # unistd.h
  332. ],
  333. deps = [
  334. "//:gpr",
  335. "//:grpc",
  336. "//:grpc++",
  337. "//:grpcpp_channelz",
  338. "//src/proto/grpc/channelz:channelz_proto",
  339. "//src/proto/grpc/testing:test_proto",
  340. "//test/core/util:grpc_test_util",
  341. "//test/core/util:grpc_test_util_base",
  342. "//test/cpp/util:test_util",
  343. ],
  344. )
  345. grpc_cc_library(
  346. name = "tls_test_utils",
  347. srcs = [
  348. "tls_test_utils.cc",
  349. ],
  350. hdrs = [
  351. "tls_test_utils.h",
  352. ],
  353. deps = [
  354. "//:gpr",
  355. "//:grpc",
  356. "//:grpc++",
  357. "//test/core/util:grpc_test_util",
  358. ],
  359. )