xref: /aosp_15_r20/external/grpc-grpc/test/cpp/qps/BUILD (revision cc02d7e222339f7a4f6ba5f422e6413f4bd931f2)
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
15load("//bazel:custom_exec_properties.bzl", "LARGE_MACHINE")
16load("//bazel:grpc_build_system.bzl", "grpc_cc_binary", "grpc_cc_library", "grpc_cc_test", "grpc_package", "grpc_py_binary")
17load("//test/cpp/qps:qps_benchmark_script.bzl", "json_run_localhost_batch", "qps_json_driver_batch")
18
19licenses(["notice"])
20
21grpc_package(name = "test/cpp/qps")
22
23grpc_cc_library(
24    name = "parse_json",
25    srcs = ["parse_json.cc"],
26    hdrs = ["parse_json.h"],
27    external_deps = ["protobuf"],
28    deps = ["//:grpc++"],
29)
30
31grpc_cc_library(
32    name = "qps_worker_impl",
33    srcs = [
34        "client_async.cc",
35        "client_callback.cc",
36        "client_sync.cc",
37        "qps_server_builder.cc",
38        "qps_worker.cc",
39        "server_async.cc",
40        "server_callback.cc",
41        "server_sync.cc",
42    ],
43    hdrs = [
44        "client.h",
45        "qps_server_builder.h",
46        "qps_worker.h",
47        "server.h",
48    ],
49    deps = [
50        ":histogram",
51        ":interarrival",
52        ":usage_timer",
53        "//:grpc",
54        "//:grpc++",
55        "//src/proto/grpc/testing:benchmark_service_proto",
56        "//src/proto/grpc/testing:control_proto",
57        "//src/proto/grpc/testing:payloads_proto",
58        "//src/proto/grpc/testing:worker_service_proto",
59        "//test/core/end2end:ssl_test_data",
60        "//test/core/util:grpc_test_util",
61        "//test/cpp/util:test_config",
62        "//test/cpp/util:test_util",
63    ],
64)
65
66grpc_cc_library(
67    name = "driver_impl",
68    srcs = [
69        "driver.cc",
70        "report.cc",
71    ],
72    hdrs = [
73        "driver.h",
74        "report.h",
75    ],
76    deps = [
77        ":histogram",
78        ":parse_json",
79        ":qps_worker_impl",
80        "//:grpc++",
81        "//src/proto/grpc/testing:control_proto",
82        "//src/proto/grpc/testing:messages_proto",
83        "//src/proto/grpc/testing:report_qps_scenario_service_proto",
84        "//src/proto/grpc/testing:worker_service_proto",
85        "//test/core/util:grpc_test_util",
86        "//test/cpp/util:test_util",
87    ],
88)
89
90grpc_cc_library(
91    name = "benchmark_config",
92    srcs = [
93        "benchmark_config.cc",
94    ],
95    hdrs = [
96        "benchmark_config.h",
97    ],
98    external_deps = [
99        "absl/flags:flag",
100    ],
101    deps = [
102        ":driver_impl",
103        ":histogram",
104        "//:grpc++",
105        "//src/proto/grpc/testing:control_proto",
106    ],
107)
108
109grpc_cc_library(
110    name = "histogram",
111    hdrs = [
112        "histogram.h",
113        "stats.h",
114    ],
115    deps = [
116        "//src/proto/grpc/testing:stats_proto",
117        "//test/core/util:grpc_test_util",
118    ],
119)
120
121grpc_cc_binary(
122    name = "qps_json_driver",
123    srcs = ["qps_json_driver.cc"],
124    external_deps = [
125        "absl/flags:flag",
126    ],
127    deps = [
128        ":benchmark_config",
129        ":driver_impl",
130        "//:grpc++",
131        "//test/cpp/util:test_config",
132        "//test/cpp/util:test_util",
133    ],
134)
135
136grpc_cc_test(
137    name = "inproc_sync_unary_ping_pong_test",
138    srcs = ["inproc_sync_unary_ping_pong_test.cc"],
139    deps = [
140        ":benchmark_config",
141        ":driver_impl",
142        "//:grpc++",
143        "//test/cpp/util:test_config",
144        "//test/cpp/util:test_util",
145    ],
146)
147
148grpc_cc_library(
149    name = "interarrival",
150    hdrs = ["interarrival.h"],
151    deps = ["//:grpc++"],
152)
153
154qps_json_driver_batch()
155
156json_run_localhost_batch()
157
158grpc_cc_test(
159    name = "qps_interarrival_test",
160    srcs = ["qps_interarrival_test.cc"],
161    uses_event_engine = False,
162    uses_polling = False,
163    deps = [
164        ":histogram",
165        ":interarrival",
166        "//test/core/util:grpc_test_util_base",
167        "//test/cpp/util:test_config",
168    ],
169)
170
171grpc_cc_test(
172    name = "qps_openloop_test",
173    srcs = ["qps_openloop_test.cc"],
174    exec_properties = LARGE_MACHINE,
175    tags = ["no_windows"],  # LARGE_MACHINE is not configured for windows RBE
176    deps = [
177        ":benchmark_config",
178        ":driver_impl",
179        ":qps_worker_impl",
180        "//test/cpp/util:test_config",
181        "//test/cpp/util:test_util",
182    ],
183)
184
185grpc_cc_test(
186    name = "secure_sync_unary_ping_pong_test",
187    srcs = ["secure_sync_unary_ping_pong_test.cc"],
188    deps = [
189        ":benchmark_config",
190        ":driver_impl",
191        "//:grpc++",
192        "//test/cpp/util:test_config",
193        "//test/cpp/util:test_util",
194    ],
195)
196
197grpc_cc_library(
198    name = "usage_timer",
199    srcs = ["usage_timer.cc"],
200    hdrs = ["usage_timer.h"],
201    deps = ["//:gpr"],
202)
203
204grpc_cc_binary(
205    name = "qps_worker",
206    srcs = ["worker.cc"],
207    external_deps = [
208        "absl/flags:flag",
209    ],
210    deps = [
211        ":qps_worker_impl",
212        "//:grpc++",
213        "//test/core/util:grpc_test_util",
214        "//test/cpp/util:test_config",
215        "//test/cpp/util:test_util",
216    ],
217)
218
219grpc_py_binary(
220    name = "scenario_runner",
221    testonly = True,
222    srcs = ["scenario_runner.py"],
223    data = ["scenario_runner_cc"],
224    python_version = "PY3",
225)
226
227grpc_cc_binary(
228    name = "scenario_runner_cc",
229    srcs = ["scenario_runner.cc"],
230    external_deps = [
231        "absl/flags:flag",
232    ],
233    deps = [
234        ":benchmark_config",
235        ":driver_impl",
236        "//:grpc++",
237        "//test/core/util:grpc_test_util",
238        "//test/cpp/util:test_config",
239        "//test/cpp/util:test_util",
240    ],
241)
242