diff options
Diffstat (limited to 'test/cpp')
46 files changed, 299 insertions, 140 deletions
diff --git a/test/cpp/common/auth_property_iterator_test.cc b/test/cpp/common/auth_property_iterator_test.cc index a629ff5a90..4b5cf02c69 100644 --- a/test/cpp/common/auth_property_iterator_test.cc +++ b/test/cpp/common/auth_property_iterator_test.cc @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -31,14 +31,14 @@ * */ -#include <grpc/grpc_security.h> #include <grpc++/security/auth_context.h> +#include <grpc/grpc_security.h> #include <gtest/gtest.h> #include "src/cpp/common/secure_auth_context.h" #include "test/cpp/util/string_ref_helper.h" extern "C" { -#include "src/core/security/security_context.h" +#include "src/core/lib/security/security_context.h" } using ::grpc::testing::ToString; diff --git a/test/cpp/common/secure_auth_context_test.cc b/test/cpp/common/secure_auth_context_test.cc index 11de646999..c421910cba 100644 --- a/test/cpp/common/secure_auth_context_test.cc +++ b/test/cpp/common/secure_auth_context_test.cc @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -31,14 +31,14 @@ * */ -#include <grpc/grpc_security.h> +#include "src/cpp/common/secure_auth_context.h" #include <grpc++/security/auth_context.h> +#include <grpc/grpc_security.h> #include <gtest/gtest.h> -#include "src/cpp/common/secure_auth_context.h" #include "test/cpp/util/string_ref_helper.h" extern "C" { -#include "src/core/security/security_context.h" +#include "src/core/lib/security/security_context.h" } using grpc::testing::ToString; diff --git a/test/cpp/end2end/async_end2end_test.cc b/test/cpp/end2end/async_end2end_test.cc index dc8c2bb6e5..d8aa4c0137 100644 --- a/test/cpp/end2end/async_end2end_test.cc +++ b/test/cpp/end2end/async_end2end_test.cc @@ -53,7 +53,7 @@ #include "test/cpp/util/string_ref_helper.h" #ifdef GPR_POSIX_SOCKET -#include "src/core/iomgr/pollset_posix.h" +#include "src/core/lib/iomgr/pollset_posix.h" #endif using grpc::testing::EchoRequest; diff --git a/test/cpp/end2end/end2end_test.cc b/test/cpp/end2end/end2end_test.cc index 4759818322..ff388c0341 100644 --- a/test/cpp/end2end/end2end_test.cc +++ b/test/cpp/end2end/end2end_test.cc @@ -48,7 +48,7 @@ #include <grpc/support/time.h> #include <gtest/gtest.h> -#include "src/core/security/credentials.h" +#include "src/core/lib/security/credentials.h" #include "src/proto/grpc/testing/duplicate/echo_duplicate.grpc.pb.h" #include "src/proto/grpc/testing/echo.grpc.pb.h" #include "test/core/util/port.h" diff --git a/test/cpp/end2end/generic_end2end_test.cc b/test/cpp/end2end/generic_end2end_test.cc index 4e6d50ea80..8dad1c2005 100644 --- a/test/cpp/end2end/generic_end2end_test.cc +++ b/test/cpp/end2end/generic_end2end_test.cc @@ -135,6 +135,8 @@ class GenericEnd2endTest : public ::testing::Test { std::unique_ptr<ByteBuffer> send_buffer = SerializeToByteBuffer(&send_request); call->Write(*send_buffer, tag(2)); + // Send ByteBuffer can be destroyed after calling Write. + send_buffer.reset(); client_ok(2); call->WritesDone(tag(3)); client_ok(3); @@ -154,6 +156,7 @@ class GenericEnd2endTest : public ::testing::Test { send_response.set_message(recv_request.message()); send_buffer = SerializeToByteBuffer(&send_response); stream.Write(*send_buffer, tag(6)); + send_buffer.reset(); server_ok(6); stream.Finish(Status::OK, tag(7)); @@ -223,6 +226,7 @@ TEST_F(GenericEnd2endTest, SimpleBidiStreaming) { std::unique_ptr<ByteBuffer> send_buffer = SerializeToByteBuffer(&send_request); cli_stream->Write(*send_buffer, tag(3)); + send_buffer.reset(); client_ok(3); ByteBuffer recv_buffer; @@ -234,6 +238,7 @@ TEST_F(GenericEnd2endTest, SimpleBidiStreaming) { send_response.set_message(recv_request.message()); send_buffer = SerializeToByteBuffer(&send_response); srv_stream.Write(*send_buffer, tag(5)); + send_buffer.reset(); server_ok(5); cli_stream->Read(&recv_buffer, tag(6)); diff --git a/test/cpp/end2end/hybrid_end2end_test.cc b/test/cpp/end2end/hybrid_end2end_test.cc index c72e20628f..02043a89d3 100644 --- a/test/cpp/end2end/hybrid_end2end_test.cc +++ b/test/cpp/end2end/hybrid_end2end_test.cc @@ -356,7 +356,8 @@ TEST_F(HybridEnd2endTest, AsyncEcho) { TEST_F(HybridEnd2endTest, AsyncEchoRequestStream) { EchoTestService::WithAsyncMethod_RequestStream< - EchoTestService::WithAsyncMethod_Echo<TestServiceImpl> > service; + EchoTestService::WithAsyncMethod_Echo<TestServiceImpl> > + service; SetUpServer(&service, nullptr, nullptr); ResetStub(); std::thread echo_handler_thread( @@ -436,7 +437,8 @@ TEST_F(HybridEnd2endTest, GenericEcho) { TEST_F(HybridEnd2endTest, GenericEchoAsyncRequestStream) { EchoTestService::WithAsyncMethod_RequestStream< - EchoTestService::WithGenericMethod_Echo<TestServiceImpl> > service; + EchoTestService::WithGenericMethod_Echo<TestServiceImpl> > + service; AsyncGenericService generic_service; SetUpServer(&service, nullptr, &generic_service); ResetStub(); @@ -453,7 +455,8 @@ TEST_F(HybridEnd2endTest, GenericEchoAsyncRequestStream) { // Add a second service with one sync method. TEST_F(HybridEnd2endTest, GenericEchoAsyncRequestStream_SyncDupService) { EchoTestService::WithAsyncMethod_RequestStream< - EchoTestService::WithGenericMethod_Echo<TestServiceImpl> > service; + EchoTestService::WithGenericMethod_Echo<TestServiceImpl> > + service; AsyncGenericService generic_service; TestServiceImplDupPkg dup_service; SetUpServer(&service, &dup_service, &generic_service); @@ -472,7 +475,8 @@ TEST_F(HybridEnd2endTest, GenericEchoAsyncRequestStream_SyncDupService) { // Add a second service with one async method. TEST_F(HybridEnd2endTest, GenericEchoAsyncRequestStream_AsyncDupService) { EchoTestService::WithAsyncMethod_RequestStream< - EchoTestService::WithGenericMethod_Echo<TestServiceImpl> > service; + EchoTestService::WithGenericMethod_Echo<TestServiceImpl> > + service; AsyncGenericService generic_service; duplicate::EchoTestService::AsyncService dup_service; SetUpServer(&service, &dup_service, &generic_service); diff --git a/test/cpp/end2end/shutdown_test.cc b/test/cpp/end2end/shutdown_test.cc index dbbda3ac51..62bb6b1b78 100644 --- a/test/cpp/end2end/shutdown_test.cc +++ b/test/cpp/end2end/shutdown_test.cc @@ -43,7 +43,7 @@ #include <grpc/support/sync.h> #include <gtest/gtest.h> -#include "src/core/support/env.h" +#include "src/core/lib/support/env.h" #include "src/proto/grpc/testing/echo.grpc.pb.h" #include "test/core/util/port.h" #include "test/core/util/test_config.h" diff --git a/test/cpp/end2end/test_service_impl.cc b/test/cpp/end2end/test_service_impl.cc index fe29c4afe9..2f5dd6d49e 100644 --- a/test/cpp/end2end/test_service_impl.cc +++ b/test/cpp/end2end/test_service_impl.cc @@ -129,10 +129,9 @@ Status TestServiceImpl::Echo(ServerContext* context, const EchoRequest* request, if (request->has_param() && request->param().echo_metadata()) { const std::multimap<grpc::string_ref, grpc::string_ref>& client_metadata = context->client_metadata(); - for ( - std::multimap<grpc::string_ref, grpc::string_ref>::const_iterator iter = - client_metadata.begin(); - iter != client_metadata.end(); ++iter) { + for (std::multimap<grpc::string_ref, grpc::string_ref>::const_iterator + iter = client_metadata.begin(); + iter != client_metadata.end(); ++iter) { context->AddTrailingMetadata(ToString(iter->first), ToString(iter->second)); } diff --git a/test/cpp/end2end/thread_stress_test.cc b/test/cpp/end2end/thread_stress_test.cc index e246c0b0e2..3f75a0c92e 100644 --- a/test/cpp/end2end/thread_stress_test.cc +++ b/test/cpp/end2end/thread_stress_test.cc @@ -45,7 +45,7 @@ #include <grpc/support/time.h> #include <gtest/gtest.h> -#include "src/core/surface/api_trace.h" +#include "src/core/lib/surface/api_trace.h" #include "src/proto/grpc/testing/duplicate/echo_duplicate.grpc.pb.h" #include "src/proto/grpc/testing/echo.grpc.pb.h" #include "test/core/util/port.h" @@ -58,6 +58,7 @@ using std::chrono::system_clock; const int kNumThreads = 100; // Number of threads const int kNumAsyncSendThreads = 2; const int kNumAsyncReceiveThreads = 50; +const int kNumAsyncServerThreads = 50; const int kNumRpcs = 1000; // Number of RPCs per thread namespace grpc { @@ -174,23 +175,12 @@ class TestServiceImplDupPkg } }; +template <class Service> class CommonStressTest { public: CommonStressTest() : kMaxMessageSize_(8192) {} - void SetUp() { - int port = grpc_pick_unused_port_or_die(); - server_address_ << "localhost:" << port; - // Setup server - ServerBuilder builder; - builder.AddListeningPort(server_address_.str(), - InsecureServerCredentials()); - builder.RegisterService(&service_); - builder.SetMaxMessageSize( - kMaxMessageSize_); // For testing max message size. - builder.RegisterService(&dup_pkg_service_); - server_ = builder.BuildAndStart(); - } - void TearDown() { server_->Shutdown(); } + virtual void SetUp() = 0; + virtual void TearDown() = 0; void ResetStub() { std::shared_ptr<Channel> channel = CreateChannel(server_address_.str(), InsecureChannelCredentials()); @@ -198,15 +188,137 @@ class CommonStressTest { } grpc::testing::EchoTestService::Stub* GetStub() { return stub_.get(); } + protected: + void SetUpStart(ServerBuilder* builder, Service* service) { + int port = grpc_pick_unused_port_or_die(); + server_address_ << "localhost:" << port; + // Setup server + builder->AddListeningPort(server_address_.str(), + InsecureServerCredentials()); + builder->RegisterService(service); + builder->SetMaxMessageSize( + kMaxMessageSize_); // For testing max message size. + builder->RegisterService(&dup_pkg_service_); + } + void SetUpEnd(ServerBuilder* builder) { server_ = builder->BuildAndStart(); } + void TearDownStart() { server_->Shutdown(); } + void TearDownEnd() {} + private: std::unique_ptr<grpc::testing::EchoTestService::Stub> stub_; std::unique_ptr<Server> server_; std::ostringstream server_address_; const int kMaxMessageSize_; - TestServiceImpl service_; TestServiceImplDupPkg dup_pkg_service_; }; +class CommonStressTestSyncServer : public CommonStressTest<TestServiceImpl> { + public: + void SetUp() GRPC_OVERRIDE { + ServerBuilder builder; + SetUpStart(&builder, &service_); + SetUpEnd(&builder); + } + void TearDown() GRPC_OVERRIDE { + TearDownStart(); + TearDownEnd(); + } + + private: + TestServiceImpl service_; +}; + +class CommonStressTestAsyncServer + : public CommonStressTest<::grpc::testing::EchoTestService::AsyncService> { + public: + void SetUp() GRPC_OVERRIDE { + shutting_down_ = false; + ServerBuilder builder; + SetUpStart(&builder, &service_); + cq_ = builder.AddCompletionQueue(); + SetUpEnd(&builder); + contexts_ = new Context[kNumAsyncServerThreads * 100]; + for (int i = 0; i < kNumAsyncServerThreads * 100; i++) { + RefreshContext(i); + } + for (int i = 0; i < kNumAsyncServerThreads; i++) { + server_threads_.push_back( + new std::thread(&CommonStressTestAsyncServer::ProcessRpcs, this)); + } + } + void TearDown() GRPC_OVERRIDE { + { + unique_lock<mutex> l(mu_); + TearDownStart(); + shutting_down_ = true; + cq_->Shutdown(); + } + + for (int i = 0; i < kNumAsyncServerThreads; i++) { + server_threads_[i]->join(); + delete server_threads_[i]; + } + + void* ignored_tag; + bool ignored_ok; + while (cq_->Next(&ignored_tag, &ignored_ok)) + ; + TearDownEnd(); + delete[] contexts_; + } + + private: + void ProcessRpcs() { + void* tag; + bool ok; + while (cq_->Next(&tag, &ok)) { + if (ok) { + int i = static_cast<int>(reinterpret_cast<intptr_t>(tag)); + switch (contexts_[i].state) { + case Context::READY: { + contexts_[i].state = Context::DONE; + EchoResponse send_response; + send_response.set_message(contexts_[i].recv_request.message()); + contexts_[i].response_writer->Finish(send_response, Status::OK, + tag); + break; + } + case Context::DONE: + RefreshContext(i); + break; + } + } + } + } + void RefreshContext(int i) { + unique_lock<mutex> l(mu_); + if (!shutting_down_) { + contexts_[i].state = Context::READY; + contexts_[i].srv_ctx.reset(new ServerContext); + contexts_[i].response_writer.reset( + new grpc::ServerAsyncResponseWriter<EchoResponse>( + contexts_[i].srv_ctx.get())); + service_.RequestEcho(contexts_[i].srv_ctx.get(), + &contexts_[i].recv_request, + contexts_[i].response_writer.get(), cq_.get(), + cq_.get(), (void*)(intptr_t)i); + } + } + struct Context { + std::unique_ptr<ServerContext> srv_ctx; + std::unique_ptr<grpc::ServerAsyncResponseWriter<EchoResponse>> + response_writer; + EchoRequest recv_request; + enum { READY, DONE } state; + } * contexts_; + ::grpc::testing::EchoTestService::AsyncService service_; + std::unique_ptr<ServerCompletionQueue> cq_; + bool shutting_down_; + mutex mu_; + std::vector<std::thread*> server_threads_; +}; + +template <class Common> class End2endTest : public ::testing::Test { protected: End2endTest() {} @@ -214,7 +326,7 @@ class End2endTest : public ::testing::Test { void TearDown() GRPC_OVERRIDE { common_.TearDown(); } void ResetStub() { common_.ResetStub(); } - CommonStressTest common_; + Common common_; }; static void SendRpc(grpc::testing::EchoTestService::Stub* stub, int num_rpcs) { @@ -230,11 +342,16 @@ static void SendRpc(grpc::testing::EchoTestService::Stub* stub, int num_rpcs) { } } -TEST_F(End2endTest, ThreadStress) { - common_.ResetStub(); +typedef ::testing::Types<CommonStressTestSyncServer, + CommonStressTestAsyncServer> + CommonTypes; +TYPED_TEST_CASE(End2endTest, CommonTypes); +TYPED_TEST(End2endTest, ThreadStress) { + this->common_.ResetStub(); std::vector<std::thread*> threads; for (int i = 0; i < kNumThreads; ++i) { - threads.push_back(new std::thread(SendRpc, common_.GetStub(), kNumRpcs)); + threads.push_back( + new std::thread(SendRpc, this->common_.GetStub(), kNumRpcs)); } for (int i = 0; i < kNumThreads; ++i) { threads[i]->join(); @@ -242,6 +359,7 @@ TEST_F(End2endTest, ThreadStress) { } } +template <class Common> class AsyncClientEnd2endTest : public ::testing::Test { protected: AsyncClientEnd2endTest() : rpcs_outstanding_(0) {} @@ -309,31 +427,33 @@ class AsyncClientEnd2endTest : public ::testing::Test { } } - CommonStressTest common_; + Common common_; CompletionQueue cq_; mutex mu_; condition_variable cv_; int rpcs_outstanding_; }; -TEST_F(AsyncClientEnd2endTest, ThreadStress) { - common_.ResetStub(); - std::vector<std::thread*> send_threads, completion_threads; +TYPED_TEST_CASE(AsyncClientEnd2endTest, CommonTypes); +TYPED_TEST(AsyncClientEnd2endTest, ThreadStress) { + this->common_.ResetStub(); + std::vector<std::thread *> send_threads, completion_threads; for (int i = 0; i < kNumAsyncReceiveThreads; ++i) { completion_threads.push_back(new std::thread( - &AsyncClientEnd2endTest_ThreadStress_Test::AsyncCompleteRpc, this)); + &AsyncClientEnd2endTest_ThreadStress_Test<TypeParam>::AsyncCompleteRpc, + this)); } for (int i = 0; i < kNumAsyncSendThreads; ++i) { - send_threads.push_back( - new std::thread(&AsyncClientEnd2endTest_ThreadStress_Test::AsyncSendRpc, - this, kNumRpcs)); + send_threads.push_back(new std::thread( + &AsyncClientEnd2endTest_ThreadStress_Test<TypeParam>::AsyncSendRpc, + this, kNumRpcs)); } for (int i = 0; i < kNumAsyncSendThreads; ++i) { send_threads[i]->join(); delete send_threads[i]; } - Wait(); + this->Wait(); for (int i = 0; i < kNumAsyncReceiveThreads; ++i) { completion_threads[i]->join(); delete completion_threads[i]; diff --git a/test/cpp/end2end/zookeeper_test.cc b/test/cpp/end2end/zookeeper_test.cc index bbf1b0edc1..f1b6ac2479 100644 --- a/test/cpp/end2end/zookeeper_test.cc +++ b/test/cpp/end2end/zookeeper_test.cc @@ -42,7 +42,7 @@ #include <gtest/gtest.h> #include <zookeeper/zookeeper.h> -#include "src/core/support/env.h" +#include "src/core/lib/support/env.h" #include "src/proto/grpc/testing/echo.grpc.pb.h" #include "test/core/util/port.h" #include "test/core/util/test_config.h" diff --git a/test/cpp/grpclb/grpclb_api_test.cc b/test/cpp/grpclb/grpclb_api_test.cc index bd4885fb4c..bc8219c1c7 100644 --- a/test/cpp/grpclb/grpclb_api_test.cc +++ b/test/cpp/grpclb/grpclb_api_test.cc @@ -34,7 +34,7 @@ #include <gtest/gtest.h> #include <string> -#include "src/core/client_config/lb_policies/load_balancer_api.h" +#include "src/core/lib/client_config/lb_policies/load_balancer_api.h" #include "src/proto/grpc/lb/v0/load_balancer.pb.h" // C++ version namespace grpc { diff --git a/test/cpp/interop/client.cc b/test/cpp/interop/client.cc index 788adefd24..8b237fe75f 100644 --- a/test/cpp/interop/client.cc +++ b/test/cpp/interop/client.cc @@ -35,11 +35,11 @@ #include <unistd.h> -#include <grpc/grpc.h> -#include <grpc/support/log.h> #include <gflags/gflags.h> #include <grpc++/channel.h> #include <grpc++/client_context.h> +#include <grpc/grpc.h> +#include <grpc/support/log.h> #include "test/cpp/interop/client_helper.h" #include "test/cpp/interop/interop_client.h" diff --git a/test/cpp/interop/client_helper.cc b/test/cpp/interop/client_helper.cc index 5caf0f2d1d..029b967801 100644 --- a/test/cpp/interop/client_helper.cc +++ b/test/cpp/interop/client_helper.cc @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -39,13 +39,13 @@ #include <memory> #include <sstream> -#include <grpc/grpc.h> -#include <grpc/support/alloc.h> -#include <grpc/support/log.h> #include <gflags/gflags.h> #include <grpc++/channel.h> #include <grpc++/create_channel.h> #include <grpc++/security/credentials.h> +#include <grpc/grpc.h> +#include <grpc/support/alloc.h> +#include <grpc/support/log.h> #include "src/cpp/client/secure_credentials.h" #include "test/core/security/oauth2_utils.h" diff --git a/test/cpp/interop/client_helper.h b/test/cpp/interop/client_helper.h index 0f77474139..0790464449 100644 --- a/test/cpp/interop/client_helper.h +++ b/test/cpp/interop/client_helper.h @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -38,7 +38,7 @@ #include <grpc++/channel.h> -#include "src/core/surface/call_test_only.h" +#include "src/core/lib/surface/call_test_only.h" namespace grpc { namespace testing { diff --git a/test/cpp/interop/interop_client.cc b/test/cpp/interop/interop_client.cc index 46f6fdac40..2fcd9f3951 100644 --- a/test/cpp/interop/interop_client.cc +++ b/test/cpp/interop/interop_client.cc @@ -46,10 +46,10 @@ #include <grpc/support/string_util.h> #include <grpc/support/useful.h> -#include "src/core/transport/byte_stream.h" +#include "src/core/lib/transport/byte_stream.h" #include "src/proto/grpc/testing/empty.grpc.pb.h" -#include "src/proto/grpc/testing/test.grpc.pb.h" #include "src/proto/grpc/testing/messages.grpc.pb.h" +#include "src/proto/grpc/testing/test.grpc.pb.h" #include "test/cpp/interop/client_helper.h" namespace grpc { diff --git a/test/cpp/interop/interop_client.h b/test/cpp/interop/interop_client.h index 3f57f3c733..e6706b5713 100644 --- a/test/cpp/interop/interop_client.h +++ b/test/cpp/interop/interop_client.h @@ -36,8 +36,8 @@ #include <memory> -#include <grpc/grpc.h> #include <grpc++/channel.h> +#include <grpc/grpc.h> #include "src/proto/grpc/testing/messages.grpc.pb.h" #include "src/proto/grpc/testing/test.grpc.pb.h" diff --git a/test/cpp/interop/interop_test.cc b/test/cpp/interop/interop_test.cc index faf6698903..f1fb3c9675 100644 --- a/test/cpp/interop/interop_test.cc +++ b/test/cpp/interop/interop_test.cc @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -35,14 +35,14 @@ #define _POSIX_SOURCE #endif -#include <unistd.h> #include <assert.h> -#include <stdio.h> -#include <string.h> #include <signal.h> +#include <stdio.h> #include <stdlib.h> +#include <string.h> #include <sys/types.h> #include <sys/wait.h> +#include <unistd.h> #include <grpc/support/alloc.h> #include <grpc/support/host_port.h> @@ -51,8 +51,8 @@ #include "test/core/util/port.h" extern "C" { -#include "src/core/iomgr/socket_utils_posix.h" -#include "src/core/support/string.h" +#include "src/core/lib/iomgr/socket_utils_posix.h" +#include "src/core/lib/support/string.h" } int test_client(const char* root, const char* host, int port) { diff --git a/test/cpp/interop/reconnect_interop_client.cc b/test/cpp/interop/reconnect_interop_client.cc index 79a60cc860..c668edaceb 100644 --- a/test/cpp/interop/reconnect_interop_client.cc +++ b/test/cpp/interop/reconnect_interop_client.cc @@ -34,16 +34,16 @@ #include <memory> #include <sstream> -#include <grpc/grpc.h> -#include <grpc/support/log.h> #include <gflags/gflags.h> #include <grpc++/channel.h> #include <grpc++/client_context.h> -#include "test/cpp/util/create_test_channel.h" -#include "test/cpp/util/test_config.h" -#include "src/proto/grpc/testing/test.grpc.pb.h" +#include <grpc/grpc.h> +#include <grpc/support/log.h> #include "src/proto/grpc/testing/empty.grpc.pb.h" #include "src/proto/grpc/testing/messages.grpc.pb.h" +#include "src/proto/grpc/testing/test.grpc.pb.h" +#include "test/cpp/util/create_test_channel.h" +#include "test/cpp/util/test_config.h" DEFINE_int32(server_control_port, 0, "Server port for control rpcs."); DEFINE_int32(server_retry_port, 0, "Server port for testing reconnection."); diff --git a/test/cpp/interop/server_helper.cc b/test/cpp/interop/server_helper.cc index 9a284094f0..97c39c4245 100644 --- a/test/cpp/interop/server_helper.cc +++ b/test/cpp/interop/server_helper.cc @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -38,7 +38,7 @@ #include <gflags/gflags.h> #include <grpc++/security/server_credentials.h> -#include "src/core/surface/call_test_only.h" +#include "src/core/lib/surface/call_test_only.h" #include "test/core/end2end/data/ssl_test_data.h" DECLARE_bool(use_tls); diff --git a/test/cpp/interop/server_helper.h b/test/cpp/interop/server_helper.h index 57337e5239..38c2fba9cf 100644 --- a/test/cpp/interop/server_helper.h +++ b/test/cpp/interop/server_helper.h @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -36,9 +36,9 @@ #include <memory> -#include <grpc/compression.h> -#include <grpc++/server_context.h> #include <grpc++/security/server_credentials.h> +#include <grpc++/server_context.h> +#include <grpc/compression.h> namespace grpc { namespace testing { diff --git a/test/cpp/interop/server_main.cc b/test/cpp/interop/server_main.cc index 18ac35d551..8a718701c3 100644 --- a/test/cpp/interop/server_main.cc +++ b/test/cpp/interop/server_main.cc @@ -40,19 +40,19 @@ #include <thread> #include <gflags/gflags.h> -#include <grpc/grpc.h> -#include <grpc/support/log.h> -#include <grpc/support/useful.h> +#include <grpc++/security/server_credentials.h> #include <grpc++/server.h> #include <grpc++/server_builder.h> #include <grpc++/server_context.h> -#include <grpc++/security/server_credentials.h> +#include <grpc/grpc.h> +#include <grpc/support/log.h> +#include <grpc/support/useful.h> -#include "test/cpp/interop/server_helper.h" -#include "test/cpp/util/test_config.h" -#include "src/proto/grpc/testing/test.grpc.pb.h" #include "src/proto/grpc/testing/empty.grpc.pb.h" #include "src/proto/grpc/testing/messages.grpc.pb.h" +#include "src/proto/grpc/testing/test.grpc.pb.h" +#include "test/cpp/interop/server_helper.h" +#include "test/cpp/util/test_config.h" DEFINE_bool(use_tls, false, "Whether to use tls."); DEFINE_int32(port, 0, "Server port."); diff --git a/test/cpp/interop/stress_test.cc b/test/cpp/interop/stress_test.cc index 702354dc87..162f7b3778 100644 --- a/test/cpp/interop/stress_test.cc +++ b/test/cpp/interop/stress_test.cc @@ -43,12 +43,12 @@ #include <grpc++/impl/thd.h> #include <grpc/support/time.h> +#include "src/proto/grpc/testing/metrics.grpc.pb.h" +#include "src/proto/grpc/testing/metrics.pb.h" #include "test/cpp/interop/interop_client.h" #include "test/cpp/interop/stress_interop_client.h" #include "test/cpp/util/metrics_server.h" #include "test/cpp/util/test_config.h" -#include "src/proto/grpc/testing/metrics.grpc.pb.h" -#include "src/proto/grpc/testing/metrics.pb.h" extern "C" { extern void gpr_default_log(gpr_log_func_args* args); diff --git a/test/cpp/qps/async_streaming_ping_pong_test.cc b/test/cpp/qps/async_streaming_ping_pong_test.cc index 97499329c1..d9fbb39df7 100644 --- a/test/cpp/qps/async_streaming_ping_pong_test.cc +++ b/test/cpp/qps/async_streaming_ping_pong_test.cc @@ -43,7 +43,7 @@ namespace grpc { namespace testing { static const int WARMUP = 5; -static const int BENCHMARK = 10; +static const int BENCHMARK = 5; static void RunAsyncStreamingPingPong() { gpr_log(GPR_INFO, "Running Async Streaming Ping Pong"); diff --git a/test/cpp/qps/async_unary_ping_pong_test.cc b/test/cpp/qps/async_unary_ping_pong_test.cc index d801bddf4a..5ab86197b0 100644 --- a/test/cpp/qps/async_unary_ping_pong_test.cc +++ b/test/cpp/qps/async_unary_ping_pong_test.cc @@ -43,7 +43,7 @@ namespace grpc { namespace testing { static const int WARMUP = 5; -static const int BENCHMARK = 10; +static const int BENCHMARK = 5; static void RunAsyncUnaryPingPong() { gpr_log(GPR_INFO, "Running Async Unary Ping Pong"); diff --git a/test/cpp/qps/client_async.cc b/test/cpp/qps/client_async.cc index 9e9da9909a..dcdb665a9a 100644 --- a/test/cpp/qps/client_async.cc +++ b/test/cpp/qps/client_async.cc @@ -141,7 +141,8 @@ class ClientRpcContextUnaryImpl : public ClientRpcContext { std::function<gpr_timespec()> next_issue_; std::function<std::unique_ptr<grpc::ClientAsyncResponseReader<ResponseType>>( BenchmarkService::Stub*, grpc::ClientContext*, const RequestType&, - CompletionQueue*)> start_req_; + CompletionQueue*)> + start_req_; grpc::Status status_; double start_; std::unique_ptr<grpc::ClientAsyncResponseReader<ResponseType>> @@ -359,10 +360,10 @@ class ClientRpcContextStreamingImpl : public ClientRpcContext { State next_state_; std::function<void(grpc::Status, ResponseType*)> callback_; std::function<gpr_timespec()> next_issue_; - std::function< - std::unique_ptr<grpc::ClientAsyncReaderWriter<RequestType, ResponseType>>( - BenchmarkService::Stub*, grpc::ClientContext*, CompletionQueue*, - void*)> start_req_; + std::function<std::unique_ptr< + grpc::ClientAsyncReaderWriter<RequestType, ResponseType>>( + BenchmarkService::Stub*, grpc::ClientContext*, CompletionQueue*, void*)> + start_req_; grpc::Status status_; double start_; std::unique_ptr<grpc::ClientAsyncReaderWriter<RequestType, ResponseType>> @@ -491,7 +492,8 @@ class ClientRpcContextGenericStreamingImpl : public ClientRpcContext { std::function<gpr_timespec()> next_issue_; std::function<std::unique_ptr<grpc::GenericClientAsyncReaderWriter>( grpc::GenericStub*, grpc::ClientContext*, const grpc::string&, - CompletionQueue*, void*)> start_req_; + CompletionQueue*, void*)> + start_req_; grpc::Status status_; double start_; std::unique_ptr<grpc::GenericClientAsyncReaderWriter> stream_; diff --git a/test/cpp/qps/client_sync.cc b/test/cpp/qps/client_sync.cc index 4284e07bd4..a1489d88e6 100644 --- a/test/cpp/qps/client_sync.cc +++ b/test/cpp/qps/client_sync.cc @@ -53,7 +53,7 @@ #include <grpc/support/time.h> #include <gtest/gtest.h> -#include "src/core/profiling/timers.h" +#include "src/core/lib/profiling/timers.h" #include "src/proto/grpc/testing/services.grpc.pb.h" #include "test/cpp/qps/client.h" #include "test/cpp/qps/histogram.h" diff --git a/test/cpp/qps/driver.cc b/test/cpp/qps/driver.cc index bc8780f74d..6cca7dec2b 100644 --- a/test/cpp/qps/driver.cc +++ b/test/cpp/qps/driver.cc @@ -43,8 +43,9 @@ #include <grpc/support/alloc.h> #include <grpc/support/host_port.h> #include <grpc/support/log.h> +#include <gtest/gtest.h> -#include "src/core/support/env.h" +#include "src/core/lib/support/env.h" #include "src/proto/grpc/testing/services.grpc.pb.h" #include "test/core/util/port.h" #include "test/core/util/test_config.h" @@ -120,11 +121,9 @@ static deque<string> get_workers(const string& name) { namespace runsc { // ClientContext allocator -template <class T> -static ClientContext* AllocContext(list<ClientContext>* contexts, T deadline) { +static ClientContext* AllocContext(list<ClientContext>* contexts) { contexts->emplace_back(); auto context = &contexts->back(); - context->set_deadline(deadline); return context; } @@ -196,9 +195,6 @@ std::unique_ptr<ScenarioResult> RunScenario( // Trim to just what we need workers.resize(num_clients + num_servers); - gpr_timespec deadline = - GRPC_TIMEOUT_SECONDS_TO_DEADLINE(warmup_seconds + benchmark_seconds + 20); - // Start servers using runsc::ServerData; // servers is array rather than std::vector to avoid gcc-4.4 issues @@ -248,7 +244,7 @@ std::unique_ptr<ScenarioResult> RunScenario( ServerArgs args; *args.mutable_setup() = server_config; servers[i].stream = - servers[i].stub->RunServer(runsc::AllocContext(&contexts, deadline)); + servers[i].stub->RunServer(runsc::AllocContext(&contexts)); GPR_ASSERT(servers[i].stream->Write(args)); ServerStatus init_status; GPR_ASSERT(servers[i].stream->Read(&init_status)); @@ -304,7 +300,7 @@ std::unique_ptr<ScenarioResult> RunScenario( ClientArgs args; *args.mutable_setup() = per_client_config; clients[i].stream = - clients[i].stub->RunClient(runsc::AllocContext(&contexts, deadline)); + clients[i].stub->RunClient(runsc::AllocContext(&contexts)); GPR_ASSERT(clients[i].stream->Write(args)); ClientStatus init_status; GPR_ASSERT(clients[i].stream->Read(&init_status)); @@ -342,7 +338,8 @@ std::unique_ptr<ScenarioResult> RunScenario( // Use gpr_sleep_until rather than this_thread::sleep_until to support // compilers that don't work with this_thread gpr_sleep_until(gpr_time_add( - start, gpr_time_from_seconds(benchmark_seconds, GPR_TIMESPAN))); + start, + gpr_time_from_seconds(warmup_seconds + benchmark_seconds, GPR_TIMESPAN))); // Finish a run std::unique_ptr<ScenarioResult> result(new ScenarioResult); diff --git a/test/cpp/qps/driver.h b/test/cpp/qps/driver.h index 3af61f7391..1e2e28029e 100644 --- a/test/cpp/qps/driver.h +++ b/test/cpp/qps/driver.h @@ -36,8 +36,8 @@ #include <memory> -#include "test/cpp/qps/histogram.h" #include "src/proto/grpc/testing/control.grpc.pb.h" +#include "test/cpp/qps/histogram.h" namespace grpc { namespace testing { diff --git a/test/cpp/qps/generic_async_streaming_ping_pong_test.cc b/test/cpp/qps/generic_async_streaming_ping_pong_test.cc index d9166ae210..fc06cddfef 100644 --- a/test/cpp/qps/generic_async_streaming_ping_pong_test.cc +++ b/test/cpp/qps/generic_async_streaming_ping_pong_test.cc @@ -43,7 +43,7 @@ namespace grpc { namespace testing { static const int WARMUP = 5; -static const int BENCHMARK = 10; +static const int BENCHMARK = 5; static void RunGenericAsyncStreamingPingPong() { gpr_log(GPR_INFO, "Running Generic Async Streaming Ping Pong"); @@ -62,6 +62,7 @@ static void RunGenericAsyncStreamingPingPong() { ServerConfig server_config; server_config.set_server_type(ASYNC_GENERIC_SERVER); server_config.set_async_server_threads(1); + *server_config.mutable_payload_config() = client_config.payload_config(); const auto result = RunScenario(client_config, 1, server_config, 1, WARMUP, BENCHMARK, -2); diff --git a/test/cpp/qps/limit_cores.cc b/test/cpp/qps/limit_cores.cc index fad9a323af..59ed369067 100644 --- a/test/cpp/qps/limit_cores.cc +++ b/test/cpp/qps/limit_cores.cc @@ -37,14 +37,15 @@ #include <grpc/support/log.h> #include <grpc/support/port_platform.h> -namespace grpc { -namespace testing { - #ifdef GPR_CPU_LINUX #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif #include <sched.h> + +namespace grpc { +namespace testing { + int LimitCores(const int* cores, int cores_size) { const int num_cores = gpr_cpu_num_cores(); int cores_set = 0; @@ -71,9 +72,16 @@ int LimitCores(const int* cores, int cores_size) { CPU_FREE(cpup); return cores_set; } + +} // namespace testing +} // namespace grpc #else +namespace grpc { +namespace testing { + // LimitCores is not currently supported for non-Linux platforms int LimitCores(const int*, int) { return gpr_cpu_num_cores(); } -#endif + } // namespace testing } // namespace grpc +#endif diff --git a/test/cpp/qps/perf_db_client.h b/test/cpp/qps/perf_db_client.h index ece020aa9b..668083b811 100644 --- a/test/cpp/qps/perf_db_client.h +++ b/test/cpp/qps/perf_db_client.h @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -31,17 +31,17 @@ * */ +#include <cfloat> #include <iostream> #include <memory> #include <string> -#include <cfloat> -#include <grpc/grpc.h> -#include <grpc++/support/channel_arguments.h> #include <grpc++/channel.h> #include <grpc++/client_context.h> #include <grpc++/create_channel.h> #include <grpc++/security/credentials.h> +#include <grpc++/support/channel_arguments.h> +#include <grpc/grpc.h> #include "src/proto/grpc/testing/perf_db.grpc.pb.h" namespace grpc { diff --git a/test/cpp/qps/qps_driver.cc b/test/cpp/qps/qps_driver.cc index 69fb4d75e8..f9bd01b2a1 100644 --- a/test/cpp/qps/qps_driver.cc +++ b/test/cpp/qps/qps_driver.cc @@ -171,6 +171,10 @@ static void QpsDriver() { server_config.set_core_limit(FLAGS_server_core_limit); } + if (FLAGS_bbuf_resp_size >= 0) { + *server_config.mutable_payload_config() = client_config.payload_config(); + } + if (FLAGS_secure_test) { // Set up security params SecurityParams security; diff --git a/test/cpp/qps/qps_openloop_test.cc b/test/cpp/qps/qps_openloop_test.cc index 27f266b32b..2ae0afbcbe 100644 --- a/test/cpp/qps/qps_openloop_test.cc +++ b/test/cpp/qps/qps_openloop_test.cc @@ -44,7 +44,7 @@ namespace grpc { namespace testing { static const int WARMUP = 5; -static const int BENCHMARK = 10; +static const int BENCHMARK = 5; static void RunQPS() { gpr_log(GPR_INFO, "Running QPS test, open-loop"); diff --git a/test/cpp/qps/qps_test.cc b/test/cpp/qps/qps_test.cc index 27aaf137f6..b6a2e1ef30 100644 --- a/test/cpp/qps/qps_test.cc +++ b/test/cpp/qps/qps_test.cc @@ -43,7 +43,7 @@ namespace grpc { namespace testing { static const int WARMUP = 20; -static const int BENCHMARK = 40; +static const int BENCHMARK = 20; static void RunQPS() { gpr_log(GPR_INFO, "Running QPS test"); diff --git a/test/cpp/qps/qps_test_with_poll.cc b/test/cpp/qps/qps_test_with_poll.cc index 8340a6386a..647aaac4c4 100644 --- a/test/cpp/qps/qps_test_with_poll.cc +++ b/test/cpp/qps/qps_test_with_poll.cc @@ -40,7 +40,7 @@ #include "test/cpp/util/benchmark_config.h" extern "C" { -#include "src/core/iomgr/pollset_posix.h" +#include "src/core/lib/iomgr/pollset_posix.h" } namespace grpc { diff --git a/test/cpp/qps/secure_sync_unary_ping_pong_test.cc b/test/cpp/qps/secure_sync_unary_ping_pong_test.cc index 359310b856..946c76f747 100644 --- a/test/cpp/qps/secure_sync_unary_ping_pong_test.cc +++ b/test/cpp/qps/secure_sync_unary_ping_pong_test.cc @@ -43,7 +43,7 @@ namespace grpc { namespace testing { static const int WARMUP = 5; -static const int BENCHMARK = 10; +static const int BENCHMARK = 5; static void RunSynchronousUnaryPingPong() { gpr_log(GPR_INFO, "Running Synchronous Unary Ping Pong"); diff --git a/test/cpp/qps/server_async.cc b/test/cpp/qps/server_async.cc index 2024e0bfef..1bfb07013d 100644 --- a/test/cpp/qps/server_async.cc +++ b/test/cpp/qps/server_async.cc @@ -130,8 +130,7 @@ class AsyncQpsServerTest : public Server { } } ~AsyncQpsServerTest() { - auto deadline = GRPC_TIMEOUT_SECONDS_TO_DEADLINE(10); - server_->Shutdown(deadline); + server_->Shutdown(); for (auto ss = shutdown_state_.begin(); ss != shutdown_state_.end(); ++ss) { (*ss)->set_shutdown(); } @@ -388,12 +387,14 @@ static Status ProcessGenericRPC(const PayloadConfig &payload_config, } std::unique_ptr<Server> CreateAsyncServer(const ServerConfig &config) { - return std::unique_ptr<Server>(new AsyncQpsServerTest< - SimpleRequest, SimpleResponse, BenchmarkService::AsyncService, - grpc::ServerContext>( - config, RegisterBenchmarkService, - &BenchmarkService::AsyncService::RequestUnaryCall, - &BenchmarkService::AsyncService::RequestStreamingCall, ProcessSimpleRPC)); + return std::unique_ptr<Server>( + new AsyncQpsServerTest<SimpleRequest, SimpleResponse, + BenchmarkService::AsyncService, + grpc::ServerContext>( + config, RegisterBenchmarkService, + &BenchmarkService::AsyncService::RequestUnaryCall, + &BenchmarkService::AsyncService::RequestStreamingCall, + ProcessSimpleRPC)); } std::unique_ptr<Server> CreateAsyncGenericServer(const ServerConfig &config) { return std::unique_ptr<Server>( diff --git a/test/cpp/qps/sync_streaming_ping_pong_test.cc b/test/cpp/qps/sync_streaming_ping_pong_test.cc index e02c14c926..ee1bbc7a11 100644 --- a/test/cpp/qps/sync_streaming_ping_pong_test.cc +++ b/test/cpp/qps/sync_streaming_ping_pong_test.cc @@ -43,7 +43,7 @@ namespace grpc { namespace testing { static const int WARMUP = 5; -static const int BENCHMARK = 10; +static const int BENCHMARK = 5; static void RunSynchronousStreamingPingPong() { gpr_log(GPR_INFO, "Running Synchronous Streaming Ping Pong"); diff --git a/test/cpp/qps/sync_unary_ping_pong_test.cc b/test/cpp/qps/sync_unary_ping_pong_test.cc index 9d363c04fb..4dccfee190 100644 --- a/test/cpp/qps/sync_unary_ping_pong_test.cc +++ b/test/cpp/qps/sync_unary_ping_pong_test.cc @@ -43,7 +43,7 @@ namespace grpc { namespace testing { static const int WARMUP = 5; -static const int BENCHMARK = 10; +static const int BENCHMARK = 5; static void RunSynchronousUnaryPingPong() { gpr_log(GPR_INFO, "Running Synchronous Unary Ping Pong"); diff --git a/test/cpp/util/benchmark_config.cc b/test/cpp/util/benchmark_config.cc index 3c38221b4c..5c3a4cf35d 100644 --- a/test/cpp/util/benchmark_config.cc +++ b/test/cpp/util/benchmark_config.cc @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -31,8 +31,8 @@ * */ -#include <gflags/gflags.h> #include "test/cpp/util/benchmark_config.h" +#include <gflags/gflags.h> DEFINE_bool(enable_log_reporter, true, "Enable reporting of benchmark results through GprLog"); diff --git a/test/cpp/util/byte_buffer_test.cc b/test/cpp/util/byte_buffer_test.cc index f36c32cac5..bc172e9717 100644 --- a/test/cpp/util/byte_buffer_test.cc +++ b/test/cpp/util/byte_buffer_test.cc @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -36,8 +36,8 @@ #include <cstring> #include <vector> -#include <grpc/support/slice.h> #include <grpc++/support/slice.h> +#include <grpc/support/slice.h> #include <gtest/gtest.h> namespace grpc { @@ -105,6 +105,24 @@ TEST_F(ByteBufferTest, Dump) { EXPECT_TRUE(SliceEqual(slices[1], world)); } +TEST_F(ByteBufferTest, SerializationMakesCopy) { + gpr_slice hello = gpr_slice_from_copied_string(kContent1); + gpr_slice world = gpr_slice_from_copied_string(kContent2); + std::vector<Slice> slices; + slices.push_back(Slice(hello, Slice::STEAL_REF)); + slices.push_back(Slice(world, Slice::STEAL_REF)); + grpc_byte_buffer* send_buffer = nullptr; + bool owned = false; + ByteBuffer buffer(&slices[0], 2); + slices.clear(); + auto status = SerializationTraits<ByteBuffer, void>::Serialize( + buffer, &send_buffer, &owned); + EXPECT_TRUE(status.ok()); + EXPECT_TRUE(owned); + EXPECT_TRUE(send_buffer != nullptr); + grpc_byte_buffer_destroy(send_buffer); +} + } // namespace } // namespace grpc diff --git a/test/cpp/util/cli_call_test.cc b/test/cpp/util/cli_call_test.cc index 5fdf519320..474ac282ce 100644 --- a/test/cpp/util/cli_call_test.cc +++ b/test/cpp/util/cli_call_test.cc @@ -33,18 +33,18 @@ #include "test/cpp/util/cli_call.h" -#include <grpc/grpc.h> #include <grpc++/channel.h> #include <grpc++/client_context.h> #include <grpc++/create_channel.h> #include <grpc++/server.h> #include <grpc++/server_builder.h> #include <grpc++/server_context.h> +#include <grpc/grpc.h> #include <gtest/gtest.h> +#include "src/proto/grpc/testing/echo.grpc.pb.h" #include "test/core/util/port.h" #include "test/core/util/test_config.h" -#include "src/proto/grpc/testing/echo.grpc.pb.h" #include "test/cpp/util/string_ref_helper.h" using grpc::testing::EchoRequest; diff --git a/test/cpp/util/grpc_cli.cc b/test/cpp/util/grpc_cli.cc index f9b9f0c40a..0b0bc20a35 100644 --- a/test/cpp/util/grpc_cli.cc +++ b/test/cpp/util/grpc_cli.cc @@ -1,6 +1,6 @@ /* - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -65,11 +65,11 @@ #include <sstream> #include <gflags/gflags.h> -#include <grpc/grpc.h> #include <grpc++/channel.h> #include <grpc++/create_channel.h> #include <grpc++/security/credentials.h> #include <grpc++/support/string_ref.h> +#include <grpc/grpc.h> #include "test/cpp/util/cli_call.h" #include "test/cpp/util/string_ref_helper.h" diff --git a/test/cpp/util/test_config.cc b/test/cpp/util/test_config.cc index e74f8fb14f..c446ae55c7 100644 --- a/test/cpp/util/test_config.cc +++ b/test/cpp/util/test_config.cc @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -31,8 +31,8 @@ * */ -#include <gflags/gflags.h> #include "test/cpp/util/test_config.h" +#include <gflags/gflags.h> // In some distros, gflags is in the namespace google, and in some others, // in gflags. This hack is enabling us to find both. diff --git a/test/cpp/util/test_credentials_provider.cc b/test/cpp/util/test_credentials_provider.cc index e314fd6d75..9c09a73115 100644 --- a/test/cpp/util/test_credentials_provider.cc +++ b/test/cpp/util/test_credentials_provider.cc @@ -36,8 +36,8 @@ #include <unordered_map> -#include <grpc/support/sync.h> #include <grpc++/impl/sync.h> +#include <grpc/support/sync.h> #include "test/core/end2end/data/ssl_test_data.h" diff --git a/test/cpp/util/time_test.cc b/test/cpp/util/time_test.cc index 48c6ce7697..e78c85b43a 100644 --- a/test/cpp/util/time_test.cc +++ b/test/cpp/util/time_test.cc @@ -31,8 +31,8 @@ * */ -#include <grpc/support/time.h> #include <grpc++/support/time.h> +#include <grpc/support/time.h> #include <gtest/gtest.h> using std::chrono::duration_cast; |