1# Copyright 2018 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# 16# This is for the gRPC build system. This isn't intended to be used outsite of 17# the BUILD file for gRPC. It contains the mapping for the template system we 18# use to generate other platform's build system files. 19# 20# Please consider that there should be a high bar for additions and changes to 21# this file. 22# Each rule listed must be re-written for Google's internal build system, and 23# each change must be ported from one to the other. 24# 25 26"""Script to run qps benchmark.""" 27 28load("//bazel:grpc_build_system.bzl", "grpc_cc_test") 29load("//test/cpp/qps:json_run_localhost_scenarios.bzl", "JSON_RUN_LOCALHOST_SCENARIOS") 30load("//test/cpp/qps:qps_json_driver_scenarios.bzl", "QPS_JSON_DRIVER_SCENARIOS") 31 32def add_suffix(name): 33 # NOTE(https://github.com/grpc/grpc/issues/24178): Add the suffix to the name 34 # to avoid having the target name that 87, 88, 89 or 90 long. 35 m = len(name) - (87 - len("//test/cpp/qps:")) 36 if m >= 0 and m <= 3: 37 return name + "_" * (4 - m) 38 else: 39 return name 40 41# buildifier: disable=unnamed-macro 42def qps_json_driver_batch(): 43 for scenario in QPS_JSON_DRIVER_SCENARIOS: 44 grpc_cc_test( 45 name = add_suffix("qps_json_driver_test_%s" % scenario), 46 srcs = ["qps_json_driver.cc"], 47 args = [ 48 "--run_inproc", 49 "--scenarios_json", 50 QPS_JSON_DRIVER_SCENARIOS[scenario], 51 ], 52 deps = [ 53 ":benchmark_config", 54 ":driver_impl", 55 "//:grpc++", 56 "//test/cpp/util:test_config", 57 "//test/cpp/util:test_util", 58 ], 59 external_deps = [ 60 "absl/log:check", 61 ], 62 tags = [ 63 "qps_json_driver", 64 "no_mac", 65 "nomsan", 66 "noubsan", 67 ], 68 # TODO(b/156975956): address OOMing benchmark tests 69 flaky = True, 70 ) 71 72# buildifier: disable=unnamed-macro 73def json_run_localhost_batch(): 74 for scenario in JSON_RUN_LOCALHOST_SCENARIOS: 75 grpc_cc_test( 76 name = add_suffix("json_run_localhost_%s" % scenario), 77 srcs = ["json_run_localhost.cc"], 78 args = [ 79 "--scenarios_json", 80 JSON_RUN_LOCALHOST_SCENARIOS[scenario], 81 ], 82 data = [ 83 "//test/cpp/qps:qps_json_driver", 84 "//test/cpp/qps:qps_worker", 85 ], 86 external_deps = [ 87 "absl/log:check", 88 ], 89 deps = [ 90 "//:gpr", 91 "//test/core/test_util:grpc_test_util", 92 "//test/cpp/util:test_config", 93 "//test/cpp/util:test_util", 94 ], 95 tags = [ 96 "json_run_localhost", 97 "no_windows", 98 "no_mac", 99 "nomsan", 100 "notsan", 101 "noubsan", 102 ], 103 # TODO(b/156975956): address OOMing benchmark tests 104 flaky = True, 105 ) 106