aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/cpp
diff options
context:
space:
mode:
authorGravatar Yuchen Zeng <zyc@google.com>2016-11-08 10:56:16 -0800
committerGravatar Yuchen Zeng <zyc@google.com>2016-11-08 10:56:16 -0800
commitbd363544fd5d4d722c068b0ffc0991d7ea6a9277 (patch)
tree176fea48dc15ac859b2191fa1d57d4ce33e4a3a0 /test/cpp
parentcc8b841832bba537aaf1c3a6e6dffb91894fe138 (diff)
parent24ef07c8afc8d59d9cfe67008bcd2d040467ff20 (diff)
Merge remote-tracking branch 'upstream/master' into cares_buildin
Diffstat (limited to 'test/cpp')
-rw-r--r--test/cpp/codegen/compiler_test_golden52
-rw-r--r--test/cpp/common/auth_property_iterator_test.cc4
-rw-r--r--test/cpp/common/channel_arguments_test.cc3
-rw-r--r--test/cpp/common/channel_filter_test.cc70
-rw-r--r--test/cpp/end2end/async_end2end_test.cc10
-rw-r--r--test/cpp/end2end/client_crash_test_server.cc9
-rw-r--r--test/cpp/end2end/end2end_test.cc22
-rw-r--r--test/cpp/end2end/filter_end2end_test.cc20
-rw-r--r--test/cpp/end2end/generic_end2end_test.cc4
-rw-r--r--test/cpp/end2end/hybrid_end2end_test.cc28
-rw-r--r--test/cpp/end2end/mock_test.cc62
-rw-r--r--test/cpp/end2end/proto_server_reflection_test.cc2
-rw-r--r--test/cpp/end2end/round_robin_end2end_test.cc14
-rw-r--r--test/cpp/end2end/server_builder_plugin_test.cc29
-rw-r--r--test/cpp/end2end/server_crash_test.cc11
-rw-r--r--test/cpp/end2end/shutdown_test.cc6
-rw-r--r--test/cpp/end2end/streaming_throughput_test.cc10
-rw-r--r--test/cpp/end2end/test_service_impl.h12
-rw-r--r--test/cpp/end2end/thread_stress_test.cc52
-rw-r--r--test/cpp/grpclb/grpclb_api_test.cc18
-rw-r--r--test/cpp/grpclb/grpclb_test.cc29
-rw-r--r--test/cpp/interop/stress_test.cc5
-rw-r--r--test/cpp/microbenchmarks/noop-benchmark.cc45
-rw-r--r--test/cpp/qps/client.h4
-rw-r--r--test/cpp/qps/client_async.cc41
-rw-r--r--test/cpp/qps/client_sync.cc10
-rwxr-xr-xtest/cpp/qps/gen_build_yaml.py2
-rw-r--r--test/cpp/qps/interarrival.h6
-rw-r--r--test/cpp/qps/qps_worker.cc20
-rw-r--r--test/cpp/qps/report.h24
-rw-r--r--test/cpp/qps/server_async.cc24
-rw-r--r--test/cpp/qps/server_sync.cc8
-rw-r--r--test/cpp/thread_manager/thread_manager_test.cc7
-rw-r--r--test/cpp/util/byte_buffer_proto_helper.cc2
-rw-r--r--test/cpp/util/byte_buffer_test.cc28
-rw-r--r--test/cpp/util/cli_call.cc4
-rw-r--r--test/cpp/util/cli_call.h2
-rw-r--r--test/cpp/util/cli_call_test.cc6
-rw-r--r--test/cpp/util/grpc_tool_test.cc9
-rw-r--r--test/cpp/util/metrics_server.h6
-rw-r--r--test/cpp/util/proto_file_parser.cc4
-rw-r--r--test/cpp/util/proto_reflection_descriptor_database.h9
-rw-r--r--test/cpp/util/slice_test.cc18
-rw-r--r--test/cpp/util/test_credentials_provider.cc26
44 files changed, 442 insertions, 335 deletions
diff --git a/test/cpp/codegen/compiler_test_golden b/test/cpp/codegen/compiler_test_golden
index 5f0e824655..0b82f2a59f 100644
--- a/test/cpp/codegen/compiler_test_golden
+++ b/test/cpp/codegen/compiler_test_golden
@@ -67,7 +67,7 @@ namespace testing {
// ServiceA detached comment 2
//
// ServiceA leading comment 1
-class ServiceA GRPC_FINAL {
+class ServiceA final {
public:
class StubInterface {
public:
@@ -94,10 +94,10 @@ class ServiceA GRPC_FINAL {
virtual ::grpc::ClientWriterInterface< ::grpc::testing::Request>* MethodA2Raw(::grpc::ClientContext* context, ::grpc::testing::Response* response) = 0;
virtual ::grpc::ClientAsyncWriterInterface< ::grpc::testing::Request>* AsyncMethodA2Raw(::grpc::ClientContext* context, ::grpc::testing::Response* response, ::grpc::CompletionQueue* cq, void* tag) = 0;
};
- class Stub GRPC_FINAL : public StubInterface {
+ class Stub final : public StubInterface {
public:
Stub(const std::shared_ptr< ::grpc::ChannelInterface>& channel);
- ::grpc::Status MethodA1(::grpc::ClientContext* context, const ::grpc::testing::Request& request, ::grpc::testing::Response* response) GRPC_OVERRIDE;
+ ::grpc::Status MethodA1(::grpc::ClientContext* context, const ::grpc::testing::Request& request, ::grpc::testing::Response* response) override;
std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::grpc::testing::Response>> AsyncMethodA1(::grpc::ClientContext* context, const ::grpc::testing::Request& request, ::grpc::CompletionQueue* cq) {
return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::grpc::testing::Response>>(AsyncMethodA1Raw(context, request, cq));
}
@@ -110,9 +110,9 @@ class ServiceA GRPC_FINAL {
private:
std::shared_ptr< ::grpc::ChannelInterface> channel_;
- ::grpc::ClientAsyncResponseReader< ::grpc::testing::Response>* AsyncMethodA1Raw(::grpc::ClientContext* context, const ::grpc::testing::Request& request, ::grpc::CompletionQueue* cq) GRPC_OVERRIDE;
- ::grpc::ClientWriter< ::grpc::testing::Request>* MethodA2Raw(::grpc::ClientContext* context, ::grpc::testing::Response* response) GRPC_OVERRIDE;
- ::grpc::ClientAsyncWriter< ::grpc::testing::Request>* AsyncMethodA2Raw(::grpc::ClientContext* context, ::grpc::testing::Response* response, ::grpc::CompletionQueue* cq, void* tag) GRPC_OVERRIDE;
+ ::grpc::ClientAsyncResponseReader< ::grpc::testing::Response>* AsyncMethodA1Raw(::grpc::ClientContext* context, const ::grpc::testing::Request& request, ::grpc::CompletionQueue* cq) override;
+ ::grpc::ClientWriter< ::grpc::testing::Request>* MethodA2Raw(::grpc::ClientContext* context, ::grpc::testing::Response* response) override;
+ ::grpc::ClientAsyncWriter< ::grpc::testing::Request>* AsyncMethodA2Raw(::grpc::ClientContext* context, ::grpc::testing::Response* response, ::grpc::CompletionQueue* cq, void* tag) override;
const ::grpc::RpcMethod rpcmethod_MethodA1_;
const ::grpc::RpcMethod rpcmethod_MethodA2_;
};
@@ -140,11 +140,11 @@ class ServiceA GRPC_FINAL {
WithAsyncMethod_MethodA1() {
::grpc::Service::MarkMethodAsync(0);
}
- ~WithAsyncMethod_MethodA1() GRPC_OVERRIDE {
+ ~WithAsyncMethod_MethodA1() override {
BaseClassMustBeDerivedFromService(this);
}
// disable synchronous version of this method
- ::grpc::Status MethodA1(::grpc::ServerContext* context, const ::grpc::testing::Request* request, ::grpc::testing::Response* response) GRPC_FINAL GRPC_OVERRIDE {
+ ::grpc::Status MethodA1(::grpc::ServerContext* context, const ::grpc::testing::Request* request, ::grpc::testing::Response* response) final override {
abort();
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
}
@@ -160,11 +160,11 @@ class ServiceA GRPC_FINAL {
WithAsyncMethod_MethodA2() {
::grpc::Service::MarkMethodAsync(1);
}
- ~WithAsyncMethod_MethodA2() GRPC_OVERRIDE {
+ ~WithAsyncMethod_MethodA2() override {
BaseClassMustBeDerivedFromService(this);
}
// disable synchronous version of this method
- ::grpc::Status MethodA2(::grpc::ServerContext* context, ::grpc::ServerReader< ::grpc::testing::Request>* reader, ::grpc::testing::Response* response) GRPC_FINAL GRPC_OVERRIDE {
+ ::grpc::Status MethodA2(::grpc::ServerContext* context, ::grpc::ServerReader< ::grpc::testing::Request>* reader, ::grpc::testing::Response* response) final override {
abort();
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
}
@@ -181,11 +181,11 @@ class ServiceA GRPC_FINAL {
WithGenericMethod_MethodA1() {
::grpc::Service::MarkMethodGeneric(0);
}
- ~WithGenericMethod_MethodA1() GRPC_OVERRIDE {
+ ~WithGenericMethod_MethodA1() override {
BaseClassMustBeDerivedFromService(this);
}
// disable synchronous version of this method
- ::grpc::Status MethodA1(::grpc::ServerContext* context, const ::grpc::testing::Request* request, ::grpc::testing::Response* response) GRPC_FINAL GRPC_OVERRIDE {
+ ::grpc::Status MethodA1(::grpc::ServerContext* context, const ::grpc::testing::Request* request, ::grpc::testing::Response* response) final override {
abort();
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
}
@@ -198,11 +198,11 @@ class ServiceA GRPC_FINAL {
WithGenericMethod_MethodA2() {
::grpc::Service::MarkMethodGeneric(1);
}
- ~WithGenericMethod_MethodA2() GRPC_OVERRIDE {
+ ~WithGenericMethod_MethodA2() override {
BaseClassMustBeDerivedFromService(this);
}
// disable synchronous version of this method
- ::grpc::Status MethodA2(::grpc::ServerContext* context, ::grpc::ServerReader< ::grpc::testing::Request>* reader, ::grpc::testing::Response* response) GRPC_FINAL GRPC_OVERRIDE {
+ ::grpc::Status MethodA2(::grpc::ServerContext* context, ::grpc::ServerReader< ::grpc::testing::Request>* reader, ::grpc::testing::Response* response) final override {
abort();
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
}
@@ -216,11 +216,11 @@ class ServiceA GRPC_FINAL {
::grpc::Service::MarkMethodStreamed(0,
new ::grpc::StreamedUnaryHandler< ::grpc::testing::Request, ::grpc::testing::Response>(std::bind(&WithStreamedUnaryMethod_MethodA1<BaseClass>::StreamedMethodA1, this, std::placeholders::_1, std::placeholders::_2)));
}
- ~WithStreamedUnaryMethod_MethodA1() GRPC_OVERRIDE {
+ ~WithStreamedUnaryMethod_MethodA1() override {
BaseClassMustBeDerivedFromService(this);
}
// disable regular version of this method
- ::grpc::Status MethodA1(::grpc::ServerContext* context, const ::grpc::testing::Request* request, ::grpc::testing::Response* response) GRPC_FINAL GRPC_OVERRIDE {
+ ::grpc::Status MethodA1(::grpc::ServerContext* context, const ::grpc::testing::Request* request, ::grpc::testing::Response* response) final override {
abort();
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
}
@@ -233,7 +233,7 @@ class ServiceA GRPC_FINAL {
};
// ServiceB leading comment 1
-class ServiceB GRPC_FINAL {
+class ServiceB final {
public:
class StubInterface {
public:
@@ -247,17 +247,17 @@ class ServiceB GRPC_FINAL {
private:
virtual ::grpc::ClientAsyncResponseReaderInterface< ::grpc::testing::Response>* AsyncMethodB1Raw(::grpc::ClientContext* context, const ::grpc::testing::Request& request, ::grpc::CompletionQueue* cq) = 0;
};
- class Stub GRPC_FINAL : public StubInterface {
+ class Stub final : public StubInterface {
public:
Stub(const std::shared_ptr< ::grpc::ChannelInterface>& channel);
- ::grpc::Status MethodB1(::grpc::ClientContext* context, const ::grpc::testing::Request& request, ::grpc::testing::Response* response) GRPC_OVERRIDE;
+ ::grpc::Status MethodB1(::grpc::ClientContext* context, const ::grpc::testing::Request& request, ::grpc::testing::Response* response) override;
std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::grpc::testing::Response>> AsyncMethodB1(::grpc::ClientContext* context, const ::grpc::testing::Request& request, ::grpc::CompletionQueue* cq) {
return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::grpc::testing::Response>>(AsyncMethodB1Raw(context, request, cq));
}
private:
std::shared_ptr< ::grpc::ChannelInterface> channel_;
- ::grpc::ClientAsyncResponseReader< ::grpc::testing::Response>* AsyncMethodB1Raw(::grpc::ClientContext* context, const ::grpc::testing::Request& request, ::grpc::CompletionQueue* cq) GRPC_OVERRIDE;
+ ::grpc::ClientAsyncResponseReader< ::grpc::testing::Response>* AsyncMethodB1Raw(::grpc::ClientContext* context, const ::grpc::testing::Request& request, ::grpc::CompletionQueue* cq) override;
const ::grpc::RpcMethod rpcmethod_MethodB1_;
};
static std::unique_ptr<Stub> NewStub(const std::shared_ptr< ::grpc::ChannelInterface>& channel, const ::grpc::StubOptions& options = ::grpc::StubOptions());
@@ -278,11 +278,11 @@ class ServiceB GRPC_FINAL {
WithAsyncMethod_MethodB1() {
::grpc::Service::MarkMethodAsync(0);
}
- ~WithAsyncMethod_MethodB1() GRPC_OVERRIDE {
+ ~WithAsyncMethod_MethodB1() override {
BaseClassMustBeDerivedFromService(this);
}
// disable synchronous version of this method
- ::grpc::Status MethodB1(::grpc::ServerContext* context, const ::grpc::testing::Request* request, ::grpc::testing::Response* response) GRPC_FINAL GRPC_OVERRIDE {
+ ::grpc::Status MethodB1(::grpc::ServerContext* context, const ::grpc::testing::Request* request, ::grpc::testing::Response* response) final override {
abort();
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
}
@@ -299,11 +299,11 @@ class ServiceB GRPC_FINAL {
WithGenericMethod_MethodB1() {
::grpc::Service::MarkMethodGeneric(0);
}
- ~WithGenericMethod_MethodB1() GRPC_OVERRIDE {
+ ~WithGenericMethod_MethodB1() override {
BaseClassMustBeDerivedFromService(this);
}
// disable synchronous version of this method
- ::grpc::Status MethodB1(::grpc::ServerContext* context, const ::grpc::testing::Request* request, ::grpc::testing::Response* response) GRPC_FINAL GRPC_OVERRIDE {
+ ::grpc::Status MethodB1(::grpc::ServerContext* context, const ::grpc::testing::Request* request, ::grpc::testing::Response* response) final override {
abort();
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
}
@@ -317,11 +317,11 @@ class ServiceB GRPC_FINAL {
::grpc::Service::MarkMethodStreamed(0,
new ::grpc::StreamedUnaryHandler< ::grpc::testing::Request, ::grpc::testing::Response>(std::bind(&WithStreamedUnaryMethod_MethodB1<BaseClass>::StreamedMethodB1, this, std::placeholders::_1, std::placeholders::_2)));
}
- ~WithStreamedUnaryMethod_MethodB1() GRPC_OVERRIDE {
+ ~WithStreamedUnaryMethod_MethodB1() override {
BaseClassMustBeDerivedFromService(this);
}
// disable regular version of this method
- ::grpc::Status MethodB1(::grpc::ServerContext* context, const ::grpc::testing::Request* request, ::grpc::testing::Response* response) GRPC_FINAL GRPC_OVERRIDE {
+ ::grpc::Status MethodB1(::grpc::ServerContext* context, const ::grpc::testing::Request* request, ::grpc::testing::Response* response) final override {
abort();
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
}
diff --git a/test/cpp/common/auth_property_iterator_test.cc b/test/cpp/common/auth_property_iterator_test.cc
index 66225ff335..16bebcab74 100644
--- a/test/cpp/common/auth_property_iterator_test.cc
+++ b/test/cpp/common/auth_property_iterator_test.cc
@@ -56,7 +56,7 @@ class TestAuthPropertyIterator : public AuthPropertyIterator {
class AuthPropertyIteratorTest : public ::testing::Test {
protected:
- void SetUp() GRPC_OVERRIDE {
+ void SetUp() override {
ctx_ = grpc_auth_context_create(NULL);
grpc_auth_context_add_cstring_property(ctx_, "name", "chapi");
grpc_auth_context_add_cstring_property(ctx_, "name", "chapo");
@@ -64,7 +64,7 @@ class AuthPropertyIteratorTest : public ::testing::Test {
EXPECT_EQ(1,
grpc_auth_context_set_peer_identity_property_name(ctx_, "name"));
}
- void TearDown() GRPC_OVERRIDE { grpc_auth_context_release(ctx_); }
+ void TearDown() override { grpc_auth_context_release(ctx_); }
grpc_auth_context* ctx_;
};
diff --git a/test/cpp/common/channel_arguments_test.cc b/test/cpp/common/channel_arguments_test.cc
index 1443eb2f68..342f6a5339 100644
--- a/test/cpp/common/channel_arguments_test.cc
+++ b/test/cpp/common/channel_arguments_test.cc
@@ -33,6 +33,7 @@
#include <grpc++/support/channel_arguments.h>
+#include <grpc++/grpc++.h>
#include <grpc/grpc.h>
#include <gtest/gtest.h>
@@ -53,7 +54,7 @@ class ChannelArgumentsTest : public ::testing::Test {
grpc::string GetDefaultUserAgentPrefix() {
std::ostringstream user_agent_prefix;
- user_agent_prefix << "grpc-c++/" << grpc_version_string();
+ user_agent_prefix << "grpc-c++/" << Version();
return user_agent_prefix.str();
}
diff --git a/test/cpp/common/channel_filter_test.cc b/test/cpp/common/channel_filter_test.cc
new file mode 100644
index 0000000000..600a953d82
--- /dev/null
+++ b/test/cpp/common/channel_filter_test.cc
@@ -0,0 +1,70 @@
+//
+// Copyright 2016, Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+
+#include "src/cpp/common/channel_filter.h"
+
+#include <limits.h>
+
+#include <grpc/grpc.h>
+#include <gtest/gtest.h>
+
+namespace grpc {
+namespace testing {
+
+class MyChannelData : public ChannelData {
+ public:
+ MyChannelData(const grpc_channel_args& args, const char* peer)
+ : ChannelData(args, peer) {}
+};
+
+class MyCallData : public CallData {
+ public:
+ explicit MyCallData(const ChannelData& channel_data)
+ : CallData(channel_data) {}
+};
+
+// This test ensures that when we make changes to the filter API in
+// C-core, we don't accidentally break the C++ filter API.
+TEST(ChannelFilterTest, RegisterChannelFilter) {
+ grpc::RegisterChannelFilter<MyChannelData, MyCallData>(
+ "myfilter", GRPC_CLIENT_CHANNEL, INT_MAX, nullptr);
+}
+
+// TODO(roth): When we have time, add tests for all methods of the
+// filter API.
+
+} // namespace testing
+} // namespace grpc
+
+int main(int argc, char** argv) {
+ ::testing::InitGoogleTest(&argc, argv);
+ return RUN_ALL_TESTS();
+}
diff --git a/test/cpp/end2end/async_end2end_test.cc b/test/cpp/end2end/async_end2end_test.cc
index 823f0bd035..3845582d5d 100644
--- a/test/cpp/end2end/async_end2end_test.cc
+++ b/test/cpp/end2end/async_end2end_test.cc
@@ -211,10 +211,10 @@ bool plugin_has_sync_methods(std::unique_ptr<ServerBuilderPlugin>& plugin) {
// that needs to be tested here.
class ServerBuilderSyncPluginDisabler : public ::grpc::ServerBuilderOption {
public:
- void UpdateArguments(ChannelArguments* arg) GRPC_OVERRIDE {}
+ void UpdateArguments(ChannelArguments* arg) override {}
- void UpdatePlugins(std::vector<std::unique_ptr<ServerBuilderPlugin>>* plugins)
- GRPC_OVERRIDE {
+ void UpdatePlugins(
+ std::vector<std::unique_ptr<ServerBuilderPlugin>>* plugins) override {
plugins->erase(std::remove_if(plugins->begin(), plugins->end(),
plugin_has_sync_methods),
plugins->end());
@@ -246,7 +246,7 @@ class AsyncEnd2endTest : public ::testing::TestWithParam<TestScenario> {
protected:
AsyncEnd2endTest() { GetParam().Log(); }
- void SetUp() GRPC_OVERRIDE {
+ void SetUp() override {
poll_overrider_.reset(new PollingOverrider(!GetParam().disable_blocking));
port_ = grpc_pick_unused_port_or_die();
@@ -269,7 +269,7 @@ class AsyncEnd2endTest : public ::testing::TestWithParam<TestScenario> {
gpr_tls_set(&g_is_async_end2end_test, 1);
}
- void TearDown() GRPC_OVERRIDE {
+ void TearDown() override {
server_->Shutdown();
void* ignored_tag;
bool ignored_ok;
diff --git a/test/cpp/end2end/client_crash_test_server.cc b/test/cpp/end2end/client_crash_test_server.cc
index 6e1457407c..0e0a105989 100644
--- a/test/cpp/end2end/client_crash_test_server.cc
+++ b/test/cpp/end2end/client_crash_test_server.cc
@@ -58,11 +58,10 @@ using namespace gflags;
namespace grpc {
namespace testing {
-class ServiceImpl GRPC_FINAL
- : public ::grpc::testing::EchoTestService::Service {
- Status BidiStream(ServerContext* context,
- ServerReaderWriter<EchoResponse, EchoRequest>* stream)
- GRPC_OVERRIDE {
+class ServiceImpl final : public ::grpc::testing::EchoTestService::Service {
+ Status BidiStream(
+ ServerContext* context,
+ ServerReaderWriter<EchoResponse, EchoRequest>* stream) override {
EchoRequest request;
EchoResponse response;
while (stream->Read(&request)) {
diff --git a/test/cpp/end2end/end2end_test.cc b/test/cpp/end2end/end2end_test.cc
index 43b7d44255..4b8749884f 100644
--- a/test/cpp/end2end/end2end_test.cc
+++ b/test/cpp/end2end/end2end_test.cc
@@ -92,12 +92,12 @@ class TestMetadataCredentialsPlugin : public MetadataCredentialsPlugin {
is_blocking_(is_blocking),
is_successful_(is_successful) {}
- bool IsBlocking() const GRPC_OVERRIDE { return is_blocking_; }
+ bool IsBlocking() const override { return is_blocking_; }
- Status GetMetadata(grpc::string_ref service_url, grpc::string_ref method_name,
- const grpc::AuthContext& channel_auth_context,
- std::multimap<grpc::string, grpc::string>* metadata)
- GRPC_OVERRIDE {
+ Status GetMetadata(
+ grpc::string_ref service_url, grpc::string_ref method_name,
+ const grpc::AuthContext& channel_auth_context,
+ std::multimap<grpc::string, grpc::string>* metadata) override {
EXPECT_GT(service_url.length(), 0UL);
EXPECT_GT(method_name.length(), 0UL);
EXPECT_TRUE(channel_auth_context.IsPeerAuthenticated());
@@ -145,11 +145,11 @@ class TestAuthMetadataProcessor : public AuthMetadataProcessor {
}
// Interface implementation
- bool IsBlocking() const GRPC_OVERRIDE { return is_blocking_; }
+ bool IsBlocking() const override { return is_blocking_; }
Status Process(const InputMetadata& auth_metadata, AuthContext* context,
OutputMetadata* consumed_auth_metadata,
- OutputMetadata* response_metadata) GRPC_OVERRIDE {
+ OutputMetadata* response_metadata) override {
EXPECT_TRUE(consumed_auth_metadata != nullptr);
EXPECT_TRUE(context != nullptr);
EXPECT_TRUE(response_metadata != nullptr);
@@ -185,7 +185,7 @@ class Proxy : public ::grpc::testing::EchoTestService::Service {
: stub_(grpc::testing::EchoTestService::NewStub(channel)) {}
Status Echo(ServerContext* server_context, const EchoRequest* request,
- EchoResponse* response) GRPC_OVERRIDE {
+ EchoResponse* response) override {
std::unique_ptr<ClientContext> client_context =
ClientContext::FromServerContext(*server_context);
return stub_->Echo(client_context.get(), *request, response);
@@ -199,7 +199,7 @@ class TestServiceImplDupPkg
: public ::grpc::testing::duplicate::EchoTestService::Service {
public:
Status Echo(ServerContext* context, const EchoRequest* request,
- EchoResponse* response) GRPC_OVERRIDE {
+ EchoResponse* response) override {
response->set_message("no package");
return Status::OK;
}
@@ -229,7 +229,7 @@ class End2endTest : public ::testing::TestWithParam<TestScenario> {
GetParam().Log();
}
- void TearDown() GRPC_OVERRIDE {
+ void TearDown() override {
if (is_server_started_) {
server_->Shutdown();
if (proxy_server_) proxy_server_->Shutdown();
@@ -1496,7 +1496,7 @@ class ResourceQuotaEnd2endTest : public End2endTest {
ResourceQuotaEnd2endTest()
: server_resource_quota_("server_resource_quota") {}
- virtual void ConfigureServerBuilder(ServerBuilder* builder) GRPC_OVERRIDE {
+ virtual void ConfigureServerBuilder(ServerBuilder* builder) override {
builder->SetResourceQuota(server_resource_quota_);
}
diff --git a/test/cpp/end2end/filter_end2end_test.cc b/test/cpp/end2end/filter_end2end_test.cc
index 853720fd0d..ab6ed46de5 100644
--- a/test/cpp/end2end/filter_end2end_test.cc
+++ b/test/cpp/end2end/filter_end2end_test.cc
@@ -78,35 +78,35 @@ namespace {
int global_num_connections = 0;
int global_num_calls = 0;
-mutex global_mu;
+std::mutex global_mu;
void IncrementConnectionCounter() {
- unique_lock<mutex> lock(global_mu);
+ std::unique_lock<std::mutex> lock(global_mu);
++global_num_connections;
}
void ResetConnectionCounter() {
- unique_lock<mutex> lock(global_mu);
+ std::unique_lock<std::mutex> lock(global_mu);
global_num_connections = 0;
}
int GetConnectionCounterValue() {
- unique_lock<mutex> lock(global_mu);
+ std::unique_lock<std::mutex> lock(global_mu);
return global_num_connections;
}
void IncrementCallCounter() {
- unique_lock<mutex> lock(global_mu);
+ std::unique_lock<std::mutex> lock(global_mu);
++global_num_calls;
}
void ResetCallCounter() {
- unique_lock<mutex> lock(global_mu);
+ std::unique_lock<std::mutex> lock(global_mu);
global_num_calls = 0;
}
int GetCallCounterValue() {
- unique_lock<mutex> lock(global_mu);
+ std::unique_lock<std::mutex> lock(global_mu);
return global_num_calls;
}
@@ -126,7 +126,7 @@ class CallDataImpl : public CallData {
: CallData(channel_data) {}
void StartTransportStreamOp(grpc_exec_ctx* exec_ctx, grpc_call_element* elem,
- TransportStreamOp* op) GRPC_OVERRIDE {
+ TransportStreamOp* op) override {
// Incrementing the counter could be done from the ctor, but we want
// to test that the individual methods are actually called correctly.
if (op->recv_initial_metadata() != nullptr) IncrementCallCounter();
@@ -138,7 +138,7 @@ class FilterEnd2endTest : public ::testing::Test {
protected:
FilterEnd2endTest() : server_host_("localhost") {}
- void SetUp() GRPC_OVERRIDE {
+ void SetUp() override {
int port = grpc_pick_unused_port_or_die();
server_address_ << server_host_ << ":" << port;
// Setup server
@@ -150,7 +150,7 @@ class FilterEnd2endTest : public ::testing::Test {
server_ = builder.BuildAndStart();
}
- void TearDown() GRPC_OVERRIDE {
+ void TearDown() override {
server_->Shutdown();
void* ignored_tag;
bool ignored_ok;
diff --git a/test/cpp/end2end/generic_end2end_test.cc b/test/cpp/end2end/generic_end2end_test.cc
index 57efa5fa17..25c221bb2b 100644
--- a/test/cpp/end2end/generic_end2end_test.cc
+++ b/test/cpp/end2end/generic_end2end_test.cc
@@ -75,7 +75,7 @@ class GenericEnd2endTest : public ::testing::Test {
protected:
GenericEnd2endTest() : server_host_("localhost") {}
- void SetUp() GRPC_OVERRIDE {
+ void SetUp() override {
int port = grpc_pick_unused_port_or_die();
server_address_ << server_host_ << ":" << port;
// Setup server
@@ -91,7 +91,7 @@ class GenericEnd2endTest : public ::testing::Test {
server_ = builder.BuildAndStart();
}
- void TearDown() GRPC_OVERRIDE {
+ void TearDown() override {
server_->Shutdown();
void* ignored_tag;
bool ignored_ok;
diff --git a/test/cpp/end2end/hybrid_end2end_test.cc b/test/cpp/end2end/hybrid_end2end_test.cc
index 76a5732f33..a4ba76fed1 100644
--- a/test/cpp/end2end/hybrid_end2end_test.cc
+++ b/test/cpp/end2end/hybrid_end2end_test.cc
@@ -188,7 +188,7 @@ class TestServiceImplDupPkg
: public ::grpc::testing::duplicate::EchoTestService::Service {
public:
Status Echo(ServerContext* context, const EchoRequest* request,
- EchoResponse* response) GRPC_OVERRIDE {
+ EchoResponse* response) override {
response->set_message(request->message() + "_dup");
return Status::OK;
}
@@ -230,7 +230,7 @@ class HybridEnd2endTest : public ::testing::Test {
server_ = builder.BuildAndStart();
}
- void TearDown() GRPC_OVERRIDE {
+ void TearDown() override {
if (server_) {
server_->Shutdown();
}
@@ -449,9 +449,9 @@ class StreamedUnaryDupPkg
: public duplicate::EchoTestService::WithStreamedUnaryMethod_Echo<
TestServiceImplDupPkg> {
public:
- Status StreamedEcho(ServerContext* context,
- ServerUnaryStreamer<EchoRequest, EchoResponse>* stream)
- GRPC_OVERRIDE {
+ Status StreamedEcho(
+ ServerContext* context,
+ ServerUnaryStreamer<EchoRequest, EchoResponse>* stream) override {
EchoRequest req;
EchoResponse resp;
uint32_t next_msg_sz;
@@ -487,9 +487,9 @@ TEST_F(HybridEnd2endTest,
class FullyStreamedUnaryDupPkg
: public duplicate::EchoTestService::StreamedUnaryService {
public:
- Status StreamedEcho(ServerContext* context,
- ServerUnaryStreamer<EchoRequest, EchoResponse>* stream)
- GRPC_OVERRIDE {
+ Status StreamedEcho(
+ ServerContext* context,
+ ServerUnaryStreamer<EchoRequest, EchoResponse>* stream) override {
EchoRequest req;
EchoResponse resp;
uint32_t next_msg_sz;
@@ -528,7 +528,7 @@ class SplitResponseStreamDupPkg
public:
Status StreamedResponseStream(
ServerContext* context,
- ServerSplitStreamer<EchoRequest, EchoResponse>* stream) GRPC_OVERRIDE {
+ ServerSplitStreamer<EchoRequest, EchoResponse>* stream) override {
EchoRequest req;
EchoResponse resp;
uint32_t next_msg_sz;
@@ -568,7 +568,7 @@ class FullySplitStreamedDupPkg
public:
Status StreamedResponseStream(
ServerContext* context,
- ServerSplitStreamer<EchoRequest, EchoResponse>* stream) GRPC_OVERRIDE {
+ ServerSplitStreamer<EchoRequest, EchoResponse>* stream) override {
EchoRequest req;
EchoResponse resp;
uint32_t next_msg_sz;
@@ -605,9 +605,9 @@ TEST_F(HybridEnd2endTest,
// Add a second service that is fully server streamed
class FullyStreamedDupPkg : public duplicate::EchoTestService::StreamedService {
public:
- Status StreamedEcho(ServerContext* context,
- ServerUnaryStreamer<EchoRequest, EchoResponse>* stream)
- GRPC_OVERRIDE {
+ Status StreamedEcho(
+ ServerContext* context,
+ ServerUnaryStreamer<EchoRequest, EchoResponse>* stream) override {
EchoRequest req;
EchoResponse resp;
uint32_t next_msg_sz;
@@ -620,7 +620,7 @@ class FullyStreamedDupPkg : public duplicate::EchoTestService::StreamedService {
}
Status StreamedResponseStream(
ServerContext* context,
- ServerSplitStreamer<EchoRequest, EchoResponse>* stream) GRPC_OVERRIDE {
+ ServerSplitStreamer<EchoRequest, EchoResponse>* stream) override {
EchoRequest req;
EchoResponse resp;
uint32_t next_msg_sz;
diff --git a/test/cpp/end2end/mock_test.cc b/test/cpp/end2end/mock_test.cc
index 0da5861b67..d6664da5a0 100644
--- a/test/cpp/end2end/mock_test.cc
+++ b/test/cpp/end2end/mock_test.cc
@@ -61,46 +61,44 @@ namespace testing {
namespace {
template <class W, class R>
-class MockClientReaderWriter GRPC_FINAL
- : public ClientReaderWriterInterface<W, R> {
+class MockClientReaderWriter final : public ClientReaderWriterInterface<W, R> {
public:
- void WaitForInitialMetadata() GRPC_OVERRIDE {}
- bool NextMessageSize(uint32_t* sz) GRPC_OVERRIDE {
+ void WaitForInitialMetadata() override {}
+ bool NextMessageSize(uint32_t* sz) override {
*sz = UINT_MAX;
return true;
}
- bool Read(R* msg) GRPC_OVERRIDE { return true; }
- bool Write(const W& msg) GRPC_OVERRIDE { return true; }
- bool WritesDone() GRPC_OVERRIDE { return true; }
- Status Finish() GRPC_OVERRIDE { return Status::OK; }
+ bool Read(R* msg) override { return true; }
+ bool Write(const W& msg) override { return true; }
+ bool WritesDone() override { return true; }
+ Status Finish() override { return Status::OK; }
};
template <>
-class MockClientReaderWriter<EchoRequest, EchoResponse> GRPC_FINAL
+class MockClientReaderWriter<EchoRequest, EchoResponse> final
: public ClientReaderWriterInterface<EchoRequest, EchoResponse> {
public:
MockClientReaderWriter() : writes_done_(false) {}
- void WaitForInitialMetadata() GRPC_OVERRIDE {}
- bool NextMessageSize(uint32_t* sz) GRPC_OVERRIDE {
+ void WaitForInitialMetadata() override {}
+ bool NextMessageSize(uint32_t* sz) override {
*sz = UINT_MAX;
return true;
}
- bool Read(EchoResponse* msg) GRPC_OVERRIDE {
+ bool Read(EchoResponse* msg) override {
if (writes_done_) return false;
msg->set_message(last_message_);
return true;
}
- bool Write(const EchoRequest& msg,
- const WriteOptions& options) GRPC_OVERRIDE {
+ bool Write(const EchoRequest& msg, const WriteOptions& options) override {
gpr_log(GPR_INFO, "mock recv msg %s", msg.message().c_str());
last_message_ = msg.message();
return true;
}
- bool WritesDone() GRPC_OVERRIDE {
+ bool WritesDone() override {
writes_done_ = true;
return true;
}
- Status Finish() GRPC_OVERRIDE { return Status::OK; }
+ Status Finish() override { return Status::OK; }
private:
bool writes_done_;
@@ -113,51 +111,51 @@ class MockStub : public EchoTestService::StubInterface {
MockStub() {}
~MockStub() {}
Status Echo(ClientContext* context, const EchoRequest& request,
- EchoResponse* response) GRPC_OVERRIDE {
+ EchoResponse* response) override {
response->set_message(request.message());
return Status::OK;
}
Status Unimplemented(ClientContext* context, const EchoRequest& request,
- EchoResponse* response) GRPC_OVERRIDE {
+ EchoResponse* response) override {
return Status::OK;
}
private:
ClientAsyncResponseReaderInterface<EchoResponse>* AsyncEchoRaw(
ClientContext* context, const EchoRequest& request,
- CompletionQueue* cq) GRPC_OVERRIDE {
+ CompletionQueue* cq) override {
return nullptr;
}
ClientWriterInterface<EchoRequest>* RequestStreamRaw(
- ClientContext* context, EchoResponse* response) GRPC_OVERRIDE {
+ ClientContext* context, EchoResponse* response) override {
return nullptr;
}
ClientAsyncWriterInterface<EchoRequest>* AsyncRequestStreamRaw(
ClientContext* context, EchoResponse* response, CompletionQueue* cq,
- void* tag) GRPC_OVERRIDE {
+ void* tag) override {
return nullptr;
}
ClientReaderInterface<EchoResponse>* ResponseStreamRaw(
- ClientContext* context, const EchoRequest& request) GRPC_OVERRIDE {
+ ClientContext* context, const EchoRequest& request) override {
return nullptr;
}
ClientAsyncReaderInterface<EchoResponse>* AsyncResponseStreamRaw(
ClientContext* context, const EchoRequest& request, CompletionQueue* cq,
- void* tag) GRPC_OVERRIDE {
+ void* tag) override {
return nullptr;
}
ClientReaderWriterInterface<EchoRequest, EchoResponse>* BidiStreamRaw(
- ClientContext* context) GRPC_OVERRIDE {
+ ClientContext* context) override {
return new MockClientReaderWriter<EchoRequest, EchoResponse>();
}
ClientAsyncReaderWriterInterface<EchoRequest, EchoResponse>*
AsyncBidiStreamRaw(ClientContext* context, CompletionQueue* cq,
- void* tag) GRPC_OVERRIDE {
+ void* tag) override {
return nullptr;
}
ClientAsyncResponseReaderInterface<EchoResponse>* AsyncUnimplementedRaw(
ClientContext* context, const EchoRequest& request,
- CompletionQueue* cq) GRPC_OVERRIDE {
+ CompletionQueue* cq) override {
return nullptr;
}
};
@@ -216,14 +214,14 @@ class FakeClient {
class TestServiceImpl : public EchoTestService::Service {
public:
Status Echo(ServerContext* context, const EchoRequest* request,
- EchoResponse* response) GRPC_OVERRIDE {
+ EchoResponse* response) override {
response->set_message(request->message());
return Status::OK;
}
- Status BidiStream(ServerContext* context,
- ServerReaderWriter<EchoResponse, EchoRequest>* stream)
- GRPC_OVERRIDE {
+ Status BidiStream(
+ ServerContext* context,
+ ServerReaderWriter<EchoResponse, EchoRequest>* stream) override {
EchoRequest request;
EchoResponse response;
while (stream->Read(&request)) {
@@ -239,7 +237,7 @@ class MockTest : public ::testing::Test {
protected:
MockTest() {}
- void SetUp() GRPC_OVERRIDE {
+ void SetUp() override {
int port = grpc_pick_unused_port_or_die();
server_address_ << "localhost:" << port;
// Setup server
@@ -250,7 +248,7 @@ class MockTest : public ::testing::Test {
server_ = builder.BuildAndStart();
}
- void TearDown() GRPC_OVERRIDE { server_->Shutdown(); }
+ void TearDown() override { server_->Shutdown(); }
void ResetStub() {
std::shared_ptr<Channel> channel =
diff --git a/test/cpp/end2end/proto_server_reflection_test.cc b/test/cpp/end2end/proto_server_reflection_test.cc
index 75efd01f06..8b9688d200 100644
--- a/test/cpp/end2end/proto_server_reflection_test.cc
+++ b/test/cpp/end2end/proto_server_reflection_test.cc
@@ -56,7 +56,7 @@ class ProtoServerReflectionTest : public ::testing::Test {
public:
ProtoServerReflectionTest() {}
- void SetUp() GRPC_OVERRIDE {
+ void SetUp() override {
port_ = grpc_pick_unused_port_or_die();
ref_desc_pool_ = protobuf::DescriptorPool::generated_pool();
diff --git a/test/cpp/end2end/round_robin_end2end_test.cc b/test/cpp/end2end/round_robin_end2end_test.cc
index 796b01cd4a..76211cbdd3 100644
--- a/test/cpp/end2end/round_robin_end2end_test.cc
+++ b/test/cpp/end2end/round_robin_end2end_test.cc
@@ -66,21 +66,21 @@ class MyTestServiceImpl : public TestServiceImpl {
MyTestServiceImpl() : request_count_(0) {}
Status Echo(ServerContext* context, const EchoRequest* request,
- EchoResponse* response) GRPC_OVERRIDE {
+ EchoResponse* response) override {
{
- unique_lock<mutex> lock(mu_);
+ std::unique_lock<std::mutex> lock(mu_);
++request_count_;
}
return TestServiceImpl::Echo(context, request, response);
}
int request_count() {
- unique_lock<mutex> lock(mu_);
+ std::unique_lock<std::mutex> lock(mu_);
return request_count_;
}
private:
- mutex mu_;
+ std::mutex mu_;
int request_count_;
};
@@ -94,7 +94,7 @@ class RoundRobinEnd2endTest : public ::testing::Test {
}
}
- void TearDown() GRPC_OVERRIDE {
+ void TearDown() override {
for (size_t i = 0; i < servers_.size(); ++i) {
servers_[i]->Shutdown();
}
@@ -139,7 +139,7 @@ class RoundRobinEnd2endTest : public ::testing::Test {
std::condition_variable cond;
thread_.reset(new std::thread(
std::bind(&ServerData::Start, this, server_host, &mu, &cond)));
- unique_lock<mutex> lock(mu);
+ std::unique_lock<std::mutex> lock(mu);
cond.wait(lock);
gpr_log(GPR_INFO, "server startup complete");
}
@@ -153,7 +153,7 @@ class RoundRobinEnd2endTest : public ::testing::Test {
InsecureServerCredentials());
builder.RegisterService(&service_);
server_ = builder.BuildAndStart();
- lock_guard<mutex> lock(*mu);
+ std::lock_guard<std::mutex> lock(*mu);
cond->notify_one();
}
diff --git a/test/cpp/end2end/server_builder_plugin_test.cc b/test/cpp/end2end/server_builder_plugin_test.cc
index b967a5d1e9..1b6f4ce37d 100644
--- a/test/cpp/end2end/server_builder_plugin_test.cc
+++ b/test/cpp/end2end/server_builder_plugin_test.cc
@@ -31,13 +31,14 @@
*
*/
+#include <thread>
+
#include <grpc++/channel.h>
#include <grpc++/client_context.h>
#include <grpc++/create_channel.h>
#include <grpc++/impl/server_builder_option.h>
#include <grpc++/impl/server_builder_plugin.h>
#include <grpc++/impl/server_initializer.h>
-#include <grpc++/impl/thd.h>
#include <grpc++/security/credentials.h>
#include <grpc++/security/server_credentials.h>
#include <grpc++/server.h>
@@ -65,29 +66,29 @@ class TestServerBuilderPlugin : public ServerBuilderPlugin {
register_service_ = false;
}
- grpc::string name() GRPC_OVERRIDE { return PLUGIN_NAME; }
+ grpc::string name() override { return PLUGIN_NAME; }
- void InitServer(ServerInitializer* si) GRPC_OVERRIDE {
+ void InitServer(ServerInitializer* si) override {
init_server_is_called_ = true;
if (register_service_) {
si->RegisterService(service_);
}
}
- void Finish(ServerInitializer* si) GRPC_OVERRIDE { finish_is_called_ = true; }
+ void Finish(ServerInitializer* si) override { finish_is_called_ = true; }
- void ChangeArguments(const grpc::string& name, void* value) GRPC_OVERRIDE {
+ void ChangeArguments(const grpc::string& name, void* value) override {
change_arguments_is_called_ = true;
}
- bool has_async_methods() const GRPC_OVERRIDE {
+ bool has_async_methods() const override {
if (register_service_) {
return service_->has_async_methods();
}
return false;
}
- bool has_sync_methods() const GRPC_OVERRIDE {
+ bool has_sync_methods() const override {
if (register_service_) {
return service_->has_synchronous_methods();
}
@@ -112,10 +113,10 @@ class InsertPluginServerBuilderOption : public ServerBuilderOption {
public:
InsertPluginServerBuilderOption() { register_service_ = false; }
- void UpdateArguments(ChannelArguments* arg) GRPC_OVERRIDE {}
+ void UpdateArguments(ChannelArguments* arg) override {}
- void UpdatePlugins(std::vector<std::unique_ptr<ServerBuilderPlugin>>* plugins)
- GRPC_OVERRIDE {
+ void UpdatePlugins(
+ std::vector<std::unique_ptr<ServerBuilderPlugin>>* plugins) override {
plugins->clear();
std::unique_ptr<TestServerBuilderPlugin> plugin(
@@ -154,7 +155,7 @@ class ServerBuilderPluginTest : public ::testing::TestWithParam<bool> {
public:
ServerBuilderPluginTest() {}
- void SetUp() GRPC_OVERRIDE {
+ void SetUp() override {
port_ = grpc_pick_unused_port_or_die();
builder_.reset(new ServerBuilder());
}
@@ -191,7 +192,7 @@ class ServerBuilderPluginTest : public ::testing::TestWithParam<bool> {
// we run some tests without a service, and for those we need to supply a
// frequently polled completion queue
cq_ = builder_->AddCompletionQueue();
- cq_thread_ = new grpc::thread(&ServerBuilderPluginTest::RunCQ, this);
+ cq_thread_ = new std::thread(&ServerBuilderPluginTest::RunCQ, this);
server_ = builder_->BuildAndStart();
EXPECT_TRUE(CheckPresent());
}
@@ -202,7 +203,7 @@ class ServerBuilderPluginTest : public ::testing::TestWithParam<bool> {
stub_ = grpc::testing::EchoTestService::NewStub(channel_);
}
- void TearDown() GRPC_OVERRIDE {
+ void TearDown() override {
auto plugin = CheckPresent();
EXPECT_TRUE(plugin);
EXPECT_TRUE(plugin->init_server_is_called());
@@ -225,7 +226,7 @@ class ServerBuilderPluginTest : public ::testing::TestWithParam<bool> {
std::unique_ptr<grpc::testing::EchoTestService::Stub> stub_;
std::unique_ptr<ServerCompletionQueue> cq_;
std::unique_ptr<Server> server_;
- grpc::thread* cq_thread_;
+ std::thread* cq_thread_;
TestServiceImpl service_;
int port_;
diff --git a/test/cpp/end2end/server_crash_test.cc b/test/cpp/end2end/server_crash_test.cc
index 16a5fa2322..8cee1403dc 100644
--- a/test/cpp/end2end/server_crash_test.cc
+++ b/test/cpp/end2end/server_crash_test.cc
@@ -60,14 +60,13 @@ namespace testing {
namespace {
-class ServiceImpl GRPC_FINAL
- : public ::grpc::testing::EchoTestService::Service {
+class ServiceImpl final : public ::grpc::testing::EchoTestService::Service {
public:
ServiceImpl() : bidi_stream_count_(0), response_stream_count_(0) {}
- Status BidiStream(ServerContext* context,
- ServerReaderWriter<EchoResponse, EchoRequest>* stream)
- GRPC_OVERRIDE {
+ Status BidiStream(
+ ServerContext* context,
+ ServerReaderWriter<EchoResponse, EchoRequest>* stream) override {
bidi_stream_count_++;
EchoRequest request;
EchoResponse response;
@@ -82,7 +81,7 @@ class ServiceImpl GRPC_FINAL
}
Status ResponseStream(ServerContext* context, const EchoRequest* request,
- ServerWriter<EchoResponse>* writer) GRPC_OVERRIDE {
+ ServerWriter<EchoResponse>* writer) override {
EchoResponse response;
response_stream_count_++;
for (int i = 0;; i++) {
diff --git a/test/cpp/end2end/shutdown_test.cc b/test/cpp/end2end/shutdown_test.cc
index 4cba3b1c81..5b52b1fc1a 100644
--- a/test/cpp/end2end/shutdown_test.cc
+++ b/test/cpp/end2end/shutdown_test.cc
@@ -61,7 +61,7 @@ class TestServiceImpl : public ::grpc::testing::EchoTestService::Service {
explicit TestServiceImpl(gpr_event* ev) : ev_(ev) {}
Status Echo(ServerContext* context, const EchoRequest* request,
- EchoResponse* response) GRPC_OVERRIDE {
+ EchoResponse* response) override {
gpr_event_set(ev_, (void*)1);
while (!context->IsCancelled()) {
}
@@ -76,7 +76,7 @@ class ShutdownTest : public ::testing::Test {
public:
ShutdownTest() : shutdown_(false), service_(&ev_) { gpr_event_init(&ev_); }
- void SetUp() GRPC_OVERRIDE {
+ void SetUp() override {
port_ = grpc_pick_unused_port_or_die();
server_ = SetUpServer(port_);
}
@@ -91,7 +91,7 @@ class ShutdownTest : public ::testing::Test {
return server;
}
- void TearDown() GRPC_OVERRIDE { GPR_ASSERT(shutdown_); }
+ void TearDown() override { GPR_ASSERT(shutdown_); }
void ResetStub() {
string target = "dns:localhost:" + to_string(port_);
diff --git a/test/cpp/end2end/streaming_throughput_test.cc b/test/cpp/end2end/streaming_throughput_test.cc
index fbef761ca9..302583766b 100644
--- a/test/cpp/end2end/streaming_throughput_test.cc
+++ b/test/cpp/end2end/streaming_throughput_test.cc
@@ -121,9 +121,9 @@ class TestServiceImpl : public ::grpc::testing::EchoTestService::Service {
}
// Only implement the one method we will be calling for brevity.
- Status BidiStream(ServerContext* context,
- ServerReaderWriter<EchoResponse, EchoRequest>* stream)
- GRPC_OVERRIDE {
+ Status BidiStream(
+ ServerContext* context,
+ ServerReaderWriter<EchoResponse, EchoRequest>* stream) override {
EchoRequest request;
gpr_atm should_exit;
gpr_atm_rel_store(&should_exit, static_cast<gpr_atm>(0));
@@ -147,7 +147,7 @@ class TestServiceImpl : public ::grpc::testing::EchoTestService::Service {
class End2endTest : public ::testing::Test {
protected:
- void SetUp() GRPC_OVERRIDE {
+ void SetUp() override {
int port = grpc_pick_unused_port_or_die();
server_address_ << "localhost:" << port;
// Setup server
@@ -158,7 +158,7 @@ class End2endTest : public ::testing::Test {
server_ = builder.BuildAndStart();
}
- void TearDown() GRPC_OVERRIDE { server_->Shutdown(); }
+ void TearDown() override { server_->Shutdown(); }
void ResetStub() {
std::shared_ptr<Channel> channel =
diff --git a/test/cpp/end2end/test_service_impl.h b/test/cpp/end2end/test_service_impl.h
index c89f88c900..88e0be7bca 100644
--- a/test/cpp/end2end/test_service_impl.h
+++ b/test/cpp/end2end/test_service_impl.h
@@ -63,20 +63,20 @@ class TestServiceImpl : public ::grpc::testing::EchoTestService::Service {
: signal_client_(false), host_(new grpc::string(host)) {}
Status Echo(ServerContext* context, const EchoRequest* request,
- EchoResponse* response) GRPC_OVERRIDE;
+ EchoResponse* response) override;
// Unimplemented is left unimplemented to test the returned error.
Status RequestStream(ServerContext* context,
ServerReader<EchoRequest>* reader,
- EchoResponse* response) GRPC_OVERRIDE;
+ EchoResponse* response) override;
Status ResponseStream(ServerContext* context, const EchoRequest* request,
- ServerWriter<EchoResponse>* writer) GRPC_OVERRIDE;
+ ServerWriter<EchoResponse>* writer) override;
- Status BidiStream(ServerContext* context,
- ServerReaderWriter<EchoResponse, EchoRequest>* stream)
- GRPC_OVERRIDE;
+ Status BidiStream(
+ ServerContext* context,
+ ServerReaderWriter<EchoResponse, EchoRequest>* stream) override;
bool signal_client() {
std::unique_lock<std::mutex> lock(mu_);
diff --git a/test/cpp/end2end/thread_stress_test.cc b/test/cpp/end2end/thread_stress_test.cc
index 0b9d4cda9f..fe5a219eed 100644
--- a/test/cpp/end2end/thread_stress_test.cc
+++ b/test/cpp/end2end/thread_stress_test.cc
@@ -86,12 +86,12 @@ class TestServiceImpl : public ::grpc::testing::EchoTestService::Service {
TestServiceImpl() : signal_client_(false) {}
Status Echo(ServerContext* context, const EchoRequest* request,
- EchoResponse* response) GRPC_OVERRIDE {
+ EchoResponse* response) override {
response->set_message(request->message());
MaybeEchoDeadline(context, request, response);
if (request->has_param() && request->param().client_cancel_after_us()) {
{
- unique_lock<mutex> lock(mu_);
+ std::unique_lock<std::mutex> lock(mu_);
signal_client_ = true;
}
while (!context->IsCancelled()) {
@@ -118,7 +118,7 @@ class TestServiceImpl : public ::grpc::testing::EchoTestService::Service {
Status RequestStream(ServerContext* context,
ServerReader<EchoRequest>* reader,
- EchoResponse* response) GRPC_OVERRIDE {
+ EchoResponse* response) override {
EchoRequest request;
response->set_message("");
while (reader->Read(&request)) {
@@ -130,7 +130,7 @@ class TestServiceImpl : public ::grpc::testing::EchoTestService::Service {
// Return 3 messages.
// TODO(yangg) make it generic by adding a parameter into EchoRequest
Status ResponseStream(ServerContext* context, const EchoRequest* request,
- ServerWriter<EchoResponse>* writer) GRPC_OVERRIDE {
+ ServerWriter<EchoResponse>* writer) override {
EchoResponse response;
response.set_message(request->message() + "0");
writer->Write(response);
@@ -142,9 +142,9 @@ class TestServiceImpl : public ::grpc::testing::EchoTestService::Service {
return Status::OK;
}
- Status BidiStream(ServerContext* context,
- ServerReaderWriter<EchoResponse, EchoRequest>* stream)
- GRPC_OVERRIDE {
+ Status BidiStream(
+ ServerContext* context,
+ ServerReaderWriter<EchoResponse, EchoRequest>* stream) override {
EchoRequest request;
EchoResponse response;
while (stream->Read(&request)) {
@@ -156,20 +156,20 @@ class TestServiceImpl : public ::grpc::testing::EchoTestService::Service {
}
bool signal_client() {
- unique_lock<mutex> lock(mu_);
+ std::unique_lock<std::mutex> lock(mu_);
return signal_client_;
}
private:
bool signal_client_;
- mutex mu_;
+ std::mutex mu_;
};
class TestServiceImplDupPkg
: public ::grpc::testing::duplicate::EchoTestService::Service {
public:
Status Echo(ServerContext* context, const EchoRequest* request,
- EchoResponse* response) GRPC_OVERRIDE {
+ EchoResponse* response) override {
response->set_message("no package");
return Status::OK;
}
@@ -215,12 +215,12 @@ class CommonStressTest {
class CommonStressTestSyncServer : public CommonStressTest<TestServiceImpl> {
public:
- void SetUp() GRPC_OVERRIDE {
+ void SetUp() override {
ServerBuilder builder;
SetUpStart(&builder, &service_);
SetUpEnd(&builder);
}
- void TearDown() GRPC_OVERRIDE {
+ void TearDown() override {
TearDownStart();
TearDownEnd();
}
@@ -232,7 +232,7 @@ class CommonStressTestSyncServer : public CommonStressTest<TestServiceImpl> {
class CommonStressTestAsyncServer
: public CommonStressTest<grpc::testing::EchoTestService::AsyncService> {
public:
- void SetUp() GRPC_OVERRIDE {
+ void SetUp() override {
shutting_down_ = false;
ServerBuilder builder;
SetUpStart(&builder, &service_);
@@ -247,9 +247,9 @@ class CommonStressTestAsyncServer
new std::thread(&CommonStressTestAsyncServer::ProcessRpcs, this));
}
}
- void TearDown() GRPC_OVERRIDE {
+ void TearDown() override {
{
- unique_lock<mutex> l(mu_);
+ std::unique_lock<std::mutex> l(mu_);
TearDownStart();
shutting_down_ = true;
cq_->Shutdown();
@@ -292,7 +292,7 @@ class CommonStressTestAsyncServer
}
}
void RefreshContext(int i) {
- unique_lock<mutex> l(mu_);
+ std::unique_lock<std::mutex> l(mu_);
if (!shutting_down_) {
contexts_[i].state = Context::READY;
contexts_[i].srv_ctx.reset(new ServerContext);
@@ -315,7 +315,7 @@ class CommonStressTestAsyncServer
::grpc::testing::EchoTestService::AsyncService service_;
std::unique_ptr<ServerCompletionQueue> cq_;
bool shutting_down_;
- mutex mu_;
+ std::mutex mu_;
std::vector<std::thread*> server_threads_;
};
@@ -323,8 +323,8 @@ template <class Common>
class End2endTest : public ::testing::Test {
protected:
End2endTest() {}
- void SetUp() GRPC_OVERRIDE { common_.SetUp(); }
- void TearDown() GRPC_OVERRIDE { common_.TearDown(); }
+ void SetUp() override { common_.SetUp(); }
+ void TearDown() override { common_.TearDown(); }
void ResetStub() { common_.ResetStub(); }
Common common_;
@@ -369,8 +369,8 @@ class AsyncClientEnd2endTest : public ::testing::Test {
protected:
AsyncClientEnd2endTest() : rpcs_outstanding_(0) {}
- void SetUp() GRPC_OVERRIDE { common_.SetUp(); }
- void TearDown() GRPC_OVERRIDE {
+ void SetUp() override { common_.SetUp(); }
+ void TearDown() override {
void* ignored_tag;
bool ignored_ok;
while (cq_.Next(&ignored_tag, &ignored_ok))
@@ -379,7 +379,7 @@ class AsyncClientEnd2endTest : public ::testing::Test {
}
void Wait() {
- unique_lock<mutex> l(mu_);
+ std::unique_lock<std::mutex> l(mu_);
while (rpcs_outstanding_ != 0) {
cv_.wait(l);
}
@@ -404,7 +404,7 @@ class AsyncClientEnd2endTest : public ::testing::Test {
call->response_reader->Finish(&call->response, &call->status,
(void*)call);
- unique_lock<mutex> l(mu_);
+ std::unique_lock<std::mutex> l(mu_);
rpcs_outstanding_++;
}
}
@@ -422,7 +422,7 @@ class AsyncClientEnd2endTest : public ::testing::Test {
bool notify;
{
- unique_lock<mutex> l(mu_);
+ std::unique_lock<std::mutex> l(mu_);
rpcs_outstanding_--;
notify = (rpcs_outstanding_ == 0);
}
@@ -434,8 +434,8 @@ class AsyncClientEnd2endTest : public ::testing::Test {
Common common_;
CompletionQueue cq_;
- mutex mu_;
- condition_variable cv_;
+ std::mutex mu_;
+ std::condition_variable cv_;
int rpcs_outstanding_;
};
diff --git a/test/cpp/grpclb/grpclb_api_test.cc b/test/cpp/grpclb/grpclb_api_test.cc
index e67189c69e..191d729a9e 100644
--- a/test/cpp/grpclb/grpclb_api_test.cc
+++ b/test/cpp/grpclb/grpclb_api_test.cc
@@ -71,12 +71,12 @@ TEST_F(GrpclbTest, CreateRequest) {
const grpc::string service_name = "AServiceName";
LoadBalanceRequest request;
grpc_grpclb_request* c_req = grpc_grpclb_request_create(service_name.c_str());
- gpr_slice slice = grpc_grpclb_request_encode(c_req);
- const int num_bytes_written = GPR_SLICE_LENGTH(slice);
+ grpc_slice slice = grpc_grpclb_request_encode(c_req);
+ const int num_bytes_written = GRPC_SLICE_LENGTH(slice);
EXPECT_GT(num_bytes_written, 0);
- request.ParseFromArray(GPR_SLICE_START_PTR(slice), num_bytes_written);
+ request.ParseFromArray(GRPC_SLICE_START_PTR(slice), num_bytes_written);
EXPECT_EQ(request.initial_request().name(), service_name);
- gpr_slice_unref(slice);
+ grpc_slice_unref(slice);
grpc_grpclb_request_destroy(c_req);
}
@@ -88,15 +88,15 @@ TEST_F(GrpclbTest, ParseInitialResponse) {
client_stats_report_interval->set_seconds(123);
client_stats_report_interval->set_nanos(456);
const grpc::string encoded_response = response.SerializeAsString();
- gpr_slice encoded_slice =
- gpr_slice_from_copied_string(encoded_response.c_str());
+ grpc_slice encoded_slice =
+ grpc_slice_from_copied_string(encoded_response.c_str());
grpc_grpclb_initial_response* c_initial_response =
grpc_grpclb_initial_response_parse(encoded_slice);
EXPECT_FALSE(c_initial_response->has_load_balancer_delegate);
EXPECT_EQ(c_initial_response->client_stats_report_interval.seconds, 123);
EXPECT_EQ(c_initial_response->client_stats_report_interval.nanos, 456);
- gpr_slice_unref(encoded_slice);
+ grpc_slice_unref(encoded_slice);
grpc_grpclb_initial_response_destroy(c_initial_response);
}
@@ -116,7 +116,7 @@ TEST_F(GrpclbTest, ParseResponseServerList) {
expiration_interval->set_nanos(999);
const grpc::string encoded_response = response.SerializeAsString();
- const gpr_slice encoded_slice = gpr_slice_from_copied_buffer(
+ const grpc_slice encoded_slice = grpc_slice_from_copied_buffer(
encoded_response.data(), encoded_response.size());
grpc_grpclb_serverlist* c_serverlist =
grpc_grpclb_response_parse_serverlist(encoded_slice);
@@ -137,7 +137,7 @@ TEST_F(GrpclbTest, ParseResponseServerList) {
EXPECT_TRUE(c_serverlist->expiration_interval.has_nanos);
EXPECT_EQ(c_serverlist->expiration_interval.nanos, 999);
- gpr_slice_unref(encoded_slice);
+ grpc_slice_unref(encoded_slice);
grpc_grpclb_destroy_serverlist(c_serverlist);
}
diff --git a/test/cpp/grpclb/grpclb_test.cc b/test/cpp/grpclb/grpclb_test.cc
index c796e55e1a..175786332b 100644
--- a/test/cpp/grpclb/grpclb_test.cc
+++ b/test/cpp/grpclb/grpclb_test.cc
@@ -121,7 +121,7 @@ typedef struct test_fixture {
static void *tag(intptr_t t) { return (void *)t; }
-static gpr_slice build_response_payload_slice(
+static grpc_slice build_response_payload_slice(
const char *host, int *ports, size_t nports,
int64_t expiration_interval_secs, int32_t expiration_interval_nanos) {
// server_list {
@@ -159,7 +159,7 @@ static gpr_slice build_response_payload_slice(
server->set_load_balance_token(token_data);
}
const grpc::string &enc_resp = response.SerializeAsString();
- return gpr_slice_from_copied_buffer(enc_resp.data(), enc_resp.size());
+ return grpc_slice_from_copied_buffer(enc_resp.data(), enc_resp.size());
}
static void drain_cq(grpc_completion_queue *cq) {
@@ -221,17 +221,17 @@ static void start_lb_server(server_fixture *sf, int *ports, size_t nports,
// validate initial request.
grpc_byte_buffer_reader bbr;
grpc_byte_buffer_reader_init(&bbr, request_payload_recv);
- gpr_slice request_payload_slice = grpc_byte_buffer_reader_readall(&bbr);
+ grpc_slice request_payload_slice = grpc_byte_buffer_reader_readall(&bbr);
grpc::lb::v1::LoadBalanceRequest request;
- request.ParseFromArray(GPR_SLICE_START_PTR(request_payload_slice),
- GPR_SLICE_LENGTH(request_payload_slice));
+ request.ParseFromArray(GRPC_SLICE_START_PTR(request_payload_slice),
+ GRPC_SLICE_LENGTH(request_payload_slice));
GPR_ASSERT(request.has_initial_request());
GPR_ASSERT(request.initial_request().name() == sf->servers_hostport);
- gpr_slice_unref(request_payload_slice);
+ grpc_slice_unref(request_payload_slice);
grpc_byte_buffer_reader_destroy(&bbr);
grpc_byte_buffer_destroy(request_payload_recv);
- gpr_slice response_payload_slice;
+ grpc_slice response_payload_slice;
op = ops;
op->op = GRPC_OP_SEND_INITIAL_METADATA;
op->data.send_initial_metadata.count = 0;
@@ -275,7 +275,7 @@ static void start_lb_server(server_fixture *sf, int *ports, size_t nports,
sf->servers_hostport, i);
grpc_byte_buffer_destroy(response_payload);
- gpr_slice_unref(response_payload_slice);
+ grpc_slice_unref(response_payload_slice);
}
gpr_log(GPR_INFO, "LB Server[%s] shutting down", sf->servers_hostport);
@@ -365,7 +365,7 @@ static void start_backend_server(server_fixture *sf) {
gpr_log(GPR_INFO, "Server[%s] after tag 101", sf->servers_hostport);
bool exit = false;
- gpr_slice response_payload_slice = gpr_slice_from_copied_string(PAYLOAD);
+ grpc_slice response_payload_slice = grpc_slice_from_copied_string(PAYLOAD);
while (!exit) {
op = ops;
op->op = GRPC_OP_RECV_MESSAGE;
@@ -424,7 +424,7 @@ static void start_backend_server(server_fixture *sf) {
++sf->num_calls_serviced;
gpr_log(GPR_INFO, "Server[%s] OUT OF THE LOOP", sf->servers_hostport);
- gpr_slice_unref(response_payload_slice);
+ grpc_slice_unref(response_payload_slice);
op = ops;
op->op = GRPC_OP_SEND_STATUS_FROM_SERVER;
@@ -466,7 +466,8 @@ static void perform_request(client_fixture *cf) {
int i;
memset(ops, 0, sizeof(ops));
- gpr_slice request_payload_slice = gpr_slice_from_copied_string("hello world");
+ grpc_slice request_payload_slice =
+ grpc_slice_from_copied_string("hello world");
c = grpc_channel_create_call(cf->client, NULL, GRPC_PROPAGATE_DEFAULTS,
cf->cq, "/foo", "foo.test.google.fr:1234",
@@ -525,7 +526,7 @@ static void perform_request(client_fixture *cf) {
grpc_byte_buffer_destroy(response_payload_recv);
}
- gpr_slice_unref(request_payload_slice);
+ grpc_slice_unref(request_payload_slice);
op = ops;
op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT;
@@ -643,7 +644,9 @@ static test_fixture setup_test_fixture(int lb_server_update_delay_ms) {
gpr_thd_new(&tf.lb_server.tid, fork_lb_server, &tf.lb_server, &options);
char *server_uri;
- gpr_asprintf(&server_uri, "test:%s?lb_policy=grpclb&lb_enabled=1",
+ // The grpclb LB policy will be automatically selected by virtue of
+ // the fact that the returned addresses are balancer addresses.
+ gpr_asprintf(&server_uri, "test:%s?lb_enabled=1",
tf.lb_server.servers_hostport);
setup_client(server_uri, &tf.client);
gpr_free(server_uri);
diff --git a/test/cpp/interop/stress_test.cc b/test/cpp/interop/stress_test.cc
index 46d09b7f28..fc35db5233 100644
--- a/test/cpp/interop/stress_test.cc
+++ b/test/cpp/interop/stress_test.cc
@@ -40,7 +40,6 @@
#include <gflags/gflags.h>
#include <grpc++/create_channel.h>
#include <grpc++/grpc++.h>
-#include <grpc++/impl/thd.h>
#include <grpc/support/log.h>
#include <grpc/support/time.h>
@@ -321,7 +320,7 @@ int main(int argc, char** argv) {
gpr_log(GPR_INFO, "Starting test(s)..");
- std::vector<grpc::thread> test_threads;
+ std::vector<std::thread> test_threads;
// Create and start the test threads.
// Note that:
@@ -361,7 +360,7 @@ int main(int argc, char** argv) {
"/stress_test/server_%d/channel_%d/stub_%d/qps",
server_idx, channel_idx, stub_idx);
- test_threads.emplace_back(grpc::thread(
+ test_threads.emplace_back(std::thread(
&StressTestInteropClient::MainLoop, client,
metrics_service.CreateQpsGauge(buffer, &is_already_created)));
diff --git a/test/cpp/microbenchmarks/noop-benchmark.cc b/test/cpp/microbenchmarks/noop-benchmark.cc
new file mode 100644
index 0000000000..6b06c69c6e
--- /dev/null
+++ b/test/cpp/microbenchmarks/noop-benchmark.cc
@@ -0,0 +1,45 @@
+/*
+ *
+ * Copyright 2015, Google Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+/* This benchmark exists to ensure that the google_benchmark integration is
+ * working */
+
+#include "third_party/google_benchmark/include/benchmark/benchmark.h"
+
+static void BM_NoOp(benchmark::State& state) {
+ while (state.KeepRunning()) {
+ }
+}
+BENCHMARK(BM_NoOp);
+
+BENCHMARK_MAIN();
diff --git a/test/cpp/qps/client.h b/test/cpp/qps/client.h
index 9983c8a7b0..3a0c359b4c 100644
--- a/test/cpp/qps/client.h
+++ b/test/cpp/qps/client.h
@@ -103,7 +103,7 @@ class ClientRequestCreator<ByteBuffer> {
if (payload_config.has_bytebuf_params()) {
std::unique_ptr<char[]> buf(
new char[payload_config.bytebuf_params().req_size()]);
- gpr_slice s = gpr_slice_from_copied_buffer(
+ grpc_slice s = grpc_slice_from_copied_buffer(
buf.get(), payload_config.bytebuf_params().req_size());
Slice slice(s, Slice::STEAL_REF);
*req = ByteBuffer(&slice, 1);
@@ -113,7 +113,7 @@ class ClientRequestCreator<ByteBuffer> {
}
};
-class HistogramEntry GRPC_FINAL {
+class HistogramEntry final {
public:
HistogramEntry() : value_used_(false), status_used_(false) {}
bool value_used() const { return value_used_; }
diff --git a/test/cpp/qps/client_async.cc b/test/cpp/qps/client_async.cc
index 4d36a6ba42..2ec6a5a23b 100644
--- a/test/cpp/qps/client_async.cc
+++ b/test/cpp/qps/client_async.cc
@@ -93,8 +93,8 @@ class ClientRpcContextUnaryImpl : public ClientRpcContext {
callback_(on_done),
next_issue_(next_issue),
start_req_(start_req) {}
- ~ClientRpcContextUnaryImpl() GRPC_OVERRIDE {}
- void Start(CompletionQueue* cq) GRPC_OVERRIDE {
+ ~ClientRpcContextUnaryImpl() override {}
+ void Start(CompletionQueue* cq) override {
cq_ = cq;
if (!next_issue_) { // ready to issue
RunNextState(true, nullptr);
@@ -102,7 +102,7 @@ class ClientRpcContextUnaryImpl : public ClientRpcContext {
alarm_.reset(new Alarm(cq_, next_issue_(), ClientRpcContext::tag(this)));
}
}
- bool RunNextState(bool ok, HistogramEntry* entry) GRPC_OVERRIDE {
+ bool RunNextState(bool ok, HistogramEntry* entry) override {
switch (next_state_) {
case State::READY:
start_ = UsageTimer::Now();
@@ -121,7 +121,7 @@ class ClientRpcContextUnaryImpl : public ClientRpcContext {
return false;
}
}
- ClientRpcContext* StartNewClone() GRPC_OVERRIDE {
+ ClientRpcContext* StartNewClone() override {
return new ClientRpcContextUnaryImpl(stub_, req_, next_issue_, start_req_,
callback_);
}
@@ -217,7 +217,7 @@ class AsyncClient : public ClientImpl<StubType, RequestType> {
}
return num_threads;
}
- void DestroyMultithreading() GRPC_OVERRIDE GRPC_FINAL {
+ void DestroyMultithreading() override final {
for (auto ss = shutdown_state_.begin(); ss != shutdown_state_.end(); ++ss) {
std::lock_guard<std::mutex> lock((*ss)->mutex);
(*ss)->shutdown = true;
@@ -228,8 +228,7 @@ class AsyncClient : public ClientImpl<StubType, RequestType> {
this->EndThreads(); // this needed for resolution
}
- bool ThreadFunc(HistogramEntry* entry,
- size_t thread_idx) GRPC_OVERRIDE GRPC_FINAL {
+ bool ThreadFunc(HistogramEntry* entry, size_t thread_idx) override final {
void* got_tag;
bool ok;
@@ -279,7 +278,7 @@ static std::unique_ptr<BenchmarkService::Stub> BenchmarkStubCreator(
return BenchmarkService::NewStub(ch);
}
-class AsyncUnaryClient GRPC_FINAL
+class AsyncUnaryClient final
: public AsyncClient<BenchmarkService::Stub, SimpleRequest> {
public:
explicit AsyncUnaryClient(const ClientConfig& config)
@@ -287,7 +286,7 @@ class AsyncUnaryClient GRPC_FINAL
config, SetupCtx, BenchmarkStubCreator) {
StartThreads(num_async_threads_);
}
- ~AsyncUnaryClient() GRPC_OVERRIDE {}
+ ~AsyncUnaryClient() override {}
private:
static void CheckDone(grpc::Status s, SimpleResponse* response,
@@ -329,13 +328,13 @@ class ClientRpcContextStreamingImpl : public ClientRpcContext {
callback_(on_done),
next_issue_(next_issue),
start_req_(start_req) {}
- ~ClientRpcContextStreamingImpl() GRPC_OVERRIDE {}
- void Start(CompletionQueue* cq) GRPC_OVERRIDE {
+ ~ClientRpcContextStreamingImpl() override {}
+ void Start(CompletionQueue* cq) override {
cq_ = cq;
stream_ = start_req_(stub_, &context_, cq, ClientRpcContext::tag(this));
next_state_ = State::STREAM_IDLE;
}
- bool RunNextState(bool ok, HistogramEntry* entry) GRPC_OVERRIDE {
+ bool RunNextState(bool ok, HistogramEntry* entry) override {
while (true) {
switch (next_state_) {
case State::STREAM_IDLE:
@@ -377,7 +376,7 @@ class ClientRpcContextStreamingImpl : public ClientRpcContext {
}
}
}
- ClientRpcContext* StartNewClone() GRPC_OVERRIDE {
+ ClientRpcContext* StartNewClone() override {
return new ClientRpcContextStreamingImpl(stub_, req_, next_issue_,
start_req_, callback_);
}
@@ -410,7 +409,7 @@ class ClientRpcContextStreamingImpl : public ClientRpcContext {
stream_;
};
-class AsyncStreamingClient GRPC_FINAL
+class AsyncStreamingClient final
: public AsyncClient<BenchmarkService::Stub, SimpleRequest> {
public:
explicit AsyncStreamingClient(const ClientConfig& config)
@@ -419,7 +418,7 @@ class AsyncStreamingClient GRPC_FINAL
StartThreads(num_async_threads_);
}
- ~AsyncStreamingClient() GRPC_OVERRIDE {}
+ ~AsyncStreamingClient() override {}
private:
static void CheckDone(grpc::Status s, SimpleResponse* response) {}
@@ -458,8 +457,8 @@ class ClientRpcContextGenericStreamingImpl : public ClientRpcContext {
callback_(on_done),
next_issue_(next_issue),
start_req_(start_req) {}
- ~ClientRpcContextGenericStreamingImpl() GRPC_OVERRIDE {}
- void Start(CompletionQueue* cq) GRPC_OVERRIDE {
+ ~ClientRpcContextGenericStreamingImpl() override {}
+ void Start(CompletionQueue* cq) override {
cq_ = cq;
const grpc::string kMethodName(
"/grpc.testing.BenchmarkService/StreamingCall");
@@ -467,7 +466,7 @@ class ClientRpcContextGenericStreamingImpl : public ClientRpcContext {
ClientRpcContext::tag(this));
next_state_ = State::STREAM_IDLE;
}
- bool RunNextState(bool ok, HistogramEntry* entry) GRPC_OVERRIDE {
+ bool RunNextState(bool ok, HistogramEntry* entry) override {
while (true) {
switch (next_state_) {
case State::STREAM_IDLE:
@@ -509,7 +508,7 @@ class ClientRpcContextGenericStreamingImpl : public ClientRpcContext {
}
}
}
- ClientRpcContext* StartNewClone() GRPC_OVERRIDE {
+ ClientRpcContext* StartNewClone() override {
return new ClientRpcContextGenericStreamingImpl(stub_, req_, next_issue_,
start_req_, callback_);
}
@@ -546,7 +545,7 @@ static std::unique_ptr<grpc::GenericStub> GenericStubCreator(
return std::unique_ptr<grpc::GenericStub>(new grpc::GenericStub(ch));
}
-class GenericAsyncStreamingClient GRPC_FINAL
+class GenericAsyncStreamingClient final
: public AsyncClient<grpc::GenericStub, ByteBuffer> {
public:
explicit GenericAsyncStreamingClient(const ClientConfig& config)
@@ -555,7 +554,7 @@ class GenericAsyncStreamingClient GRPC_FINAL
StartThreads(num_async_threads_);
}
- ~GenericAsyncStreamingClient() GRPC_OVERRIDE {}
+ ~GenericAsyncStreamingClient() override {}
private:
static void CheckDone(grpc::Status s, ByteBuffer* response) {}
diff --git a/test/cpp/qps/client_sync.cc b/test/cpp/qps/client_sync.cc
index f61e80d76b..a88a24d89c 100644
--- a/test/cpp/qps/client_sync.cc
+++ b/test/cpp/qps/client_sync.cc
@@ -108,10 +108,10 @@ class SynchronousClient
std::vector<SimpleResponse> responses_;
private:
- void DestroyMultithreading() GRPC_OVERRIDE GRPC_FINAL { EndThreads(); }
+ void DestroyMultithreading() override final { EndThreads(); }
};
-class SynchronousUnaryClient GRPC_FINAL : public SynchronousClient {
+class SynchronousUnaryClient final : public SynchronousClient {
public:
SynchronousUnaryClient(const ClientConfig& config)
: SynchronousClient(config) {
@@ -119,7 +119,7 @@ class SynchronousUnaryClient GRPC_FINAL : public SynchronousClient {
}
~SynchronousUnaryClient() {}
- bool ThreadFunc(HistogramEntry* entry, size_t thread_idx) GRPC_OVERRIDE {
+ bool ThreadFunc(HistogramEntry* entry, size_t thread_idx) override {
if (!WaitToIssue(thread_idx)) {
return true;
}
@@ -135,7 +135,7 @@ class SynchronousUnaryClient GRPC_FINAL : public SynchronousClient {
}
};
-class SynchronousStreamingClient GRPC_FINAL : public SynchronousClient {
+class SynchronousStreamingClient final : public SynchronousClient {
public:
SynchronousStreamingClient(const ClientConfig& config)
: SynchronousClient(config) {
@@ -165,7 +165,7 @@ class SynchronousStreamingClient GRPC_FINAL : public SynchronousClient {
delete[] context_;
}
- bool ThreadFunc(HistogramEntry* entry, size_t thread_idx) GRPC_OVERRIDE {
+ bool ThreadFunc(HistogramEntry* entry, size_t thread_idx) override {
if (!WaitToIssue(thread_idx)) {
return true;
}
diff --git a/test/cpp/qps/gen_build_yaml.py b/test/cpp/qps/gen_build_yaml.py
index 369da2c8ca..e4d9e7ac58 100755
--- a/test/cpp/qps/gen_build_yaml.py
+++ b/test/cpp/qps/gen_build_yaml.py
@@ -82,7 +82,7 @@ print yaml.dump({
'defaults': 'boringssl',
'cpu_cost': guess_cpu(scenario_json),
'exclude_configs': [],
- 'timeout_seconds': 3*60
+ 'timeout_seconds': 6*60
}
for scenario_json in scenario_config.CXXLanguage().scenarios()
if 'scalable' in scenario_json.get('CATEGORIES', [])
diff --git a/test/cpp/qps/interarrival.h b/test/cpp/qps/interarrival.h
index 0980d5e8ba..4bef06f566 100644
--- a/test/cpp/qps/interarrival.h
+++ b/test/cpp/qps/interarrival.h
@@ -69,11 +69,11 @@ inline RandomDistInterface::~RandomDistInterface() {}
// independent identical stationary sources. For more information,
// see http://en.wikipedia.org/wiki/Exponential_distribution
-class ExpDist GRPC_FINAL : public RandomDistInterface {
+class ExpDist final : public RandomDistInterface {
public:
explicit ExpDist(double lambda) : lambda_recip_(1.0 / lambda) {}
- ~ExpDist() GRPC_OVERRIDE {}
- double transform(double uni) const GRPC_OVERRIDE {
+ ~ExpDist() override {}
+ double transform(double uni) const override {
// Note: Use 1.0-uni above to avoid NaN if uni is 0
return lambda_recip_ * (-log(1.0 - uni));
}
diff --git a/test/cpp/qps/qps_worker.cc b/test/cpp/qps/qps_worker.cc
index d3e53fe14a..d437920e68 100644
--- a/test/cpp/qps/qps_worker.cc
+++ b/test/cpp/qps/qps_worker.cc
@@ -100,7 +100,7 @@ static std::unique_ptr<Server> CreateServer(const ServerConfig& config) {
abort();
}
-class ScopedProfile GRPC_FINAL {
+class ScopedProfile final {
public:
ScopedProfile(const char* filename, bool enable) : enable_(enable) {
if (enable_) grpc_profiler_start(filename);
@@ -113,14 +113,14 @@ class ScopedProfile GRPC_FINAL {
const bool enable_;
};
-class WorkerServiceImpl GRPC_FINAL : public WorkerService::Service {
+class WorkerServiceImpl final : public WorkerService::Service {
public:
WorkerServiceImpl(int server_port, QpsWorker* worker)
: acquired_(false), server_port_(server_port), worker_(worker) {}
- Status RunClient(ServerContext* ctx,
- ServerReaderWriter<ClientStatus, ClientArgs>* stream)
- GRPC_OVERRIDE {
+ Status RunClient(
+ ServerContext* ctx,
+ ServerReaderWriter<ClientStatus, ClientArgs>* stream) override {
InstanceGuard g(this);
if (!g.Acquired()) {
return Status(StatusCode::RESOURCE_EXHAUSTED, "Client worker busy");
@@ -132,9 +132,9 @@ class WorkerServiceImpl GRPC_FINAL : public WorkerService::Service {
return ret;
}
- Status RunServer(ServerContext* ctx,
- ServerReaderWriter<ServerStatus, ServerArgs>* stream)
- GRPC_OVERRIDE {
+ Status RunServer(
+ ServerContext* ctx,
+ ServerReaderWriter<ServerStatus, ServerArgs>* stream) override {
InstanceGuard g(this);
if (!g.Acquired()) {
return Status(StatusCode::RESOURCE_EXHAUSTED, "Server worker busy");
@@ -147,12 +147,12 @@ class WorkerServiceImpl GRPC_FINAL : public WorkerService::Service {
}
Status CoreCount(ServerContext* ctx, const CoreRequest*,
- CoreResponse* resp) GRPC_OVERRIDE {
+ CoreResponse* resp) override {
resp->set_cores(gpr_cpu_num_cores());
return Status::OK;
}
- Status QuitWorker(ServerContext* ctx, const Void*, Void*) GRPC_OVERRIDE {
+ Status QuitWorker(ServerContext* ctx, const Void*, Void*) override {
InstanceGuard g(this);
if (!g.Acquired()) {
return Status(StatusCode::RESOURCE_EXHAUSTED, "Quitting worker busy");
diff --git a/test/cpp/qps/report.h b/test/cpp/qps/report.h
index 39cf498e7b..9dc259e95a 100644
--- a/test/cpp/qps/report.h
+++ b/test/cpp/qps/report.h
@@ -82,10 +82,10 @@ class CompositeReporter : public Reporter {
/** Adds a \a reporter to the composite. */
void add(std::unique_ptr<Reporter> reporter);
- void ReportQPS(const ScenarioResult& result) GRPC_OVERRIDE;
- void ReportQPSPerCore(const ScenarioResult& result) GRPC_OVERRIDE;
- void ReportLatency(const ScenarioResult& result) GRPC_OVERRIDE;
- void ReportTimes(const ScenarioResult& result) GRPC_OVERRIDE;
+ void ReportQPS(const ScenarioResult& result) override;
+ void ReportQPSPerCore(const ScenarioResult& result) override;
+ void ReportLatency(const ScenarioResult& result) override;
+ void ReportTimes(const ScenarioResult& result) override;
private:
std::vector<std::unique_ptr<Reporter> > reporters_;
@@ -97,10 +97,10 @@ class GprLogReporter : public Reporter {
GprLogReporter(const string& name) : Reporter(name) {}
private:
- void ReportQPS(const ScenarioResult& result) GRPC_OVERRIDE;
- void ReportQPSPerCore(const ScenarioResult& result) GRPC_OVERRIDE;
- void ReportLatency(const ScenarioResult& result) GRPC_OVERRIDE;
- void ReportTimes(const ScenarioResult& result) GRPC_OVERRIDE;
+ void ReportQPS(const ScenarioResult& result) override;
+ void ReportQPSPerCore(const ScenarioResult& result) override;
+ void ReportLatency(const ScenarioResult& result) override;
+ void ReportTimes(const ScenarioResult& result) override;
};
/** Dumps the report to a JSON file. */
@@ -110,10 +110,10 @@ class JsonReporter : public Reporter {
: Reporter(name), report_file_(report_file) {}
private:
- void ReportQPS(const ScenarioResult& result) GRPC_OVERRIDE;
- void ReportQPSPerCore(const ScenarioResult& result) GRPC_OVERRIDE;
- void ReportLatency(const ScenarioResult& result) GRPC_OVERRIDE;
- void ReportTimes(const ScenarioResult& result) GRPC_OVERRIDE;
+ void ReportQPS(const ScenarioResult& result) override;
+ void ReportQPSPerCore(const ScenarioResult& result) override;
+ void ReportLatency(const ScenarioResult& result) override;
+ void ReportTimes(const ScenarioResult& result) override;
const string report_file_;
};
diff --git a/test/cpp/qps/server_async.cc b/test/cpp/qps/server_async.cc
index bc4c896d83..b3a06aeaf5 100644
--- a/test/cpp/qps/server_async.cc
+++ b/test/cpp/qps/server_async.cc
@@ -58,7 +58,7 @@ namespace testing {
template <class RequestType, class ResponseType, class ServiceType,
class ServerContextType>
-class AsyncQpsServerTest GRPC_FINAL : public grpc::testing::Server {
+class AsyncQpsServerTest final : public grpc::testing::Server {
public:
AsyncQpsServerTest(
const ServerConfig &config,
@@ -196,7 +196,7 @@ class AsyncQpsServerTest GRPC_FINAL : public grpc::testing::Server {
return reinterpret_cast<ServerRpcContext *>(tag);
}
- class ServerRpcContextUnaryImpl GRPC_FINAL : public ServerRpcContext {
+ class ServerRpcContextUnaryImpl final : public ServerRpcContext {
public:
ServerRpcContextUnaryImpl(
std::function<void(ServerContextType *, RequestType *,
@@ -213,11 +213,9 @@ class AsyncQpsServerTest GRPC_FINAL : public grpc::testing::Server {
request_method_(srv_ctx_.get(), &req_, &response_writer_,
AsyncQpsServerTest::tag(this));
}
- ~ServerRpcContextUnaryImpl() GRPC_OVERRIDE {}
- bool RunNextState(bool ok) GRPC_OVERRIDE {
- return (this->*next_state_)(ok);
- }
- void Reset() GRPC_OVERRIDE {
+ ~ServerRpcContextUnaryImpl() override {}
+ bool RunNextState(bool ok) override { return (this->*next_state_)(ok); }
+ void Reset() override {
srv_ctx_.reset(new ServerContextType);
req_ = RequestType();
response_writer_ =
@@ -257,7 +255,7 @@ class AsyncQpsServerTest GRPC_FINAL : public grpc::testing::Server {
grpc::ServerAsyncResponseWriter<ResponseType> response_writer_;
};
- class ServerRpcContextStreamingImpl GRPC_FINAL : public ServerRpcContext {
+ class ServerRpcContextStreamingImpl final : public ServerRpcContext {
public:
ServerRpcContextStreamingImpl(
std::function<void(
@@ -273,11 +271,9 @@ class AsyncQpsServerTest GRPC_FINAL : public grpc::testing::Server {
stream_(srv_ctx_.get()) {
request_method_(srv_ctx_.get(), &stream_, AsyncQpsServerTest::tag(this));
}
- ~ServerRpcContextStreamingImpl() GRPC_OVERRIDE {}
- bool RunNextState(bool ok) GRPC_OVERRIDE {
- return (this->*next_state_)(ok);
- }
- void Reset() GRPC_OVERRIDE {
+ ~ServerRpcContextStreamingImpl() override {}
+ bool RunNextState(bool ok) override { return (this->*next_state_)(ok); }
+ void Reset() override {
srv_ctx_.reset(new ServerContextType);
req_ = RequestType();
stream_ = grpc::ServerAsyncReaderWriter<ResponseType, RequestType>(
@@ -380,7 +376,7 @@ static Status ProcessGenericRPC(const PayloadConfig &payload_config,
ByteBuffer *response) {
int resp_size = payload_config.bytebuf_params().resp_size();
std::unique_ptr<char[]> buf(new char[resp_size]);
- gpr_slice s = gpr_slice_from_copied_buffer(buf.get(), resp_size);
+ grpc_slice s = grpc_slice_from_copied_buffer(buf.get(), resp_size);
Slice slice(s, Slice::STEAL_REF);
*response = ByteBuffer(&slice, 1);
return Status::OK;
diff --git a/test/cpp/qps/server_sync.cc b/test/cpp/qps/server_sync.cc
index 07f48e2644..8076a4a6b9 100644
--- a/test/cpp/qps/server_sync.cc
+++ b/test/cpp/qps/server_sync.cc
@@ -48,10 +48,10 @@
namespace grpc {
namespace testing {
-class BenchmarkServiceImpl GRPC_FINAL : public BenchmarkService::Service {
+class BenchmarkServiceImpl final : public BenchmarkService::Service {
public:
Status UnaryCall(ServerContext* context, const SimpleRequest* request,
- SimpleResponse* response) GRPC_OVERRIDE {
+ SimpleResponse* response) override {
if (request->response_size() > 0) {
if (!Server::SetPayload(request->response_type(),
request->response_size(),
@@ -63,7 +63,7 @@ class BenchmarkServiceImpl GRPC_FINAL : public BenchmarkService::Service {
}
Status StreamingCall(
ServerContext* context,
- ServerReaderWriter<SimpleResponse, SimpleRequest>* stream) GRPC_OVERRIDE {
+ ServerReaderWriter<SimpleResponse, SimpleRequest>* stream) override {
SimpleRequest request;
while (stream->Read(&request)) {
SimpleResponse response;
@@ -80,7 +80,7 @@ class BenchmarkServiceImpl GRPC_FINAL : public BenchmarkService::Service {
}
};
-class SynchronousServer GRPC_FINAL : public grpc::testing::Server {
+class SynchronousServer final : public grpc::testing::Server {
public:
explicit SynchronousServer(const ServerConfig& config) : Server(config) {
ServerBuilder builder;
diff --git a/test/cpp/thread_manager/thread_manager_test.cc b/test/cpp/thread_manager/thread_manager_test.cc
index 5c70103947..284761c53a 100644
--- a/test/cpp/thread_manager/thread_manager_test.cc
+++ b/test/cpp/thread_manager/thread_manager_test.cc
@@ -43,7 +43,7 @@
#include "test/cpp/util/test_config.h"
namespace grpc {
-class ThreadManagerTest GRPC_FINAL : public grpc::ThreadManager {
+class ThreadManagerTest final : public grpc::ThreadManager {
public:
ThreadManagerTest()
: ThreadManager(kMinPollers, kMaxPollers),
@@ -51,9 +51,8 @@ class ThreadManagerTest GRPC_FINAL : public grpc::ThreadManager {
num_poll_for_work_(0),
num_work_found_(0) {}
- grpc::ThreadManager::WorkStatus PollForWork(void **tag,
- bool *ok) GRPC_OVERRIDE;
- void DoWork(void *tag, bool ok) GRPC_OVERRIDE;
+ grpc::ThreadManager::WorkStatus PollForWork(void **tag, bool *ok) override;
+ void DoWork(void *tag, bool ok) override;
void PerformTest();
private:
diff --git a/test/cpp/util/byte_buffer_proto_helper.cc b/test/cpp/util/byte_buffer_proto_helper.cc
index d625d6f3f4..ab5ca261e6 100644
--- a/test/cpp/util/byte_buffer_proto_helper.cc
+++ b/test/cpp/util/byte_buffer_proto_helper.cc
@@ -51,7 +51,7 @@ std::unique_ptr<ByteBuffer> SerializeToByteBuffer(
grpc::protobuf::Message* message) {
grpc::string buf;
message->SerializeToString(&buf);
- gpr_slice s = gpr_slice_from_copied_string(buf.c_str());
+ grpc_slice s = grpc_slice_from_copied_string(buf.c_str());
Slice slice(s, Slice::STEAL_REF);
return std::unique_ptr<ByteBuffer>(new ByteBuffer(&slice, 1));
}
diff --git a/test/cpp/util/byte_buffer_test.cc b/test/cpp/util/byte_buffer_test.cc
index 2089a62011..470ce0cbf4 100644
--- a/test/cpp/util/byte_buffer_test.cc
+++ b/test/cpp/util/byte_buffer_test.cc
@@ -37,7 +37,7 @@
#include <vector>
#include <grpc++/support/slice.h>
-#include <grpc/support/slice.h>
+#include <grpc/slice.h>
#include <gtest/gtest.h>
namespace grpc {
@@ -49,14 +49,14 @@ const char* kContent2 = "yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy world";
class ByteBufferTest : public ::testing::Test {};
TEST_F(ByteBufferTest, CreateFromSingleSlice) {
- gpr_slice hello = gpr_slice_from_copied_string(kContent1);
+ grpc_slice hello = grpc_slice_from_copied_string(kContent1);
Slice s(hello, Slice::STEAL_REF);
ByteBuffer buffer(&s, 1);
}
TEST_F(ByteBufferTest, CreateFromVector) {
- gpr_slice hello = gpr_slice_from_copied_string(kContent1);
- gpr_slice world = gpr_slice_from_copied_string(kContent2);
+ grpc_slice hello = grpc_slice_from_copied_string(kContent1);
+ grpc_slice world = grpc_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));
@@ -64,15 +64,15 @@ TEST_F(ByteBufferTest, CreateFromVector) {
}
TEST_F(ByteBufferTest, Clear) {
- gpr_slice hello = gpr_slice_from_copied_string(kContent1);
+ grpc_slice hello = grpc_slice_from_copied_string(kContent1);
Slice s(hello, Slice::STEAL_REF);
ByteBuffer buffer(&s, 1);
buffer.Clear();
}
TEST_F(ByteBufferTest, Length) {
- gpr_slice hello = gpr_slice_from_copied_string(kContent1);
- gpr_slice world = gpr_slice_from_copied_string(kContent2);
+ grpc_slice hello = grpc_slice_from_copied_string(kContent1);
+ grpc_slice world = grpc_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));
@@ -80,12 +80,12 @@ TEST_F(ByteBufferTest, Length) {
EXPECT_EQ(strlen(kContent1) + strlen(kContent2), buffer.Length());
}
-bool SliceEqual(const Slice& a, gpr_slice b) {
- if (a.size() != GPR_SLICE_LENGTH(b)) {
+bool SliceEqual(const Slice& a, grpc_slice b) {
+ if (a.size() != GRPC_SLICE_LENGTH(b)) {
return false;
}
for (size_t i = 0; i < a.size(); i++) {
- if (a.begin()[i] != GPR_SLICE_START_PTR(b)[i]) {
+ if (a.begin()[i] != GRPC_SLICE_START_PTR(b)[i]) {
return false;
}
}
@@ -93,8 +93,8 @@ bool SliceEqual(const Slice& a, gpr_slice b) {
}
TEST_F(ByteBufferTest, Dump) {
- gpr_slice hello = gpr_slice_from_copied_string(kContent1);
- gpr_slice world = gpr_slice_from_copied_string(kContent2);
+ grpc_slice hello = grpc_slice_from_copied_string(kContent1);
+ grpc_slice world = grpc_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));
@@ -106,8 +106,8 @@ TEST_F(ByteBufferTest, Dump) {
}
TEST_F(ByteBufferTest, SerializationMakesCopy) {
- gpr_slice hello = gpr_slice_from_copied_string(kContent1);
- gpr_slice world = gpr_slice_from_copied_string(kContent2);
+ grpc_slice hello = grpc_slice_from_copied_string(kContent1);
+ grpc_slice world = grpc_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));
diff --git a/test/cpp/util/cli_call.cc b/test/cpp/util/cli_call.cc
index 1edffbe08e..a02a8b2ee2 100644
--- a/test/cpp/util/cli_call.cc
+++ b/test/cpp/util/cli_call.cc
@@ -41,8 +41,8 @@
#include <grpc++/generic/generic_stub.h>
#include <grpc++/support/byte_buffer.h>
#include <grpc/grpc.h>
+#include <grpc/slice.h>
#include <grpc/support/log.h>
-#include <grpc/support/slice.h>
namespace grpc {
namespace testing {
@@ -72,7 +72,7 @@ Status CliCall::Call(std::shared_ptr<grpc::Channel> channel,
cq.Next(&got_tag, &ok);
GPR_ASSERT(ok);
- gpr_slice s = gpr_slice_from_copied_string(request.c_str());
+ grpc_slice s = grpc_slice_from_copied_string(request.c_str());
grpc::Slice req_slice(s, grpc::Slice::STEAL_REF);
grpc::ByteBuffer send_buffer(&req_slice, 1);
call->Write(send_buffer, tag(2));
diff --git a/test/cpp/util/cli_call.h b/test/cpp/util/cli_call.h
index 2fbc9618b6..65da86bd4e 100644
--- a/test/cpp/util/cli_call.h
+++ b/test/cpp/util/cli_call.h
@@ -43,7 +43,7 @@
namespace grpc {
namespace testing {
-class CliCall GRPC_FINAL {
+class CliCall final {
public:
typedef std::multimap<grpc::string, grpc::string> OutgoingMetadataContainer;
typedef std::multimap<grpc::string_ref, grpc::string_ref>
diff --git a/test/cpp/util/cli_call_test.cc b/test/cpp/util/cli_call_test.cc
index 75e90f824f..2e8501b2c3 100644
--- a/test/cpp/util/cli_call_test.cc
+++ b/test/cpp/util/cli_call_test.cc
@@ -56,7 +56,7 @@ namespace testing {
class TestServiceImpl : public ::grpc::testing::EchoTestService::Service {
public:
Status Echo(ServerContext* context, const EchoRequest* request,
- EchoResponse* response) GRPC_OVERRIDE {
+ EchoResponse* response) override {
if (!context->client_metadata().empty()) {
for (std::multimap<grpc::string_ref, grpc::string_ref>::const_iterator
iter = context->client_metadata().begin();
@@ -75,7 +75,7 @@ class CliCallTest : public ::testing::Test {
protected:
CliCallTest() {}
- void SetUp() GRPC_OVERRIDE {
+ void SetUp() override {
int port = grpc_pick_unused_port_or_die();
server_address_ << "localhost:" << port;
// Setup server
@@ -86,7 +86,7 @@ class CliCallTest : public ::testing::Test {
server_ = builder.BuildAndStart();
}
- void TearDown() GRPC_OVERRIDE { server_->Shutdown(); }
+ void TearDown() override { server_->Shutdown(); }
void ResetStub() {
channel_ =
diff --git a/test/cpp/util/grpc_tool_test.cc b/test/cpp/util/grpc_tool_test.cc
index bad1579f11..5ab054d04a 100644
--- a/test/cpp/util/grpc_tool_test.cc
+++ b/test/cpp/util/grpc_tool_test.cc
@@ -93,13 +93,12 @@ DECLARE_bool(l);
namespace {
-class TestCliCredentials GRPC_FINAL : public grpc::testing::CliCredentials {
+class TestCliCredentials final : public grpc::testing::CliCredentials {
public:
- std::shared_ptr<grpc::ChannelCredentials> GetCredentials() const
- GRPC_OVERRIDE {
+ std::shared_ptr<grpc::ChannelCredentials> GetCredentials() const override {
return InsecureChannelCredentials();
}
- const grpc::string GetCredentialUsage() const GRPC_OVERRIDE { return ""; }
+ const grpc::string GetCredentialUsage() const override { return ""; }
};
bool PrintStream(std::stringstream* ss, const grpc::string& output) {
@@ -118,7 +117,7 @@ size_t ArraySize(T& a) {
class TestServiceImpl : public ::grpc::testing::EchoTestService::Service {
public:
Status Echo(ServerContext* context, const EchoRequest* request,
- EchoResponse* response) GRPC_OVERRIDE {
+ EchoResponse* response) override {
if (!context->client_metadata().empty()) {
for (std::multimap<grpc::string_ref, grpc::string_ref>::const_iterator
iter = context->client_metadata().begin();
diff --git a/test/cpp/util/metrics_server.h b/test/cpp/util/metrics_server.h
index aa9bfed23d..4f1e393a63 100644
--- a/test/cpp/util/metrics_server.h
+++ b/test/cpp/util/metrics_server.h
@@ -83,13 +83,13 @@ class QpsGauge {
std::mutex num_queries_mu_;
};
-class MetricsServiceImpl GRPC_FINAL : public MetricsService::Service {
+class MetricsServiceImpl final : public MetricsService::Service {
public:
grpc::Status GetAllGauges(ServerContext* context, const EmptyMessage* request,
- ServerWriter<GaugeResponse>* writer) GRPC_OVERRIDE;
+ ServerWriter<GaugeResponse>* writer) override;
grpc::Status GetGauge(ServerContext* context, const GaugeRequest* request,
- GaugeResponse* response) GRPC_OVERRIDE;
+ GaugeResponse* response) override;
// Create a QpsGauge with name 'name'. is_present is set to true if the Gauge
// is already present in the map.
diff --git a/test/cpp/util/proto_file_parser.cc b/test/cpp/util/proto_file_parser.cc
index 98dd3f14ad..3e524227e5 100644
--- a/test/cpp/util/proto_file_parser.cc
+++ b/test/cpp/util/proto_file_parser.cc
@@ -61,7 +61,7 @@ class ErrorPrinter : public protobuf::compiler::MultiFileErrorCollector {
explicit ErrorPrinter(ProtoFileParser* parser) : parser_(parser) {}
void AddError(const grpc::string& filename, int line, int column,
- const grpc::string& message) GRPC_OVERRIDE {
+ const grpc::string& message) override {
std::ostringstream oss;
oss << "error " << filename << " " << line << " " << column << " "
<< message << "\n";
@@ -69,7 +69,7 @@ class ErrorPrinter : public protobuf::compiler::MultiFileErrorCollector {
}
void AddWarning(const grpc::string& filename, int line, int column,
- const grpc::string& message) GRPC_OVERRIDE {
+ const grpc::string& message) override {
std::cerr << "warning " << filename << " " << line << " " << column << " "
<< message << std::endl;
}
diff --git a/test/cpp/util/proto_reflection_descriptor_database.h b/test/cpp/util/proto_reflection_descriptor_database.h
index 4637c043f1..259277ebbe 100644
--- a/test/cpp/util/proto_reflection_descriptor_database.h
+++ b/test/cpp/util/proto_reflection_descriptor_database.h
@@ -62,14 +62,13 @@ class ProtoReflectionDescriptorDatabase : public protobuf::DescriptorDatabase {
// Find a file by file name. Fills in in *output and returns true if found.
// Otherwise, returns false, leaving the contents of *output undefined.
bool FindFileByName(const string& filename,
- protobuf::FileDescriptorProto* output) GRPC_OVERRIDE;
+ protobuf::FileDescriptorProto* output) override;
// Find the file that declares the given fully-qualified symbol name.
// If found, fills in *output and returns true, otherwise returns false
// and leaves *output undefined.
bool FindFileContainingSymbol(const string& symbol_name,
- protobuf::FileDescriptorProto* output)
- GRPC_OVERRIDE;
+ protobuf::FileDescriptorProto* output) override;
// Find the file which defines an extension extending the given message type
// with the given field number. If found, fills in *output and returns true,
@@ -77,7 +76,7 @@ class ProtoReflectionDescriptorDatabase : public protobuf::DescriptorDatabase {
// must be a fully-qualified type name.
bool FindFileContainingExtension(
const string& containing_type, int field_number,
- protobuf::FileDescriptorProto* output) GRPC_OVERRIDE;
+ protobuf::FileDescriptorProto* output) override;
// Finds the tag numbers used by all known extensions of
// extendee_type, and appends them to output in an undefined
@@ -87,7 +86,7 @@ class ProtoReflectionDescriptorDatabase : public protobuf::DescriptorDatabase {
// numbers. Returns true if the search was successful, otherwise
// returns false and leaves output unchanged.
bool FindAllExtensionNumbers(const string& extendee_type,
- std::vector<int>* output) GRPC_OVERRIDE;
+ std::vector<int>* output) override;
// Provide a list of full names of registered services
bool GetServices(std::vector<grpc::string>* output);
diff --git a/test/cpp/util/slice_test.cc b/test/cpp/util/slice_test.cc
index 45799ae157..8926fb7d5a 100644
--- a/test/cpp/util/slice_test.cc
+++ b/test/cpp/util/slice_test.cc
@@ -33,7 +33,7 @@
#include <grpc++/support/slice.h>
-#include <grpc/support/slice.h>
+#include <grpc/slice.h>
#include <gtest/gtest.h>
namespace grpc {
@@ -51,15 +51,15 @@ class SliceTest : public ::testing::Test {
};
TEST_F(SliceTest, Steal) {
- gpr_slice s = gpr_slice_from_copied_string(kContent);
+ grpc_slice s = grpc_slice_from_copied_string(kContent);
Slice spp(s, Slice::STEAL_REF);
CheckSlice(spp, kContent);
}
TEST_F(SliceTest, Add) {
- gpr_slice s = gpr_slice_from_copied_string(kContent);
+ grpc_slice s = grpc_slice_from_copied_string(kContent);
Slice spp(s, Slice::ADD_REF);
- gpr_slice_unref(s);
+ grpc_slice_unref(s);
CheckSlice(spp, kContent);
}
@@ -69,13 +69,13 @@ TEST_F(SliceTest, Empty) {
}
TEST_F(SliceTest, Cslice) {
- gpr_slice s = gpr_slice_from_copied_string(kContent);
+ grpc_slice s = grpc_slice_from_copied_string(kContent);
Slice spp(s, Slice::STEAL_REF);
CheckSlice(spp, kContent);
- gpr_slice c_slice = spp.c_slice();
- EXPECT_EQ(GPR_SLICE_START_PTR(s), GPR_SLICE_START_PTR(c_slice));
- EXPECT_EQ(GPR_SLICE_END_PTR(s), GPR_SLICE_END_PTR(c_slice));
- gpr_slice_unref(c_slice);
+ grpc_slice c_slice = spp.c_slice();
+ EXPECT_EQ(GRPC_SLICE_START_PTR(s), GRPC_SLICE_START_PTR(c_slice));
+ EXPECT_EQ(GRPC_SLICE_END_PTR(s), GRPC_SLICE_END_PTR(c_slice));
+ grpc_slice_unref(c_slice);
}
} // namespace
diff --git a/test/cpp/util/test_credentials_provider.cc b/test/cpp/util/test_credentials_provider.cc
index ca15f29795..0456b96667 100644
--- a/test/cpp/util/test_credentials_provider.cc
+++ b/test/cpp/util/test_credentials_provider.cc
@@ -34,9 +34,9 @@
#include "test/cpp/util/test_credentials_provider.h"
+#include <mutex>
#include <unordered_map>
-#include <grpc++/impl/sync.h>
#include <grpc/support/log.h>
#include <grpc/support/sync.h>
@@ -64,14 +64,14 @@ class CredentialsProvider {
class DefaultCredentialsProvider : public CredentialsProvider {
public:
- ~DefaultCredentialsProvider() GRPC_OVERRIDE {}
+ ~DefaultCredentialsProvider() override {}
- void AddSecureType(const grpc::string& type,
- std::unique_ptr<CredentialTypeProvider> type_provider)
- GRPC_OVERRIDE {
+ void AddSecureType(
+ const grpc::string& type,
+ std::unique_ptr<CredentialTypeProvider> type_provider) override {
// This clobbers any existing entry for type, except the defaults, which
// can't be clobbered.
- grpc::unique_lock<grpc::mutex> lock(mu_);
+ std::unique_lock<std::mutex> lock(mu_);
auto it = std::find(added_secure_type_names_.begin(),
added_secure_type_names_.end(), type);
if (it == added_secure_type_names_.end()) {
@@ -84,7 +84,7 @@ class DefaultCredentialsProvider : public CredentialsProvider {
}
std::shared_ptr<ChannelCredentials> GetChannelCredentials(
- const grpc::string& type, ChannelArguments* args) GRPC_OVERRIDE {
+ const grpc::string& type, ChannelArguments* args) override {
if (type == grpc::testing::kInsecureCredentialsType) {
return InsecureChannelCredentials();
} else if (type == grpc::testing::kTlsCredentialsType) {
@@ -92,7 +92,7 @@ class DefaultCredentialsProvider : public CredentialsProvider {
args->SetSslTargetNameOverride("foo.test.google.fr");
return SslCredentials(ssl_opts);
} else {
- grpc::unique_lock<grpc::mutex> lock(mu_);
+ std::unique_lock<std::mutex> lock(mu_);
auto it(std::find(added_secure_type_names_.begin(),
added_secure_type_names_.end(), type));
if (it == added_secure_type_names_.end()) {
@@ -105,7 +105,7 @@ class DefaultCredentialsProvider : public CredentialsProvider {
}
std::shared_ptr<ServerCredentials> GetServerCredentials(
- const grpc::string& type) GRPC_OVERRIDE {
+ const grpc::string& type) override {
if (type == grpc::testing::kInsecureCredentialsType) {
return InsecureServerCredentials();
} else if (type == grpc::testing::kTlsCredentialsType) {
@@ -116,7 +116,7 @@ class DefaultCredentialsProvider : public CredentialsProvider {
ssl_opts.pem_key_cert_pairs.push_back(pkcp);
return SslServerCredentials(ssl_opts);
} else {
- grpc::unique_lock<grpc::mutex> lock(mu_);
+ std::unique_lock<std::mutex> lock(mu_);
auto it(std::find(added_secure_type_names_.begin(),
added_secure_type_names_.end(), type));
if (it == added_secure_type_names_.end()) {
@@ -127,10 +127,10 @@ class DefaultCredentialsProvider : public CredentialsProvider {
->GetServerCredentials();
}
}
- std::vector<grpc::string> GetSecureCredentialsTypeList() GRPC_OVERRIDE {
+ std::vector<grpc::string> GetSecureCredentialsTypeList() override {
std::vector<grpc::string> types;
types.push_back(grpc::testing::kTlsCredentialsType);
- grpc::unique_lock<grpc::mutex> lock(mu_);
+ std::unique_lock<std::mutex> lock(mu_);
for (auto it = added_secure_type_names_.begin();
it != added_secure_type_names_.end(); it++) {
types.push_back(*it);
@@ -139,7 +139,7 @@ class DefaultCredentialsProvider : public CredentialsProvider {
}
private:
- grpc::mutex mu_;
+ std::mutex mu_;
std::vector<grpc::string> added_secure_type_names_;
std::vector<std::unique_ptr<CredentialTypeProvider>>
added_secure_type_providers_;