Fix echo.proto path under bazel

pull/14266/head
Adele Zhou 7 years ago
parent d6358a5b0a
commit 2294031d6a
  1. 5
      src/proto/grpc/testing/BUILD
  2. 4
      test/cpp/util/BUILD
  3. 6
      test/cpp/util/grpc_tool_test.cc

@ -18,6 +18,11 @@ load("//bazel:grpc_build_system.bzl", "grpc_proto_library", "grpc_package")
grpc_package(name = "testing", visibility = "public") grpc_package(name = "testing", visibility = "public")
exports_files([
"echo.proto",
"echo_messages.proto",
])
grpc_proto_library( grpc_proto_library(
name = "compiler_test_proto", name = "compiler_test_proto",
srcs = ["compiler_test.proto"], srcs = ["compiler_test.proto"],

@ -140,6 +140,10 @@ grpc_cc_test(
srcs = [ srcs = [
"grpc_tool_test.cc", "grpc_tool_test.cc",
], ],
data = [
"//src/proto/grpc/testing:echo.proto",
"//src/proto/grpc/testing:echo_messages.proto"
],
deps = [ deps = [
":grpc_cli_libs", ":grpc_cli_libs",
":test_util", ":test_util",

@ -31,6 +31,7 @@
#include <grpc/grpc.h> #include <grpc/grpc.h>
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include "src/core/lib/gpr/env.h"
#include "src/proto/grpc/testing/echo.grpc.pb.h" #include "src/proto/grpc/testing/echo.grpc.pb.h"
#include "src/proto/grpc/testing/echo.pb.h" #include "src/proto/grpc/testing/echo.pb.h"
#include "test/core/util/port.h" #include "test/core/util/port.h"
@ -87,6 +88,7 @@ DECLARE_bool(l);
DECLARE_bool(batch); DECLARE_bool(batch);
DECLARE_string(metadata); DECLARE_string(metadata);
DECLARE_string(protofiles); DECLARE_string(protofiles);
DECLARE_string(proto_path);
namespace { namespace {
@ -707,6 +709,10 @@ TEST_F(GrpcToolTest, CallCommandWithBadMetadata) {
const char* argv[] = {"grpc_cli", "call", "localhost:10000", "Echo", const char* argv[] = {"grpc_cli", "call", "localhost:10000", "Echo",
"message: 'Hello'"}; "message: 'Hello'"};
FLAGS_protofiles = "src/proto/grpc/testing/echo.proto"; FLAGS_protofiles = "src/proto/grpc/testing/echo.proto";
char* test_srcdir = gpr_getenv("TEST_SRCDIR");
if (test_srcdir != nullptr) {
FLAGS_proto_path = test_srcdir + std::string("/com_github_grpc_grpc");
}
{ {
std::stringstream output_stream; std::stringstream output_stream;

Loading…
Cancel
Save