Allow to run cpp tests under grpc/tests/ using bazel. (#6040)

This is the first step to upgrade grpc dependency to the latest version.

- Patch protobuf 3.6.1. and grpc 1.15.1 to fix build errors when using the latest Bazel version (3.4.1).
- Add grpc/tests:grpc_test. One can kick off tests in Bazel by calling `bazel test grpc/tests/...`.
- Add missing build targets in tests/BUILD in order to support grpc/tests/BUILD
This commit is contained in:
Shengzhe
2020-07-21 11:08:01 -07:00
committed by GitHub
parent 6d0aae73cd
commit c8fa0afdfc
11 changed files with 166 additions and 6 deletions

View File

@@ -9,6 +9,7 @@ cc_test(
srcs = [
"evolution_test/evolution_v1_generated.h",
"evolution_test/evolution_v2_generated.h",
"monster_test_bfbs_generated.h",
"namespace_test/namespace_test1_generated.h",
"namespace_test/namespace_test2_generated.h",
"native_type_test_impl.cpp",
@@ -19,7 +20,6 @@ cc_test(
"test_builder.cpp",
"test_builder.h",
"union_vector/union_vector_generated.h",
"monster_test_bfbs_generated.h",
],
copts = [
"-DFLATBUFFERS_TRACK_VERIFIER_BUFFER_SIZE",
@@ -70,6 +70,45 @@ cc_test(
# Test bzl rules
load("//:build_defs.bzl", "flatbuffer_cc_library")
cc_library(
name = "test_assert",
srcs = ["test_assert.cpp"],
hdrs = ["test_assert.h"],
visibility = ["//grpc/tests:__subpackages__"],
deps = ["//:flatbuffers"],
)
cc_library(
name = "test_builder",
srcs = ["test_builder.cpp"],
hdrs = ["test_builder.h"],
visibility = ["//grpc/tests:__subpackages__"],
deps = [
":monster_test_grpc",
":test_assert",
"//:flatbuffers",
],
)
cc_library(
name = "monster_test_grpc",
srcs = [
"monster_test.grpc.fb.cc",
"monster_test.grpc.fb.h",
"monster_test_generated.h",
],
hdrs = [
"monster_test.grpc.fb.h",
"monster_test_generated.h",
],
includes = ["."],
visibility = ["//grpc/tests:__subpackages__"],
deps = [
"//:flatbuffers",
"@com_github_grpc_grpc//:grpc++",
],
)
flatbuffer_cc_library(
name = "monster_test_cc_fbs",
srcs = ["monster_test.fbs"],
@@ -78,6 +117,7 @@ flatbuffer_cc_library(
"include_test/include_test1.fbs",
"include_test/sub/include_test2.fbs",
],
visibility = ["//grpc/tests:__subpackages__"],
)
flatbuffer_cc_library(