diff options
61 files changed, 1297 insertions, 572 deletions
@@ -33,13 +33,20 @@ licenses(["notice"]) # 3-clause BSD exports_files(["LICENSE"]) -package(default_visibility = ["//visibility:public"]) +package( + default_visibility = ["//visibility:public"], + features = [ + "-layering_check", + "-parse_headers", + ], +) load( "//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_proto_plugin", "grpc_cc_libraries", + "grpc_generate_one_off_targets", ) # This should be updated along with build.yaml @@ -457,7 +464,7 @@ grpc_cc_library( ) grpc_cc_library( - name = "grpc_base", + name = "grpc_base_c", srcs = [ "src/core/lib/channel/channel_args.c", "src/core/lib/channel/channel_stack.c", @@ -566,7 +573,6 @@ grpc_cc_library( "src/core/lib/surface/completion_queue.c", "src/core/lib/surface/completion_queue_factory.c", "src/core/lib/surface/event_string.c", - "src/core/lib/surface/lame_client.cc", "src/core/lib/surface/metadata_array.c", "src/core/lib/surface/server.c", "src/core/lib/surface/validate_metadata.c", @@ -723,6 +729,17 @@ grpc_cc_library( ) grpc_cc_library( + name = "grpc_base", + language = "c++", + srcs = [ + "src/core/lib/surface/lame_client.cc", + ], + deps = [ + "grpc_base_c", + ] +) + +grpc_cc_library( name = "grpc_client_channel", srcs = [ "src/core/ext/filters/client_channel/channel_connectivity.c", @@ -1459,3 +1476,16 @@ grpc_cc_library( "//src/proto/grpc/reflection/v1alpha:reflection_proto", ], ) + +grpc_cc_library( + name = "grpc++_test", + public_hdrs = [ + "include/grpc++/test/mock_stream.h", + "include/grpc++/test/server_context_test_spouse.h", + ], + deps = [ + ":grpc++", + ], +) + +grpc_generate_one_off_targets() @@ -5,7 +5,7 @@ bind( bind( name = "libssl", - actual = "@submodule_boringssl//:ssl", + actual = "@boringssl//:ssl", ) bind( @@ -49,7 +49,7 @@ bind( ) local_repository( - name = "submodule_boringssl", + name = "boringssl", path = "third_party/boringssl-with-bazel", ) diff --git a/bazel/grpc_build_system.bzl b/bazel/grpc_build_system.bzl index a104fa00a0..4a50cb51fe 100644 --- a/bazel/grpc_build_system.bzl +++ b/bazel/grpc_build_system.bzl @@ -33,7 +33,9 @@ # use to generate other platform's build system files. # -def grpc_cc_library(name, srcs = [], public_hdrs = [], hdrs = [], external_deps = [], deps = [], standalone = False, language = "C++"): +def grpc_cc_library(name, srcs = [], public_hdrs = [], hdrs = [], + external_deps = [], deps = [], standalone = False, + language = "C++", testonly = False, visibility = None): copts = [] if language.upper() == "C": copts = ["-std=c99"] @@ -43,6 +45,8 @@ def grpc_cc_library(name, srcs = [], public_hdrs = [], hdrs = [], external_deps hdrs = hdrs + public_hdrs, deps = deps + ["//external:" + dep for dep in external_deps], copts = copts, + visibility = visibility, + testonly = testonly, linkopts = ["-pthread"], includes = [ "include" @@ -86,3 +90,38 @@ def grpc_proto_library(name, srcs = [], deps = [], well_known_protos = None, generate_mock = generate_mock, ) +def grpc_cc_test(name, srcs = [], deps = [], external_deps = [], args = [], data = [], language = "C++"): + native.cc_test( + name = name, + srcs = srcs, + args = args, + data = data, + deps = deps + ["//external:" + dep for dep in external_deps], + linkopts = ["-pthread"], + ) + +def grpc_cc_binary(name, srcs = [], deps = [], external_deps = [], args = [], data = [], language = "C++", testonly = False, linkshared = False): + copts = [] + if language.upper() == "C": + copts = ["-std=c99"] + native.cc_binary( + name = name, + srcs = srcs, + args = args, + data = data, + testonly = testonly, + linkshared = linkshared, + deps = deps + ["//external:" + dep for dep in external_deps], + copts = copts, + linkopts = ["-pthread"], + ) + +def grpc_generate_one_off_targets(): + pass + +def grpc_sh_test(name, srcs, args = [], data = []): + native.sh_test( + name = name, + srcs = srcs, + args = args, + data = data) diff --git a/examples/BUILD b/examples/BUILD index 382713e5e4..bd2d3c3150 100644 --- a/examples/BUILD +++ b/examples/BUILD @@ -54,13 +54,13 @@ grpc_proto_library( cc_binary( name = "greeter_client", srcs = ["cpp/helloworld/greeter_client.cc"], - deps = ["helloworld"], defines = ["BAZEL_BUILD"], + deps = [":helloworld"], ) cc_binary( name = "greeter_server", srcs = ["cpp/helloworld/greeter_server.cc"], - deps = ["helloworld"], defines = ["BAZEL_BUILD"], + deps = [":helloworld"], ) diff --git a/src/core/lib/iomgr/error.c b/src/core/lib/iomgr/error.c index 5f2c989aad..685581b5cb 100644 --- a/src/core/lib/iomgr/error.c +++ b/src/core/lib/iomgr/error.c @@ -769,7 +769,7 @@ grpc_error *grpc_os_error(const char *file, int line, int err, GRPC_ERROR_INT_ERRNO, err), GRPC_ERROR_STR_OS_ERROR, grpc_slice_from_static_string(strerror(err))), - GRPC_ERROR_STR_SYSCALL, grpc_slice_from_static_string(call_name)); + GRPC_ERROR_STR_SYSCALL, grpc_slice_from_copied_string(call_name)); } #ifdef GPR_WINDOWS diff --git a/src/cpp/server/server_cc.cc b/src/cpp/server/server_cc.cc index 2f89aa3dce..7c93bb8683 100644 --- a/src/cpp/server/server_cc.cc +++ b/src/cpp/server/server_cc.cc @@ -686,6 +686,7 @@ bool ServerInterface::GenericAsyncRequest::FinalizeResult(void** tag, StringFromCopiedSlice(call_details_.method); static_cast<GenericServerContext*>(context_)->host_ = StringFromCopiedSlice(call_details_.host); + context_->deadline_ = call_details_.deadline; } grpc_slice_unref(call_details_.method); grpc_slice_unref(call_details_.host); diff --git a/src/csharp/Grpc.Core/Version.csproj.include b/src/csharp/Grpc.Core/Version.csproj.include index 6af2af10bd..8388bfd9cc 100755 --- a/src/csharp/Grpc.Core/Version.csproj.include +++ b/src/csharp/Grpc.Core/Version.csproj.include @@ -2,6 +2,6 @@ <Project> <PropertyGroup> <GrpcCsharpVersion>1.4.0-dev</GrpcCsharpVersion> - <GoogleProtobufVersion>3.2.0</GoogleProtobufVersion> + <GoogleProtobufVersion>3.3.0</GoogleProtobufVersion> </PropertyGroup> </Project> diff --git a/src/proto/grpc/testing/BUILD b/src/proto/grpc/testing/BUILD index 805988c337..5f1c005faf 100644 --- a/src/proto/grpc/testing/BUILD +++ b/src/proto/grpc/testing/BUILD @@ -42,8 +42,11 @@ grpc_proto_library( grpc_proto_library( name = "control_proto", srcs = ["control.proto"], - deps = ["payloads_proto", "stats_proto"], has_services = False, + deps = [ + "payloads_proto", + "stats_proto", + ], ) grpc_proto_library( @@ -101,5 +104,8 @@ grpc_proto_library( grpc_proto_library( name = "test_proto", srcs = ["test.proto"], - deps = ["empty_proto", "messages_proto"], + deps = [ + "empty_proto", + "messages_proto", + ], ) diff --git a/templates/src/csharp/Grpc.Core/Version.csproj.include.template b/templates/src/csharp/Grpc.Core/Version.csproj.include.template index 30b8d26375..5bc66e911b 100755 --- a/templates/src/csharp/Grpc.Core/Version.csproj.include.template +++ b/templates/src/csharp/Grpc.Core/Version.csproj.include.template @@ -4,6 +4,6 @@ <Project> <PropertyGroup> <GrpcCsharpVersion>${settings.csharp_version}</GrpcCsharpVersion> - <GoogleProtobufVersion>3.2.0</GoogleProtobufVersion> + <GoogleProtobufVersion>3.3.0</GoogleProtobufVersion> </PropertyGroup> </Project> diff --git a/test/core/bad_client/BUILD b/test/core/bad_client/BUILD index 6b06955efe..bcfd2f1db2 100644 --- a/test/core/bad_client/BUILD +++ b/test/core/bad_client/BUILD @@ -27,6 +27,8 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary") + licenses(["notice"]) # 3-clause BSD load(":generate_tests.bzl", "grpc_bad_client_tests") diff --git a/test/core/bad_client/tests/large_metadata.c b/test/core/bad_client/tests/large_metadata.c index d7a3ce9461..5f3a9c9ca4 100644 --- a/test/core/bad_client/tests/large_metadata.c +++ b/test/core/bad_client/tests/large_metadata.c @@ -212,12 +212,14 @@ static void client_validator(grpc_slice_buffer *incoming) { } int main(int argc, char **argv) { + int i; + grpc_test_init(argc, argv); // Test sending more metadata than the server will accept. gpr_strvec headers; gpr_strvec_init(&headers); - for (int i = 0; i < NUM_HEADERS; ++i) { + for (i = 0; i < NUM_HEADERS; ++i) { char *str; gpr_asprintf(&str, "%s%02d%s", PFX_TOO_MUCH_METADATA_FROM_CLIENT_HEADER_START_STR, i, diff --git a/test/core/bad_ssl/BUILD b/test/core/bad_ssl/BUILD index 288788a52d..61c634ae26 100644 --- a/test/core/bad_ssl/BUILD +++ b/test/core/bad_ssl/BUILD @@ -27,6 +27,8 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary") + licenses(["notice"]) # 3-clause BSD load(":generate_tests.bzl", "grpc_bad_ssl_tests") diff --git a/test/core/census/BUILD b/test/core/census/BUILD index 49680ab91f..3fdf5114e8 100644 --- a/test/core/census/BUILD +++ b/test/core/census/BUILD @@ -27,12 +27,14 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary") + licenses(["notice"]) # 3-clause BSD -cc_test( +grpc_cc_test( name = "context_test", srcs = ["context_test.c"], - copts = ["-std=c99"], + language = "C", deps = [ "//:gpr", "//:grpc", @@ -41,10 +43,10 @@ cc_test( ], ) -cc_test( +grpc_cc_test( name = "mlog_test", srcs = ["mlog_test.c"], - copts = ["-std=c99"], + language = "C", deps = [ "//:gpr", "//:grpc", @@ -53,10 +55,10 @@ cc_test( ], ) -cc_test( +grpc_cc_test( name = "resource_test", srcs = ["resource_test.c"], - copts = ["-std=c99"], + language = "C", data = [ ":data/resource_empty_name.pb", ":data/resource_full.pb", @@ -73,10 +75,10 @@ cc_test( ], ) -cc_test( +grpc_cc_test( name = "trace_context_test", srcs = ["trace_context_test.c"], - copts = ["-std=c99"], + language = "C", data = [ ":data/context_empty.pb", ":data/context_full.pb", diff --git a/test/core/channel/BUILD b/test/core/channel/BUILD index c6590465f1..5e7e8c1ef4 100644 --- a/test/core/channel/BUILD +++ b/test/core/channel/BUILD @@ -27,12 +27,14 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary") + licenses(["notice"]) # 3-clause BSD -cc_test( +grpc_cc_test( name = "channel_args_test", srcs = ["channel_args_test.c"], - copts = ["-std=c99"], + language = "C", deps = [ "//:gpr", "//:grpc", @@ -41,10 +43,10 @@ cc_test( ], ) -cc_test( +grpc_cc_test( name = "channel_stack_test", srcs = ["channel_stack_test.c"], - copts = ["-std=c99"], + language = "C", deps = [ "//:gpr", "//:grpc", diff --git a/test/core/client_channel/BUILD b/test/core/client_channel/BUILD index 55a74c6d01..6c4b40e411 100644 --- a/test/core/client_channel/BUILD +++ b/test/core/client_channel/BUILD @@ -27,21 +27,33 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary") + licenses(["notice"]) # 3-clause BSD load("//test/core/util:grpc_fuzzer.bzl", "grpc_fuzzer") grpc_fuzzer( - name = "uri_fuzzer_test", - srcs = ["uri_fuzzer_test.c"], - deps = ["//:gpr", "//:grpc", "//test/core/util:grpc_test_util"], - corpus = "uri_corpus", - copts = ["-std=c99"], + name = "uri_fuzzer_test", + srcs = ["uri_fuzzer_test.c"], + language = "C", + corpus = "uri_corpus", + deps = [ + "//:gpr", + "//:grpc", + "//test/core/util:grpc_test_util", + ], ) -cc_test( +grpc_cc_test( name = "lb_policies_test", srcs = ["lb_policies_test.c"], - deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util", "//test/core/end2end:cq_verifier"], - copts = ['-std=c99'] + language = "C", + deps = [ + "//:gpr", + "//:grpc", + "//test/core/end2end:cq_verifier", + "//test/core/util:gpr_test_util", + "//test/core/util:grpc_test_util", + ], ) diff --git a/test/core/client_channel/resolvers/BUILD b/test/core/client_channel/resolvers/BUILD index e8361cdef6..80ca7d3ebb 100644 --- a/test/core/client_channel/resolvers/BUILD +++ b/test/core/client_channel/resolvers/BUILD @@ -27,12 +27,14 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary") + licenses(["notice"]) # 3-clause BSD -cc_test( +grpc_cc_test( name = "dns_resolver_connectivity_test", srcs = ["dns_resolver_connectivity_test.c"], - copts = ["-std=c99"], + language = "C", deps = [ "//:gpr", "//:grpc", @@ -41,10 +43,10 @@ cc_test( ], ) -cc_test( +grpc_cc_test( name = "dns_resolver_test", srcs = ["dns_resolver_test.c"], - copts = ["-std=c99"], + language = "C", deps = [ "//:gpr", "//:grpc", @@ -53,10 +55,10 @@ cc_test( ], ) -cc_test( +grpc_cc_test( name = "sockaddr_resolver_test", srcs = ["sockaddr_resolver_test.c"], - copts = ["-std=c99"], + language = "C", deps = [ "//:gpr", "//:grpc", @@ -65,10 +67,10 @@ cc_test( ], ) -cc_test( +grpc_cc_test( name = "fake_resolver_test", srcs = ["fake_resolver_test.c"], - copts = ["-std=c99"], + language = "C", deps = [ "//:gpr", "//:grpc", diff --git a/test/core/compression/BUILD b/test/core/compression/BUILD index 9ddb4c52b4..bbd66bdb52 100644 --- a/test/core/compression/BUILD +++ b/test/core/compression/BUILD @@ -27,12 +27,14 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary") + licenses(["notice"]) # 3-clause BSD -cc_test( +grpc_cc_test( name = "algorithm_test", srcs = ["algorithm_test.c"], - copts = ["-std=c99"], + language = "C", deps = [ "//:gpr", "//:grpc", @@ -41,10 +43,10 @@ cc_test( ], ) -cc_test( +grpc_cc_test( name = "compression_test", srcs = ["compression_test.c"], - copts = ["-std=c99"], + language = "C", deps = [ "//:gpr", "//:grpc", @@ -53,10 +55,10 @@ cc_test( ], ) -cc_test( +grpc_cc_test( name = "message_compress_test", srcs = ["message_compress_test.c"], - copts = ["-std=c99"], + language = "C", deps = [ "//:gpr", "//:grpc", diff --git a/test/core/end2end/BUILD b/test/core/end2end/BUILD index ffea1cc4e8..cf387a93e8 100644 --- a/test/core/end2end/BUILD +++ b/test/core/end2end/BUILD @@ -27,15 +27,17 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary") + licenses(["notice"]) # 3-clause BSD load(":generate_tests.bzl", "grpc_end2end_tests") -cc_library( +grpc_cc_library( name = "cq_verifier", srcs = ["cq_verifier.c"], hdrs = ["cq_verifier.h"], - copts = ["-std=c99"], + language = "C", visibility = ["//test:__subpackages__"], deps = [ "//:gpr", @@ -44,7 +46,7 @@ cc_library( ], ) -cc_library( +grpc_cc_library( name = "ssl_test_data", srcs = [ "data/client_certs.c", @@ -53,15 +55,15 @@ cc_library( "data/test_root_cert.c", ], hdrs = ["data/ssl_test_data.h"], - copts = ["-std=c99"], + language = "C", visibility = ["//test:__subpackages__"], ) -cc_library( +grpc_cc_library( name = "fake_resolver", srcs = ["fake_resolver.c"], hdrs = ["fake_resolver.h"], - copts = ["-std=c99"], + language = "C", visibility = ["//test:__subpackages__"], deps = [ "//:gpr", @@ -70,11 +72,11 @@ cc_library( ], ) -cc_library( +grpc_cc_library( name = "http_proxy", srcs = ["fixtures/http_proxy_fixture.c"], hdrs = ["fixtures/http_proxy_fixture.h"], - copts = ["-std=c99"], + language = "C", deps = [ "//:gpr", "//:grpc", @@ -82,11 +84,11 @@ cc_library( ], ) -cc_library( +grpc_cc_library( name = "proxy", srcs = ["fixtures/proxy.c"], hdrs = ["fixtures/proxy.h"], - copts = ["-std=c99"], + language = "C", deps = [ "//:gpr", "//:grpc", diff --git a/test/core/end2end/fuzzers/BUILD b/test/core/end2end/fuzzers/BUILD index 4d98aa0725..55810bd0b8 100644 --- a/test/core/end2end/fuzzers/BUILD +++ b/test/core/end2end/fuzzers/BUILD @@ -27,30 +27,45 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary") + licenses(["notice"]) # 3-clause BSD load("//test/core/util:grpc_fuzzer.bzl", "grpc_fuzzer") grpc_fuzzer( - name = "api_fuzzer", - srcs = ["api_fuzzer.c"], - deps = ["//:gpr", "//:grpc", "//test/core/util:grpc_test_util", "//test/core/end2end:ssl_test_data"], - corpus = "api_fuzzer_corpus", - copts = ["-std=c99"], + name = "api_fuzzer", + srcs = ["api_fuzzer.c"], + language = "C", + corpus = "api_fuzzer_corpus", + deps = [ + "//:gpr", + "//:grpc", + "//test/core/end2end:ssl_test_data", + "//test/core/util:grpc_test_util", + ], ) grpc_fuzzer( - name = "client_fuzzer", - srcs = ["client_fuzzer.c"], - deps = ["//:gpr", "//:grpc", "//test/core/util:grpc_test_util"], - corpus = "client_fuzzer_corpus", - copts = ["-std=c99"], + name = "client_fuzzer", + srcs = ["client_fuzzer.c"], + language = "C", + corpus = "client_fuzzer_corpus", + deps = [ + "//:gpr", + "//:grpc", + "//test/core/util:grpc_test_util", + ], ) grpc_fuzzer( - name = "server_fuzzer", - srcs = ["server_fuzzer.c"], - deps = ["//:gpr", "//:grpc", "//test/core/util:grpc_test_util"], - corpus = "server_fuzzer_corpus", - copts = ["-std=c99"], + name = "server_fuzzer", + srcs = ["server_fuzzer.c"], + language = "C", + corpus = "server_fuzzer_corpus", + deps = [ + "//:gpr", + "//:grpc", + "//test/core/util:grpc_test_util", + ], ) diff --git a/test/core/end2end/generate_tests.bzl b/test/core/end2end/generate_tests.bzl index e14157849f..a872bc7276 100755 --- a/test/core/end2end/generate_tests.bzl +++ b/test/core/end2end/generate_tests.bzl @@ -28,6 +28,7 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +load("//bazel:grpc_build_system.bzl", "grpc_sh_test", "grpc_cc_binary", "grpc_cc_library") """Generates the appropriate build.json data for all the end2end tests.""" @@ -157,7 +158,7 @@ def compatible(fopt, topt): def grpc_end2end_tests(): - native.cc_library( + grpc_cc_library( name = 'end2end_tests', srcs = ['end2end_tests.c', 'end2end_test_utils.c'] + [ 'tests/%s.c' % t @@ -166,31 +167,33 @@ def grpc_end2end_tests(): 'tests/cancel_test_helpers.h', 'end2end_tests.h' ], - copts = ['-std=c99'], + language = "C", deps = [ ':cq_verifier', ':ssl_test_data', ':fake_resolver', ':http_proxy', ':proxy', - '//test/core/util:grpc_test_util', - '//:grpc', - '//test/core/util:gpr_test_util', - '//:gpr', ] ) for f, fopt in END2END_FIXTURES.items(): - native.cc_binary( + grpc_cc_binary( name = '%s_test' % f, srcs = ['fixtures/%s.c' % f], - copts = ['-std=c99'], - deps = [':end2end_tests'] + language = "C", + deps = [ + ':end2end_tests', + '//test/core/util:grpc_test_util', + '//:grpc', + '//test/core/util:gpr_test_util', + '//:gpr', + ], ) for t, topt in END2END_TESTS.items(): #print(compatible(fopt, topt), f, t, fopt, topt) if not compatible(fopt, topt): continue - native.sh_test( + grpc_sh_test( name = '%s_test@%s' % (f, t), srcs = ['end2end_test.sh'], args = ['$(location %s_test)' % f, t], diff --git a/test/core/fling/BUILD b/test/core/fling/BUILD index 0b0ebcb252..8f17527d44 100644 --- a/test/core/fling/BUILD +++ b/test/core/fling/BUILD @@ -27,36 +27,68 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary") + licenses(["notice"]) # 3-clause BSD load("//test/core/util:grpc_fuzzer.bzl", "grpc_fuzzer") -cc_binary( +grpc_cc_binary( name = "client", - srcs = ["client.c"], - deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util", "//test/core/end2end:ssl_test_data"], testonly = 1, - copts = ['-std=c99'] + srcs = ["client.c"], + language = "C", + deps = [ + "//:gpr", + "//:grpc", + "//test/core/end2end:ssl_test_data", + "//test/core/util:gpr_test_util", + "//test/core/util:grpc_test_util", + ], ) -cc_binary( +grpc_cc_binary( name = "server", - srcs = ["server.c"], - deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util", "//test/core/end2end:ssl_test_data"], testonly = 1, - copts = ['-std=c99'] + srcs = ["server.c"], + language = "C", + deps = [ + "//:gpr", + "//:grpc", + "//test/core/end2end:ssl_test_data", + "//test/core/util:gpr_test_util", + "//test/core/util:grpc_test_util", + ], ) -cc_test( +grpc_cc_test( name = "fling", srcs = ["fling_test.c"], - deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util", "//test/core/end2end:ssl_test_data"], - data = [":client", ":server"] + data = [ + ":client", + ":server", + ], + deps = [ + "//:gpr", + "//:grpc", + "//test/core/end2end:ssl_test_data", + "//test/core/util:gpr_test_util", + "//test/core/util:grpc_test_util", + ], ) -cc_test( +grpc_cc_test( name = "fling_stream", srcs = ["fling_stream_test.c"], - deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util", "//test/core/end2end:ssl_test_data"], - data = [":client", ":server"] + data = [ + ":client", + ":server", + ], + deps = [ + "//:gpr", + "//:grpc", + "//test/core/end2end:ssl_test_data", + "//test/core/util:gpr_test_util", + "//test/core/util:grpc_test_util", + ], ) diff --git a/test/core/handshake/BUILD b/test/core/handshake/BUILD index 996b503d35..bdb91eab8b 100644 --- a/test/core/handshake/BUILD +++ b/test/core/handshake/BUILD @@ -27,12 +27,14 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary") + licenses(["notice"]) # 3-clause BSD -cc_test( +grpc_cc_test( name = "client_ssl", srcs = ["client_ssl.c"], - copts = ["-std=c99"], + language = "C", data = [ "//src/core/tsi/test_creds:ca.pem", "//src/core/tsi/test_creds:server1.key", @@ -46,10 +48,10 @@ cc_test( ], ) -cc_test( +grpc_cc_test( name = "server_ssl", srcs = ["server_ssl.c"], - copts = ["-std=c99"], + language = "C", data = [ "//src/core/tsi/test_creds:ca.pem", "//src/core/tsi/test_creds:server1.key", diff --git a/test/core/http/BUILD b/test/core/http/BUILD index abfa759179..9350daccf4 100644 --- a/test/core/http/BUILD +++ b/test/core/http/BUILD @@ -27,24 +27,34 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary") + licenses(["notice"]) # 3-clause BSD load("//test/core/util:grpc_fuzzer.bzl", "grpc_fuzzer") grpc_fuzzer( - name = "response_fuzzer", - srcs = ["response_fuzzer.c"], - deps = ["//:gpr", "//:grpc", "//test/core/util:grpc_test_util"], - corpus = "response_corpus", - copts = ["-std=c99"], + name = "response_fuzzer", + srcs = ["response_fuzzer.c"], + language = "C", + corpus = "response_corpus", + deps = [ + "//:gpr", + "//:grpc", + "//test/core/util:grpc_test_util", + ], ) grpc_fuzzer( - name = "request_fuzzer", - srcs = ["request_fuzzer.c"], - deps = ["//:gpr", "//:grpc", "//test/core/util:grpc_test_util"], - corpus = "request_corpus", - copts = ["-std=c99"], + name = "request_fuzzer", + srcs = ["request_fuzzer.c"], + language = "C", + corpus = "request_corpus", + deps = [ + "//:gpr", + "//:grpc", + "//test/core/util:grpc_test_util", + ], ) # Copyright 2017, Google Inc. @@ -80,25 +90,43 @@ licenses(["notice"]) # 3-clause BSD load("//test/core/util:grpc_fuzzer.bzl", "grpc_fuzzer") -cc_test( +grpc_cc_test( name = "httpcli_test", srcs = ["httpcli_test.c"], - deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util", "//test/core/end2end:ssl_test_data"], - copts = ['-std=c99'], - data = ['test_server.py'] + language = "C", + data = ["test_server.py"], + deps = [ + "//:gpr", + "//:grpc", + "//test/core/end2end:ssl_test_data", + "//test/core/util:gpr_test_util", + "//test/core/util:grpc_test_util", + ], ) -cc_test( +grpc_cc_test( name = "httpscli_test", srcs = ["httpscli_test.c"], - deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util", "//test/core/end2end:ssl_test_data"], - copts = ['-std=c99'], - data = ['test_server.py'] + language = "C", + data = ["test_server.py"], + deps = [ + "//:gpr", + "//:grpc", + "//test/core/end2end:ssl_test_data", + "//test/core/util:gpr_test_util", + "//test/core/util:grpc_test_util", + ], ) -cc_test( +grpc_cc_test( name = "parser_test", srcs = ["parser_test.c"], - deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util", "//test/core/end2end:ssl_test_data"], - copts = ['-std=c99'] + language = "C", + deps = [ + "//:gpr", + "//:grpc", + "//test/core/end2end:ssl_test_data", + "//test/core/util:gpr_test_util", + "//test/core/util:grpc_test_util", + ], ) diff --git a/test/core/iomgr/BUILD b/test/core/iomgr/BUILD index 808faf57c9..269ca949f6 100644 --- a/test/core/iomgr/BUILD +++ b/test/core/iomgr/BUILD @@ -27,155 +27,266 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary") + licenses(["notice"]) # 3-clause BSD load("//test/core/util:grpc_fuzzer.bzl", "grpc_fuzzer") -cc_library( +package(default_visibility = ["//visibility:public"]) # Useful for third party devs to test their io manager implementation. + +grpc_cc_library( name = "endpoint_tests", srcs = ["endpoint_tests.c"], hdrs = ["endpoint_tests.h"], - deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], + language = "C", visibility = ["//test:__subpackages__"], - copts = ['-std=c99'] + deps = [ + "//:gpr", + "//:grpc", + "//test/core/util:gpr_test_util", + "//test/core/util:grpc_test_util", + ], ) -cc_test( +grpc_cc_test( name = "combiner_test", srcs = ["combiner_test.c"], - deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], - copts = ['-std=c99'] + language = "C", + deps = [ + "//:gpr", + "//:grpc", + "//test/core/util:gpr_test_util", + "//test/core/util:grpc_test_util", + ], ) -cc_test( +grpc_cc_test( name = "endpoint_pair_test", srcs = ["endpoint_pair_test.c"], - deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util", ":endpoint_tests"], - copts = ['-std=c99'] + language = "C", + deps = [ + ":endpoint_tests", + "//:gpr", + "//:grpc", + "//test/core/util:gpr_test_util", + "//test/core/util:grpc_test_util", + ], ) -cc_test( +grpc_cc_test( name = "ev_epollsig_linux_test", srcs = ["ev_epollsig_linux_test.c"], - deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], - copts = ['-std=c99'] + deps = [ + "//:gpr", + "//:grpc", + "//test/core/util:gpr_test_util", + "//test/core/util:grpc_test_util", + ], + language = "C", ) -cc_test( +grpc_cc_test( name = "fd_conservation_posix_test", srcs = ["fd_conservation_posix_test.c"], - deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], - copts = ['-std=c99'] + language = "C", + deps = [ + "//:gpr", + "//:grpc", + "//test/core/util:gpr_test_util", + "//test/core/util:grpc_test_util", + ], ) -cc_test( +grpc_cc_test( name = "fd_posix_test", srcs = ["fd_posix_test.c"], - deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], - copts = ['-std=c99'] + language = "C", + deps = [ + "//:gpr", + "//:grpc", + "//test/core/util:gpr_test_util", + "//test/core/util:grpc_test_util", + ], ) -cc_test( +grpc_cc_test( name = "load_file_test", srcs = ["load_file_test.c"], - deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], - copts = ['-std=c99'] + language = "C", + deps = [ + "//:gpr", + "//:grpc", + "//test/core/util:gpr_test_util", + "//test/core/util:grpc_test_util", + ], ) -cc_test( +grpc_cc_test( name = "pollset_set_test", srcs = ["pollset_set_test.c"], - deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], - copts = ['-std=c99'] + language = "C", + deps = [ + "//:gpr", + "//:grpc", + "//test/core/util:gpr_test_util", + "//test/core/util:grpc_test_util", + ], ) -cc_test( +grpc_cc_test( name = "resolve_address_posix_test", srcs = ["resolve_address_posix_test.c"], - deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], - copts = ['-std=c99'] + language = "C", + deps = [ + "//:gpr", + "//:grpc", + "//test/core/util:gpr_test_util", + "//test/core/util:grpc_test_util", + ], ) -cc_test( +grpc_cc_test( name = "resolve_address_test", srcs = ["resolve_address_test.c"], - deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], - copts = ['-std=c99'] + language = "C", + deps = [ + "//:gpr", + "//:grpc", + "//test/core/util:gpr_test_util", + "//test/core/util:grpc_test_util", + ], ) -cc_test( +grpc_cc_test( name = "resource_quota_test", srcs = ["resource_quota_test.c"], - deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], - copts = ['-std=c99'] + language = "C", + deps = [ + "//:gpr", + "//:grpc", + "//test/core/util:gpr_test_util", + "//test/core/util:grpc_test_util", + ], ) -cc_test( +grpc_cc_test( name = "sockaddr_utils_test", srcs = ["sockaddr_utils_test.c"], - deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], - copts = ['-std=c99'] + language = "C", + deps = [ + "//:gpr", + "//:grpc", + "//test/core/util:gpr_test_util", + "//test/core/util:grpc_test_util", + ], ) -cc_test( +grpc_cc_test( name = "socket_utils_test", srcs = ["socket_utils_test.c"], - deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], - copts = ['-std=c99'] + language = "C", + deps = [ + "//:gpr", + "//:grpc", + "//test/core/util:gpr_test_util", + "//test/core/util:grpc_test_util", + ], ) -cc_test( +grpc_cc_test( name = "tcp_client_posix_test", srcs = ["tcp_client_posix_test.c"], - deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], - copts = ['-std=c99'] + language = "C", + deps = [ + "//:gpr", + "//:grpc", + "//test/core/util:gpr_test_util", + "//test/core/util:grpc_test_util", + ], ) -cc_test( +grpc_cc_test( name = "tcp_posix_test", srcs = ["tcp_posix_test.c"], - deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util", ":endpoint_tests"], - copts = ['-std=c99'] + language = "C", + deps = [ + ":endpoint_tests", + "//:gpr", + "//:grpc", + "//test/core/util:gpr_test_util", + "//test/core/util:grpc_test_util", + ], ) -cc_test( +grpc_cc_test( name = "tcp_server_posix_test", srcs = ["tcp_server_posix_test.c"], - deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], - copts = ['-std=c99'] + language = "C", + deps = [ + "//:gpr", + "//:grpc", + "//test/core/util:gpr_test_util", + "//test/core/util:grpc_test_util", + ], ) -cc_test( +grpc_cc_test( name = "time_averaged_stats_test", srcs = ["time_averaged_stats_test.c"], - deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], - copts = ['-std=c99'] + language = "C", + deps = [ + "//:gpr", + "//:grpc", + "//test/core/util:gpr_test_util", + "//test/core/util:grpc_test_util", + ], ) -cc_test( +grpc_cc_test( name = "timer_heap_test", srcs = ["timer_heap_test.c"], - deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], - copts = ['-std=c99'] + language = "C", + deps = [ + "//:gpr", + "//:grpc", + "//test/core/util:gpr_test_util", + "//test/core/util:grpc_test_util", + ], ) -cc_test( +grpc_cc_test( name = "timer_list_test", srcs = ["timer_list_test.c"], - deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], - copts = ['-std=c99'] + language = "C", + deps = [ + "//:gpr", + "//:grpc", + "//test/core/util:gpr_test_util", + "//test/core/util:grpc_test_util", + ], ) -cc_test( +grpc_cc_test( name = "udp_server_test", srcs = ["udp_server_test.c"], - deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], - copts = ['-std=c99'] + language = "C", + deps = [ + "//:gpr", + "//:grpc", + "//test/core/util:gpr_test_util", + "//test/core/util:grpc_test_util", + ], ) -cc_test( +grpc_cc_test( name = "wakeup_fd_cv_test", srcs = ["wakeup_fd_cv_test.c"], - deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], - copts = ['-std=c99'] + language = "C", + deps = [ + "//:gpr", + "//:grpc", + "//test/core/util:gpr_test_util", + "//test/core/util:grpc_test_util", + ], ) diff --git a/test/core/json/BUILD b/test/core/json/BUILD index f5a877e6af..aba2e2c522 100644 --- a/test/core/json/BUILD +++ b/test/core/json/BUILD @@ -27,44 +27,75 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary") + licenses(["notice"]) # 3-clause BSD load("//test/core/util:grpc_fuzzer.bzl", "grpc_fuzzer") grpc_fuzzer( - name = "json_fuzzer", - srcs = ["fuzzer.c"], - deps = ["//:gpr", "//:grpc", "//test/core/util:grpc_test_util"], - corpus = "corpus", - copts = ["-std=c99"], + name = "json_fuzzer", + srcs = ["fuzzer.c"], + language = "C", + corpus = "corpus", + deps = [ + "//:gpr", + "//:grpc", + "//test/core/util:grpc_test_util", + ], ) -cc_binary( +grpc_cc_binary( name = "json_rewrite", - srcs = ["json_rewrite.c"], - deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], testonly = 1, - copts = ['-std=c99'] + srcs = ["json_rewrite.c"], + language = "C", + deps = [ + "//:gpr", + "//:grpc", + "//test/core/util:gpr_test_util", + "//test/core/util:grpc_test_util", + ], ) -cc_test( +grpc_cc_test( name = "json_rewrite_test", srcs = ["json_rewrite_test.c"], - deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], - copts = ['-std=c99'], - data = ["rewrite_test_input.json", "rewrite_test_output_condensed.json", "rewrite_test_output_indented.json", ":json_stream_error_test"] + language = "C", + data = [ + "rewrite_test_input.json", + "rewrite_test_output_condensed.json", + "rewrite_test_output_indented.json", + ":json_stream_error_test", + ], + deps = [ + "//:gpr", + "//:grpc", + "//test/core/util:gpr_test_util", + "//test/core/util:grpc_test_util", + ], ) -cc_test( +grpc_cc_test( name = "json_stream_error_test", srcs = ["json_stream_error_test.c"], - deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], - copts = ['-std=c99'] + language = "C", + deps = [ + "//:gpr", + "//:grpc", + "//test/core/util:gpr_test_util", + "//test/core/util:grpc_test_util", + ], ) -cc_test( +grpc_cc_test( name = "json_test", srcs = ["json_test.c"], - deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], - copts = ['-std=c99'] + language = "C", + deps = [ + "//:gpr", + "//:grpc", + "//test/core/util:gpr_test_util", + "//test/core/util:grpc_test_util", + ], ) diff --git a/test/core/nanopb/BUILD b/test/core/nanopb/BUILD index b02d750f32..33e9338ed4 100644 --- a/test/core/nanopb/BUILD +++ b/test/core/nanopb/BUILD @@ -27,23 +27,32 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary") + licenses(["notice"]) # 3-clause BSD load("//test/core/util:grpc_fuzzer.bzl", "grpc_fuzzer") grpc_fuzzer( - name = "fuzzer_response", - srcs = ["fuzzer_response.c"], - deps = ["//:gpr", "//:grpc", "//test/core/util:grpc_test_util"], - corpus = "corpus_response", - copts = ["-std=c99"], + name = "fuzzer_response", + srcs = ["fuzzer_response.c"], + language = "C", + corpus = "corpus_response", + deps = [ + "//:gpr", + "//:grpc", + "//test/core/util:grpc_test_util", + ], ) grpc_fuzzer( - name = "fuzzer_serverlist", - srcs = ["fuzzer_serverlist.c"], - deps = ["//:gpr", "//:grpc", "//test/core/util:grpc_test_util"], - corpus = "corpus_serverlist", - copts = ["-std=c99"], + name = "fuzzer_serverlist", + srcs = ["fuzzer_serverlist.c"], + language = "C", + corpus = "corpus_serverlist", + deps = [ + "//:gpr", + "//:grpc", + "//test/core/util:grpc_test_util", + ], ) - diff --git a/test/core/network_benchmarks/BUILD b/test/core/network_benchmarks/BUILD index a5209de4c9..5c243f7347 100644 --- a/test/core/network_benchmarks/BUILD +++ b/test/core/network_benchmarks/BUILD @@ -27,11 +27,18 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary") + licenses(["notice"]) # 3-clause BSD -cc_binary( +grpc_cc_binary( name = "low_level_ping_pong", srcs = ["low_level_ping_pong.c"], - deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], - copts = ['-std=c99'] + language = "C", + deps = [ + "//:gpr", + "//:grpc", + "//test/core/util:gpr_test_util", + "//test/core/util:grpc_test_util", + ], ) diff --git a/test/core/security/BUILD b/test/core/security/BUILD index a81e1d366b..b2d8774e80 100644 --- a/test/core/security/BUILD +++ b/test/core/security/BUILD @@ -27,72 +27,110 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary") + licenses(["notice"]) # 3-clause BSD load("//test/core/util:grpc_fuzzer.bzl", "grpc_fuzzer") grpc_fuzzer( - name = "ssl_server_fuzzer", - srcs = ["ssl_server_fuzzer.c"], - deps = ["//:gpr", "//:grpc", "//test/core/util:grpc_test_util", "//test/core/end2end:ssl_test_data"], - corpus = "corpus", - copts = ["-std=c99"], + name = "ssl_server_fuzzer", + srcs = ["ssl_server_fuzzer.c"], + language = "C", + corpus = "corpus", + deps = [ + "//:gpr", + "//:grpc", + "//test/core/end2end:ssl_test_data", + "//test/core/util:grpc_test_util", + ], ) -cc_library( +grpc_cc_library( name = "oauth2_utils", srcs = ["oauth2_utils.c"], hdrs = ["oauth2_utils.h"], + language = "C", deps = ["//:grpc"], - copts = ['-std=c99'], visibility = ["//test/cpp:__subpackages__"], ) -cc_test( +grpc_cc_test( name = "auth_context_test", srcs = ["auth_context_test.c"], - deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], - copts = ['-std=c99'] + language = "C", + deps = [ + "//:gpr", + "//:grpc", + "//test/core/util:gpr_test_util", + "//test/core/util:grpc_test_util", + ], ) -cc_test( +grpc_cc_test( name = "credentials_test", srcs = ["credentials_test.c"], - deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], - copts = ['-std=c99'] + language = "C", + deps = [ + "//:gpr", + "//:grpc", + "//test/core/util:gpr_test_util", + "//test/core/util:grpc_test_util", + ], ) -cc_test( +grpc_cc_test( name = "secure_endpoint_test", srcs = ["secure_endpoint_test.c"], - deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util", "//test/core/iomgr:endpoint_tests"], - copts = ['-std=c99'] + language = "C", + deps = [ + "//:gpr", + "//:grpc", + "//test/core/iomgr:endpoint_tests", + "//test/core/util:gpr_test_util", + "//test/core/util:grpc_test_util", + ], ) -cc_test( +grpc_cc_test( name = "security_connector_test", srcs = ["security_connector_test.c"], - deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], - copts = ['-std=c99'] + language = "C", + deps = [ + "//:gpr", + "//:grpc", + "//test/core/util:gpr_test_util", + "//test/core/util:grpc_test_util", + ], ) -cc_binary( +grpc_cc_binary( name = "create_jwt", srcs = ["create_jwt.c"], - deps = ["//:grpc", "//:gpr"], - copts = ['-std=c99'] + language = "C", + deps = [ + "//:gpr", + "//:grpc", + ], ) -cc_binary( +grpc_cc_binary( name = "fetch_oauth2", srcs = ["fetch_oauth2.c"], - deps = ["//:grpc", "//:gpr", ":oauth2_utils"], - copts = ['-std=c99'] + language = "C", + deps = [ + ":oauth2_utils", + "//:gpr", + "//:grpc", + ], ) -cc_binary( +grpc_cc_binary( name = "verify_jwt", srcs = ["verify_jwt.c"], - deps = ["//:grpc", "//:gpr"], - copts = ['-std=c99'] + language = "C", + deps = [ + "//:gpr", + "//:grpc", + ], ) diff --git a/test/core/slice/BUILD b/test/core/slice/BUILD index 18cf6f60af..8dc34e7492 100644 --- a/test/core/slice/BUILD +++ b/test/core/slice/BUILD @@ -27,56 +27,77 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary") + licenses(["notice"]) # 3-clause BSD load("//test/core/util:grpc_fuzzer.bzl", "grpc_fuzzer") grpc_fuzzer( - name = "percent_decode_fuzzer", - srcs = ["percent_decode_fuzzer.c"], - deps = ["//:gpr", "//:grpc", "//test/core/util:grpc_test_util"], - corpus = "response_corpus", - copts = ["-std=c99"], + name = "percent_decode_fuzzer", + srcs = ["percent_decode_fuzzer.c"], + language = "C", + corpus = "response_corpus", + deps = [ + "//:gpr", + "//:grpc", + "//test/core/util:grpc_test_util", + ], ) -cc_test( +grpc_cc_test( name = "percent_encoding_test", srcs = ["percent_encoding_test.c"], - deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], - copts = ['-std=c99'] + language = "C", + deps = [ + "//:gpr", + "//:grpc", + "//test/core/util:gpr_test_util", + "//test/core/util:grpc_test_util", + ], ) -cc_test( +grpc_cc_test( name = "slice_test", srcs = ["slice_test.c"], deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], - copts = ['-std=c99'] + language = "C", ) -cc_test( +grpc_cc_test( name = "slice_string_helpers_test", srcs = ["slice_string_helpers_test.c"], - deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], - copts = ['-std=c99'] + language = "C", + deps = [ + "//:gpr", + "//:grpc", + "//test/core/util:gpr_test_util", + "//test/core/util:grpc_test_util", + ], ) -cc_test( +grpc_cc_test( name = "slice_buffer_test", srcs = ["slice_buffer_test.c"], deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], - copts = ['-std=c99'] + language = "C", ) -cc_test( +grpc_cc_test( name = "slice_hash_table_test", srcs = ["slice_hash_table_test.c"], deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], - copts = ['-std=c99'] + language = "C", ) -cc_test( +grpc_cc_test( name = "b64_test", srcs = ["b64_test.c"], - deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], - copts = ['-std=c99'] + language = "C", + deps = [ + "//:gpr", + "//:grpc", + "//test/core/util:gpr_test_util", + "//test/core/util:grpc_test_util", + ], ) diff --git a/test/core/support/BUILD b/test/core/support/BUILD index 3183510db9..db408199fc 100644 --- a/test/core/support/BUILD +++ b/test/core/support/BUILD @@ -27,137 +27,196 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary") + licenses(["notice"]) # 3-clause BSD -cc_test( +grpc_cc_test( name = "alloc_test", srcs = ["alloc_test.c"], - deps = ["//:gpr", "//test/core/util:gpr_test_util"], - copts = ['-std=c99'] + language = "C", + deps = [ + "//:gpr", + "//test/core/util:gpr_test_util", + ], ) -cc_test( +grpc_cc_test( name = "avl_test", srcs = ["avl_test.c"], - deps = ["//:gpr", "//test/core/util:gpr_test_util"], - copts = ['-std=c99'] + language = "C", + deps = [ + "//:gpr", + "//test/core/util:gpr_test_util", + ], ) -cc_test( +grpc_cc_test( name = "backoff_test", srcs = ["backoff_test.c"], - deps = ["//:gpr", "//test/core/util:gpr_test_util"], - copts = ['-std=c99'] + language = "C", + deps = [ + "//:gpr", + "//test/core/util:gpr_test_util", + ], ) -cc_test( +grpc_cc_test( name = "cmdline_test", srcs = ["cmdline_test.c"], - deps = ["//:gpr", "//test/core/util:gpr_test_util"], - copts = ['-std=c99'] + language = "C", + deps = [ + "//:gpr", + "//test/core/util:gpr_test_util", + ], ) -cc_test( +grpc_cc_test( name = "cpu_test", srcs = ["cpu_test.c"], - deps = ["//:gpr", "//test/core/util:gpr_test_util"], - copts = ['-std=c99'] + language = "C", + deps = [ + "//:gpr", + "//test/core/util:gpr_test_util", + ], ) -cc_test( +grpc_cc_test( name = "env_test", srcs = ["env_test.c"], - deps = ["//:gpr", "//test/core/util:gpr_test_util"], - copts = ['-std=c99'] + language = "C", + deps = [ + "//:gpr", + "//test/core/util:gpr_test_util", + ], ) -cc_test( +grpc_cc_test( name = "histogram_test", srcs = ["histogram_test.c"], - deps = ["//:gpr", "//test/core/util:gpr_test_util"], - copts = ['-std=c99'] + language = "C", + deps = [ + "//:gpr", + "//test/core/util:gpr_test_util", + ], ) -cc_test( +grpc_cc_test( name = "host_port_test", srcs = ["host_port_test.c"], - deps = ["//:gpr", "//test/core/util:gpr_test_util"], - copts = ['-std=c99'] + language = "C", + deps = [ + "//:gpr", + "//test/core/util:gpr_test_util", + ], ) -cc_test( +grpc_cc_test( name = "log_test", srcs = ["log_test.c"], - deps = ["//:gpr", "//test/core/util:gpr_test_util"], - copts = ['-std=c99'] + language = "C", + deps = [ + "//:gpr", + "//test/core/util:gpr_test_util", + ], ) -cc_test( +grpc_cc_test( name = "mpscq_test", srcs = ["mpscq_test.c"], - deps = ["//:gpr", "//test/core/util:gpr_test_util"], - copts = ['-std=c99'] + language = "C", + deps = [ + "//:gpr", + "//test/core/util:gpr_test_util", + ], ) -cc_test( +grpc_cc_test( name = "murmur_hash_test", srcs = ["murmur_hash_test.c"], - deps = ["//:gpr", "//test/core/util:gpr_test_util"], - copts = ['-std=c99'] + language = "C", + deps = [ + "//:gpr", + "//test/core/util:gpr_test_util", + ], ) -cc_test( +grpc_cc_test( name = "stack_lockfree_test", srcs = ["stack_lockfree_test.c"], - deps = ["//:gpr", "//test/core/util:gpr_test_util"], - copts = ['-std=c99'] + language = "C", + deps = [ + "//:gpr", + "//test/core/util:gpr_test_util", + ], ) -cc_test( +grpc_cc_test( name = "string_test", srcs = ["string_test.c"], - deps = ["//:gpr", "//test/core/util:gpr_test_util"], - copts = ['-std=c99'] + language = "C", + deps = [ + "//:gpr", + "//test/core/util:gpr_test_util", + ], ) -cc_test( +grpc_cc_test( name = "spinlock_test", srcs = ["spinlock_test.c"], - deps = ["//:gpr", "//test/core/util:gpr_test_util"], - copts = ['-std=c99'] + language = "C", + deps = [ + "//:gpr", + "//test/core/util:gpr_test_util", + ], ) -cc_test( +grpc_cc_test( name = "sync_test", srcs = ["sync_test.c"], - deps = ["//:gpr", "//test/core/util:gpr_test_util"], - copts = ['-std=c99'] + language = "C", + deps = [ + "//:gpr", + "//test/core/util:gpr_test_util", + ], ) -cc_test( +grpc_cc_test( name = "thd_test", srcs = ["thd_test.c"], - deps = ["//:gpr", "//test/core/util:gpr_test_util"], - copts = ['-std=c99'] + language = "C", + deps = [ + "//:gpr", + "//test/core/util:gpr_test_util", + ], ) -cc_test( +grpc_cc_test( name = "time_test", srcs = ["time_test.c"], - deps = ["//:gpr", "//test/core/util:gpr_test_util"], - copts = ['-std=c99'] + language = "C", + deps = [ + "//:gpr", + "//test/core/util:gpr_test_util", + ], ) -cc_test( +grpc_cc_test( name = "tls_test", srcs = ["tls_test.c"], - deps = ["//:gpr", "//test/core/util:gpr_test_util"], - copts = ['-std=c99'] + language = "C", + deps = [ + "//:gpr", + "//test/core/util:gpr_test_util", + ], ) -cc_test( +grpc_cc_test( name = "useful_test", srcs = ["useful_test.c"], - deps = ["//:gpr", "//test/core/util:gpr_test_util"], - copts = ['-std=c99'] + language = "C", + deps = [ + "//:gpr", + "//test/core/util:gpr_test_util", + ], ) diff --git a/test/core/surface/BUILD b/test/core/surface/BUILD index 3d5e26ced3..44d37da0b9 100644 --- a/test/core/surface/BUILD +++ b/test/core/surface/BUILD @@ -27,12 +27,14 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary") + licenses(["notice"]) # 3-clause BSD -cc_test( +grpc_cc_test( name = "alarm_test", srcs = ["alarm_test.c"], - copts = ["-std=c99"], + language = "C", deps = [ "//:gpr", "//:grpc", @@ -41,10 +43,10 @@ cc_test( ], ) -cc_test( +grpc_cc_test( name = "grpc_byte_buffer_reader_test", srcs = ["byte_buffer_reader_test.c"], - copts = ["-std=c99"], + language = "C", deps = [ "//:gpr", "//:grpc", @@ -53,10 +55,10 @@ cc_test( ], ) -cc_test( +grpc_cc_test( name = "channel_create_test", srcs = ["channel_create_test.c"], - copts = ["-std=c99"], + language = "C", deps = [ "//:gpr", "//:grpc", @@ -65,10 +67,10 @@ cc_test( ], ) -cc_test( +grpc_cc_test( name = "grpc_completion_queue_test", srcs = ["completion_queue_test.c"], - copts = ["-std=c99"], + language = "C", deps = [ "//:gpr", "//:grpc", @@ -77,10 +79,10 @@ cc_test( ], ) -cc_test( +grpc_cc_test( name = "concurrent_connectivity_test", srcs = ["concurrent_connectivity_test.c"], - copts = ["-std=c99"], + language = "C", deps = [ "//:gpr", "//:grpc", @@ -89,10 +91,10 @@ cc_test( ], ) -cc_test( +grpc_cc_test( name = "init_test", srcs = ["init_test.c"], - copts = ["-std=c99"], + language = "C", deps = [ "//:gpr", "//:grpc", @@ -101,10 +103,10 @@ cc_test( ], ) -cc_test( +grpc_cc_test( name = "grpc_invalid_channel_args_test", srcs = ["invalid_channel_args_test.c"], - copts = ["-std=c99"], + language = "C", deps = [ "//:gpr", "//:grpc", @@ -113,10 +115,10 @@ cc_test( ], ) -cc_test( +grpc_cc_test( name = "lame_client_test", srcs = ["lame_client_test.c"], - copts = ["-std=c99"], + language = "C", deps = [ "//:gpr", "//:grpc", @@ -126,10 +128,10 @@ cc_test( ], ) -cc_test( +grpc_cc_test( name = "public_headers_must_be_c89", srcs = ["public_headers_must_be_c89.c"], - copts = ["-std=c99"], + language = "C", deps = [ "//:gpr", "//:grpc", @@ -138,10 +140,10 @@ cc_test( ], ) -cc_test( +grpc_cc_test( name = "secure_channel_create_test", srcs = ["secure_channel_create_test.c"], - copts = ["-std=c99"], + language = "C", deps = [ "//:gpr", "//:grpc", @@ -150,10 +152,10 @@ cc_test( ], ) -cc_test( +grpc_cc_test( name = "sequential_connectivity_test", srcs = ["sequential_connectivity_test.c"], - copts = ["-std=c99"], + language = "C", deps = [ "//:gpr", "//:grpc", @@ -163,10 +165,10 @@ cc_test( ], ) -cc_test( +grpc_cc_test( name = "server_chttp2_test", srcs = ["server_chttp2_test.c"], - copts = ["-std=c99"], + language = "C", deps = [ "//:gpr", "//:grpc", @@ -175,10 +177,10 @@ cc_test( ], ) -cc_test( +grpc_cc_test( name = "server_test", srcs = ["server_test.c"], - copts = ["-std=c99"], + language = "C", deps = [ "//:gpr", "//:grpc", diff --git a/test/core/transport/BUILD b/test/core/transport/BUILD index 08b2fd3332..2628c891ec 100644 --- a/test/core/transport/BUILD +++ b/test/core/transport/BUILD @@ -27,53 +27,90 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary") + licenses(["notice"]) # 3-clause BSD -cc_test( +grpc_cc_test( name = "bdp_estimator_test", srcs = ["bdp_estimator_test.c"], - deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], - copts = ['-std=c99'] + language = "C", + deps = [ + "//:gpr", + "//:grpc", + "//test/core/util:gpr_test_util", + "//test/core/util:grpc_test_util", + ], ) -cc_test( +grpc_cc_test( name = "connectivity_state_test", srcs = ["connectivity_state_test.c"], - deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], - copts = ['-std=c99'] + language = "C", + deps = [ + "//:gpr", + "//:grpc", + "//test/core/util:gpr_test_util", + "//test/core/util:grpc_test_util", + ], ) -cc_test( +grpc_cc_test( name = "metadata_test", srcs = ["metadata_test.c"], - deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], - copts = ['-std=c99'] + language = "C", + deps = [ + "//:gpr", + "//:grpc", + "//test/core/util:gpr_test_util", + "//test/core/util:grpc_test_util", + ], ) -cc_test( +grpc_cc_test( name = "pid_controller_test", srcs = ["pid_controller_test.c"], - deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], - copts = ['-std=c99'] + language = "C", + deps = [ + "//:gpr", + "//:grpc", + "//test/core/util:gpr_test_util", + "//test/core/util:grpc_test_util", + ], ) -cc_test( +grpc_cc_test( name = "status_conversion_test", srcs = ["status_conversion_test.c"], - deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], - copts = ['-std=c99'] + language = "C", + deps = [ + "//:gpr", + "//:grpc", + "//test/core/util:gpr_test_util", + "//test/core/util:grpc_test_util", + ], ) -cc_test( +grpc_cc_test( name = "stream_owned_slice_test", srcs = ["stream_owned_slice_test.c"], - deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], - copts = ['-std=c99'] + language = "C", + deps = [ + "//:gpr", + "//:grpc", + "//test/core/util:gpr_test_util", + "//test/core/util:grpc_test_util", + ], ) -cc_test( +grpc_cc_test( name = "timeout_encoding_test", srcs = ["timeout_encoding_test.c"], - deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], - copts = ['-std=c99'] + language = "C", + deps = [ + "//:gpr", + "//:grpc", + "//test/core/util:gpr_test_util", + "//test/core/util:grpc_test_util", + ], ) diff --git a/test/core/transport/chttp2/BUILD b/test/core/transport/chttp2/BUILD index b507e27efe..af2a4aed34 100644 --- a/test/core/transport/chttp2/BUILD +++ b/test/core/transport/chttp2/BUILD @@ -27,69 +27,114 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary") + licenses(["notice"]) # 3-clause BSD load("//test/core/util:grpc_fuzzer.bzl", "grpc_fuzzer") grpc_fuzzer( - name = "hpack_parser_fuzzer", - srcs = ["hpack_parser_fuzzer_test.c"], - deps = ["//:grpc", "//test/core/util:grpc_test_util"], - corpus = "hpack_parser_corpus" + name = "hpack_parser_fuzzer", + srcs = ["hpack_parser_fuzzer_test.c"], + corpus = "hpack_parser_corpus", + deps = [ + "//:grpc", + "//test/core/util:grpc_test_util", + ], ) -cc_test( +grpc_cc_test( name = "alpn_test", srcs = ["alpn_test.c"], - deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], - copts = ['-std=c99'] + language = "C", + deps = [ + "//:gpr", + "//:grpc", + "//test/core/util:gpr_test_util", + "//test/core/util:grpc_test_util", + ], ) -cc_test( +grpc_cc_test( name = "bin_decoder_test", srcs = ["bin_decoder_test.c"], - deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], - copts = ['-std=c99'] + language = "C", + deps = [ + "//:gpr", + "//:grpc", + "//test/core/util:gpr_test_util", + "//test/core/util:grpc_test_util", + ], ) -cc_test( +grpc_cc_test( name = "bin_encoder_test", srcs = ["bin_encoder_test.c"], - deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], - copts = ['-std=c99'] + language = "C", + deps = [ + "//:gpr", + "//:grpc", + "//test/core/util:gpr_test_util", + "//test/core/util:grpc_test_util", + ], ) -cc_test( +grpc_cc_test( name = "hpack_encoder_test", srcs = ["hpack_encoder_test.c"], - deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], - copts = ['-std=c99'] + language = "C", + deps = [ + "//:gpr", + "//:grpc", + "//test/core/util:gpr_test_util", + "//test/core/util:grpc_test_util", + ], ) -cc_test( +grpc_cc_test( name = "hpack_parser_test", srcs = ["hpack_parser_test.c"], - deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], - copts = ['-std=c99'] + language = "C", + deps = [ + "//:gpr", + "//:grpc", + "//test/core/util:gpr_test_util", + "//test/core/util:grpc_test_util", + ], ) -cc_test( +grpc_cc_test( name = "hpack_table_test", srcs = ["hpack_table_test.c"], - deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], - copts = ['-std=c99'] + language = "C", + deps = [ + "//:gpr", + "//:grpc", + "//test/core/util:gpr_test_util", + "//test/core/util:grpc_test_util", + ], ) -cc_test( +grpc_cc_test( name = "stream_map_test", srcs = ["stream_map_test.c"], - deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], - copts = ['-std=c99'] + language = "C", + deps = [ + "//:gpr", + "//:grpc", + "//test/core/util:gpr_test_util", + "//test/core/util:grpc_test_util", + ], ) -cc_test( +grpc_cc_test( name = "varint_test", srcs = ["varint_test.c"], - deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], - copts = ['-std=c99'] + language = "C", + deps = [ + "//:gpr", + "//:grpc", + "//test/core/util:gpr_test_util", + "//test/core/util:grpc_test_util", + ], ) diff --git a/test/core/tsi/BUILD b/test/core/tsi/BUILD index e6cba344ee..a0f2910f73 100644 --- a/test/core/tsi/BUILD +++ b/test/core/tsi/BUILD @@ -27,11 +27,18 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary") + licenses(["notice"]) # 3-clause BSD -cc_test( +grpc_cc_test( name = "transport_security_test", srcs = ["transport_security_test.c"], - deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], - copts = ['-std=c99'] + language = "C", + deps = [ + "//:gpr", + "//:grpc", + "//test/core/util:gpr_test_util", + "//test/core/util:grpc_test_util", + ], ) diff --git a/test/core/util/BUILD b/test/core/util/BUILD index 03c79f1f15..6b994625b9 100644 --- a/test/core/util/BUILD +++ b/test/core/util/BUILD @@ -27,23 +27,26 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary") + licenses(["notice"]) # 3-clause BSD -cc_library( +package(default_visibility = ["//visibility:public"]) + +grpc_cc_library( name = "gpr_test_util", srcs = [ - "test_config.c", "memory_counters.c", + "test_config.c", ], hdrs = [ - "test_config.h", "memory_counters.h", + "test_config.h", ], deps = ["//:gpr"], - visibility = ["//:__subpackages__"], ) -cc_library( +grpc_cc_library( name = "grpc_test_util", srcs = [ "debugger_macros.c", @@ -60,7 +63,6 @@ cc_library( ], hdrs = [ "debugger_macros.h", - "trickle_endpoint.h", "grpc_profiler.h", "mock_endpoint.h", "parse_hexstring.h", @@ -70,21 +72,25 @@ cc_library( "reconnect_server.h", "slice_splitter.h", "test_tcp_server.h", + "trickle_endpoint.h", + ], + language = "C", + deps = [ + ":gpr_test_util", + "//:grpc", ], - deps = [":gpr_test_util", "//:grpc"], - visibility = ["//test:__subpackages__"], - copts = ["-std=c99"], ) -cc_library( - name = "one_corpus_entry_fuzzer", - srcs = ["one_corpus_entry_fuzzer.c"], - deps = [":gpr_test_util", "//:grpc"], - visibility = ["//test:__subpackages__"], +grpc_cc_library( + name = "one_corpus_entry_fuzzer", + srcs = ["one_corpus_entry_fuzzer.c"], + deps = [ + ":gpr_test_util", + "//:grpc", + ], ) sh_library( - name = "fuzzer_one_entry_runner", - srcs = ["fuzzer_one_entry_runner.sh"], - visibility = ["//test:__subpackages__"], + name = "fuzzer_one_entry_runner", + srcs = ["fuzzer_one_entry_runner.sh"], ) diff --git a/test/core/util/grpc_fuzzer.bzl b/test/core/util/grpc_fuzzer.bzl index 2f552a9fdb..2fcb58b5a9 100644 --- a/test/core/util/grpc_fuzzer.bzl +++ b/test/core/util/grpc_fuzzer.bzl @@ -27,8 +27,10 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +load("//bazel:grpc_build_system.bzl", "grpc_cc_binary") + def grpc_fuzzer(name, corpus, srcs = [], deps = [], **kwargs): - native.cc_binary( + grpc_cc_binary( name = '%s/one_entry.bin' % name, srcs = srcs, deps = deps + ["//test/core/util:one_corpus_entry_fuzzer"], diff --git a/test/cpp/codegen/BUILD b/test/cpp/codegen/BUILD index 43d133fc34..f974e63eb4 100644 --- a/test/cpp/codegen/BUILD +++ b/test/cpp/codegen/BUILD @@ -29,37 +29,45 @@ licenses(["notice"]) # 3-clause BSD -cc_test( +load("//bazel:grpc_build_system.bzl", "grpc_cc_test") + +grpc_cc_test( name = "codegen_test_full", srcs = ["codegen_test_full.cc"], deps = [ "//:grpc++", - "//external:gtest", "//test/core/util:gpr_test_util", ], + external_deps = [ + "gtest", + ], ) -cc_test( +grpc_cc_test( name = "codegen_test_minimal", srcs = ["codegen_test_minimal.cc"], deps = [ "//:grpc++", - "//external:gtest", "//test/core/util:gpr_test_util", ], + external_deps = [ + "gtest", + ], ) -cc_test( +grpc_cc_test( name = "proto_utils_test", srcs = ["proto_utils_test.cc"], deps = [ "//:grpc++", - "//external:gtest", "//test/core/util:gpr_test_util", ], + external_deps = [ + "gtest", + ], ) -cc_test( +grpc_cc_test( name = "golden_file_test", srcs = ["golden_file_test.cc"], args = ["--generated_file_path=$(GENDIR)/src/proto/grpc/testing/"], @@ -69,9 +77,11 @@ cc_test( ], deps = [ "//:grpc++", - "//external:gflags", - "//external:gtest", "//src/proto/grpc/testing:compiler_test_proto", "//test/core/util:gpr_test_util", ], + external_deps = [ + "gtest", + "gflags", + ], ) diff --git a/test/cpp/common/BUILD b/test/cpp/common/BUILD index 48ad583981..c8b3e46f5f 100644 --- a/test/cpp/common/BUILD +++ b/test/cpp/common/BUILD @@ -29,32 +29,66 @@ licenses(["notice"]) # 3-clause BSD -cc_test( +load("//bazel:grpc_build_system.bzl", "grpc_cc_test") + +grpc_cc_test( name = "alarm_cpp_test", srcs = ["alarm_cpp_test.cc"], - deps = ["//:grpc++", "//external:gtest", "//test/core/util:gpr_test_util"], + deps = [ + "//:grpc++", + "//test/core/util:gpr_test_util", + ], + external_deps = [ + "gtest", + ], ) -cc_test( +grpc_cc_test( name = "auth_property_iterator_test", srcs = ["auth_property_iterator_test.cc"], - deps = ["//:grpc++", "//external:gtest", "//test/core/util:gpr_test_util", "//test/cpp/util:test_util"], + deps = [ + "//:grpc++", + "//test/core/util:gpr_test_util", + "//test/cpp/util:test_util", + ], + external_deps = [ + "gtest", + ], ) -cc_test( +grpc_cc_test( name = "channel_arguments_test", srcs = ["channel_arguments_test.cc"], - deps = ["//:grpc++", "//external:gtest", "//test/core/util:gpr_test_util"], + deps = [ + "//:grpc++", + "//test/core/util:gpr_test_util", + ], + external_deps = [ + "gtest", + ], ) -cc_test( +grpc_cc_test( name = "channel_filter_test", srcs = ["channel_filter_test.cc"], - deps = ["//:grpc++", "//external:gtest", "//test/core/util:gpr_test_util"], + deps = [ + "//:grpc++", + "//test/core/util:gpr_test_util", + ], + external_deps = [ + "gtest", + ], ) -cc_test( +grpc_cc_test( name = "secure_auth_context_test", srcs = ["secure_auth_context_test.cc"], - deps = ["//:grpc++", "//external:gtest", "//test/core/util:gpr_test_util", "//test/cpp/util:test_util"], + deps = [ + "//:grpc++", + "//test/core/util:gpr_test_util", + "//test/cpp/util:test_util", + ], + external_deps = [ + "gtest", + ], ) diff --git a/test/cpp/end2end/BUILD b/test/cpp/end2end/BUILD index e867493fb9..9b691a83e0 100644 --- a/test/cpp/end2end/BUILD +++ b/test/cpp/end2end/BUILD @@ -29,25 +29,30 @@ licenses(["notice"]) # 3-clause BSD -cc_library( +load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test") + +package(default_visibility=["//visibility:public"]) # Allows external users to implement end2end tests. + +grpc_cc_library( name = "test_service_impl", srcs = ["test_service_impl.cc"], hdrs = ["test_service_impl.h"], deps = [ - "//external:gtest", "//src/proto/grpc/testing:echo_proto", "//test/cpp/util:test_util", ], + external_deps = [ + "gtest", + ], ) -cc_test( +grpc_cc_test( name = "async_end2end_test", srcs = ["async_end2end_test.cc"], deps = [ "//:gpr", "//:grpc", "//:grpc++", - "//external:gtest", "//src/proto/grpc/health/v1:health_proto", "//src/proto/grpc/testing:echo_messages_proto", "//src/proto/grpc/testing:echo_proto", @@ -56,16 +61,18 @@ cc_test( "//test/core/util:grpc_test_util", "//test/cpp/util:test_util", ], + external_deps = [ + "gtest", + ], ) -cc_test( +grpc_cc_test( name = "client_crash_test", srcs = ["client_crash_test.cc"], deps = [ "//:gpr", "//:grpc", "//:grpc++", - "//external:gtest", "//src/proto/grpc/testing:echo_messages_proto", "//src/proto/grpc/testing:echo_proto", "//src/proto/grpc/testing/duplicate:echo_duplicate_proto", @@ -73,17 +80,18 @@ cc_test( "//test/core/util:grpc_test_util", "//test/cpp/util:test_util", ], + external_deps = [ + "gtest", + ], ) -cc_test( +grpc_cc_test( name = "client_crash_test_server", srcs = ["client_crash_test_server.cc"], deps = [ "//:gpr", "//:grpc", "//:grpc++", - "//external:gflags", - "//external:gtest", "//src/proto/grpc/testing:echo_messages_proto", "//src/proto/grpc/testing:echo_proto", "//src/proto/grpc/testing/duplicate:echo_duplicate_proto", @@ -91,17 +99,21 @@ cc_test( "//test/core/util:grpc_test_util", "//test/cpp/util:test_util", ], + external_deps = [ + "gflags", + "gtest", + ], ) -cc_test( - name = "end2end_test", +grpc_cc_library( + name = "end2end_test_lib", srcs = ["end2end_test.cc"], + testonly = True, deps = [ ":test_service_impl", "//:gpr", "//:grpc", "//:grpc++", - "//external:gtest", "//src/proto/grpc/testing:echo_messages_proto", "//src/proto/grpc/testing:echo_proto", "//src/proto/grpc/testing/duplicate:echo_duplicate_proto", @@ -109,16 +121,25 @@ cc_test( "//test/core/util:grpc_test_util", "//test/cpp/util:test_util", ], + external_deps = [ + "gtest", + ], ) -cc_test( +grpc_cc_test( + name = "end2end_test", + deps = [ + ":end2end_test_lib" + ], +) + +grpc_cc_test( name = "filter_end2end_test", srcs = ["filter_end2end_test.cc"], deps = [ "//:gpr", "//:grpc", "//:grpc++", - "//external:gtest", "//src/proto/grpc/testing:echo_messages_proto", "//src/proto/grpc/testing:echo_proto", "//src/proto/grpc/testing/duplicate:echo_duplicate_proto", @@ -126,16 +147,18 @@ cc_test( "//test/core/util:grpc_test_util", "//test/cpp/util:test_util", ], + external_deps = [ + "gtest", + ], ) -cc_test( +grpc_cc_test( name = "generic_end2end_test", srcs = ["generic_end2end_test.cc"], deps = [ "//:gpr", "//:grpc", "//:grpc++", - "//external:gtest", "//src/proto/grpc/testing:echo_messages_proto", "//src/proto/grpc/testing:echo_proto", "//src/proto/grpc/testing/duplicate:echo_duplicate_proto", @@ -143,9 +166,12 @@ cc_test( "//test/core/util:grpc_test_util", "//test/cpp/util:test_util", ], + external_deps = [ + "gtest", + ], ) -cc_test( +grpc_cc_test( name = "hybrid_end2end_test", srcs = ["hybrid_end2end_test.cc"], deps = [ @@ -153,7 +179,6 @@ cc_test( "//:gpr", "//:grpc", "//:grpc++", - "//external:gtest", "//src/proto/grpc/testing:echo_messages_proto", "//src/proto/grpc/testing:echo_proto", "//src/proto/grpc/testing/duplicate:echo_duplicate_proto", @@ -161,16 +186,19 @@ cc_test( "//test/core/util:grpc_test_util", "//test/cpp/util:test_util", ], + external_deps = [ + "gtest", + ], ) -cc_test( +grpc_cc_test( name = "mock_test", srcs = ["mock_test.cc"], deps = [ "//:gpr", "//:grpc", "//:grpc++", - "//external:gtest", + "//:grpc++_test", "//src/proto/grpc/testing:echo_messages_proto", "//src/proto/grpc/testing:echo_proto", "//src/proto/grpc/testing/duplicate:echo_duplicate_proto", @@ -178,9 +206,12 @@ cc_test( "//test/core/util:grpc_test_util", "//test/cpp/util:test_util", ], + external_deps = [ + "gtest", + ], ) -cc_test( +grpc_cc_test( name = "round_robin_end2end_test", srcs = ["round_robin_end2end_test.cc"], deps = [ @@ -188,7 +219,6 @@ cc_test( "//:gpr", "//:grpc", "//:grpc++", - "//external:gtest", "//src/proto/grpc/testing:echo_messages_proto", "//src/proto/grpc/testing:echo_proto", "//src/proto/grpc/testing/duplicate:echo_duplicate_proto", @@ -196,10 +226,12 @@ cc_test( "//test/core/util:grpc_test_util", "//test/cpp/util:test_util", ], + external_deps = [ + "gtest", + ], ) - -cc_test( +grpc_cc_test( name = "grpclb_end2end_test", srcs = ["grpclb_end2end_test.cc"], deps = [ @@ -207,7 +239,6 @@ cc_test( "//:gpr", "//:grpc", "//:grpc++", - "//external:gtest", "//src/proto/grpc/lb/v1:load_balancer_proto", "//src/proto/grpc/testing:echo_messages_proto", "//src/proto/grpc/testing:echo_proto", @@ -217,9 +248,12 @@ cc_test( "//test/core/util:grpc_test_util", "//test/cpp/util:test_util", ], + external_deps = [ + "gtest", + ], ) -cc_test( +grpc_cc_test( name = "proto_server_reflection_test", srcs = ["proto_server_reflection_test.cc"], deps = [ @@ -228,8 +262,6 @@ cc_test( "//:grpc", "//:grpc++", "//:grpc++_reflection", - "//external:gflags", - "//external:gtest", "//src/proto/grpc/testing:echo_messages_proto", "//src/proto/grpc/testing:echo_proto", "//src/proto/grpc/testing/duplicate:echo_duplicate_proto", @@ -238,9 +270,13 @@ cc_test( "//test/cpp/util:grpc++_proto_reflection_desc_db", "//test/cpp/util:test_util", ], + external_deps = [ + "gtest", + "gflags", + ], ) -cc_test( +grpc_cc_test( name = "server_builder_plugin_test", srcs = ["server_builder_plugin_test.cc"], deps = [ @@ -248,7 +284,6 @@ cc_test( "//:gpr", "//:grpc", "//:grpc++", - "//external:gtest", "//src/proto/grpc/testing:echo_messages_proto", "//src/proto/grpc/testing:echo_proto", "//src/proto/grpc/testing/duplicate:echo_duplicate_proto", @@ -256,16 +291,18 @@ cc_test( "//test/core/util:grpc_test_util", "//test/cpp/util:test_util", ], + external_deps = [ + "gtest", + ], ) -cc_test( +grpc_cc_test( name = "server_crash_test", srcs = ["server_crash_test.cc"], deps = [ "//:gpr", "//:grpc", "//:grpc++", - "//external:gtest", "//src/proto/grpc/testing:echo_messages_proto", "//src/proto/grpc/testing:echo_proto", "//src/proto/grpc/testing/duplicate:echo_duplicate_proto", @@ -273,17 +310,18 @@ cc_test( "//test/core/util:grpc_test_util", "//test/cpp/util:test_util", ], + external_deps = [ + "gtest", + ], ) -cc_test( +grpc_cc_test( name = "server_crash_test_client", srcs = ["server_crash_test_client.cc"], deps = [ "//:gpr", "//:grpc", "//:grpc++", - "//external:gflags", - "//external:gtest", "//src/proto/grpc/testing:echo_messages_proto", "//src/proto/grpc/testing:echo_proto", "//src/proto/grpc/testing/duplicate:echo_duplicate_proto", @@ -291,16 +329,19 @@ cc_test( "//test/core/util:grpc_test_util", "//test/cpp/util:test_util", ], + external_deps = [ + "gflags", + "gtest", + ], ) -cc_test( +grpc_cc_test( name = "shutdown_test", srcs = ["shutdown_test.cc"], deps = [ "//:gpr", "//:grpc", "//:grpc++", - "//external:gtest", "//src/proto/grpc/testing:echo_messages_proto", "//src/proto/grpc/testing:echo_proto", "//src/proto/grpc/testing/duplicate:echo_duplicate_proto", @@ -308,16 +349,18 @@ cc_test( "//test/core/util:grpc_test_util", "//test/cpp/util:test_util", ], + external_deps = [ + "gtest", + ], ) -cc_test( +grpc_cc_test( name = "streaming_throughput_test", srcs = ["streaming_throughput_test.cc"], deps = [ "//:gpr", "//:grpc", "//:grpc++", - "//external:gtest", "//src/proto/grpc/testing:echo_messages_proto", "//src/proto/grpc/testing:echo_proto", "//src/proto/grpc/testing/duplicate:echo_duplicate_proto", @@ -325,16 +368,18 @@ cc_test( "//test/core/util:grpc_test_util", "//test/cpp/util:test_util", ], + external_deps = [ + "gtest", + ], ) -cc_test( +grpc_cc_test( name = "thread_stress_test", srcs = ["thread_stress_test.cc"], deps = [ "//:gpr", "//:grpc", "//:grpc++", - "//external:gtest", "//src/proto/grpc/testing:echo_messages_proto", "//src/proto/grpc/testing:echo_proto", "//src/proto/grpc/testing/duplicate:echo_duplicate_proto", @@ -342,4 +387,7 @@ cc_test( "//test/core/util:grpc_test_util", "//test/cpp/util:test_util", ], + external_deps = [ + "gtest", + ], ) diff --git a/test/cpp/end2end/async_end2end_test.cc b/test/cpp/end2end/async_end2end_test.cc index cc3958bf13..8d59cbb7e0 100644 --- a/test/cpp/end2end/async_end2end_test.cc +++ b/test/cpp/end2end/async_end2end_test.cc @@ -47,7 +47,6 @@ #include <grpc/support/thd.h> #include <grpc/support/time.h> #include <grpc/support/tls.h> -#include <gtest/gtest.h> #include "src/core/lib/iomgr/port.h" #include "src/proto/grpc/health/v1/health.grpc.pb.h" @@ -58,6 +57,8 @@ #include "test/cpp/util/string_ref_helper.h" #include "test/cpp/util/test_credentials_provider.h" +#include <gtest/gtest.h> + #ifdef GRPC_POSIX_SOCKET #include "src/core/lib/iomgr/ev_posix.h" #endif diff --git a/test/cpp/end2end/client_crash_test.cc b/test/cpp/end2end/client_crash_test.cc index 966c04b0e3..0ea520925f 100644 --- a/test/cpp/end2end/client_crash_test.cc +++ b/test/cpp/end2end/client_crash_test.cc @@ -41,7 +41,6 @@ #include <grpc/support/log.h> #include <grpc/support/thd.h> #include <grpc/support/time.h> -#include <gtest/gtest.h> #include "src/proto/grpc/testing/duplicate/echo_duplicate.grpc.pb.h" #include "src/proto/grpc/testing/echo.grpc.pb.h" @@ -49,6 +48,8 @@ #include "test/core/util/test_config.h" #include "test/cpp/util/subprocess.h" +#include <gtest/gtest.h> + using grpc::testing::EchoRequest; using grpc::testing::EchoResponse; using std::chrono::system_clock; diff --git a/test/cpp/end2end/end2end_test.cc b/test/cpp/end2end/end2end_test.cc index df71777e4b..9a9e81853f 100644 --- a/test/cpp/end2end/end2end_test.cc +++ b/test/cpp/end2end/end2end_test.cc @@ -48,7 +48,6 @@ #include <grpc/support/log.h> #include <grpc/support/thd.h> #include <grpc/support/time.h> -#include <gtest/gtest.h> #include "src/core/lib/security/credentials/credentials.h" #include "src/proto/grpc/testing/duplicate/echo_duplicate.grpc.pb.h" @@ -59,6 +58,8 @@ #include "test/cpp/util/string_ref_helper.h" #include "test/cpp/util/test_credentials_provider.h" +#include <gtest/gtest.h> + using grpc::testing::EchoRequest; using grpc::testing::EchoResponse; using grpc::testing::kTlsCredentialsType; diff --git a/test/cpp/end2end/filter_end2end_test.cc b/test/cpp/end2end/filter_end2end_test.cc index 2f873eeaa8..5589e2fddc 100644 --- a/test/cpp/end2end/filter_end2end_test.cc +++ b/test/cpp/end2end/filter_end2end_test.cc @@ -48,7 +48,6 @@ #include <grpc/grpc.h> #include <grpc/support/thd.h> #include <grpc/support/time.h> -#include <gtest/gtest.h> #include "src/cpp/common/channel_filter.h" #include "src/proto/grpc/testing/echo.grpc.pb.h" @@ -56,6 +55,8 @@ #include "test/core/util/test_config.h" #include "test/cpp/util/byte_buffer_proto_helper.h" +#include <gtest/gtest.h> + using grpc::testing::EchoRequest; using grpc::testing::EchoResponse; using std::chrono::system_clock; diff --git a/test/cpp/end2end/generic_end2end_test.cc b/test/cpp/end2end/generic_end2end_test.cc index 25c221bb2b..281c58efad 100644 --- a/test/cpp/end2end/generic_end2end_test.cc +++ b/test/cpp/end2end/generic_end2end_test.cc @@ -46,13 +46,14 @@ #include <grpc/grpc.h> #include <grpc/support/thd.h> #include <grpc/support/time.h> -#include <gtest/gtest.h> #include "src/proto/grpc/testing/echo.grpc.pb.h" #include "test/core/util/port.h" #include "test/core/util/test_config.h" #include "test/cpp/util/byte_buffer_proto_helper.h" +#include <gtest/gtest.h> + using grpc::testing::EchoRequest; using grpc::testing::EchoResponse; using std::chrono::system_clock; @@ -115,6 +116,10 @@ class GenericEnd2endTest : public ::testing::Test { void client_fail(int i) { verify_ok(&cli_cq_, i, false); } void SendRpc(int num_rpcs) { + SendRpc(num_rpcs, false, gpr_inf_future(GPR_CLOCK_MONOTONIC)); + } + + void SendRpc(int num_rpcs, bool check_deadline, gpr_timespec deadline) { const grpc::string kMethodName("/grpc.cpp.test.util.EchoTestService/Echo"); for (int i = 0; i < num_rpcs; i++) { EchoRequest send_request; @@ -129,6 +134,11 @@ class GenericEnd2endTest : public ::testing::Test { // The string needs to be long enough to test heap-based slice. send_request.set_message("Hello world. Hello world. Hello world."); + + if (check_deadline) { + cli_ctx.set_deadline(deadline); + } + std::unique_ptr<GenericClientAsyncReaderWriter> call = generic_stub_->Call(&cli_ctx, kMethodName, &cli_cq_, tag(1)); client_ok(1); @@ -147,6 +157,12 @@ class GenericEnd2endTest : public ::testing::Test { verify_ok(srv_cq_.get(), 4, true); EXPECT_EQ(server_host_, srv_ctx.host().substr(0, server_host_.length())); EXPECT_EQ(kMethodName, srv_ctx.method()); + + if (check_deadline) { + EXPECT_TRUE(gpr_time_similar(deadline, srv_ctx.raw_deadline(), + gpr_time_from_millis(100, GPR_TIMESPAN))); + } + ByteBuffer recv_buffer; stream.Read(&recv_buffer, tag(5)); server_ok(5); @@ -262,6 +278,12 @@ TEST_F(GenericEnd2endTest, SimpleBidiStreaming) { EXPECT_TRUE(recv_status.ok()); } +TEST_F(GenericEnd2endTest, Deadline) { + ResetStub(); + SendRpc(1, true, gpr_time_add(gpr_now(GPR_CLOCK_MONOTONIC), + gpr_time_from_seconds(10, GPR_TIMESPAN))); +} + } // namespace } // namespace testing } // namespace grpc diff --git a/test/cpp/end2end/health_service_end2end_test.cc b/test/cpp/end2end/health_service_end2end_test.cc index 3d51007857..c320c78697 100644 --- a/test/cpp/end2end/health_service_end2end_test.cc +++ b/test/cpp/end2end/health_service_end2end_test.cc @@ -46,7 +46,6 @@ #include <grpc++/server_context.h> #include <grpc/grpc.h> #include <grpc/support/log.h> -#include <gtest/gtest.h> #include "src/proto/grpc/health/v1/health.grpc.pb.h" #include "src/proto/grpc/testing/duplicate/echo_duplicate.grpc.pb.h" @@ -55,6 +54,8 @@ #include "test/core/util/test_config.h" #include "test/cpp/end2end/test_service_impl.h" +#include <gtest/gtest.h> + using grpc::health::v1::Health; using grpc::health::v1::HealthCheckRequest; using grpc::health::v1::HealthCheckResponse; diff --git a/test/cpp/end2end/hybrid_end2end_test.cc b/test/cpp/end2end/hybrid_end2end_test.cc index a4ba76fed1..1cd515a23b 100644 --- a/test/cpp/end2end/hybrid_end2end_test.cc +++ b/test/cpp/end2end/hybrid_end2end_test.cc @@ -42,7 +42,6 @@ #include <grpc++/server_builder.h> #include <grpc++/server_context.h> #include <grpc/grpc.h> -#include <gtest/gtest.h> #include "src/proto/grpc/testing/duplicate/echo_duplicate.grpc.pb.h" #include "src/proto/grpc/testing/echo.grpc.pb.h" @@ -51,6 +50,8 @@ #include "test/cpp/end2end/test_service_impl.h" #include "test/cpp/util/byte_buffer_proto_helper.h" +#include <gtest/gtest.h> + namespace grpc { namespace testing { diff --git a/test/cpp/end2end/mock_test.cc b/test/cpp/end2end/mock_test.cc index 7e330063ed..3a82b3a5d6 100644 --- a/test/cpp/end2end/mock_test.cc +++ b/test/cpp/end2end/mock_test.cc @@ -45,7 +45,6 @@ #include <grpc/support/log.h> #include <grpc/support/thd.h> #include <grpc/support/time.h> -#include <gtest/gtest.h> #include <grpc++/test/mock_stream.h> @@ -55,6 +54,8 @@ #include "test/core/util/port.h" #include "test/core/util/test_config.h" +#include <gtest/gtest.h> + #include <iostream> using namespace std; diff --git a/test/cpp/end2end/proto_server_reflection_test.cc b/test/cpp/end2end/proto_server_reflection_test.cc index 8b9688d200..25cb0d5f73 100644 --- a/test/cpp/end2end/proto_server_reflection_test.cc +++ b/test/cpp/end2end/proto_server_reflection_test.cc @@ -41,7 +41,6 @@ #include <grpc++/server_builder.h> #include <grpc++/server_context.h> #include <grpc/grpc.h> -#include <gtest/gtest.h> #include "src/proto/grpc/testing/echo.grpc.pb.h" #include "test/core/util/port.h" @@ -49,6 +48,8 @@ #include "test/cpp/end2end/test_service_impl.h" #include "test/cpp/util/proto_reflection_descriptor_database.h" +#include <gtest/gtest.h> + namespace grpc { namespace testing { diff --git a/test/cpp/end2end/round_robin_end2end_test.cc b/test/cpp/end2end/round_robin_end2end_test.cc index cc340b96b3..f8e3cc06c0 100644 --- a/test/cpp/end2end/round_robin_end2end_test.cc +++ b/test/cpp/end2end/round_robin_end2end_test.cc @@ -44,13 +44,14 @@ #include <grpc/support/log.h> #include <grpc/support/thd.h> #include <grpc/support/time.h> -#include <gtest/gtest.h> #include "src/proto/grpc/testing/echo.grpc.pb.h" #include "test/core/util/port.h" #include "test/core/util/test_config.h" #include "test/cpp/end2end/test_service_impl.h" +#include <gtest/gtest.h> + using grpc::testing::EchoRequest; using grpc::testing::EchoResponse; using std::chrono::system_clock; diff --git a/test/cpp/end2end/server_builder_plugin_test.cc b/test/cpp/end2end/server_builder_plugin_test.cc index 1b6f4ce37d..81b747a7af 100644 --- a/test/cpp/end2end/server_builder_plugin_test.cc +++ b/test/cpp/end2end/server_builder_plugin_test.cc @@ -45,13 +45,14 @@ #include <grpc++/server_builder.h> #include <grpc++/server_context.h> #include <grpc/grpc.h> -#include <gtest/gtest.h> #include "src/proto/grpc/testing/echo.grpc.pb.h" #include "test/core/util/port.h" #include "test/core/util/test_config.h" #include "test/cpp/end2end/test_service_impl.h" +#include <gtest/gtest.h> + #define PLUGIN_NAME "TestServerBuilderPlugin" namespace grpc { diff --git a/test/cpp/end2end/server_crash_test.cc b/test/cpp/end2end/server_crash_test.cc index b1f9216055..4b7041aebe 100644 --- a/test/cpp/end2end/server_crash_test.cc +++ b/test/cpp/end2end/server_crash_test.cc @@ -41,7 +41,6 @@ #include <grpc/support/log.h> #include <grpc/support/thd.h> #include <grpc/support/time.h> -#include <gtest/gtest.h> #include "src/proto/grpc/testing/duplicate/echo_duplicate.grpc.pb.h" #include "src/proto/grpc/testing/echo.grpc.pb.h" @@ -49,6 +48,8 @@ #include "test/core/util/test_config.h" #include "test/cpp/util/subprocess.h" +#include <gtest/gtest.h> + using grpc::testing::EchoRequest; using grpc::testing::EchoResponse; using std::chrono::system_clock; diff --git a/test/cpp/end2end/shutdown_test.cc b/test/cpp/end2end/shutdown_test.cc index bd68e851d3..63b397dd1c 100644 --- a/test/cpp/end2end/shutdown_test.cc +++ b/test/cpp/end2end/shutdown_test.cc @@ -33,8 +33,6 @@ #include <thread> -#include <gtest/gtest.h> - #include <grpc++/channel.h> #include <grpc++/client_context.h> #include <grpc++/create_channel.h> @@ -51,6 +49,8 @@ #include "test/core/util/test_config.h" #include "test/cpp/util/test_credentials_provider.h" +#include <gtest/gtest.h> + using grpc::testing::EchoRequest; using grpc::testing::EchoResponse; diff --git a/test/cpp/end2end/streaming_throughput_test.cc b/test/cpp/end2end/streaming_throughput_test.cc index 302583766b..ec5b83d1da 100644 --- a/test/cpp/end2end/streaming_throughput_test.cc +++ b/test/cpp/end2end/streaming_throughput_test.cc @@ -35,8 +35,6 @@ #include <mutex> #include <thread> -#include <gtest/gtest.h> - #include <grpc++/channel.h> #include <grpc++/client_context.h> #include <grpc++/create_channel.h> @@ -56,6 +54,8 @@ #include "test/core/util/port.h" #include "test/core/util/test_config.h" +#include <gtest/gtest.h> + using grpc::testing::EchoRequest; using grpc::testing::EchoResponse; using std::chrono::system_clock; diff --git a/test/cpp/end2end/test_service_impl.cc b/test/cpp/end2end/test_service_impl.cc index b473dd1f52..5411b35f16 100644 --- a/test/cpp/end2end/test_service_impl.cc +++ b/test/cpp/end2end/test_service_impl.cc @@ -40,11 +40,11 @@ #include <grpc++/server_context.h> #include <grpc/support/log.h> -#include <gtest/gtest.h> - #include "src/proto/grpc/testing/echo.grpc.pb.h" #include "test/cpp/util/string_ref_helper.h" +#include <gtest/gtest.h> + using std::chrono::system_clock; namespace grpc { diff --git a/test/cpp/end2end/thread_stress_test.cc b/test/cpp/end2end/thread_stress_test.cc index d353f9894b..defa7894ff 100644 --- a/test/cpp/end2end/thread_stress_test.cc +++ b/test/cpp/end2end/thread_stress_test.cc @@ -43,7 +43,6 @@ #include <grpc/grpc.h> #include <grpc/support/thd.h> #include <grpc/support/time.h> -#include <gtest/gtest.h> #include "src/core/lib/surface/api_trace.h" #include "src/proto/grpc/testing/duplicate/echo_duplicate.grpc.pb.h" @@ -51,6 +50,8 @@ #include "test/core/util/port.h" #include "test/core/util/test_config.h" +#include <gtest/gtest.h> + using grpc::testing::EchoRequest; using grpc::testing::EchoResponse; using std::chrono::system_clock; diff --git a/test/cpp/microbenchmarks/BUILD b/test/cpp/microbenchmarks/BUILD index 208ac6d794..3a968a020a 100644 --- a/test/cpp/microbenchmarks/BUILD +++ b/test/cpp/microbenchmarks/BUILD @@ -29,14 +29,17 @@ licenses(["notice"]) # 3-clause BSD -cc_test( +load("//bazel:grpc_build_system.bzl", "grpc_cc_test", "grpc_cc_library") + +grpc_cc_test( name = "noop-benchmark", srcs = ["noop-benchmark.cc"], - linkopts = ["-pthread"], - deps = ["//external:benchmark"], + external_deps = [ + "benchmark", + ], ) -cc_library( +grpc_cc_library( name = "helpers", srcs = ["helpers.cc"], hdrs = [ @@ -44,64 +47,68 @@ cc_library( "fullstack_fixtures.h", "helpers.h", ], - linkopts = ["-pthread"], deps = [ "//:grpc++", - "//external:benchmark", "//src/proto/grpc/testing:echo_proto", "//test/core/util:grpc_test_util", ], + external_deps = [ + "benchmark", + ], ) -cc_test( +grpc_cc_test( name = "bm_closure", srcs = ["bm_closure.cc"], deps = [":helpers"], ) -cc_test( +grpc_cc_test( name = "bm_cq", srcs = ["bm_cq.cc"], deps = [":helpers"], ) -cc_test( +grpc_cc_test( name = "bm_cq_multiple_threads", srcs = ["bm_cq_multiple_threads.cc"], deps = [":helpers"], ) -cc_test( +grpc_cc_test( name = "bm_error", srcs = ["bm_error.cc"], deps = [":helpers"], ) -cc_test( +grpc_cc_test( name = "bm_fullstack_streaming_ping_pong", srcs = ["bm_fullstack_streaming_ping_pong.cc"], deps = [":helpers"], ) -cc_test( +grpc_cc_test( name = "bm_fullstack_streaming_pump", srcs = ["bm_fullstack_streaming_pump.cc"], deps = [":helpers"], ) -cc_test( +grpc_cc_test( name = "bm_fullstack_trickle", srcs = ["bm_fullstack_trickle.cc"], - deps = [":helpers", "//external:gflags"], + deps = [":helpers"], + external_deps = [ + "gflags", + ], ) -cc_test( +grpc_cc_test( name = "bm_fullstack_unary_ping_pong", srcs = ["bm_fullstack_unary_ping_pong.cc"], deps = [":helpers"], ) -cc_test( +grpc_cc_test( name = "bm_metadata", srcs = ["bm_metadata.cc"], deps = [":helpers"], diff --git a/test/cpp/microbenchmarks/helpers.cc b/test/cpp/microbenchmarks/helpers.cc index 6550742453..73ab9e4a1a 100644 --- a/test/cpp/microbenchmarks/helpers.cc +++ b/test/cpp/microbenchmarks/helpers.cc @@ -36,11 +36,11 @@ void TrackCounters::Finish(benchmark::State &state) { std::ostringstream out; AddToLabel(out, state); - auto label = out.str(); + std::string label = out.str(); if (label.length() && label[0] == ' ') { label = label.substr(1); } - state.SetLabel(label); + state.SetLabel(label.c_str()); } void TrackCounters::AddToLabel(std::ostream &out, benchmark::State &state) { diff --git a/test/cpp/qps/BUILD b/test/cpp/qps/BUILD index 6492b63ec3..c6a1fd2fce 100644 --- a/test/cpp/qps/BUILD +++ b/test/cpp/qps/BUILD @@ -29,14 +29,17 @@ licenses(["notice"]) # 3-clause BSD -cc_library( +load("//bazel:grpc_build_system.bzl", "grpc_cc_test", "grpc_cc_library", "grpc_cc_binary") + +grpc_cc_library( name = "parse_json", srcs = ["parse_json.cc"], hdrs = ["parse_json.h"], deps = ["//:grpc++"], + external_deps = ["protobuf"], ) -cc_library( +grpc_cc_library( name = "qps_worker_impl", srcs = [ "client_async.cc", @@ -56,7 +59,6 @@ cc_library( ":usage_timer", "//:grpc", "//:grpc++", - "//external:gtest", "//src/proto/grpc/testing:control_proto", "//src/proto/grpc/testing:payloads_proto", "//src/proto/grpc/testing:services_proto", @@ -65,9 +67,12 @@ cc_library( "//test/core/util:grpc_test_util", "//test/cpp/util:test_util", ], + external_deps = [ + "gtest", + ], ) -cc_library( +grpc_cc_library( name = "driver_impl", srcs = [ "driver.cc", @@ -90,7 +95,7 @@ cc_library( ], ) -cc_library( +grpc_cc_library( name = "benchmark_config", srcs = [ "benchmark_config.cc", @@ -102,12 +107,14 @@ cc_library( ":driver_impl", ":histogram", "//:grpc++", - "//external:gflags", "//src/proto/grpc/testing:control_proto", ], + external_deps = [ + "gflags", + ], ) -cc_library( +grpc_cc_library( name = "histogram", hdrs = [ "histogram.h", @@ -116,13 +123,13 @@ cc_library( deps = ["//:gpr"], ) -cc_library( +grpc_cc_library( name = "interarrival", hdrs = ["interarrival.h"], deps = ["//:grpc++"], ) -cc_binary( +grpc_cc_binary( name = "json_run_localhost", srcs = ["json_run_localhost.cc"], deps = [ @@ -133,7 +140,7 @@ cc_binary( ], ) -cc_test( +grpc_cc_test( name = "qps_interarrival_test", srcs = ["qps_interarrival_test.cc"], deps = [ @@ -142,18 +149,20 @@ cc_test( ], ) -cc_binary( +grpc_cc_binary( name = "qps_json_driver", srcs = ["qps_json_driver.cc"], deps = [ ":benchmark_config", ":driver_impl", "//:grpc++", - "//external:gflags", + ], + external_deps = [ + "gflags", ], ) -cc_test( +grpc_cc_test( name = "qps_openloop_test", srcs = ["qps_openloop_test.cc"], deps = [ @@ -163,7 +172,7 @@ cc_test( ], ) -cc_test( +grpc_cc_test( name = "secure_sync_unary_ping_pong_test", srcs = ["secure_sync_unary_ping_pong_test.cc"], deps = [ @@ -173,14 +182,14 @@ cc_test( ], ) -cc_library( +grpc_cc_library( name = "usage_timer", srcs = ["usage_timer.cc"], hdrs = ["usage_timer.h"], deps = ["//:gpr"], ) -cc_binary( +grpc_cc_binary( name = "qps_worker", srcs = ["worker.cc"], deps = [ diff --git a/test/cpp/qps/client_sync.cc b/test/cpp/qps/client_sync.cc index 9075033bd4..f35713280a 100644 --- a/test/cpp/qps/client_sync.cc +++ b/test/cpp/qps/client_sync.cc @@ -48,7 +48,6 @@ #include <grpc/support/host_port.h> #include <grpc/support/log.h> #include <grpc/support/time.h> -#include <gtest/gtest.h> #include "src/core/lib/profiling/timers.h" #include "src/proto/grpc/testing/services.grpc.pb.h" diff --git a/test/cpp/util/BUILD b/test/cpp/util/BUILD index 9dde22b4d1..453e9b6c0f 100644 --- a/test/cpp/util/BUILD +++ b/test/cpp/util/BUILD @@ -29,16 +29,20 @@ licenses(["notice"]) # 3-clause BSD +load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_binary") + +package(default_visibility = ["//visibility:public"]) + # The following builds a shared-object to confirm that grpc++_unsecure # builds properly. Build-only is sufficient here -cc_binary( +grpc_cc_binary( name = "testso.so", srcs = [], linkshared = 1, deps = ["//:grpc++_unsecure"], ) -cc_library( +grpc_cc_library( name = "test_config", srcs = [ "test_config_cc.cc", @@ -46,14 +50,15 @@ cc_library( hdrs = [ "test_config.h", ], - visibility = ["//test:__subpackages__"], + external_deps = [ + "gflags", + ], deps = [ "//:gpr", - "//external:gflags", ], ) -cc_library( +grpc_cc_library( name = "grpc++_proto_reflection_desc_db", srcs = [ "proto_reflection_descriptor_database.cc", @@ -61,14 +66,13 @@ cc_library( hdrs = [ "proto_reflection_descriptor_database.h", ], - visibility = ["//test:__subpackages__"], deps = [ "//:grpc++_config_proto", "//src/proto/grpc/reflection/v1alpha:reflection_proto", ], ) -cc_library( +grpc_cc_library( name = "test_util", srcs = [ "byte_buffer_proto_helper.cc", @@ -84,12 +88,57 @@ cc_library( "subprocess.h", "test_credentials_provider.h", ], - visibility = ["//test:__subpackages__"], deps = [ "//:grpc++", "//test/core/end2end:ssl_test_data", "//test/core/util:gpr_test_util", ], + external_deps = [ + "protobuf", + ], +) + +grpc_cc_library( + name = "grpc_cli_libs", + srcs = [ + "cli_call.cc", + "cli_credentials.cc", + "grpc_tool.cc", + "proto_file_parser.cc", + "service_describer.cc", + ], + hdrs = [ + "cli_call.h", + "cli_credentials.h", + "config_grpc_cli.h", + "grpc_tool.h", + "proto_file_parser.h", + "service_describer.h", + ], + deps = [ + "//:grpc++", + "//src/proto/grpc/reflection/v1alpha:reflection_proto", + ":grpc++_proto_reflection_desc_db", + ], + external_deps = [ + "gflags", + "protobuf", + "protobuf_clib", + ], +) + +grpc_cc_library( + name = "metrics_server_lib", + srcs = [ + "metrics_server.cc", + ], + hdrs = [ + "metrics_server.h", + ], + deps = [ + "//src/proto/grpc/testing:metrics_proto", + "//:grpc++", + ], ) cc_test( diff --git a/tools/dockerfile/test/bazel/Dockerfile b/tools/dockerfile/test/bazel/Dockerfile index 6ea8ef316c..c562704944 100644 --- a/tools/dockerfile/test/bazel/Dockerfile +++ b/tools/dockerfile/test/bazel/Dockerfile @@ -27,46 +27,22 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -FROM ubuntu:15.10 +FROM gcr.io/oss-fuzz-base/base-builder -# Install Git and basic packages. -RUN apt-get update && apt-get install -y \ +# Install basic packages and Bazel dependencies. +RUN apt-get update && apt-get install -y software-properties-common python-software-properties +RUN add-apt-repository ppa:webupd8team/java +RUN apt-get update && apt-get -y install \ autoconf \ - autotools-dev \ build-essential \ - bzip2 \ - ccache \ curl \ - gcc \ - gcc-multilib \ - git \ - golang \ - gyp \ - lcov \ - libc6 \ - libc6-dbg \ - libc6-dev \ - libgtest-dev \ libtool \ make \ - perl \ - strace \ - python-dev \ - python-setuptools \ - python-yaml \ - telnet \ - unzip \ - wget \ - zip && apt-get clean - -#================ -# Build profiling -RUN apt-get update && apt-get install -y time && apt-get clean - + openjdk-8-jdk \ + vim #======================== # Bazel installation -RUN apt-get install -y software-properties-common g++ RUN echo "deb [arch=amd64] http://storage.googleapis.com/bazel-apt stable jdk1.8" > /etc/apt/sources.list.d/bazel.list RUN curl https://bazel.build/bazel-release.pub.gpg | apt-key add - RUN apt-get -y update |