diff options
author | ncteisen <ncteisen@gmail.com> | 2018-06-15 11:13:46 -0400 |
---|---|---|
committer | ncteisen <ncteisen@gmail.com> | 2018-06-15 11:13:46 -0400 |
commit | c14e95fc63302421b71f0939a71d3a2b32c8ab1f (patch) | |
tree | 7a5a865423be974130cd24d3e70067052d6b9d8e /test/cpp/util | |
parent | c7166ae67dd554d41b4d26286da2888aebc0153b (diff) | |
parent | bd6ac0f9d57dda96797bbd5b1bd27815342e7ee5 (diff) |
Merge branch 'master' of https://github.com/grpc/grpc into channelz
Diffstat (limited to 'test/cpp/util')
-rw-r--r-- | test/cpp/util/.clang-tidy | 6 | ||||
-rw-r--r-- | test/cpp/util/BUILD | 2 | ||||
-rw-r--r-- | test/cpp/util/byte_buffer_test.cc | 2 | ||||
-rw-r--r-- | test/cpp/util/cli_call.cc | 5 | ||||
-rw-r--r-- | test/cpp/util/cli_call.h | 3 | ||||
-rw-r--r-- | test/cpp/util/proto_file_parser.cc | 2 | ||||
-rw-r--r-- | test/cpp/util/proto_file_parser.h | 2 | ||||
-rw-r--r-- | test/cpp/util/proto_reflection_descriptor_database.cc | 14 | ||||
-rw-r--r-- | test/cpp/util/proto_reflection_descriptor_database.h | 2 | ||||
-rw-r--r-- | test/cpp/util/string_ref_test.cc | 2 |
10 files changed, 23 insertions, 17 deletions
diff --git a/test/cpp/util/.clang-tidy b/test/cpp/util/.clang-tidy new file mode 100644 index 0000000000..f951ee5fea --- /dev/null +++ b/test/cpp/util/.clang-tidy @@ -0,0 +1,6 @@ +--- +Checks: 'modernize-use-nullptr,google-build-namespaces,google-build-explicit-make-pair,readability-function-size,performance-*,-performance-unnecessary-copy-initialization' +WarningsAsErrors: 'modernize-use-nullptr,google-build-namespaces,google-build-explicit-make-pair,readability-function-size,performance-*,-performance-unnecessary-copy-initialization' +CheckOptions: + - key: readability-function-size.StatementThreshold + value: '450' diff --git a/test/cpp/util/BUILD b/test/cpp/util/BUILD index 9b42bb28b1..b1153d2df3 100644 --- a/test/cpp/util/BUILD +++ b/test/cpp/util/BUILD @@ -217,7 +217,6 @@ grpc_cc_test( ], deps = [ "//:grpc++", - "//test/core/util:gpr_test_util", ], ) @@ -261,7 +260,6 @@ grpc_cc_test( deps = [ "//:grpc++_error_details", "//src/proto/grpc/testing:echo_messages_proto", - "//test/core/util:gpr_test_util", ], ) diff --git a/test/cpp/util/byte_buffer_test.cc b/test/cpp/util/byte_buffer_test.cc index b48a53eed1..9bffbf7ac1 100644 --- a/test/cpp/util/byte_buffer_test.cc +++ b/test/cpp/util/byte_buffer_test.cc @@ -41,7 +41,7 @@ class ByteBufferTest : public ::testing::Test {}; TEST_F(ByteBufferTest, CopyCtor) { ByteBuffer buffer1; EXPECT_FALSE(buffer1.Valid()); - ByteBuffer buffer2 = buffer1; + const ByteBuffer& buffer2 = buffer1; EXPECT_FALSE(buffer2.Valid()); } diff --git a/test/cpp/util/cli_call.cc b/test/cpp/util/cli_call.cc index a3992ab278..c258bde908 100644 --- a/test/cpp/util/cli_call.cc +++ b/test/cpp/util/cli_call.cc @@ -19,6 +19,7 @@ #include "test/cpp/util/cli_call.h" #include <iostream> +#include <utility> #include <grpc/grpc.h> #include <grpc/slice.h> @@ -39,7 +40,7 @@ Status CliCall::Call(std::shared_ptr<grpc::Channel> channel, const OutgoingMetadataContainer& metadata, IncomingMetadataContainer* server_initial_metadata, IncomingMetadataContainer* server_trailing_metadata) { - CliCall call(channel, method, metadata); + CliCall call(std::move(channel), method, metadata); call.Write(request); call.WritesDone(); if (!call.Read(response, server_initial_metadata)) { @@ -48,7 +49,7 @@ Status CliCall::Call(std::shared_ptr<grpc::Channel> channel, return call.Finish(server_trailing_metadata); } -CliCall::CliCall(std::shared_ptr<grpc::Channel> channel, +CliCall::CliCall(const std::shared_ptr<grpc::Channel>& channel, const grpc::string& method, const OutgoingMetadataContainer& metadata) : stub_(new grpc::GenericStub(channel)) { diff --git a/test/cpp/util/cli_call.h b/test/cpp/util/cli_call.h index 51ffafd29f..3f279095a4 100644 --- a/test/cpp/util/cli_call.h +++ b/test/cpp/util/cli_call.h @@ -42,7 +42,8 @@ class CliCall final { typedef std::multimap<grpc::string_ref, grpc::string_ref> IncomingMetadataContainer; - CliCall(std::shared_ptr<grpc::Channel> channel, const grpc::string& method, + CliCall(const std::shared_ptr<grpc::Channel>& channel, + const grpc::string& method, const OutgoingMetadataContainer& metadata); ~CliCall(); diff --git a/test/cpp/util/proto_file_parser.cc b/test/cpp/util/proto_file_parser.cc index 3fc96f38ae..a530ed1ffc 100644 --- a/test/cpp/util/proto_file_parser.cc +++ b/test/cpp/util/proto_file_parser.cc @@ -63,7 +63,7 @@ class ErrorPrinter : public protobuf::compiler::MultiFileErrorCollector { ProtoFileParser* parser_; // not owned }; -ProtoFileParser::ProtoFileParser(std::shared_ptr<grpc::Channel> channel, +ProtoFileParser::ProtoFileParser(const std::shared_ptr<grpc::Channel>& channel, const grpc::string& proto_path, const grpc::string& protofiles) : has_error_(false), diff --git a/test/cpp/util/proto_file_parser.h b/test/cpp/util/proto_file_parser.h index 2236b59451..eb1d793c2b 100644 --- a/test/cpp/util/proto_file_parser.h +++ b/test/cpp/util/proto_file_parser.h @@ -36,7 +36,7 @@ class ProtoFileParser { // The parser will search proto files using the server reflection service // provided on the given channel. The given protofiles in a source tree rooted // from proto_path will also be searched. - ProtoFileParser(std::shared_ptr<grpc::Channel> channel, + ProtoFileParser(const std::shared_ptr<grpc::Channel>& channel, const grpc::string& proto_path, const grpc::string& protofiles); diff --git a/test/cpp/util/proto_reflection_descriptor_database.cc b/test/cpp/util/proto_reflection_descriptor_database.cc index 0adbf20ce6..119272ca42 100644 --- a/test/cpp/util/proto_reflection_descriptor_database.cc +++ b/test/cpp/util/proto_reflection_descriptor_database.cc @@ -35,7 +35,7 @@ ProtoReflectionDescriptorDatabase::ProtoReflectionDescriptorDatabase( : stub_(std::move(stub)) {} ProtoReflectionDescriptorDatabase::ProtoReflectionDescriptorDatabase( - std::shared_ptr<grpc::Channel> channel) + const std::shared_ptr<grpc::Channel>& channel) : stub_(ServerReflection::NewStub(channel)) {} ProtoReflectionDescriptorDatabase::~ProtoReflectionDescriptorDatabase() { @@ -79,7 +79,7 @@ bool ProtoReflectionDescriptorDatabase::FindFileByName( AddFileFromResponse(response.file_descriptor_response()); } else if (response.message_response_case() == ServerReflectionResponse::MessageResponseCase::kErrorResponse) { - const ErrorResponse error = response.error_response(); + const ErrorResponse& error = response.error_response(); if (error.error_code() == StatusCode::NOT_FOUND) { gpr_log(GPR_INFO, "NOT_FOUND from server for FindFileByName(%s)", filename.c_str()); @@ -126,7 +126,7 @@ bool ProtoReflectionDescriptorDatabase::FindFileContainingSymbol( AddFileFromResponse(response.file_descriptor_response()); } else if (response.message_response_case() == ServerReflectionResponse::MessageResponseCase::kErrorResponse) { - const ErrorResponse error = response.error_response(); + const ErrorResponse& error = response.error_response(); if (error.error_code() == StatusCode::NOT_FOUND) { missing_symbols_.insert(symbol_name); gpr_log(GPR_INFO, @@ -182,7 +182,7 @@ bool ProtoReflectionDescriptorDatabase::FindFileContainingExtension( AddFileFromResponse(response.file_descriptor_response()); } else if (response.message_response_case() == ServerReflectionResponse::MessageResponseCase::kErrorResponse) { - const ErrorResponse error = response.error_response(); + const ErrorResponse& error = response.error_response(); if (error.error_code() == StatusCode::NOT_FOUND) { if (missing_extensions_.find(containing_type) == missing_extensions_.end()) { @@ -238,7 +238,7 @@ bool ProtoReflectionDescriptorDatabase::FindAllExtensionNumbers( return true; } else if (response.message_response_case() == ServerReflectionResponse::MessageResponseCase::kErrorResponse) { - const ErrorResponse error = response.error_response(); + const ErrorResponse& error = response.error_response(); if (error.error_code() == StatusCode::NOT_FOUND) { gpr_log(GPR_INFO, "NOT_FOUND from server for FindAllExtensionNumbers(%s)", extendee_type.c_str()); @@ -265,14 +265,14 @@ bool ProtoReflectionDescriptorDatabase::GetServices( if (response.message_response_case() == ServerReflectionResponse::MessageResponseCase::kListServicesResponse) { - const ListServiceResponse ls_response = response.list_services_response(); + const ListServiceResponse& ls_response = response.list_services_response(); for (int i = 0; i < ls_response.service_size(); ++i) { (*output).push_back(ls_response.service(i).name()); } return true; } else if (response.message_response_case() == ServerReflectionResponse::MessageResponseCase::kErrorResponse) { - const ErrorResponse error = response.error_response(); + const ErrorResponse& error = response.error_response(); gpr_log(GPR_INFO, "Error on GetServices()\n\tError code: %d\n" "\tError Message: %s", diff --git a/test/cpp/util/proto_reflection_descriptor_database.h b/test/cpp/util/proto_reflection_descriptor_database.h index e4cf2f207e..46190b3217 100644 --- a/test/cpp/util/proto_reflection_descriptor_database.h +++ b/test/cpp/util/proto_reflection_descriptor_database.h @@ -38,7 +38,7 @@ class ProtoReflectionDescriptorDatabase : public protobuf::DescriptorDatabase { std::unique_ptr<reflection::v1alpha::ServerReflection::Stub> stub); explicit ProtoReflectionDescriptorDatabase( - std::shared_ptr<grpc::Channel> channel); + const std::shared_ptr<grpc::Channel>& channel); virtual ~ProtoReflectionDescriptorDatabase(); diff --git a/test/cpp/util/string_ref_test.cc b/test/cpp/util/string_ref_test.cc index 8f7986e64e..031ec33241 100644 --- a/test/cpp/util/string_ref_test.cc +++ b/test/cpp/util/string_ref_test.cc @@ -60,7 +60,7 @@ TEST_F(StringRefTest, FromString) { TEST_F(StringRefTest, CopyConstructor) { string_ref s1(kTestString); ; - string_ref s2(s1); + const string_ref& s2(s1); EXPECT_EQ(s1.length(), s2.length()); EXPECT_EQ(s1.data(), s2.data()); } |