aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Noah Eisen <ncteisen@google.com>2018-06-07 22:52:23 -0700
committerGravatar ncteisen <ncteisen@gmail.com>2018-06-14 14:58:09 -0400
commit373fc6dc40a7d12bb257d67188ca3aa3c997d8a6 (patch)
treea0bf04f2f5ee080b1adeb6d9dc59a91157ae0d45
parent58e0cbf9fb67186ee67be5bb71aba36e9cfebe7f (diff)
Manual fixes to enable performance- clang tidy checks
-rw-r--r--test/cpp/codegen/golden_file_test.cc4
-rw-r--r--test/cpp/end2end/async_end2end_test.cc14
-rw-r--r--test/cpp/interop/http2_client.cc11
-rw-r--r--test/cpp/interop/http2_client.h6
-rw-r--r--test/cpp/interop/interop_client.cc4
-rw-r--r--test/cpp/interop/interop_client.h4
-rw-r--r--test/cpp/interop/interop_server.cc8
-rw-r--r--test/cpp/interop/server_helper.h8
-rw-r--r--test/cpp/naming/resolver_component_test.cc6
-rw-r--r--test/cpp/naming/resolver_component_tests_runner_invoker.cc26
-rw-r--r--test/cpp/qps/client.h2
-rw-r--r--test/cpp/qps/client_async.cc14
-rw-r--r--test/cpp/qps/client_sync.cc2
-rw-r--r--test/cpp/qps/driver.cc1
14 files changed, 55 insertions, 55 deletions
diff --git a/test/cpp/codegen/golden_file_test.cc b/test/cpp/codegen/golden_file_test.cc
index 7e4d15a7c9..bfd3649494 100644
--- a/test/cpp/codegen/golden_file_test.cc
+++ b/test/cpp/codegen/golden_file_test.cc
@@ -37,8 +37,8 @@ DEFINE_string(
const char kGoldenFilePath[] = "test/cpp/codegen/compiler_test_golden";
const char kMockGoldenFilePath[] = "test/cpp/codegen/compiler_test_mock_golden";
-void run_test(std::basic_string<char> generated_file,
- std::basic_string<char> golden_file) {
+void run_test(const std::basic_string<char>& generated_file,
+ const std::basic_string<char>& golden_file) {
std::ifstream generated(generated_file);
std::ifstream golden(golden_file);
diff --git a/test/cpp/end2end/async_end2end_test.cc b/test/cpp/end2end/async_end2end_test.cc
index 87bba2263f..3d31c9d810 100644
--- a/test/cpp/end2end/async_end2end_test.cc
+++ b/test/cpp/end2end/async_end2end_test.cc
@@ -891,7 +891,7 @@ TEST_P(AsyncEnd2endTest, ClientInitialMetadataRpc) {
cq_.get(), tag(2));
Verifier().Expect(2, true).Verify(cq_.get());
EXPECT_EQ(send_request.message(), recv_request.message());
- auto client_initial_metadata = srv_ctx.client_metadata();
+ const auto& client_initial_metadata = srv_ctx.client_metadata();
EXPECT_EQ(meta1.second,
ToString(client_initial_metadata.find(meta1.first)->second));
EXPECT_EQ(meta2.second,
@@ -937,7 +937,7 @@ TEST_P(AsyncEnd2endTest, ServerInitialMetadataRpc) {
srv_ctx.AddInitialMetadata(meta2.first, meta2.second);
response_writer.SendInitialMetadata(tag(3));
Verifier().Expect(3, true).Expect(4, true).Verify(cq_.get());
- auto server_initial_metadata = cli_ctx.GetServerInitialMetadata();
+ const auto& server_initial_metadata = cli_ctx.GetServerInitialMetadata();
EXPECT_EQ(meta1.second,
ToString(server_initial_metadata.find(meta1.first)->second));
EXPECT_EQ(meta2.second,
@@ -990,7 +990,7 @@ TEST_P(AsyncEnd2endTest, ServerTrailingMetadataRpc) {
EXPECT_EQ(send_response.message(), recv_response.message());
EXPECT_TRUE(recv_status.ok());
- auto server_trailing_metadata = cli_ctx.GetServerTrailingMetadata();
+ const auto& server_trailing_metadata = cli_ctx.GetServerTrailingMetadata();
EXPECT_EQ(meta1.second,
ToString(server_trailing_metadata.find(meta1.first)->second));
EXPECT_EQ(meta2.second,
@@ -1038,7 +1038,7 @@ TEST_P(AsyncEnd2endTest, MetadataRpc) {
cq_.get(), tag(2));
Verifier().Expect(2, true).Verify(cq_.get());
EXPECT_EQ(send_request.message(), recv_request.message());
- auto client_initial_metadata = srv_ctx.client_metadata();
+ const auto& client_initial_metadata = srv_ctx.client_metadata();
EXPECT_EQ(meta1.second,
ToString(client_initial_metadata.find(meta1.first)->second));
EXPECT_EQ(meta2.second,
@@ -1049,7 +1049,7 @@ TEST_P(AsyncEnd2endTest, MetadataRpc) {
srv_ctx.AddInitialMetadata(meta4.first, meta4.second);
response_writer.SendInitialMetadata(tag(3));
Verifier().Expect(3, true).Expect(4, true).Verify(cq_.get());
- auto server_initial_metadata = cli_ctx.GetServerInitialMetadata();
+ const auto& server_initial_metadata = cli_ctx.GetServerInitialMetadata();
EXPECT_EQ(meta3.second,
ToString(server_initial_metadata.find(meta3.first)->second));
EXPECT_EQ(meta4.second,
@@ -1066,7 +1066,7 @@ TEST_P(AsyncEnd2endTest, MetadataRpc) {
EXPECT_EQ(send_response.message(), recv_response.message());
EXPECT_TRUE(recv_status.ok());
- auto server_trailing_metadata = cli_ctx.GetServerTrailingMetadata();
+ const auto& server_trailing_metadata = cli_ctx.GetServerTrailingMetadata();
EXPECT_EQ(meta5.second,
ToString(server_trailing_metadata.find(meta5.first)->second));
EXPECT_EQ(meta6.second,
@@ -1144,7 +1144,7 @@ TEST_P(AsyncEnd2endTest, ServerCheckDone) {
TEST_P(AsyncEnd2endTest, UnimplementedRpc) {
ChannelArguments args;
- auto channel_creds = GetCredentialsProvider()->GetChannelCredentials(
+ const auto& channel_creds = GetCredentialsProvider()->GetChannelCredentials(
GetParam().credentials_type, &args);
std::shared_ptr<Channel> channel =
!(GetParam().inproc)
diff --git a/test/cpp/interop/http2_client.cc b/test/cpp/interop/http2_client.cc
index 543f159265..bc7f0f5edb 100644
--- a/test/cpp/interop/http2_client.cc
+++ b/test/cpp/interop/http2_client.cc
@@ -42,16 +42,16 @@ const int kLargeRequestSize = 271828;
const int kLargeResponseSize = 314159;
} // namespace
-Http2Client::ServiceStub::ServiceStub(std::shared_ptr<Channel> channel)
- : channel_(channel) {
+Http2Client::ServiceStub::ServiceStub(const std::shared_ptr<Channel>& channel)
+ : channel_(std::move(channel)) {
stub_ = TestService::NewStub(channel);
}
TestService::Stub* Http2Client::ServiceStub::Get() { return stub_.get(); }
-Http2Client::Http2Client(std::shared_ptr<Channel> channel)
+Http2Client::Http2Client(const std::shared_ptr<Channel>& channel)
: serviceStub_(channel),
- channel_(channel),
+ channel_(std::move(channel)),
defaultRequest_(BuildDefaultRequest()) {}
bool Http2Client::AssertStatusCode(const Status& s, StatusCode expected_code) {
@@ -140,7 +140,8 @@ bool Http2Client::DoPing() {
return true;
}
-void Http2Client::MaxStreamsWorker(std::shared_ptr<grpc::Channel> channel) {
+void Http2Client::MaxStreamsWorker(
+ const std::shared_ptr<grpc::Channel>& channel) {
SimpleResponse response;
AssertStatusCode(SendUnaryCall(&response), grpc::StatusCode::OK);
GPR_ASSERT(response.payload().body() ==
diff --git a/test/cpp/interop/http2_client.h b/test/cpp/interop/http2_client.h
index 2bcfdd69db..269d3b32e2 100644
--- a/test/cpp/interop/http2_client.h
+++ b/test/cpp/interop/http2_client.h
@@ -31,7 +31,7 @@ namespace testing {
class Http2Client {
public:
- explicit Http2Client(std::shared_ptr<Channel> channel);
+ explicit Http2Client(const std::shared_ptr<Channel>& channel);
~Http2Client() {}
bool DoRstAfterHeader();
@@ -44,7 +44,7 @@ class Http2Client {
private:
class ServiceStub {
public:
- ServiceStub(std::shared_ptr<Channel> channel);
+ ServiceStub(const std::shared_ptr<Channel>& channel);
TestService::Stub* Get();
@@ -53,7 +53,7 @@ class Http2Client {
std::shared_ptr<Channel> channel_;
};
- void MaxStreamsWorker(std::shared_ptr<grpc::Channel> channel);
+ void MaxStreamsWorker(const std::shared_ptr<grpc::Channel>& channel);
bool AssertStatusCode(const Status& s, StatusCode expected_code);
Status SendUnaryCall(SimpleResponse* response);
SimpleRequest BuildDefaultRequest();
diff --git a/test/cpp/interop/interop_client.cc b/test/cpp/interop/interop_client.cc
index aaaa21de5b..fce99a1697 100644
--- a/test/cpp/interop/interop_client.cc
+++ b/test/cpp/interop/interop_client.cc
@@ -113,11 +113,11 @@ void InteropClient::ServiceStub::Reset(
}
}
-void InteropClient::Reset(std::shared_ptr<Channel> channel) {
+void InteropClient::Reset(const std::shared_ptr<Channel>& channel) {
serviceStub_.Reset(std::move(channel));
}
-InteropClient::InteropClient(std::shared_ptr<Channel> channel,
+InteropClient::InteropClient(const std::shared_ptr<Channel>& channel,
bool new_stub_every_test_case,
bool do_not_abort_on_transient_failures)
: serviceStub_(std::move(channel), new_stub_every_test_case),
diff --git a/test/cpp/interop/interop_client.h b/test/cpp/interop/interop_client.h
index a146212ff6..480eb3f4b6 100644
--- a/test/cpp/interop/interop_client.h
+++ b/test/cpp/interop/interop_client.h
@@ -40,12 +40,12 @@ class InteropClient {
/// created for every test case
/// If do_not_abort_on_transient_failures is true, abort() is not called in
/// case of transient failures (like connection failures)
- explicit InteropClient(std::shared_ptr<Channel> channel,
+ explicit InteropClient(const std::shared_ptr<Channel>& channel,
bool new_stub_every_test_case,
bool do_not_abort_on_transient_failures);
~InteropClient() {}
- void Reset(std::shared_ptr<Channel> channel);
+ void Reset(const std::shared_ptr<Channel>& channel);
bool DoEmpty();
bool DoLargeUnary();
diff --git a/test/cpp/interop/interop_server.cc b/test/cpp/interop/interop_server.cc
index f55d624b21..6570bbf969 100644
--- a/test/cpp/interop/interop_server.cc
+++ b/test/cpp/interop/interop_server.cc
@@ -317,25 +317,25 @@ class TestServiceImpl : public TestService::Service {
};
void grpc::testing::interop::RunServer(
- std::shared_ptr<ServerCredentials> creds) {
+ const std::shared_ptr<ServerCredentials>& creds) {
RunServer(creds, FLAGS_port, nullptr, nullptr);
}
void grpc::testing::interop::RunServer(
- std::shared_ptr<ServerCredentials> creds,
+ const std::shared_ptr<ServerCredentials>& creds,
std::unique_ptr<std::vector<std::unique_ptr<ServerBuilderOption>>>
server_options) {
RunServer(creds, FLAGS_port, nullptr, std::move(server_options));
}
void grpc::testing::interop::RunServer(
- std::shared_ptr<ServerCredentials> creds, const int port,
+ const std::shared_ptr<ServerCredentials>& creds, const int port,
ServerStartedCondition* server_started_condition) {
RunServer(creds, port, server_started_condition, nullptr);
}
void grpc::testing::interop::RunServer(
- std::shared_ptr<ServerCredentials> creds, const int port,
+ const std::shared_ptr<ServerCredentials>& creds, const int port,
ServerStartedCondition* server_started_condition,
std::unique_ptr<std::vector<std::unique_ptr<ServerBuilderOption>>>
server_options) {
diff --git a/test/cpp/interop/server_helper.h b/test/cpp/interop/server_helper.h
index 265874df70..1bfbf8e474 100644
--- a/test/cpp/interop/server_helper.h
+++ b/test/cpp/interop/server_helper.h
@@ -63,7 +63,7 @@ struct ServerStartedCondition {
/// Run gRPC interop server using port FLAGS_port.
///
/// \param creds The credentials associated with the server.
-void RunServer(std::shared_ptr<ServerCredentials> creds);
+void RunServer(const std::shared_ptr<ServerCredentials>& creds);
/// Run gRPC interop server.
///
@@ -71,7 +71,7 @@ void RunServer(std::shared_ptr<ServerCredentials> creds);
/// \param port Port to use for the server.
/// \param server_started_condition (optional) Struct holding mutex, condition
/// variable, and condition used to notify when the server has started.
-void RunServer(std::shared_ptr<ServerCredentials> creds, int port,
+void RunServer(const std::shared_ptr<ServerCredentials>& creds, int port,
ServerStartedCondition* server_started_condition);
/// Run gRPC interop server.
@@ -79,7 +79,7 @@ void RunServer(std::shared_ptr<ServerCredentials> creds, int port,
/// \param creds The credentials associated with the server.
/// \param server_options List of options to set when building the server.
void RunServer(
- std::shared_ptr<ServerCredentials> creds,
+ const std::shared_ptr<ServerCredentials>& creds,
std::unique_ptr<std::vector<std::unique_ptr<ServerBuilderOption>>>
server_options);
@@ -91,7 +91,7 @@ void RunServer(
/// \param server_started_condition (optional) Struct holding mutex, condition
// variable, and condition used to notify when the server has started.
void RunServer(
- std::shared_ptr<ServerCredentials> creds, const int port,
+ const std::shared_ptr<ServerCredentials>& creds, const int port,
ServerStartedCondition* server_started_condition,
std::unique_ptr<std::vector<std::unique_ptr<grpc::ServerBuilderOption>>>
server_options);
diff --git a/test/cpp/naming/resolver_component_test.cc b/test/cpp/naming/resolver_component_test.cc
index 07ddfd30ee..6ac548120c 100644
--- a/test/cpp/naming/resolver_component_test.cc
+++ b/test/cpp/naming/resolver_component_test.cc
@@ -90,7 +90,7 @@ namespace {
class GrpcLBAddress final {
public:
GrpcLBAddress(std::string address, bool is_balancer)
- : is_balancer(is_balancer), address(address) {}
+ : is_balancer(is_balancer), address(std::move(address)) {}
bool operator==(const GrpcLBAddress& other) const {
return this->is_balancer == other.is_balancer &&
@@ -109,7 +109,7 @@ vector<GrpcLBAddress> ParseExpectedAddrs(std::string expected_addrs) {
std::vector<GrpcLBAddress> out;
while (expected_addrs.size() != 0) {
// get the next <ip>,<port> (v4 or v6)
- size_t next_comma = expected_addrs.find(",");
+ size_t next_comma = expected_addrs.find(',');
if (next_comma == std::string::npos) {
gpr_log(GPR_ERROR,
"Missing ','. Expected_addrs arg should be a semicolon-separated "
@@ -120,7 +120,7 @@ vector<GrpcLBAddress> ParseExpectedAddrs(std::string expected_addrs) {
std::string next_addr = expected_addrs.substr(0, next_comma);
expected_addrs = expected_addrs.substr(next_comma + 1, std::string::npos);
// get the next is_balancer 'bool' associated with this address
- size_t next_semicolon = expected_addrs.find(";");
+ size_t next_semicolon = expected_addrs.find(';');
bool is_balancer =
gpr_is_true(expected_addrs.substr(0, next_semicolon).c_str());
out.emplace_back(GrpcLBAddress(next_addr, is_balancer));
diff --git a/test/cpp/naming/resolver_component_tests_runner_invoker.cc b/test/cpp/naming/resolver_component_tests_runner_invoker.cc
index 45c1029caa..68be00a67d 100644
--- a/test/cpp/naming/resolver_component_tests_runner_invoker.cc
+++ b/test/cpp/naming/resolver_component_tests_runner_invoker.cc
@@ -99,21 +99,21 @@ namespace grpc {
namespace testing {
-void InvokeResolverComponentTestsRunner(std::string test_runner_bin_path,
- std::string test_bin_path,
- std::string dns_server_bin_path,
- std::string records_config_path,
- std::string dns_resolver_bin_path,
- std::string tcp_connect_bin_path) {
+void InvokeResolverComponentTestsRunner(
+ std::string test_runner_bin_path, const std::string& test_bin_path,
+ const std::string& dns_server_bin_path,
+ const std::string& records_config_path,
+ const std::string& dns_resolver_bin_path,
+ const std::string& tcp_connect_bin_path) {
int dns_server_port = grpc_pick_unused_port_or_die();
- SubProcess* test_driver =
- new SubProcess({test_runner_bin_path, "--test_bin_path=" + test_bin_path,
- "--dns_server_bin_path=" + dns_server_bin_path,
- "--records_config_path=" + records_config_path,
- "--dns_server_port=" + std::to_string(dns_server_port),
- "--dns_resolver_bin_path=" + dns_resolver_bin_path,
- "--tcp_connect_bin_path=" + tcp_connect_bin_path});
+ SubProcess* test_driver = new SubProcess(
+ {std::move(test_runner_bin_path), "--test_bin_path=" + test_bin_path,
+ "--dns_server_bin_path=" + dns_server_bin_path,
+ "--records_config_path=" + records_config_path,
+ "--dns_server_port=" + std::to_string(dns_server_port),
+ "--dns_resolver_bin_path=" + dns_resolver_bin_path,
+ "--tcp_connect_bin_path=" + tcp_connect_bin_path});
gpr_mu test_driver_mu;
gpr_mu_init(&test_driver_mu);
gpr_cv test_driver_cv;
diff --git a/test/cpp/qps/client.h b/test/cpp/qps/client.h
index 31ae6ca1fb..9d58ea8882 100644
--- a/test/cpp/qps/client.h
+++ b/test/cpp/qps/client.h
@@ -450,7 +450,7 @@ class ClientImpl : public Client {
private:
void set_channel_args(const ClientConfig& config, ChannelArguments* args) {
- for (auto channel_arg : config.channel_args()) {
+ for (const auto& channel_arg : config.channel_args()) {
if (channel_arg.value_case() == ChannelArg::kStrValue) {
args->SetString(channel_arg.name(), channel_arg.str_value());
} else if (channel_arg.value_case() == ChannelArg::kIntValue) {
diff --git a/test/cpp/qps/client_async.cc b/test/cpp/qps/client_async.cc
index e6dbb7e076..bad24cf04a 100644
--- a/test/cpp/qps/client_async.cc
+++ b/test/cpp/qps/client_async.cc
@@ -299,7 +299,7 @@ class AsyncClient : public ClientImpl<StubType, RequestType> {
};
static std::unique_ptr<BenchmarkService::Stub> BenchmarkStubCreator(
- std::shared_ptr<Channel> ch) {
+ const std::shared_ptr<Channel>& ch) {
return BenchmarkService::NewStub(ch);
}
@@ -314,7 +314,7 @@ class AsyncUnaryClient final
~AsyncUnaryClient() override {}
private:
- static void CheckDone(grpc::Status s, SimpleResponse* response,
+ static void CheckDone(const grpc::Status& s, SimpleResponse* response,
HistogramEntry* entry) {
entry->set_status(s.error_code());
}
@@ -498,7 +498,7 @@ class AsyncStreamingPingPongClient final
~AsyncStreamingPingPongClient() override {}
private:
- static void CheckDone(grpc::Status s, SimpleResponse* response) {}
+ static void CheckDone(const grpc::Status& s, SimpleResponse* response) {}
static std::unique_ptr<
grpc::ClientAsyncReaderWriter<SimpleRequest, SimpleResponse>>
PrepareReq(BenchmarkService::Stub* stub, grpc::ClientContext* ctx,
@@ -630,7 +630,7 @@ class AsyncStreamingFromClientClient final
~AsyncStreamingFromClientClient() override {}
private:
- static void CheckDone(grpc::Status s, SimpleResponse* response) {}
+ static void CheckDone(const grpc::Status& s, SimpleResponse* response) {}
static std::unique_ptr<grpc::ClientAsyncWriter<SimpleRequest>> PrepareReq(
BenchmarkService::Stub* stub, grpc::ClientContext* ctx,
SimpleResponse* resp, CompletionQueue* cq) {
@@ -745,7 +745,7 @@ class AsyncStreamingFromServerClient final
~AsyncStreamingFromServerClient() override {}
private:
- static void CheckDone(grpc::Status s, SimpleResponse* response) {}
+ static void CheckDone(const grpc::Status& s, SimpleResponse* response) {}
static std::unique_ptr<grpc::ClientAsyncReader<SimpleResponse>> PrepareReq(
BenchmarkService::Stub* stub, grpc::ClientContext* ctx,
const SimpleRequest& req, CompletionQueue* cq) {
@@ -895,7 +895,7 @@ class ClientRpcContextGenericStreamingImpl : public ClientRpcContext {
};
static std::unique_ptr<grpc::GenericStub> GenericStubCreator(
- std::shared_ptr<Channel> ch) {
+ const std::shared_ptr<Channel>& ch) {
return std::unique_ptr<grpc::GenericStub>(new grpc::GenericStub(ch));
}
@@ -911,7 +911,7 @@ class GenericAsyncStreamingClient final
~GenericAsyncStreamingClient() override {}
private:
- static void CheckDone(grpc::Status s, ByteBuffer* response) {}
+ static void CheckDone(const grpc::Status& s, ByteBuffer* response) {}
static std::unique_ptr<grpc::GenericClientAsyncReaderWriter> PrepareReq(
grpc::GenericStub* stub, grpc::ClientContext* ctx,
const grpc::string& method_name, CompletionQueue* cq) {
diff --git a/test/cpp/qps/client_sync.cc b/test/cpp/qps/client_sync.cc
index 3a60c57e1d..668d9abf5c 100644
--- a/test/cpp/qps/client_sync.cc
+++ b/test/cpp/qps/client_sync.cc
@@ -44,7 +44,7 @@ namespace grpc {
namespace testing {
static std::unique_ptr<BenchmarkService::Stub> BenchmarkStubCreator(
- std::shared_ptr<Channel> ch) {
+ const std::shared_ptr<Channel>& ch) {
return BenchmarkService::NewStub(ch);
}
diff --git a/test/cpp/qps/driver.cc b/test/cpp/qps/driver.cc
index ecf5860b93..cabbd51843 100644
--- a/test/cpp/qps/driver.cc
+++ b/test/cpp/qps/driver.cc
@@ -217,7 +217,6 @@ std::unique_ptr<ScenarioResult> RunScenario(
// To be added to the result, containing the final configuration used for
// client and config (including host, etc.)
ClientConfig result_client_config;
- const ServerConfig& result_server_config = initial_server_config;
// Get client, server lists; ignore if inproc test
auto workers = (!run_inproc) ? get_workers("QPS_WORKERS") : deque<string>();