aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/cpp/qps/qps_json_driver.cc
diff options
context:
space:
mode:
authorGravatar vjpai <vpai@google.com>2016-04-20 12:38:16 -0700
committerGravatar vjpai <vpai@google.com>2016-04-20 12:38:16 -0700
commit29089c7b41425a7f274c1d56597d5635182b506d (patch)
treeed68ef0b8cb18ccfc8553f35984fd80c72e8dc49 /test/cpp/qps/qps_json_driver.cc
parentf4154296382f41c86ef16809bdd9b91967120117 (diff)
Deprecation of qps_driver and use of shell scripts, in progress
Diffstat (limited to 'test/cpp/qps/qps_json_driver.cc')
-rw-r--r--test/cpp/qps/qps_json_driver.cc27
1 files changed, 16 insertions, 11 deletions
diff --git a/test/cpp/qps/qps_json_driver.cc b/test/cpp/qps/qps_json_driver.cc
index e9266a5711..17f3d3c463 100644
--- a/test/cpp/qps/qps_json_driver.cc
+++ b/test/cpp/qps/qps_json_driver.cc
@@ -48,6 +48,7 @@ DEFINE_string(scenarios_file, "",
"JSON file containing an array of Scenario objects");
DEFINE_string(scenarios_json, "",
"JSON string containing an array of Scenario objects");
+DEFINE_bool(quit, false, "Quit the workers");
namespace grpc {
namespace testing {
@@ -55,12 +56,17 @@ namespace testing {
static void QpsDriver() {
grpc::string json;
- if (FLAGS_scenarios_file != "") {
- if (FLAGS_scenarios_json != "") {
- gpr_log(GPR_ERROR,
- "Only one of --scenarios_file or --scenarios_json must be set");
- abort();
- }
+ bool scfile = (FLAGS_scenarios_file != "");
+ bool scjson = (FLAGS_scenarios_json != "");
+ if ((!scfile && !scjson && !FLAGS_quit) ||
+ (scfile && (scjson || FLAGS_quit)) ||
+ (scjson && FLAGS_quit)) {
+ gpr_log(GPR_ERROR, "Exactly one of --scenarios_file, --scenarios_json, "
+ "or --quit must be set");
+ abort();
+ }
+
+ if (scfile) {
// Read the json data from disk
FILE *json_file = fopen(FLAGS_scenarios_file.c_str(), "r");
GPR_ASSERT(json_file != NULL);
@@ -72,12 +78,11 @@ static void QpsDriver() {
fclose(json_file);
json = grpc::string(data, data + len);
delete[] data;
- } else if (FLAGS_scenarios_json != "") {
+ } else if (scjson) {
json = FLAGS_scenarios_json.c_str();
- } else {
- gpr_log(GPR_ERROR,
- "One of --scenarios_file or --scenarios_json must be set");
- abort();
+ } else if (FLAGS_quit) {
+ RunQuit();
+ return;
}
// Parse into an array of scenarios