Add more information so that we can have a meaningful exit code

pull/7244/head
Vijay Pai 9 years ago
parent b0f15e8af3
commit ceb1a7d79f
  1. 3
      src/proto/grpc/testing/control.proto
  2. 8
      test/cpp/qps/driver.cc
  3. 2
      test/cpp/qps/driver.h
  4. 18
      test/cpp/qps/qps_json_driver.cc

@ -229,4 +229,7 @@ message ScenarioResult {
repeated int32 server_cores = 5;
// An after-the-fact computed summary
ScenarioResultSummary summary = 6;
// Information on success or failure of each worker
repeated bool client_success = 7;
repeated bool server_success = 8;
}

@ -436,6 +436,7 @@ std::unique_ptr<ScenarioResult> RunScenario(
for (size_t i = 0; i < num_clients; i++) {
auto client = &clients[i];
Status s = client->stream->Finish();
result->add_client_success(s.ok());
if (!s.ok()) {
gpr_log(GPR_ERROR, "Client %zu had an error %s", i,
s.error_message().c_str());
@ -471,6 +472,7 @@ std::unique_ptr<ScenarioResult> RunScenario(
for (size_t i = 0; i < num_servers; i++) {
auto server = &servers[i];
Status s = server->stream->Finish();
result->add_server_success(s.ok());
if (!s.ok()) {
gpr_log(GPR_ERROR, "Server %zu had an error %s", i,
s.error_message().c_str());
@ -483,8 +485,9 @@ std::unique_ptr<ScenarioResult> RunScenario(
return result;
}
void RunQuit() {
bool RunQuit() {
// Get client, server lists
bool result = true;
auto workers = get_workers("QPS_WORKERS");
for (size_t i = 0; i < workers.size(); i++) {
auto stub = WorkerService::NewStub(
@ -496,9 +499,10 @@ void RunQuit() {
if (!s.ok()) {
gpr_log(GPR_ERROR, "Worker %zu could not be properly quit because %s",
i, s.error_message().c_str());
GPR_ASSERT(false);
result = false;
}
}
return result;
}
} // namespace testing

@ -47,7 +47,7 @@ std::unique_ptr<ScenarioResult> RunScenario(
const grpc::testing::ServerConfig& server_config, size_t num_servers,
int warmup_seconds, int benchmark_seconds, int spawn_local_worker_count);
void RunQuit();
bool RunQuit();
} // namespace testing
} // namespace grpc

@ -53,7 +53,7 @@ DEFINE_bool(quit, false, "Quit the workers");
namespace grpc {
namespace testing {
static void QpsDriver() {
static bool QpsDriver() {
grpc::string json;
bool scfile = (FLAGS_scenarios_file != "");
@ -81,13 +81,13 @@ static void QpsDriver() {
} else if (scjson) {
json = FLAGS_scenarios_json.c_str();
} else if (FLAGS_quit) {
RunQuit();
return;
return RunQuit();
}
// Parse into an array of scenarios
Scenarios scenarios;
ParseJson(json.c_str(), "grpc.testing.Scenarios", &scenarios);
bool success = true;
// Make sure that there is at least some valid scenario here
GPR_ASSERT(scenarios.scenarios_size() > 0);
@ -109,7 +109,15 @@ static void QpsDriver() {
GetReporter()->ReportQPSPerCore(*result);
GetReporter()->ReportLatency(*result);
GetReporter()->ReportTimes(*result);
for (int i = 0; success && i < result->client_success_size(); i++) {
success = result->client_success(i);
}
for (int i = 0; success && i < result->server_success_size(); i++) {
success = result->server_success(i);
}
}
return success;
}
} // namespace testing
@ -118,7 +126,7 @@ static void QpsDriver() {
int main(int argc, char **argv) {
grpc::testing::InitBenchmark(&argc, &argv, true);
grpc::testing::QpsDriver();
bool ok = grpc::testing::QpsDriver();
return 0;
return ok ? 0 : 1;
}

Loading…
Cancel
Save