used alternative approach - generated bazel scenarios

pull/16402/head
Bill Feng 6 years ago
parent 654a1ea0f6
commit 21824afb09
  1. 75
      test/cpp/qps/BUILD
  2. 20
      test/cpp/qps/json_run_localhost_scenario_gen.py
  3. 1
      test/cpp/qps/json_run_localhost_scenarios.bzl
  4. 1
      test/cpp/qps/json_run_localhost_scenarios.json
  5. 76
      test/cpp/qps/qps_benchmark_script.bzl
  6. 8
      test/cpp/qps/qps_json_driver_scenario_gen.py
  7. 1
      test/cpp/qps/qps_json_driver_scenarios.bzl
  8. 1
      test/cpp/qps/qps_json_driver_scenarios.json

@ -15,6 +15,7 @@
licenses(["notice"]) # Apache v2
load("//bazel:grpc_build_system.bzl", "grpc_cc_test", "grpc_cc_library", "grpc_cc_binary", "grpc_package")
load("//test/cpp/qps:qps_benchmark_script.bzl", "qps_json_driver_batch", "json_run_localhost_batch")
grpc_package(name = "test/cpp/qps")
@ -117,6 +118,21 @@ grpc_cc_library(
deps = ["//test/core/util:grpc_test_util"],
)
grpc_cc_binary(
name = "qps_json_driver",
srcs = ["qps_json_driver.cc"],
external_deps = [
"gflags",
],
deps = [
":benchmark_config",
":driver_impl",
"//:grpc++",
"//test/cpp/util:test_config",
"//test/cpp/util:test_util",
],
)
grpc_cc_test(
name = "inproc_sync_unary_ping_pong_test",
srcs = ["inproc_sync_unary_ping_pong_test.cc"],
@ -135,34 +151,9 @@ grpc_cc_library(
deps = ["//:grpc++"],
)
filegroup(
name = "json_run_localhost_scenarios",
srcs = [
":json_run_localhost_scenarios.json",
],
)
qps_json_driver_batch()
grpc_cc_test(
name = "json_run_localhost",
timeout = "eternal",
srcs = ["json_run_localhost.cc"],
args = [
"--scenarios_file",
"$(location //test/cpp/qps:json_run_localhost_scenarios)",
],
data = [
"//test/cpp/qps:json_run_localhost_scenarios",
"//test/cpp/qps:qps_json_driver",
"//test/cpp/qps:qps_worker",
],
deps = [
"//:gpr",
"//test/core/util:gpr_test_util",
"//test/core/util:grpc_test_util",
"//test/cpp/util:test_config",
"//test/cpp/util:test_util",
],
)
json_run_localhost_batch()
grpc_cc_test(
name = "qps_interarrival_test",
@ -174,36 +165,6 @@ grpc_cc_test(
],
)
filegroup(
name = "qps_json_driver_scenarios",
srcs = [
":qps_json_driver_scenarios.json",
],
)
grpc_cc_test(
name = "qps_json_driver",
srcs = ["qps_json_driver.cc"],
args = [
"--run_inproc",
"--scenarios_file",
"$(location //test/cpp/qps:qps_json_driver_scenarios)",
],
data = [
"//test/cpp/qps:qps_json_driver_scenarios",
],
external_deps = [
"gflags",
],
deps = [
":benchmark_config",
":driver_impl",
"//:grpc++",
"//test/cpp/util:test_config",
"//test/cpp/util:test_util",
],
)
grpc_cc_test(
name = "qps_openloop_test",
srcs = ["qps_openloop_test.cc"],

@ -20,15 +20,19 @@ import json
def generate_args():
all_scenario_set = gen.generate_yaml()
all_scenario_set = all_scenario_set['tests']
qps_json_driver_scenario_set = \
[item for item in all_scenario_set if item['name'] == 'json_run_localhost']
qps_json_driver_arg_set = \
[item['args'][1] for item in qps_json_driver_scenario_set \
if 'args' in item and len(item['args']) > 1]
json_run_localhost_scenarios = \
[item for item in all_scenario_set if item['name'] == 'qps_json_driver']
json_run_localhost_arg_set = \
[item['args'][2] for item in json_run_localhost_scenarios \
if 'args' in item and len(item['args']) > 2]
deserialized_scenarios = [json.loads(item)['scenarios'][0] \
for item in qps_json_driver_arg_set]
all_scenarios = {'scenarios': deserialized_scenarios}
print('\'' + json.dumps(all_scenarios) + '\'')
for item in json_run_localhost_arg_set]
all_scenarios = [{'scenarios' : [scenario]} \
for scenario in deserialized_scenarios]
serialized_scenarios_str = str(['\'' + json.dumps(scenario) + '\'' \
for scenario in all_scenarios])
with open('json_run_localhost_scenarios.bzl', 'wb') as f:
f.write('JSON_RUN_LOCALHOST_SCENARIOS = ' + serialized_scenarios_str + '\n')
generate_args()

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -0,0 +1,76 @@
# Copyright 2018 gRPC authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# This is for the gRPC build system. This isn't intended to be used outsite of
# the BUILD file for gRPC. It contains the mapping for the template system we
# use to generate other platform's build system files.
#
# Please consider that there should be a high bar for additions and changes to
# this file.
# Each rule listed must be re-written for Google's internal build system, and
# each change must be ported from one to the other.
#
load("//bazel:grpc_build_system.bzl", "grpc_cc_binary", "grpc_cc_test")
load("//test/cpp/qps:qps_json_driver_scenarios.bzl", "QPS_JSON_DRIVER_SCENARIOS")
load("//test/cpp/qps:json_run_localhost_scenarios.bzl", "JSON_RUN_LOCALHOST_SCENARIOS")
def qps_json_driver_batch():
idx = 0 # number for differentiating names
for scenario in QPS_JSON_DRIVER_SCENARIOS:
grpc_cc_test(
name = "qps_json_driver_test_%s" % str(idx),
srcs = ["qps_json_driver.cc"],
args = [
"--run_inproc",
"--scenarios_json",
scenario,
],
external_deps = [
"gflags",
],
deps = [
":benchmark_config",
":driver_impl",
"//:grpc++",
"//test/cpp/util:test_config",
"//test/cpp/util:test_util",
],
)
idx += 1
def json_run_localhost_batch():
idx = 0 # number for differentiating names
for scenario in JSON_RUN_LOCALHOST_SCENARIOS:
grpc_cc_test(
name = "json_run_localhost_%s" % str(idx),
srcs = ["json_run_localhost.cc"],
args = [
"--scenarios_json",
scenario,
],
data = [
"//test/cpp/qps:qps_json_driver",
"//test/cpp/qps:qps_worker",
],
deps = [
"//:gpr",
"//test/core/util:gpr_test_util",
"//test/core/util:grpc_test_util",
"//test/cpp/util:test_config",
"//test/cpp/util:test_util",
],
)
idx += 1

@ -27,8 +27,12 @@ def generate_args():
if 'args' in item and len(item['args']) > 2]
deserialized_scenarios = [json.loads(item)['scenarios'][0] \
for item in qps_json_driver_arg_set]
all_scenarios = {'scenarios': deserialized_scenarios}
print('\'' + json.dumps(all_scenarios) + '\'')
all_scenarios = [{'scenarios' : [scenario]} \
for scenario in deserialized_scenarios]
serialized_scenarios_str = str(['\'' + json.dumps(scenario) + '\'' \
for scenario in all_scenarios])
with open('qps_json_driver_scenarios.bzl', 'wb') as f:
f.write('QPS_JSON_DRIVER_SCENARIOS = ' + serialized_scenarios_str + '\n')
generate_args()

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save