diff options
author | Vijay Pai <vpai@google.com> | 2015-03-26 10:33:23 -0700 |
---|---|---|
committer | Vijay Pai <vpai@google.com> | 2015-03-26 10:33:23 -0700 |
commit | 96d3b8af32e2ffcca0d18bc5df7b0bf452131d4e (patch) | |
tree | 70d75f7b9b7251af54a59cc7c704eaf5309d40ba /test/cpp | |
parent | 6266b9341ce5f88ff4c888a87d682bc1b9ac706e (diff) | |
parent | 9032adcbef6797c5d0b6c5321de684e6b1f32a2d (diff) |
Merge branch 'vjpai-qps-stream' into qps-stream
Diffstat (limited to 'test/cpp')
-rw-r--r-- | test/cpp/end2end/async_end2end_test.cc | 1 | ||||
-rw-r--r-- | test/cpp/end2end/end2end_test.cc | 1 | ||||
-rw-r--r-- | test/cpp/end2end/generic_end2end_test.cc | 5 | ||||
-rw-r--r-- | test/cpp/qps/client_async.cc | 11 | ||||
-rw-r--r-- | test/cpp/qps/driver.cc | 44 | ||||
-rw-r--r-- | test/cpp/qps/server_async.cc | 4 | ||||
-rw-r--r-- | test/cpp/qps/stats.h | 4 |
7 files changed, 34 insertions, 36 deletions
diff --git a/test/cpp/end2end/async_end2end_test.cc b/test/cpp/end2end/async_end2end_test.cc index 4c71831dec..233c5b13a7 100644 --- a/test/cpp/end2end/async_end2end_test.cc +++ b/test/cpp/end2end/async_end2end_test.cc @@ -595,6 +595,5 @@ int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); int result = RUN_ALL_TESTS(); grpc_shutdown(); - google::protobuf::ShutdownProtobufLibrary(); return result; } diff --git a/test/cpp/end2end/end2end_test.cc b/test/cpp/end2end/end2end_test.cc index 41c2669533..e2649c2826 100644 --- a/test/cpp/end2end/end2end_test.cc +++ b/test/cpp/end2end/end2end_test.cc @@ -432,6 +432,5 @@ int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); int result = RUN_ALL_TESTS(); grpc_shutdown(); - google::protobuf::ShutdownProtobufLibrary(); return result; } diff --git a/test/cpp/end2end/generic_end2end_test.cc b/test/cpp/end2end/generic_end2end_test.cc index 711f1b9540..4692188721 100644 --- a/test/cpp/end2end/generic_end2end_test.cc +++ b/test/cpp/end2end/generic_end2end_test.cc @@ -83,8 +83,8 @@ bool ParseFromByteBuffer(ByteBuffer* buffer, grpc::protobuf::Message* message) { buffer->Dump(&slices); grpc::string buf; buf.reserve(buffer->Length()); - for (const Slice& s : slices) { - buf.append(reinterpret_cast<const char*>(s.begin()), s.size()); + for (auto s = slices.begin(); s != slices.end(); s++) { + buf.append(reinterpret_cast<const char*>(s->begin()), s->size()); } return message->ParseFromString(buf); } @@ -265,6 +265,5 @@ int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); int result = RUN_ALL_TESTS(); grpc_shutdown(); - google::protobuf::ShutdownProtobufLibrary(); return result; } diff --git a/test/cpp/qps/client_async.cc b/test/cpp/qps/client_async.cc index 3fd9628bd9..e4e7e73762 100644 --- a/test/cpp/qps/client_async.cc +++ b/test/cpp/qps/client_async.cc @@ -148,7 +148,8 @@ class AsyncUnaryClient GRPC_FINAL : public Client { int t = 0; for (int i = 0; i < config.outstanding_rpcs_per_channel(); i++) { - for (auto& channel : channels_) { + for (auto channel = channels_.begin(); channel != channels_.end(); + channel++) { auto* cq = cli_cqs_[t].get(); t = (t + 1) % cli_cqs_.size(); auto start_req = [cq](TestService::Stub* stub, grpc::ClientContext* ctx, @@ -156,7 +157,7 @@ class AsyncUnaryClient GRPC_FINAL : public Client { return stub->AsyncUnaryCall(ctx, request, cq, tag); }; - TestService::Stub* stub = channel.get_stub(); + TestService::Stub* stub = channel->get_stub(); const SimpleRequest& request = request_; new ClientRpcContextUnaryImpl<SimpleRequest, SimpleResponse>( stub, request, start_req, check_done); @@ -169,11 +170,11 @@ class AsyncUnaryClient GRPC_FINAL : public Client { ~AsyncUnaryClient() GRPC_OVERRIDE { EndThreads(); - for (auto& cq : cli_cqs_) { - cq->Shutdown(); + for (auto cq = cli_cqs_.begin(); cq != cli_cqs_.end(); cq++) { + (*cq)->Shutdown(); void* got_tag; bool ok; - while (cq->Next(&got_tag, &ok)) { + while ((*cq)->Next(&got_tag, &ok)) { delete ClientRpcContext::detag(got_tag); } } diff --git a/test/cpp/qps/driver.cc b/test/cpp/qps/driver.cc index d29ca1de94..64a53496ae 100644 --- a/test/cpp/qps/driver.cc +++ b/test/cpp/qps/driver.cc @@ -154,19 +154,19 @@ ScenarioResult RunScenario(const ClientConfig& initial_client_config, server_mark.mutable_mark(); ClientArgs client_mark; client_mark.mutable_mark(); - for (auto& server : servers) { - GPR_ASSERT(server.stream->Write(server_mark)); + for (auto server = servers.begin(); server != servers.end(); server++) { + GPR_ASSERT(server->stream->Write(server_mark)); } - for (auto& client : clients) { - GPR_ASSERT(client.stream->Write(client_mark)); + for (auto client = clients.begin(); client != clients.end(); client++) { + GPR_ASSERT(client->stream->Write(client_mark)); } ServerStatus server_status; ClientStatus client_status; - for (auto& server : servers) { - GPR_ASSERT(server.stream->Read(&server_status)); + for (auto server = servers.begin(); server != servers.end(); server++) { + GPR_ASSERT(server->stream->Read(&server_status)); } - for (auto& client : clients) { - GPR_ASSERT(client.stream->Read(&client_status)); + for (auto client = clients.begin(); client != clients.end(); client++) { + GPR_ASSERT(client->stream->Read(&client_status)); } // Wait some time @@ -176,33 +176,33 @@ ScenarioResult RunScenario(const ClientConfig& initial_client_config, // Finish a run ScenarioResult result; gpr_log(GPR_INFO, "Finishing"); - for (auto& server : servers) { - GPR_ASSERT(server.stream->Write(server_mark)); + for (auto server = servers.begin(); server != servers.end(); server++) { + GPR_ASSERT(server->stream->Write(server_mark)); } - for (auto& client : clients) { - GPR_ASSERT(client.stream->Write(client_mark)); + for (auto client = clients.begin(); client != clients.end(); client++) { + GPR_ASSERT(client->stream->Write(client_mark)); } - for (auto& server : servers) { - GPR_ASSERT(server.stream->Read(&server_status)); + for (auto server = servers.begin(); server != servers.end(); server++) { + GPR_ASSERT(server->stream->Read(&server_status)); const auto& stats = server_status.stats(); result.server_resources.push_back(ResourceUsage{ stats.time_elapsed(), stats.time_user(), stats.time_system()}); } - for (auto& client : clients) { - GPR_ASSERT(client.stream->Read(&client_status)); + for (auto client = clients.begin(); client != clients.end(); client++) { + GPR_ASSERT(client->stream->Read(&client_status)); const auto& stats = client_status.stats(); result.latencies.MergeProto(stats.latencies()); result.client_resources.push_back(ResourceUsage{ stats.time_elapsed(), stats.time_user(), stats.time_system()}); } - for (auto& client : clients) { - GPR_ASSERT(client.stream->WritesDone()); - GPR_ASSERT(client.stream->Finish().IsOk()); + for (auto client = clients.begin(); client != clients.end(); client++) { + GPR_ASSERT(client->stream->WritesDone()); + GPR_ASSERT(client->stream->Finish().IsOk()); } - for (auto& server : servers) { - GPR_ASSERT(server.stream->WritesDone()); - GPR_ASSERT(server.stream->Finish().IsOk()); + for (auto server = servers.begin(); server != servers.end(); server++) { + GPR_ASSERT(server->stream->WritesDone()); + GPR_ASSERT(server->stream->Finish().IsOk()); } return result; } diff --git a/test/cpp/qps/server_async.cc b/test/cpp/qps/server_async.cc index 1ec1928ab7..83bb08cd49 100644 --- a/test/cpp/qps/server_async.cc +++ b/test/cpp/qps/server_async.cc @@ -119,8 +119,8 @@ class AsyncQpsServerTest : public Server { shutdown_ = true; srv_cq_.Shutdown(); } - for (auto& thr : threads_) { - thr.join(); + for (auto thr = threads_.begin(); thr != threads_.end(); thr++) { + thr->join(); } while (!contexts_.empty()) { delete contexts_.front(); diff --git a/test/cpp/qps/stats.h b/test/cpp/qps/stats.h index ca59390ad7..82dc03e3da 100644 --- a/test/cpp/qps/stats.h +++ b/test/cpp/qps/stats.h @@ -43,8 +43,8 @@ namespace testing { template <class T, class F> double sum(const T& container, F functor) { double r = 0; - for (auto v : container) { - r += functor(v); + for (auto v = container.begin(); v != container.end(); v++) { + r += functor(*v); } return r; } |