aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/cpp/util
diff options
context:
space:
mode:
authorGravatar ncteisen <ncteisen@gmail.com>2018-06-13 23:00:07 -0700
committerGravatar ncteisen <ncteisen@gmail.com>2018-06-13 23:00:07 -0700
commitf92460e539405bbca98af3547edd3150d0fcca40 (patch)
treedea35a54d1f6db8135df398c6e5a328ba3489609 /test/cpp/util
parent19ac7c0baf298be51c0dbfa7d5bcd1f45eec7c78 (diff)
parent9a2c0a8641d1837185a60436adf9419209f89fbe (diff)
Merge branch 'master' of https://github.com/grpc/grpc into channelz
Diffstat (limited to 'test/cpp/util')
-rw-r--r--test/cpp/util/BUILD2
-rw-r--r--test/cpp/util/grpc_tool.cc28
2 files changed, 24 insertions, 6 deletions
diff --git a/test/cpp/util/BUILD b/test/cpp/util/BUILD
index b1153d2df3..9b42bb28b1 100644
--- a/test/cpp/util/BUILD
+++ b/test/cpp/util/BUILD
@@ -217,6 +217,7 @@ grpc_cc_test(
],
deps = [
"//:grpc++",
+ "//test/core/util:gpr_test_util",
],
)
@@ -260,6 +261,7 @@ 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/grpc_tool.cc b/test/cpp/util/grpc_tool.cc
index 195b6bd304..840ca07d2b 100644
--- a/test/cpp/util/grpc_tool.cc
+++ b/test/cpp/util/grpc_tool.cc
@@ -471,17 +471,26 @@ bool GrpcTool::CallMethod(int argc, const char** argv,
std::shared_ptr<grpc::Channel> channel =
grpc::CreateChannel(server_address, cred.GetCredentials());
- parser.reset(new grpc::testing::ProtoFileParser(
- FLAGS_remotedb ? channel : nullptr, FLAGS_proto_path, FLAGS_protofiles));
+ if (!FLAGS_binary_input || !FLAGS_binary_output) {
+ parser.reset(
+ new grpc::testing::ProtoFileParser(FLAGS_remotedb ? channel : nullptr,
+ FLAGS_proto_path, FLAGS_protofiles));
+ if (parser->HasError()) {
+ fprintf(
+ stderr,
+ "Failed to find remote reflection service and local proto files.\n");
+ return false;
+ }
+ }
if (FLAGS_binary_input) {
formatted_method_name = method_name;
} else {
formatted_method_name = parser->GetFormattedMethodName(method_name);
- }
-
- if (parser->HasError()) {
- return false;
+ if (parser->HasError()) {
+ fprintf(stderr, "Failed to find method %s in proto files.\n",
+ method_name.c_str());
+ }
}
if (argc == 3) {
@@ -711,6 +720,7 @@ bool GrpcTool::CallMethod(int argc, const char** argv,
serialized_request_proto = parser->GetSerializedProtoFromMethod(
method_name, request_text, true /* is_request */);
if (parser->HasError()) {
+ fprintf(stderr, "Failed to parse request.\n");
return false;
}
}
@@ -735,6 +745,7 @@ bool GrpcTool::CallMethod(int argc, const char** argv,
serialized_response_proto = parser->GetTextFormatFromMethod(
method_name, serialized_response_proto, false /* is_request */);
if (parser->HasError()) {
+ fprintf(stderr, "Failed to parse response.\n");
return false;
}
}
@@ -814,6 +825,9 @@ bool GrpcTool::ParseMessage(int argc, const char** argv,
new grpc::testing::ProtoFileParser(FLAGS_remotedb ? channel : nullptr,
FLAGS_proto_path, FLAGS_protofiles));
if (parser->HasError()) {
+ fprintf(
+ stderr,
+ "Failed to find remote reflection service and local proto files.\n");
return false;
}
}
@@ -824,6 +838,7 @@ bool GrpcTool::ParseMessage(int argc, const char** argv,
serialized_request_proto =
parser->GetSerializedProtoFromMessageType(type_name, message_text);
if (parser->HasError()) {
+ fprintf(stderr, "Failed to serialize the message.\n");
return false;
}
}
@@ -834,6 +849,7 @@ bool GrpcTool::ParseMessage(int argc, const char** argv,
grpc::string output_text = parser->GetTextFormatFromMessageType(
type_name, serialized_request_proto);
if (parser->HasError()) {
+ fprintf(stderr, "Failed to deserialize the message.\n");
return false;
}
output_ss << output_text << std::endl;