From faee58378120d5953281bd7f58b3b4e8021fad1d Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Mon, 15 May 2017 14:23:44 -0700 Subject: [PATCH 01/42] Add language where it was missing to BUILD file --- BUILD | 2 ++ 1 file changed, 2 insertions(+) diff --git a/BUILD b/BUILD index 201b358f4dc..07c343bca5a 100644 --- a/BUILD +++ b/BUILD @@ -444,6 +444,7 @@ grpc_cc_library( grpc_cc_library( name = "grpc_trace", + language = "c", srcs = ["src/core/lib/debug/trace.c"], hdrs = ["src/core/lib/debug/trace.h"], deps = [":gpr"], @@ -727,6 +728,7 @@ grpc_cc_library( grpc_cc_library( name = "grpc_common", + language = "c", deps = [ "grpc_base", # standard plugins From a3eac51e1e8eb9ace390d181d328de8fce009a5b Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Mon, 15 May 2017 14:24:00 -0700 Subject: [PATCH 02/42] Const correctness? for cython --- src/python/grpcio/grpc/_cython/_cygrpc/security.pyx.pxi | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/security.pyx.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/security.pyx.pxi index a21eac79951..c2ee361660d 100644 --- a/src/python/grpcio/grpc/_cython/_cygrpc/security.pyx.pxi +++ b/src/python/grpcio/grpc/_cython/_cygrpc/security.pyx.pxi @@ -49,7 +49,7 @@ cdef grpc_ssl_roots_override_result ssl_roots_override_callback( def peer_identities(Call call): cdef grpc_auth_context* auth_context cdef grpc_auth_property_iterator properties - cdef grpc_auth_property* property + cdef const grpc_auth_property* property auth_context = grpc_call_auth_context(call.c_call) if auth_context == NULL: @@ -67,7 +67,7 @@ def peer_identities(Call call): def peer_identity_key(Call call): cdef grpc_auth_context* auth_context - cdef char* c_key + cdef const char* c_key auth_context = grpc_call_auth_context(call.c_call) if auth_context == NULL: return None @@ -82,7 +82,7 @@ def peer_identity_key(Call call): def auth_context(Call call): cdef grpc_auth_context* auth_context cdef grpc_auth_property_iterator properties - cdef grpc_auth_property* property + cdef const grpc_auth_property* property auth_context = grpc_call_auth_context(call.c_call) if auth_context == NULL: From a753371f05dd116df3f27a18eb6e08e1ed0c1b4f Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 16 May 2017 13:09:33 -0700 Subject: [PATCH 03/42] Rework well_known_protos attr, and some other fixes --- bazel/cc_grpc_library.bzl | 5 ++--- bazel/generate_cc.bzl | 8 +++++++- bazel/grpc_build_system.bzl | 2 +- examples/BUILD | 2 ++ src/proto/grpc/status/BUILD | 2 +- test/cpp/interop/BUILD | 18 +++++++++++++----- test/cpp/util/BUILD | 14 +++++++++----- tools/grpcz/BUILD | 4 ++-- 8 files changed, 37 insertions(+), 18 deletions(-) diff --git a/bazel/cc_grpc_library.bzl b/bazel/cc_grpc_library.bzl index 0600bb9e304..afc5543795a 100644 --- a/bazel/cc_grpc_library.bzl +++ b/bazel/cc_grpc_library.bzl @@ -12,9 +12,8 @@ def cc_grpc_library(name, srcs, deps, proto_only, well_known_protos, generate_mo srcs: a single proto_library, which wraps the .proto files with services. deps: a list of C++ proto_library (or cc_proto_library) which provides the compiled code of any message that the services depend on. - well_known_protos: The target from protobuf library that exports well - known protos. Currently it will only work if the value is - "@com_google_protobuf//:well_known_protos" + well_known_protos: Should this library additionally depend on well known + protos use_external: When True the grpc deps are prefixed with //external. This allows grpc to be used as a dependency in other bazel projects. generate_mock: When true GMOCk code for client stub is generated. diff --git a/bazel/generate_cc.bzl b/bazel/generate_cc.bzl index d05509fc153..7fffb582188 100644 --- a/bazel/generate_cc.bzl +++ b/bazel/generate_cc.bzl @@ -57,7 +57,7 @@ def generate_cc_impl(ctx): return struct(files=set(out_files)) -generate_cc = rule( +_generate_cc = rule( attrs = { "srcs": attr.label_list( mandatory = True, @@ -90,3 +90,9 @@ generate_cc = rule( output_to_genfiles = True, implementation = generate_cc_impl, ) + +def generate_cc(well_known_protos, **kwargs): + if well_known_protos: + _generate_cc(well_known_protos="@com_google_protobuf//:well_known_protos", **kwargs) + else: + _generate_cc(**kwargs) diff --git a/bazel/grpc_build_system.bzl b/bazel/grpc_build_system.bzl index 0f66edbcd05..b19c85c962c 100644 --- a/bazel/grpc_build_system.bzl +++ b/bazel/grpc_build_system.bzl @@ -67,7 +67,7 @@ def grpc_proto_plugin(name, srcs = [], deps = []): load("//:bazel/cc_grpc_library.bzl", "cc_grpc_library") -def grpc_proto_library(name, srcs = [], deps = [], well_known_protos = None, +def grpc_proto_library(name, srcs = [], deps = [], well_known_protos = False, has_services = True, use_external = False, generate_mock = False): cc_grpc_library( name = name, diff --git a/examples/BUILD b/examples/BUILD index bd2d3c31500..33131346acd 100644 --- a/examples/BUILD +++ b/examples/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. +licenses(["notice"]) # 3-clause BSD + package(default_visibility = ["//visibility:public"]) load("//bazel:grpc_build_system.bzl", "grpc_proto_library") diff --git a/src/proto/grpc/status/BUILD b/src/proto/grpc/status/BUILD index 71363bd1b63..a93bfac419f 100644 --- a/src/proto/grpc/status/BUILD +++ b/src/proto/grpc/status/BUILD @@ -37,5 +37,5 @@ grpc_proto_library( name = "status_proto", srcs = ["status.proto"], has_services = False, - well_known_protos = "@com_google_protobuf//:well_known_protos", + well_known_protos = True, ) diff --git a/test/cpp/interop/BUILD b/test/cpp/interop/BUILD index 1a3e8d916fa..04c3489adc4 100644 --- a/test/cpp/interop/BUILD +++ b/test/cpp/interop/BUILD @@ -29,8 +29,11 @@ licenses(["notice"]) # 3-clause BSD -cc_library( +load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary") + +grpc_cc_library( name = "server_helper_lib", + language = "c++", srcs = [ "server_helper.cc", ], @@ -39,12 +42,15 @@ cc_library( ], deps = [ "//test/cpp/util:test_util", - "//external:gflags", + ], + external_deps = [ + "gflags", ], ) -cc_binary( +grpc_cc_binary( name = "interop_server", + language = "c++", srcs = [ "interop_server.cc", "interop_server_bootstrap.cc", @@ -59,8 +65,9 @@ cc_binary( ], ) -cc_library( +grpc_cc_library( name = "client_helper_lib", + language = "c++", srcs = [ "client_helper.cc", "interop_client.cc", @@ -79,8 +86,9 @@ cc_library( ], ) -cc_binary( +grpc_cc_binary( name = "interop_client", + language = "c++", srcs = [ "client.cc", ], diff --git a/test/cpp/util/BUILD b/test/cpp/util/BUILD index 453e9b6c0fd..9e4701b179a 100644 --- a/test/cpp/util/BUILD +++ b/test/cpp/util/BUILD @@ -29,7 +29,7 @@ licenses(["notice"]) # 3-clause BSD -load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_binary") +load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_binary", "grpc_cc_test") package(default_visibility = ["//visibility:public"]) @@ -141,19 +141,21 @@ grpc_cc_library( ], ) -cc_test( +grpc_cc_test( name = "error_details_test", srcs = [ "error_details_test.cc", ], deps = [ "//:grpc++_error_details", - "//external:gtest", "//src/proto/grpc/testing:echo_messages_proto", ], + external_deps = [ + "gtest", + ], ) -cc_binary( +grpc_cc_binary( name = "grpc_cli", srcs = [ "cli_call.cc", @@ -175,7 +177,9 @@ cc_binary( ], deps = [ "//:grpc++", - "//external:gflags", "//src/proto/grpc/reflection/v1alpha:reflection_proto", ], + external_deps = [ + "gflags", + ], ) diff --git a/tools/grpcz/BUILD b/tools/grpcz/BUILD index cc887a53751..fbd01cbf9a9 100644 --- a/tools/grpcz/BUILD +++ b/tools/grpcz/BUILD @@ -38,7 +38,7 @@ grpc_proto_library( srcs = [ "monitoring.proto", ], - well_known_protos = "@com_google_protobuf//:well_known_protos", + well_known_protos = True, deps = [ ":census_proto", ], @@ -49,7 +49,7 @@ grpc_proto_library( srcs = [ "census.proto", ], - well_known_protos = "@com_google_protobuf//:well_known_protos", + well_known_protos = True, ) cc_binary( From af6c83f9e141aa1ae32398f1f9b1f152a248a8f0 Mon Sep 17 00:00:00 2001 From: "Nicolas \"Pixel\" Noble" Date: Fri, 19 May 2017 00:38:10 +0200 Subject: [PATCH 04/42] Adding dummy layering check option. --- src/proto/grpc/health/v1/BUILD | 8 +++++++- src/proto/grpc/lb/v1/BUILD | 8 +++++++- src/proto/grpc/reflection/v1alpha/BUILD | 8 +++++++- src/proto/grpc/status/BUILD | 8 +++++++- src/proto/grpc/testing/BUILD | 8 +++++++- src/proto/grpc/testing/duplicate/BUILD | 8 +++++++- test/core/bad_client/BUILD | 7 +++++++ test/core/bad_ssl/BUILD | 7 +++++++ test/core/census/BUILD | 7 +++++++ test/core/channel/BUILD | 7 +++++++ test/core/client_channel/BUILD | 7 +++++++ test/core/client_channel/resolvers/BUILD | 7 +++++++ test/core/compression/BUILD | 7 +++++++ test/core/end2end/BUILD | 7 +++++++ test/core/end2end/fuzzers/BUILD | 7 +++++++ test/core/fling/BUILD | 7 +++++++ test/core/handshake/BUILD | 7 +++++++ test/core/http/BUILD | 7 +++++++ test/core/iomgr/BUILD | 8 +++++++- test/core/json/BUILD | 7 +++++++ test/core/nanopb/BUILD | 7 +++++++ test/core/network_benchmarks/BUILD | 7 +++++++ test/core/security/BUILD | 7 +++++++ test/core/slice/BUILD | 7 +++++++ test/core/support/BUILD | 7 +++++++ test/core/surface/BUILD | 7 +++++++ test/core/transport/BUILD | 7 +++++++ test/core/transport/chttp2/BUILD | 7 +++++++ test/core/tsi/BUILD | 7 +++++++ test/core/util/BUILD | 8 +++++++- test/cpp/codegen/BUILD | 7 +++++++ test/cpp/common/BUILD | 7 +++++++ test/cpp/end2end/BUILD | 8 +++++++- test/cpp/interop/BUILD | 7 +++++++ test/cpp/microbenchmarks/BUILD | 7 +++++++ test/cpp/qps/BUILD | 7 +++++++ test/cpp/util/BUILD | 8 +++++++- 37 files changed, 259 insertions(+), 10 deletions(-) diff --git a/src/proto/grpc/health/v1/BUILD b/src/proto/grpc/health/v1/BUILD index dbb91d91392..2f58dc403c3 100644 --- a/src/proto/grpc/health/v1/BUILD +++ b/src/proto/grpc/health/v1/BUILD @@ -29,7 +29,13 @@ licenses(["notice"]) # 3-clause BSD -package(default_visibility = ["//visibility:public"]) +package( + default_visibility = ["//visibility:public"], + features = [ + "-layering_check", + "-parse_headers", + ], +) load("//bazel:grpc_build_system.bzl", "grpc_proto_library") diff --git a/src/proto/grpc/lb/v1/BUILD b/src/proto/grpc/lb/v1/BUILD index 46d4f2d62c7..4ee139ab06a 100644 --- a/src/proto/grpc/lb/v1/BUILD +++ b/src/proto/grpc/lb/v1/BUILD @@ -29,7 +29,13 @@ licenses(["notice"]) # 3-clause BSD -package(default_visibility = ["//visibility:public"]) +package( + default_visibility = ["//visibility:public"], + features = [ + "-layering_check", + "-parse_headers", + ], +) load("//bazel:grpc_build_system.bzl", "grpc_proto_library") diff --git a/src/proto/grpc/reflection/v1alpha/BUILD b/src/proto/grpc/reflection/v1alpha/BUILD index 92dd3d7f686..3f6342f977d 100644 --- a/src/proto/grpc/reflection/v1alpha/BUILD +++ b/src/proto/grpc/reflection/v1alpha/BUILD @@ -29,7 +29,13 @@ licenses(["notice"]) # 3-clause BSD -package(default_visibility = ["//visibility:public"]) +package( + default_visibility = ["//visibility:public"], + features = [ + "-layering_check", + "-parse_headers", + ], +) load("//bazel:grpc_build_system.bzl", "grpc_proto_library") diff --git a/src/proto/grpc/status/BUILD b/src/proto/grpc/status/BUILD index 71363bd1b63..7bc742da4b3 100644 --- a/src/proto/grpc/status/BUILD +++ b/src/proto/grpc/status/BUILD @@ -29,7 +29,13 @@ licenses(["notice"]) # 3-clause BSD -package(default_visibility = ["//visibility:public"]) +package( + default_visibility = ["//visibility:public"], + features = [ + "-layering_check", + "-parse_headers", + ], +) load("//bazel:grpc_build_system.bzl", "grpc_proto_library") diff --git a/src/proto/grpc/testing/BUILD b/src/proto/grpc/testing/BUILD index 5f1c005faff..75fd61090d8 100644 --- a/src/proto/grpc/testing/BUILD +++ b/src/proto/grpc/testing/BUILD @@ -29,7 +29,13 @@ licenses(["notice"]) # 3-clause BSD -package(default_visibility = ["//visibility:public"]) +package( + default_visibility = ["//visibility:public"], + features = [ + "-layering_check", + "-parse_headers", + ], +) load("//bazel:grpc_build_system.bzl", "grpc_proto_library") diff --git a/src/proto/grpc/testing/duplicate/BUILD b/src/proto/grpc/testing/duplicate/BUILD index 8fc5a96af40..9d37c96d9dc 100644 --- a/src/proto/grpc/testing/duplicate/BUILD +++ b/src/proto/grpc/testing/duplicate/BUILD @@ -29,7 +29,13 @@ licenses(["notice"]) # 3-clause BSD -package(default_visibility = ["//visibility:public"]) +package( + default_visibility = ["//visibility:public"], + features = [ + "-layering_check", + "-parse_headers", + ], +) load("//bazel:grpc_build_system.bzl", "grpc_proto_library") diff --git a/test/core/bad_client/BUILD b/test/core/bad_client/BUILD index bcfd2f1db2a..f0115a55fcb 100644 --- a/test/core/bad_client/BUILD +++ b/test/core/bad_client/BUILD @@ -29,6 +29,13 @@ load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary") +package( + features = [ + "-layering_check", + "-parse_headers", + ], +) + licenses(["notice"]) # 3-clause BSD load(":generate_tests.bzl", "grpc_bad_client_tests") diff --git a/test/core/bad_ssl/BUILD b/test/core/bad_ssl/BUILD index 61c634ae260..be6be4ca79f 100644 --- a/test/core/bad_ssl/BUILD +++ b/test/core/bad_ssl/BUILD @@ -29,6 +29,13 @@ load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary") +package( + features = [ + "-layering_check", + "-parse_headers", + ], +) + 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 3fdf5114e8a..97dff420077 100644 --- a/test/core/census/BUILD +++ b/test/core/census/BUILD @@ -31,6 +31,13 @@ load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_c licenses(["notice"]) # 3-clause BSD +package( + features = [ + "-layering_check", + "-parse_headers", + ], +) + grpc_cc_test( name = "context_test", srcs = ["context_test.c"], diff --git a/test/core/channel/BUILD b/test/core/channel/BUILD index 5e7e8c1ef42..fe5fdcefd72 100644 --- a/test/core/channel/BUILD +++ b/test/core/channel/BUILD @@ -31,6 +31,13 @@ load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_c licenses(["notice"]) # 3-clause BSD +package( + features = [ + "-layering_check", + "-parse_headers", + ], +) + grpc_cc_test( name = "channel_args_test", srcs = ["channel_args_test.c"], diff --git a/test/core/client_channel/BUILD b/test/core/client_channel/BUILD index 6c4b40e4111..4d43ce9de7c 100644 --- a/test/core/client_channel/BUILD +++ b/test/core/client_channel/BUILD @@ -31,6 +31,13 @@ load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_c licenses(["notice"]) # 3-clause BSD +package( + features = [ + "-layering_check", + "-parse_headers", + ], +) + load("//test/core/util:grpc_fuzzer.bzl", "grpc_fuzzer") grpc_fuzzer( diff --git a/test/core/client_channel/resolvers/BUILD b/test/core/client_channel/resolvers/BUILD index 80ca7d3ebb2..55974d4227c 100644 --- a/test/core/client_channel/resolvers/BUILD +++ b/test/core/client_channel/resolvers/BUILD @@ -31,6 +31,13 @@ load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_c licenses(["notice"]) # 3-clause BSD +package( + features = [ + "-layering_check", + "-parse_headers", + ], +) + grpc_cc_test( name = "dns_resolver_connectivity_test", srcs = ["dns_resolver_connectivity_test.c"], diff --git a/test/core/compression/BUILD b/test/core/compression/BUILD index bbd66bdb52a..6bdd6cff923 100644 --- a/test/core/compression/BUILD +++ b/test/core/compression/BUILD @@ -31,6 +31,13 @@ load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_c licenses(["notice"]) # 3-clause BSD +package( + features = [ + "-layering_check", + "-parse_headers", + ], +) + grpc_cc_test( name = "algorithm_test", srcs = ["algorithm_test.c"], diff --git a/test/core/end2end/BUILD b/test/core/end2end/BUILD index cf387a93e85..41797c7b015 100644 --- a/test/core/end2end/BUILD +++ b/test/core/end2end/BUILD @@ -31,6 +31,13 @@ load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_c licenses(["notice"]) # 3-clause BSD +package( + features = [ + "-layering_check", + "-parse_headers", + ], +) + load(":generate_tests.bzl", "grpc_end2end_tests") grpc_cc_library( diff --git a/test/core/end2end/fuzzers/BUILD b/test/core/end2end/fuzzers/BUILD index 55810bd0b80..2a9c96eba00 100644 --- a/test/core/end2end/fuzzers/BUILD +++ b/test/core/end2end/fuzzers/BUILD @@ -31,6 +31,13 @@ load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_c licenses(["notice"]) # 3-clause BSD +package( + features = [ + "-layering_check", + "-parse_headers", + ], +) + load("//test/core/util:grpc_fuzzer.bzl", "grpc_fuzzer") grpc_fuzzer( diff --git a/test/core/fling/BUILD b/test/core/fling/BUILD index 8f17527d446..421e7858ca0 100644 --- a/test/core/fling/BUILD +++ b/test/core/fling/BUILD @@ -31,6 +31,13 @@ load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_c licenses(["notice"]) # 3-clause BSD +package( + features = [ + "-layering_check", + "-parse_headers", + ], +) + load("//test/core/util:grpc_fuzzer.bzl", "grpc_fuzzer") grpc_cc_binary( diff --git a/test/core/handshake/BUILD b/test/core/handshake/BUILD index bdb91eab8b8..23ab5a71de1 100644 --- a/test/core/handshake/BUILD +++ b/test/core/handshake/BUILD @@ -31,6 +31,13 @@ load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_c licenses(["notice"]) # 3-clause BSD +package( + features = [ + "-layering_check", + "-parse_headers", + ], +) + grpc_cc_test( name = "client_ssl", srcs = ["client_ssl.c"], diff --git a/test/core/http/BUILD b/test/core/http/BUILD index 9350daccf43..529aa7beff0 100644 --- a/test/core/http/BUILD +++ b/test/core/http/BUILD @@ -31,6 +31,13 @@ load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_c licenses(["notice"]) # 3-clause BSD +package( + features = [ + "-layering_check", + "-parse_headers", + ], +) + load("//test/core/util:grpc_fuzzer.bzl", "grpc_fuzzer") grpc_fuzzer( diff --git a/test/core/iomgr/BUILD b/test/core/iomgr/BUILD index 269ca949f63..cfb7b31200b 100644 --- a/test/core/iomgr/BUILD +++ b/test/core/iomgr/BUILD @@ -33,7 +33,13 @@ licenses(["notice"]) # 3-clause BSD load("//test/core/util:grpc_fuzzer.bzl", "grpc_fuzzer") -package(default_visibility = ["//visibility:public"]) # Useful for third party devs to test their io manager implementation. +package( + default_visibility = ["//visibility:public"], # Useful for third party devs to test their io manager implementation. + features = [ + "-layering_check", + "-parse_headers", + ], +) grpc_cc_library( name = "endpoint_tests", diff --git a/test/core/json/BUILD b/test/core/json/BUILD index aba2e2c5222..2a59d1b3f88 100644 --- a/test/core/json/BUILD +++ b/test/core/json/BUILD @@ -31,6 +31,13 @@ load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_c licenses(["notice"]) # 3-clause BSD +package( + features = [ + "-layering_check", + "-parse_headers", + ], +) + load("//test/core/util:grpc_fuzzer.bzl", "grpc_fuzzer") grpc_fuzzer( diff --git a/test/core/nanopb/BUILD b/test/core/nanopb/BUILD index 33e9338ed4e..f792f0cdbce 100644 --- a/test/core/nanopb/BUILD +++ b/test/core/nanopb/BUILD @@ -31,6 +31,13 @@ load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_c licenses(["notice"]) # 3-clause BSD +package( + features = [ + "-layering_check", + "-parse_headers", + ], +) + load("//test/core/util:grpc_fuzzer.bzl", "grpc_fuzzer") grpc_fuzzer( diff --git a/test/core/network_benchmarks/BUILD b/test/core/network_benchmarks/BUILD index 5c243f7347a..5ba9835c05c 100644 --- a/test/core/network_benchmarks/BUILD +++ b/test/core/network_benchmarks/BUILD @@ -31,6 +31,13 @@ load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_c licenses(["notice"]) # 3-clause BSD +package( + features = [ + "-layering_check", + "-parse_headers", + ], +) + grpc_cc_binary( name = "low_level_ping_pong", srcs = ["low_level_ping_pong.c"], diff --git a/test/core/security/BUILD b/test/core/security/BUILD index b2d8774e801..b1385dc83ff 100644 --- a/test/core/security/BUILD +++ b/test/core/security/BUILD @@ -31,6 +31,13 @@ load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_c licenses(["notice"]) # 3-clause BSD +package( + features = [ + "-layering_check", + "-parse_headers", + ], +) + load("//test/core/util:grpc_fuzzer.bzl", "grpc_fuzzer") grpc_fuzzer( diff --git a/test/core/slice/BUILD b/test/core/slice/BUILD index 8dc34e7492b..2fa80dd05a2 100644 --- a/test/core/slice/BUILD +++ b/test/core/slice/BUILD @@ -31,6 +31,13 @@ load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_c licenses(["notice"]) # 3-clause BSD +package( + features = [ + "-layering_check", + "-parse_headers", + ], +) + load("//test/core/util:grpc_fuzzer.bzl", "grpc_fuzzer") grpc_fuzzer( diff --git a/test/core/support/BUILD b/test/core/support/BUILD index db408199fc8..9eb0b326378 100644 --- a/test/core/support/BUILD +++ b/test/core/support/BUILD @@ -31,6 +31,13 @@ load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_c licenses(["notice"]) # 3-clause BSD +package( + features = [ + "-layering_check", + "-parse_headers", + ], +) + grpc_cc_test( name = "alloc_test", srcs = ["alloc_test.c"], diff --git a/test/core/surface/BUILD b/test/core/surface/BUILD index 44d37da0b94..0dc392dbf31 100644 --- a/test/core/surface/BUILD +++ b/test/core/surface/BUILD @@ -31,6 +31,13 @@ load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_c licenses(["notice"]) # 3-clause BSD +package( + features = [ + "-layering_check", + "-parse_headers", + ], +) + grpc_cc_test( name = "alarm_test", srcs = ["alarm_test.c"], diff --git a/test/core/transport/BUILD b/test/core/transport/BUILD index 2628c891ec7..6c8b3f34ec6 100644 --- a/test/core/transport/BUILD +++ b/test/core/transport/BUILD @@ -31,6 +31,13 @@ load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_c licenses(["notice"]) # 3-clause BSD +package( + features = [ + "-layering_check", + "-parse_headers", + ], +) + grpc_cc_test( name = "bdp_estimator_test", srcs = ["bdp_estimator_test.c"], diff --git a/test/core/transport/chttp2/BUILD b/test/core/transport/chttp2/BUILD index af2a4aed342..fc24bea3991 100644 --- a/test/core/transport/chttp2/BUILD +++ b/test/core/transport/chttp2/BUILD @@ -31,6 +31,13 @@ load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_c licenses(["notice"]) # 3-clause BSD +package( + features = [ + "-layering_check", + "-parse_headers", + ], +) + load("//test/core/util:grpc_fuzzer.bzl", "grpc_fuzzer") grpc_fuzzer( diff --git a/test/core/tsi/BUILD b/test/core/tsi/BUILD index a0f2910f733..0ae2d28e159 100644 --- a/test/core/tsi/BUILD +++ b/test/core/tsi/BUILD @@ -31,6 +31,13 @@ load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_c licenses(["notice"]) # 3-clause BSD +package( + features = [ + "-layering_check", + "-parse_headers", + ], +) + grpc_cc_test( name = "transport_security_test", srcs = ["transport_security_test.c"], diff --git a/test/core/util/BUILD b/test/core/util/BUILD index 6b994625b97..dbc648bba09 100644 --- a/test/core/util/BUILD +++ b/test/core/util/BUILD @@ -31,7 +31,13 @@ load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_c licenses(["notice"]) # 3-clause BSD -package(default_visibility = ["//visibility:public"]) +package( + default_visibility = ["//visibility:public"], + features = [ + "-layering_check", + "-parse_headers", + ], +) grpc_cc_library( name = "gpr_test_util", diff --git a/test/cpp/codegen/BUILD b/test/cpp/codegen/BUILD index f974e63eb47..c6825afeec3 100644 --- a/test/cpp/codegen/BUILD +++ b/test/cpp/codegen/BUILD @@ -31,6 +31,13 @@ licenses(["notice"]) # 3-clause BSD load("//bazel:grpc_build_system.bzl", "grpc_cc_test") +package( + features = [ + "-layering_check", + "-parse_headers", + ], +) + grpc_cc_test( name = "codegen_test_full", srcs = ["codegen_test_full.cc"], diff --git a/test/cpp/common/BUILD b/test/cpp/common/BUILD index c8b3e46f5fd..76e3c0ff851 100644 --- a/test/cpp/common/BUILD +++ b/test/cpp/common/BUILD @@ -31,6 +31,13 @@ licenses(["notice"]) # 3-clause BSD load("//bazel:grpc_build_system.bzl", "grpc_cc_test") +package( + features = [ + "-layering_check", + "-parse_headers", + ], +) + grpc_cc_test( name = "alarm_cpp_test", srcs = ["alarm_cpp_test.cc"], diff --git a/test/cpp/end2end/BUILD b/test/cpp/end2end/BUILD index 9b691a83e09..459a9607369 100644 --- a/test/cpp/end2end/BUILD +++ b/test/cpp/end2end/BUILD @@ -31,7 +31,13 @@ licenses(["notice"]) # 3-clause BSD load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test") -package(default_visibility=["//visibility:public"]) # Allows external users to implement end2end tests. +package( + default_visibility=["//visibility:public"], # Allows external users to implement end2end tests. + features = [ + "-layering_check", + "-parse_headers", + ], +) grpc_cc_library( name = "test_service_impl", diff --git a/test/cpp/interop/BUILD b/test/cpp/interop/BUILD index 1a3e8d916fa..187addcdcd6 100644 --- a/test/cpp/interop/BUILD +++ b/test/cpp/interop/BUILD @@ -29,6 +29,13 @@ licenses(["notice"]) # 3-clause BSD +package( + features = [ + "-layering_check", + "-parse_headers", + ], +) + cc_library( name = "server_helper_lib", srcs = [ diff --git a/test/cpp/microbenchmarks/BUILD b/test/cpp/microbenchmarks/BUILD index 3a968a020a2..8eb813f3d59 100644 --- a/test/cpp/microbenchmarks/BUILD +++ b/test/cpp/microbenchmarks/BUILD @@ -31,6 +31,13 @@ licenses(["notice"]) # 3-clause BSD load("//bazel:grpc_build_system.bzl", "grpc_cc_test", "grpc_cc_library") +package( + features = [ + "-layering_check", + "-parse_headers", + ], +) + grpc_cc_test( name = "noop-benchmark", srcs = ["noop-benchmark.cc"], diff --git a/test/cpp/qps/BUILD b/test/cpp/qps/BUILD index c6a1fd2fcee..389ed7ba7db 100644 --- a/test/cpp/qps/BUILD +++ b/test/cpp/qps/BUILD @@ -31,6 +31,13 @@ licenses(["notice"]) # 3-clause BSD load("//bazel:grpc_build_system.bzl", "grpc_cc_test", "grpc_cc_library", "grpc_cc_binary") +package( + features = [ + "-layering_check", + "-parse_headers", + ], +) + grpc_cc_library( name = "parse_json", srcs = ["parse_json.cc"], diff --git a/test/cpp/util/BUILD b/test/cpp/util/BUILD index 453e9b6c0fd..b77eb60ee93 100644 --- a/test/cpp/util/BUILD +++ b/test/cpp/util/BUILD @@ -31,7 +31,13 @@ licenses(["notice"]) # 3-clause BSD load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_binary") -package(default_visibility = ["//visibility:public"]) +package( + default_visibility = ["//visibility:public"], + features = [ + "-layering_check", + "-parse_headers", + ], +) # The following builds a shared-object to confirm that grpc++_unsecure # builds properly. Build-only is sufficient here From 840931eec9bfd95c2d69f6b1e60413d18dd8281e Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Fri, 19 May 2017 15:37:45 -0700 Subject: [PATCH 05/42] More import fixes --- include/grpc++/impl/codegen/status.h | 5 +++++ src/core/lib/iomgr/timer_manager.c | 9 ++++----- test/cpp/end2end/BUILD | 1 + test/cpp/interop/BUILD | 14 +++++++++++--- test/cpp/qps/BUILD | 3 --- test/cpp/qps/client_sync.cc | 2 +- 6 files changed, 22 insertions(+), 12 deletions(-) diff --git a/include/grpc++/impl/codegen/status.h b/include/grpc++/impl/codegen/status.h index 31fd6cdbe78..e89103f85b9 100644 --- a/include/grpc++/impl/codegen/status.h +++ b/include/grpc++/impl/codegen/status.h @@ -75,6 +75,11 @@ class Status { /// Is the status OK? bool ok() const { return code_ == StatusCode::OK; } + // Ignores any errors. This method does nothing except potentially suppress + // complaints from any tools that are checking that errors are not dropped on + // the floor. + void IgnoreError() const {} + private: StatusCode code_; grpc::string error_message_; diff --git a/src/core/lib/iomgr/timer_manager.c b/src/core/lib/iomgr/timer_manager.c index 24085093e70..fd9a7a2f041 100644 --- a/src/core/lib/iomgr/timer_manager.c +++ b/src/core/lib/iomgr/timer_manager.c @@ -93,10 +93,10 @@ static void start_timer_thread_and_unlock(void) { if (GRPC_TRACER_ON(grpc_timer_check_trace)) { gpr_log(GPR_DEBUG, "Spawn timer thread"); } - gpr_thd_id thd; gpr_thd_options opt = gpr_thd_options_default(); gpr_thd_options_set_joinable(&opt); - gpr_thd_new(&thd, timer_thread, NULL, &opt); + completed_thread *ct = gpr_malloc(sizeof(*ct)); + gpr_thd_new(&ct->t, timer_thread, ct, &opt); } void grpc_timer_manager_tick() { @@ -107,7 +107,7 @@ void grpc_timer_manager_tick() { grpc_exec_ctx_finish(&exec_ctx); } -static void timer_thread(void *unused) { +static void timer_thread(void *completed_thread_ptr) { // this threads exec_ctx: we try to run things through to completion here // since it's easy to spin up new threads grpc_exec_ctx exec_ctx = @@ -194,8 +194,7 @@ static void timer_thread(void *unused) { if (0 == g_thread_count) { gpr_cv_signal(&g_cv_shutdown); } - completed_thread *ct = gpr_malloc(sizeof(*ct)); - ct->t = gpr_thd_currentid(); + completed_thread *ct = completed_thread_ptr; ct->next = g_completed_threads; g_completed_threads = ct; gpr_mu_unlock(&g_mu); diff --git a/test/cpp/end2end/BUILD b/test/cpp/end2end/BUILD index 9b691a83e09..1f7a4870d44 100644 --- a/test/cpp/end2end/BUILD +++ b/test/cpp/end2end/BUILD @@ -35,6 +35,7 @@ package(default_visibility=["//visibility:public"]) # Allows external users to i grpc_cc_library( name = "test_service_impl", + testonly = True, srcs = ["test_service_impl.cc"], hdrs = ["test_service_impl.h"], deps = [ diff --git a/test/cpp/interop/BUILD b/test/cpp/interop/BUILD index 04c3489adc4..8892da32bee 100644 --- a/test/cpp/interop/BUILD +++ b/test/cpp/interop/BUILD @@ -86,13 +86,21 @@ grpc_cc_library( ], ) -grpc_cc_binary( - name = "interop_client", +grpc_cc_library( + name = "interop_client_main", language = "c++", srcs = [ "client.cc", ], deps = [ - ":client_helper_lib", + ":client_helper_lib" + ], +) + +grpc_cc_binary( + name = "interop_client", + language = "c++", + deps = [ + ":interop_client_main", ], ) diff --git a/test/cpp/qps/BUILD b/test/cpp/qps/BUILD index c6a1fd2fcee..1f33dc55ff5 100644 --- a/test/cpp/qps/BUILD +++ b/test/cpp/qps/BUILD @@ -67,9 +67,6 @@ grpc_cc_library( "//test/core/util:grpc_test_util", "//test/cpp/util:test_util", ], - external_deps = [ - "gtest", - ], ) grpc_cc_library( diff --git a/test/cpp/qps/client_sync.cc b/test/cpp/qps/client_sync.cc index f35713280a1..0aae82604dc 100644 --- a/test/cpp/qps/client_sync.cc +++ b/test/cpp/qps/client_sync.cc @@ -155,7 +155,7 @@ class SynchronousStreamingClient : public SynchronousClient { if (*stream) { // forcibly cancel the streams, then finish context_[i].TryCancel(); - (*stream)->Finish(); + (*stream)->Finish().IgnoreError(); // don't log any error message on !ok since this was canceled } }); From 3dedf65b0f8e46f69dabcca0cef896c41e0bf586 Mon Sep 17 00:00:00 2001 From: "Nicolas \"Pixel\" Noble" Date: Wed, 24 May 2017 02:29:02 +0200 Subject: [PATCH 06/42] Fixing indentation + fixing interop_client. --- bazel/grpc_build_system.bzl | 12 ++++++------ test/cpp/interop/BUILD | 1 + 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/bazel/grpc_build_system.bzl b/bazel/grpc_build_system.bzl index 0f66edbcd05..cbf479b4a72 100644 --- a/bazel/grpc_build_system.bzl +++ b/bazel/grpc_build_system.bzl @@ -110,11 +110,11 @@ def grpc_cc_binary(name, srcs = [], deps = [], external_deps = [], args = [], da ) def grpc_generate_one_off_targets(): - pass + pass def grpc_sh_test(name, srcs, args = [], data = []): - native.sh_test( - name = name, - srcs = srcs, - args = args, - data = data) + native.sh_test( + name = name, + srcs = srcs, + args = args, + data = data) diff --git a/test/cpp/interop/BUILD b/test/cpp/interop/BUILD index 187addcdcd6..f12395ef44f 100644 --- a/test/cpp/interop/BUILD +++ b/test/cpp/interop/BUILD @@ -93,5 +93,6 @@ cc_binary( ], deps = [ ":client_helper_lib", + "//:grpc++", ], ) From c6dea730caf06699019ebe2765ce56bcff02449d Mon Sep 17 00:00:00 2001 From: "Nicolas \"Pixel\" Noble" Date: Thu, 25 May 2017 02:19:29 +0200 Subject: [PATCH 07/42] Realized that the interop BUILD file still uses cc_library and stuff. --- test/cpp/interop/BUILD | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/test/cpp/interop/BUILD b/test/cpp/interop/BUILD index f12395ef44f..55775654856 100644 --- a/test/cpp/interop/BUILD +++ b/test/cpp/interop/BUILD @@ -29,6 +29,8 @@ licenses(["notice"]) # 3-clause BSD +load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary") + package( features = [ "-layering_check", @@ -36,7 +38,7 @@ package( ], ) -cc_library( +grpc_cc_library( name = "server_helper_lib", srcs = [ "server_helper.cc", @@ -50,15 +52,25 @@ cc_library( ], ) -cc_binary( +grpc_cc_binary( name = "interop_server", srcs = [ - "interop_server.cc", "interop_server_bootstrap.cc", ], + language = "C++", deps = [ - ":server_helper_lib", "//:grpc++", + ], +) + +grpc_cc_library( + name = "interop_server_lib", + srcs = [ + "interop_server.cc", + ], + language = "C++", + deps = [ + ":server_helper_lib", "//src/proto/grpc/testing:empty_proto", "//src/proto/grpc/testing:messages_proto", "//src/proto/grpc/testing:test_proto", @@ -66,7 +78,7 @@ cc_binary( ], ) -cc_library( +grpc_cc_library( name = "client_helper_lib", srcs = [ "client_helper.cc", @@ -86,7 +98,7 @@ cc_library( ], ) -cc_binary( +grpc_cc_binary( name = "interop_client", srcs = [ "client.cc", From d1c72ee33e49961cc6fbf4ee113a5f9e72f08872 Mon Sep 17 00:00:00 2001 From: "Nicolas \"Pixel\" Noble" Date: Thu, 25 May 2017 04:26:01 +0200 Subject: [PATCH 08/42] Adding reconnect interop client and server. --- test/cpp/interop/BUILD | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/test/cpp/interop/BUILD b/test/cpp/interop/BUILD index 55775654856..7b4286d8b82 100644 --- a/test/cpp/interop/BUILD +++ b/test/cpp/interop/BUILD @@ -60,6 +60,7 @@ grpc_cc_binary( language = "C++", deps = [ "//:grpc++", + ":interop_server_lib", ], ) @@ -108,3 +109,28 @@ grpc_cc_binary( "//:grpc++", ], ) + +grpc_cc_binary( + name = "reconnect_interop_client", + srcs = [ + "reconnect_interop_client.cc", + ], + deps = [ + ":client_helper_lib", + "//:grpc++", + "//test/core/util:grpc_test_util", + ], +) + +grpc_cc_binary( + name = "reconnect_interop_server", + srcs = [ + "reconnect_interop_server.cc" + ], + language = "C++", + deps = [ + "//:grpc++", + ":interop_server_lib", + "//test/core/util:grpc_test_util", + ], +) From 7e5364781b9091d18978d900b8778f40e8854f2e Mon Sep 17 00:00:00 2001 From: "Nicolas \"Pixel\" Noble" Date: Thu, 25 May 2017 04:45:06 +0200 Subject: [PATCH 09/42] Adding interop stress test. --- test/cpp/interop/BUILD | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/test/cpp/interop/BUILD b/test/cpp/interop/BUILD index 7b4286d8b82..1bfe40f3b43 100644 --- a/test/cpp/interop/BUILD +++ b/test/cpp/interop/BUILD @@ -129,8 +129,23 @@ grpc_cc_binary( ], language = "C++", deps = [ - "//:grpc++", ":interop_server_lib", + "//:grpc++", "//test/core/util:grpc_test_util", ], ) + +grpc_cc_binary( + name = "stress_test", + srcs = [ + "stress_test.cc", + "stress_interop_client.cc", + "stress_interop_client.h", + ], + deps = [ + ":client_helper_lib", + "//:grpc++", + "//test/cpp/util:metrics_server_lib", + "//test/cpp/util:test_config", + ], +) From 6fa7236d2460288c595369b920a7840e45118e0a Mon Sep 17 00:00:00 2001 From: "Nicolas \"Pixel\" Noble" Date: Thu, 25 May 2017 19:38:44 +0200 Subject: [PATCH 10/42] Moving testing headers at the end. --- test/cpp/end2end/mock_test.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/cpp/end2end/mock_test.cc b/test/cpp/end2end/mock_test.cc index 3a82b3a5d60..c93bc61657a 100644 --- a/test/cpp/end2end/mock_test.cc +++ b/test/cpp/end2end/mock_test.cc @@ -34,7 +34,6 @@ #include #include -#include #include #include #include @@ -46,14 +45,15 @@ #include #include -#include - #include "src/proto/grpc/testing/duplicate/echo_duplicate.grpc.pb.h" #include "src/proto/grpc/testing/echo.grpc.pb.h" #include "src/proto/grpc/testing/echo_mock.grpc.pb.h" #include "test/core/util/port.h" #include "test/core/util/test_config.h" +#include + +#include #include #include From 670d8bf67512998437b8bb87c393c764774294ed Mon Sep 17 00:00:00 2001 From: "Nicolas \"Pixel\" Noble" Date: Thu, 25 May 2017 21:25:02 +0200 Subject: [PATCH 11/42] Moving gtest to the end. --- test/cpp/end2end/grpclb_end2end_test.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/cpp/end2end/grpclb_end2end_test.cc b/test/cpp/end2end/grpclb_end2end_test.cc index 4e1bcc7a60d..31aeee0e809 100644 --- a/test/cpp/end2end/grpclb_end2end_test.cc +++ b/test/cpp/end2end/grpclb_end2end_test.cc @@ -47,7 +47,6 @@ #include #include #include -#include extern "C" { #include "src/core/lib/iomgr/sockaddr.h" @@ -61,6 +60,8 @@ extern "C" { #include "src/proto/grpc/lb/v1/load_balancer.grpc.pb.h" #include "src/proto/grpc/testing/echo.grpc.pb.h" +#include + // TODO(dgq): Other scenarios in need of testing: // - Send a serverlist with faulty ip:port addresses (port > 2^16, etc). // - Test reception of invalid serverlist From 86ac5966f6cfd5af91e46f132019a530ec936e3a Mon Sep 17 00:00:00 2001 From: "Nicolas \"Pixel\" Noble" Date: Wed, 31 May 2017 20:23:41 +0200 Subject: [PATCH 12/42] Better layering support for grpc++. --- BUILD | 197 +++++++++++++++++++++++++++++----------------------------- 1 file changed, 99 insertions(+), 98 deletions(-) diff --git a/BUILD b/BUILD index 1ed55a693e7..6416cef1264 100644 --- a/BUILD +++ b/BUILD @@ -111,6 +111,103 @@ grpc_cc_library( ], ) +# TODO(ctiller): layer grpc atop grpc_unsecure, layer grpc++ atop grpc++_unsecure +GRPCXX_SRCS = [ + "src/cpp/client/channel_cc.cc", + "src/cpp/client/client_context.cc", + "src/cpp/client/create_channel.cc", + "src/cpp/client/create_channel_internal.cc", + "src/cpp/client/create_channel_posix.cc", + "src/cpp/client/credentials_cc.cc", + "src/cpp/client/generic_stub.cc", + "src/cpp/common/channel_arguments.cc", + "src/cpp/common/channel_filter.cc", + "src/cpp/common/completion_queue_cc.cc", + "src/cpp/common/core_codegen.cc", + "src/cpp/common/resource_quota_cc.cc", + "src/cpp/common/rpc_method.cc", + "src/cpp/common/version_cc.cc", + "src/cpp/server/async_generic_service.cc", + "src/cpp/server/channel_argument_option.cc", + "src/cpp/server/create_default_thread_pool.cc", + "src/cpp/server/dynamic_thread_pool.cc", + "src/cpp/server/health/default_health_check_service.cc", + "src/cpp/server/health/health.pb.c", + "src/cpp/server/health/health_check_service.cc", + "src/cpp/server/health/health_check_service_server_builder_option.cc", + "src/cpp/server/server_builder.cc", + "src/cpp/server/server_cc.cc", + "src/cpp/server/server_context.cc", + "src/cpp/server/server_credentials.cc", + "src/cpp/server/server_posix.cc", + "src/cpp/thread_manager/thread_manager.cc", + "src/cpp/util/byte_buffer_cc.cc", + "src/cpp/util/slice_cc.cc", + "src/cpp/util/status.cc", + "src/cpp/util/string_ref.cc", + "src/cpp/util/time_cc.cc", +] + +GRPCXX_HDRS = [ + "src/cpp/client/create_channel_internal.h", + "src/cpp/common/channel_filter.h", + "src/cpp/server/dynamic_thread_pool.h", + "src/cpp/server/health/default_health_check_service.h", + "src/cpp/server/health/health.pb.h", + "src/cpp/server/thread_pool_interface.h", + "src/cpp/thread_manager/thread_manager.h", +] + +GRPCXX_PUBLIC_HDRS = [ + "include/grpc++/alarm.h", + "include/grpc++/channel.h", + "include/grpc++/client_context.h", + "include/grpc++/completion_queue.h", + "include/grpc++/create_channel.h", + "include/grpc++/create_channel_posix.h", + "include/grpc++/ext/health_check_service_server_builder_option.h", + "include/grpc++/generic/async_generic_service.h", + "include/grpc++/generic/generic_stub.h", + "include/grpc++/grpc++.h", + "include/grpc++/health_check_service_interface.h", + "include/grpc++/impl/call.h", + "include/grpc++/impl/channel_argument_option.h", + "include/grpc++/impl/client_unary_call.h", + "include/grpc++/impl/codegen/core_codegen.h", + "include/grpc++/impl/grpc_library.h", + "include/grpc++/impl/method_handler_impl.h", + "include/grpc++/impl/rpc_method.h", + "include/grpc++/impl/rpc_service_method.h", + "include/grpc++/impl/serialization_traits.h", + "include/grpc++/impl/server_builder_option.h", + "include/grpc++/impl/server_builder_plugin.h", + "include/grpc++/impl/server_initializer.h", + "include/grpc++/impl/service_type.h", + "include/grpc++/impl/sync_cxx11.h", + "include/grpc++/impl/sync_no_cxx11.h", + "include/grpc++/resource_quota.h", + "include/grpc++/security/auth_context.h", + "include/grpc++/security/auth_metadata_processor.h", + "include/grpc++/security/credentials.h", + "include/grpc++/security/server_credentials.h", + "include/grpc++/server.h", + "include/grpc++/server_builder.h", + "include/grpc++/server_context.h", + "include/grpc++/server_posix.h", + "include/grpc++/support/async_stream.h", + "include/grpc++/support/async_unary_call.h", + "include/grpc++/support/byte_buffer.h", + "include/grpc++/support/channel_arguments.h", + "include/grpc++/support/config.h", + "include/grpc++/support/slice.h", + "include/grpc++/support/status.h", + "include/grpc++/support/status_code_enum.h", + "include/grpc++/support/string_ref.h", + "include/grpc++/support/stub_options.h", + "include/grpc++/support/sync_stream.h", + "include/grpc++/support/time.h", +] + grpc_cc_library( name = "grpc++", srcs = [ @@ -129,6 +226,7 @@ grpc_cc_library( "src/cpp/server/secure_server_credentials.h", ], language = "c++", + public_hdrs = GRPCXX_PUBLIC_HDRS, standalone = True, deps = [ "gpr", @@ -447,9 +545,9 @@ grpc_cc_library( grpc_cc_library( name = "grpc_trace", - language = "c", srcs = ["src/core/lib/debug/trace.c"], hdrs = ["src/core/lib/debug/trace.h"], + language = "c", deps = [":gpr"], ) @@ -1306,103 +1404,6 @@ grpc_cc_library( ], ) -# TODO(ctiller): layer grpc atop grpc_unsecure, layer grpc++ atop grpc++_unsecure -GRPCXX_SRCS = [ - "src/cpp/client/channel_cc.cc", - "src/cpp/client/client_context.cc", - "src/cpp/client/create_channel.cc", - "src/cpp/client/create_channel_internal.cc", - "src/cpp/client/create_channel_posix.cc", - "src/cpp/client/credentials_cc.cc", - "src/cpp/client/generic_stub.cc", - "src/cpp/common/channel_arguments.cc", - "src/cpp/common/channel_filter.cc", - "src/cpp/common/completion_queue_cc.cc", - "src/cpp/common/core_codegen.cc", - "src/cpp/common/resource_quota_cc.cc", - "src/cpp/common/rpc_method.cc", - "src/cpp/common/version_cc.cc", - "src/cpp/server/async_generic_service.cc", - "src/cpp/server/channel_argument_option.cc", - "src/cpp/server/create_default_thread_pool.cc", - "src/cpp/server/dynamic_thread_pool.cc", - "src/cpp/server/health/default_health_check_service.cc", - "src/cpp/server/health/health.pb.c", - "src/cpp/server/health/health_check_service.cc", - "src/cpp/server/health/health_check_service_server_builder_option.cc", - "src/cpp/server/server_builder.cc", - "src/cpp/server/server_cc.cc", - "src/cpp/server/server_context.cc", - "src/cpp/server/server_credentials.cc", - "src/cpp/server/server_posix.cc", - "src/cpp/thread_manager/thread_manager.cc", - "src/cpp/util/byte_buffer_cc.cc", - "src/cpp/util/slice_cc.cc", - "src/cpp/util/status.cc", - "src/cpp/util/string_ref.cc", - "src/cpp/util/time_cc.cc", -] - -GRPCXX_HDRS = [ - "src/cpp/client/create_channel_internal.h", - "src/cpp/common/channel_filter.h", - "src/cpp/server/dynamic_thread_pool.h", - "src/cpp/server/health/default_health_check_service.h", - "src/cpp/server/health/health.pb.h", - "src/cpp/server/thread_pool_interface.h", - "src/cpp/thread_manager/thread_manager.h", -] - -GRPCXX_PUBLIC_HDRS = [ - "include/grpc++/alarm.h", - "include/grpc++/channel.h", - "include/grpc++/client_context.h", - "include/grpc++/completion_queue.h", - "include/grpc++/create_channel.h", - "include/grpc++/create_channel_posix.h", - "include/grpc++/ext/health_check_service_server_builder_option.h", - "include/grpc++/generic/async_generic_service.h", - "include/grpc++/generic/generic_stub.h", - "include/grpc++/grpc++.h", - "include/grpc++/health_check_service_interface.h", - "include/grpc++/impl/call.h", - "include/grpc++/impl/channel_argument_option.h", - "include/grpc++/impl/client_unary_call.h", - "include/grpc++/impl/codegen/core_codegen.h", - "include/grpc++/impl/grpc_library.h", - "include/grpc++/impl/method_handler_impl.h", - "include/grpc++/impl/rpc_method.h", - "include/grpc++/impl/rpc_service_method.h", - "include/grpc++/impl/serialization_traits.h", - "include/grpc++/impl/server_builder_option.h", - "include/grpc++/impl/server_builder_plugin.h", - "include/grpc++/impl/server_initializer.h", - "include/grpc++/impl/service_type.h", - "include/grpc++/impl/sync_cxx11.h", - "include/grpc++/impl/sync_no_cxx11.h", - "include/grpc++/resource_quota.h", - "include/grpc++/security/auth_context.h", - "include/grpc++/security/auth_metadata_processor.h", - "include/grpc++/security/credentials.h", - "include/grpc++/security/server_credentials.h", - "include/grpc++/server.h", - "include/grpc++/server_builder.h", - "include/grpc++/server_context.h", - "include/grpc++/server_posix.h", - "include/grpc++/support/async_stream.h", - "include/grpc++/support/async_unary_call.h", - "include/grpc++/support/byte_buffer.h", - "include/grpc++/support/channel_arguments.h", - "include/grpc++/support/config.h", - "include/grpc++/support/slice.h", - "include/grpc++/support/status.h", - "include/grpc++/support/status_code_enum.h", - "include/grpc++/support/string_ref.h", - "include/grpc++/support/stub_options.h", - "include/grpc++/support/sync_stream.h", - "include/grpc++/support/time.h", -] - grpc_cc_library( name = "grpc++_base", srcs = GRPCXX_SRCS, From e7c2458d66b4e4210fb4c5d7e1670aef6b4c9381 Mon Sep 17 00:00:00 2001 From: "Nicolas \"Pixel\" Noble" Date: Fri, 2 Jun 2017 20:29:36 +0200 Subject: [PATCH 13/42] More layering. --- BUILD | 203 ++++++++++++++++++++++++++++++---------------------------- 1 file changed, 106 insertions(+), 97 deletions(-) diff --git a/BUILD b/BUILD index 6416cef1264..8d9288a3dd3 100644 --- a/BUILD +++ b/BUILD @@ -55,61 +55,52 @@ core_version = "3.0.0-dev" version = "1.4.0-dev" -grpc_cc_library( - name = "gpr", - language = "c", - standalone = True, - deps = [ - "gpr_base", - ], -) - -grpc_cc_library( - name = "grpc_unsecure", - srcs = [ - "src/core/lib/surface/init.c", - "src/core/lib/surface/init_unsecure.c", - "src/core/plugin_registry/grpc_unsecure_plugin_registry.c", - ], - language = "c", - standalone = True, - deps = [ - "grpc_common", - ], -) +GPR_PUBLIC_HDRS = [ + "include/grpc/support/alloc.h", + "include/grpc/support/atm.h", + "include/grpc/support/atm_gcc_atomic.h", + "include/grpc/support/atm_gcc_sync.h", + "include/grpc/support/atm_windows.h", + "include/grpc/support/avl.h", + "include/grpc/support/cmdline.h", + "include/grpc/support/cpu.h", + "include/grpc/support/histogram.h", + "include/grpc/support/host_port.h", + "include/grpc/support/log.h", + "include/grpc/support/log_windows.h", + "include/grpc/support/port_platform.h", + "include/grpc/support/string_util.h", + "include/grpc/support/subprocess.h", + "include/grpc/support/sync.h", + "include/grpc/support/sync_generic.h", + "include/grpc/support/sync_posix.h", + "include/grpc/support/sync_windows.h", + "include/grpc/support/thd.h", + "include/grpc/support/time.h", + "include/grpc/support/tls.h", + "include/grpc/support/tls_gcc.h", + "include/grpc/support/tls_msvc.h", + "include/grpc/support/tls_pthread.h", + "include/grpc/support/useful.h", +] -grpc_cc_library( - name = "grpc", - srcs = [ - "src/core/lib/surface/init.c", - "src/core/plugin_registry/grpc_plugin_registry.c", - ], - language = "c", - standalone = True, - deps = [ - "grpc_common", - "grpc_lb_policy_grpclb_secure", - "grpc_resolver_dns_ares", - "grpc_secure", - "grpc_transport_chttp2_client_secure", - "grpc_transport_chttp2_server_secure", - ], -) +GRPC_PUBLIC_HDRS = [ + "include/grpc/byte_buffer.h", + "include/grpc/byte_buffer_reader.h", + "include/grpc/compression.h", + "include/grpc/load_reporting.h", + "include/grpc/grpc.h", + "include/grpc/grpc_posix.h", + "include/grpc/grpc_security_constants.h", + "include/grpc/slice.h", + "include/grpc/slice_buffer.h", + "include/grpc/status.h", + "include/grpc/support/workaround_list.h", +] -grpc_cc_library( - name = "grpc_cronet", - srcs = [ - "src/core/lib/surface/init.c", - "src/core/plugin_registry/grpc_cronet_plugin_registry.c", - ], - language = "c", - deps = [ - "grpc_base", - "grpc_http_filters", - "grpc_transport_chttp2_client_secure", - "grpc_transport_cronet_client_secure", - ], -) +GRPC_SECURE_PUBLIC_HDRS = [ + "include/grpc/grpc_security.h", +] # TODO(ctiller): layer grpc atop grpc_unsecure, layer grpc++ atop grpc++_unsecure GRPCXX_SRCS = [ @@ -208,6 +199,65 @@ GRPCXX_PUBLIC_HDRS = [ "include/grpc++/support/time.h", ] +grpc_cc_library( + name = "gpr", + language = "c", + public_hdrs = GPR_PUBLIC_HDRS, + standalone = True, + deps = [ + "gpr_base", + ], +) + +grpc_cc_library( + name = "grpc_unsecure", + srcs = [ + "src/core/lib/surface/init.c", + "src/core/lib/surface/init_unsecure.c", + "src/core/plugin_registry/grpc_unsecure_plugin_registry.c", + ], + language = "c", + public_hdrs = GRPC_PUBLIC_HDRS, + standalone = True, + deps = [ + "grpc_common", + ], +) + +grpc_cc_library( + name = "grpc", + srcs = [ + "src/core/lib/surface/init.c", + "src/core/plugin_registry/grpc_plugin_registry.c", + ], + language = "c", + public_hdrs = GRPC_PUBLIC_HDRS + GRPC_SECURE_PUBLIC_HDRS, + standalone = True, + deps = [ + "grpc_common", + "grpc_lb_policy_grpclb_secure", + "grpc_resolver_dns_ares", + "grpc_secure", + "grpc_transport_chttp2_client_secure", + "grpc_transport_chttp2_server_secure", + ], +) + +grpc_cc_library( + name = "grpc_cronet", + srcs = [ + "src/core/lib/surface/init.c", + "src/core/plugin_registry/grpc_cronet_plugin_registry.c", + ], + language = "c", + deps = [ + "grpc_base", + "grpc_http_filters", + "grpc_transport_chttp2_client_secure", + "grpc_transport_cronet_client_secure", + ], +) + grpc_cc_library( name = "grpc++", srcs = [ @@ -492,34 +542,7 @@ grpc_cc_library( "src/core/lib/support/tmpfile.h", ], language = "c", - public_hdrs = [ - "include/grpc/support/alloc.h", - "include/grpc/support/atm.h", - "include/grpc/support/atm_gcc_atomic.h", - "include/grpc/support/atm_gcc_sync.h", - "include/grpc/support/atm_windows.h", - "include/grpc/support/avl.h", - "include/grpc/support/cmdline.h", - "include/grpc/support/cpu.h", - "include/grpc/support/histogram.h", - "include/grpc/support/host_port.h", - "include/grpc/support/log.h", - "include/grpc/support/log_windows.h", - "include/grpc/support/port_platform.h", - "include/grpc/support/string_util.h", - "include/grpc/support/subprocess.h", - "include/grpc/support/sync.h", - "include/grpc/support/sync_generic.h", - "include/grpc/support/sync_posix.h", - "include/grpc/support/sync_windows.h", - "include/grpc/support/thd.h", - "include/grpc/support/time.h", - "include/grpc/support/tls.h", - "include/grpc/support/tls_gcc.h", - "include/grpc/support/tls_msvc.h", - "include/grpc/support/tls_pthread.h", - "include/grpc/support/useful.h", - ], + public_hdrs = GPR_PUBLIC_HDRS, deps = [ "gpr_codegen", ], @@ -798,19 +821,7 @@ grpc_cc_library( "zlib", ], language = "c", - public_hdrs = [ - "include/grpc/byte_buffer.h", - "include/grpc/byte_buffer_reader.h", - "include/grpc/compression.h", - "include/grpc/load_reporting.h", - "include/grpc/grpc.h", - "include/grpc/grpc_posix.h", - "include/grpc/grpc_security_constants.h", - "include/grpc/slice.h", - "include/grpc/slice_buffer.h", - "include/grpc/status.h", - "include/grpc/support/workaround_list.h", - ], + public_hdrs = GRPC_PUBLIC_HDRS, deps = [ "gpr_base", "grpc_codegen", @@ -1188,9 +1199,7 @@ grpc_cc_library( "src/core/lib/security/util/json_util.h", ], language = "c", - public_hdrs = [ - "include/grpc/grpc_security.h", - ], + public_hdrs = GRPC_SECURE_PUBLIC_HDRS, deps = [ "grpc_base", "grpc_transport_chttp2_alpn", From 7301ab4d73c86d188daefed05022976d8a0c8a98 Mon Sep 17 00:00:00 2001 From: Adele Zhou Date: Tue, 11 Jul 2017 12:05:26 -0700 Subject: [PATCH 14/42] Use special report suffix for internal ci. --- .../internal_ci/linux/grpc_interop_tocloud.sh | 2 +- tools/run_tests/run_interop_tests.py | 21 +++++++++++++++++-- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/tools/internal_ci/linux/grpc_interop_tocloud.sh b/tools/internal_ci/linux/grpc_interop_tocloud.sh index fe5c9a5130a..e3ba25af5df 100755 --- a/tools/internal_ci/linux/grpc_interop_tocloud.sh +++ b/tools/internal_ci/linux/grpc_interop_tocloud.sh @@ -23,4 +23,4 @@ cd $(dirname $0)/../../.. source tools/internal_ci/helper_scripts/prepare_build_linux_rc source tools/internal_ci/helper_scripts/prepare_build_interop_rc -tools/run_tests/run_interop_tests.py -l all -s all --use_docker --http2_interop -t -j 12 $@ +tools/run_tests/run_interop_tests.py -l all -s all --use_docker --http2_interop --internal_ci -t -j 12 $@ diff --git a/tools/run_tests/run_interop_tests.py b/tools/run_tests/run_interop_tests.py index 80062aa37d9..533676ea310 100755 --- a/tools/run_tests/run_interop_tests.py +++ b/tools/run_tests/run_interop_tests.py @@ -63,6 +63,15 @@ _TEST_TIMEOUT = 3*60 # see https://github.com/grpc/grpc/issues/9779 _SKIP_DATA_FRAME_PADDING = ['data_frame_padding'] +# report suffix is important for reports to get picked up by internal CI +_INTERNAL_CL_REPORT_SUFFIX = 'sponge_log.xml' + + +def _report_filename_internal_ci(name): + """Generates report file name that leads to better presentation by internal CI""" + return '%s/%s' % (name, _INTERNAL_CL_REPORT_SUFFIX) + + class CXXLanguage: def __init__(self): @@ -943,7 +952,12 @@ argp.add_argument('--insecure', action='store_const', const=True, help='Whether to use secure channel.') - +argp.add_argument('--internal_ci', + default=False, + action='store_const', + const=True, + help=('Put reports into subdirectories to improve ' + 'presentation of results by Internal CI.')) args = argp.parse_args() servers = set(s for s in itertools.chain.from_iterable(_SERVERS @@ -1201,7 +1215,10 @@ try: write_cmdlog_maybe(server_manual_cmd_log, 'interop_server_cmds.sh') write_cmdlog_maybe(client_manual_cmd_log, 'interop_client_cmds.sh') - report_utils.render_junit_xml_report(resultset, 'report.xml') + xml_report_name = 'report.xml' + if args.internal_ci: + xml_report_name = _report_filename_internal_ci(xml_report_name) + report_utils.render_junit_xml_report(resultset, xml_report_name) for name, job in resultset.items(): if "http2" in name: From b867c06088377d45f1699c87bbdd63055f66934b Mon Sep 17 00:00:00 2001 From: Adele Zhou Date: Tue, 11 Jul 2017 14:00:20 -0700 Subject: [PATCH 15/42] Add config and script for cloud-to-prod for internal ci. --- .../linux/grpc_interop_tocloud.cfg | 2 +- .../internal_ci/linux/grpc_interop_toprod.cfg | 26 +++++++++++++++ .../internal_ci/linux/grpc_interop_toprod.sh | 32 +++++++++++++++++++ tools/run_tests/run_interop_tests.py | 12 +++---- 4 files changed, 64 insertions(+), 8 deletions(-) create mode 100644 tools/internal_ci/linux/grpc_interop_toprod.cfg create mode 100644 tools/internal_ci/linux/grpc_interop_toprod.sh diff --git a/tools/internal_ci/linux/grpc_interop_tocloud.cfg b/tools/internal_ci/linux/grpc_interop_tocloud.cfg index 1f6421c83d7..0c31b497afe 100644 --- a/tools/internal_ci/linux/grpc_interop_tocloud.cfg +++ b/tools/internal_ci/linux/grpc_interop_tocloud.cfg @@ -20,6 +20,6 @@ build_file: "grpc/tools/internal_ci/linux/grpc_interop_tocloud.sh" timeout_mins: 480 action { define_artifacts { - regex: "**/report.xml" + regex: "**/sponge_log.xml" } } diff --git a/tools/internal_ci/linux/grpc_interop_toprod.cfg b/tools/internal_ci/linux/grpc_interop_toprod.cfg new file mode 100644 index 00000000000..18978b87e55 --- /dev/null +++ b/tools/internal_ci/linux/grpc_interop_toprod.cfg @@ -0,0 +1,26 @@ +# Copyright 2017 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Config file for the internal CI (in protobuf text format) + +# Location of the continuous shell script in repository. +build_file: "grpc/tools/internal_ci/linux/grpc_interop_toprod.sh" +# grpc_interop tests can take 6+ hours to complete. +timeout_mins: 60 +action { + define_artifacts { + regex: "**/sponge_log.xml" + } +} + diff --git a/tools/internal_ci/linux/grpc_interop_toprod.sh b/tools/internal_ci/linux/grpc_interop_toprod.sh new file mode 100644 index 00000000000..3d06185406a --- /dev/null +++ b/tools/internal_ci/linux/grpc_interop_toprod.sh @@ -0,0 +1,32 @@ +#!/usr/bin/env bash +# Copyright 2017 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -ex + +export LANG=en_US.UTF-8 + +# Enter the gRPC repo root +cd $(dirname $0)/../../.. + +source tools/internal_ci/helper_scripts/prepare_build_linux_rc +source tools/internal_ci/helper_scripts/prepare_build_interop_rc + +tools/run_tests/run_interop_tests.py \ + -l all \ + --cloud_to_prod \ + --cloud_to_prod_auth \ + --prod_servers default gateway_v4 \ + --use_docker --internal_ci -t -j 12 $@ + diff --git a/tools/run_tests/run_interop_tests.py b/tools/run_tests/run_interop_tests.py index 533676ea310..1e702a86365 100755 --- a/tools/run_tests/run_interop_tests.py +++ b/tools/run_tests/run_interop_tests.py @@ -64,12 +64,10 @@ _TEST_TIMEOUT = 3*60 _SKIP_DATA_FRAME_PADDING = ['data_frame_padding'] # report suffix is important for reports to get picked up by internal CI -_INTERNAL_CL_REPORT_SUFFIX = 'sponge_log.xml' +_INTERNAL_CL_XML_REPORT = 'sponge_log.xml' - -def _report_filename_internal_ci(name): - """Generates report file name that leads to better presentation by internal CI""" - return '%s/%s' % (name, _INTERNAL_CL_REPORT_SUFFIX) +# report suffix is important for reports to get picked up by internal CI +_XML_REPORT = 'report.xml' class CXXLanguage: @@ -1215,9 +1213,9 @@ try: write_cmdlog_maybe(server_manual_cmd_log, 'interop_server_cmds.sh') write_cmdlog_maybe(client_manual_cmd_log, 'interop_client_cmds.sh') - xml_report_name = 'report.xml' + xml_report_name = _XML_REPORT if args.internal_ci: - xml_report_name = _report_filename_internal_ci(xml_report_name) + xml_report_name = _INTERNAL_CL_XML_REPORT report_utils.render_junit_xml_report(resultset, xml_report_name) for name, job in resultset.items(): From 600ae82d4caee4cc8226a7f806f4e03c9e5d0a87 Mon Sep 17 00:00:00 2001 From: Alexander Polcyn Date: Tue, 11 Jul 2017 15:47:05 -0700 Subject: [PATCH 16/42] remove an unused method --- src/ruby/lib/grpc/generic/active_call.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ruby/lib/grpc/generic/active_call.rb b/src/ruby/lib/grpc/generic/active_call.rb index cb407d236d1..67c984ab49b 100644 --- a/src/ruby/lib/grpc/generic/active_call.rb +++ b/src/ruby/lib/grpc/generic/active_call.rb @@ -516,7 +516,7 @@ module GRPC # MultiReqView limits access to an ActiveCall's methods for use in # server client_streamer handlers. - MultiReqView = view_class(:cancelled?, :deadline, :each_queued_msg, + MultiReqView = view_class(:cancelled?, :deadline, :each_remote_read, :metadata, :output_metadata, :send_initial_metadata, :metadata_to_send, From 147f52f31e7cac8eca6522a9a65b185896ebd3be Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Fri, 2 Jun 2017 10:21:30 -0700 Subject: [PATCH 17/42] increase timeout for builing ruby artifact --- tools/run_tests/artifacts/artifact_targets.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/run_tests/artifacts/artifact_targets.py b/tools/run_tests/artifacts/artifact_targets.py index 9373db2948f..841bbdf9120 100644 --- a/tools/run_tests/artifacts/artifact_targets.py +++ b/tools/run_tests/artifacts/artifact_targets.py @@ -180,7 +180,8 @@ class RubyArtifact: # We are using a custom workspace instead. return create_jobspec(self.name, ['tools/run_tests/artifacts/build_artifact_ruby.sh'], - use_workspace=True) + use_workspace=True, + timeout_seconds=45*60) class CSharpExtArtifact: From 15494b5d3e2b4ed8d8dc2243f32d06c41d668e9d Mon Sep 17 00:00:00 2001 From: "Mark D. Roth" Date: Wed, 12 Jul 2017 15:26:55 -0700 Subject: [PATCH 18/42] Don't set the channel's state to TRANSIENT_FAILURE if we updated the LB policy. --- src/core/ext/filters/client_channel/client_channel.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/core/ext/filters/client_channel/client_channel.c b/src/core/ext/filters/client_channel/client_channel.c index 7add4325895..a383d4f6786 100644 --- a/src/core/ext/filters/client_channel/client_channel.c +++ b/src/core/ext/filters/client_channel/client_channel.c @@ -370,6 +370,7 @@ static void on_resolver_result_changed_locked(grpc_exec_ctx *exec_ctx, grpc_error_string(error)); } // Extract the following fields from the resolver result, if non-NULL. + bool lb_policy_updated = false; char *lb_policy_name = NULL; bool lb_policy_name_changed = false; grpc_lb_policy *new_lb_policy = NULL; @@ -424,6 +425,7 @@ static void on_resolver_result_changed_locked(grpc_exec_ctx *exec_ctx, strcmp(chand->info_lb_policy_name, lb_policy_name) != 0; if (chand->lb_policy != NULL && !lb_policy_name_changed) { // Continue using the same LB policy. Update with new addresses. + lb_policy_updated = true; grpc_lb_policy_update_locked(exec_ctx, chand->lb_policy, &lb_policy_args); } else { // Instantiate new LB policy. @@ -569,8 +571,11 @@ static void on_resolver_result_changed_locked(grpc_exec_ctx *exec_ctx, } watch_lb_policy_locked(exec_ctx, chand, new_lb_policy, state); } - set_channel_connectivity_state_locked( - exec_ctx, chand, state, GRPC_ERROR_REF(state_error), "new_lb+resolver"); + if (!lb_policy_updated) { + set_channel_connectivity_state_locked(exec_ctx, chand, state, + GRPC_ERROR_REF(state_error), + "new_lb+resolver"); + } grpc_resolver_next_locked(exec_ctx, chand->resolver, &chand->resolver_result, &chand->on_resolver_result_changed); From 616dafd52c5ea2e34aa4c20e22aecdd3f4531800 Mon Sep 17 00:00:00 2001 From: ncteisen Date: Sun, 11 Jun 2017 22:07:36 -0700 Subject: [PATCH 19/42] Partial revert of https://github.com/grpc/grpc/pull/10743 --- include/grpc++/impl/codegen/config_protobuf.h | 2 - include/grpc++/impl/codegen/proto_utils.h | 110 +++++++----------- 2 files changed, 42 insertions(+), 70 deletions(-) diff --git a/include/grpc++/impl/codegen/config_protobuf.h b/include/grpc++/impl/codegen/config_protobuf.h index 7387fa25c66..c5e5bdf0dbc 100644 --- a/include/grpc++/impl/codegen/config_protobuf.h +++ b/include/grpc++/impl/codegen/config_protobuf.h @@ -19,8 +19,6 @@ #ifndef GRPCXX_IMPL_CODEGEN_CONFIG_PROTOBUF_H #define GRPCXX_IMPL_CODEGEN_CONFIG_PROTOBUF_H -#define GRPC_OPEN_SOURCE_PROTO - #ifndef GRPC_CUSTOM_PROTOBUF_INT64 #include #define GRPC_CUSTOM_PROTOBUF_INT64 ::google::protobuf::int64 diff --git a/include/grpc++/impl/codegen/proto_utils.h b/include/grpc++/impl/codegen/proto_utils.h index fcb4453d836..67e8f71a899 100644 --- a/include/grpc++/impl/codegen/proto_utils.h +++ b/include/grpc++/impl/codegen/proto_utils.h @@ -39,7 +39,8 @@ class GrpcBufferWriterPeer; const int kGrpcBufferWriterMaxBufferLength = 1024 * 1024; -class GrpcBufferWriter : public ::grpc::protobuf::io::ZeroCopyOutputStream { +class GrpcBufferWriter final + : public ::grpc::protobuf::io::ZeroCopyOutputStream { public: explicit GrpcBufferWriter(grpc_byte_buffer** bp, int block_size) : block_size_(block_size), byte_count_(0), have_backup_(false) { @@ -87,8 +88,6 @@ class GrpcBufferWriter : public ::grpc::protobuf::io::ZeroCopyOutputStream { grpc::protobuf::int64 ByteCount() const override { return byte_count_; } - grpc_slice_buffer* SliceBuffer() { return slice_buffer_; } - private: friend class GrpcBufferWriterPeer; const int block_size_; @@ -99,7 +98,8 @@ class GrpcBufferWriter : public ::grpc::protobuf::io::ZeroCopyOutputStream { grpc_slice slice_; }; -class GrpcBufferReader : public ::grpc::protobuf::io::ZeroCopyInputStream { +class GrpcBufferReader final + : public ::grpc::protobuf::io::ZeroCopyInputStream { public: explicit GrpcBufferReader(grpc_byte_buffer* buffer) : byte_count_(0), backup_count_(0), status_() { @@ -160,7 +160,7 @@ class GrpcBufferReader : public ::grpc::protobuf::io::ZeroCopyInputStream { return byte_count_ - backup_count_; } - protected: + private: int64_t byte_count_; int64_t backup_count_; grpc_byte_buffer_reader reader_; @@ -168,83 +168,57 @@ class GrpcBufferReader : public ::grpc::protobuf::io::ZeroCopyInputStream { Status status_; }; -template -Status GenericSerialize(const grpc::protobuf::Message& msg, - grpc_byte_buffer** bp, bool* own_buffer) { - static_assert( - std::is_base_of::value, - "BufferWriter must be a subclass of io::ZeroCopyOutputStream"); - *own_buffer = true; - int byte_size = msg.ByteSize(); - if (byte_size <= internal::kGrpcBufferWriterMaxBufferLength) { - grpc_slice slice = g_core_codegen_interface->grpc_slice_malloc(byte_size); - GPR_CODEGEN_ASSERT( - GRPC_SLICE_END_PTR(slice) == - msg.SerializeWithCachedSizesToArray(GRPC_SLICE_START_PTR(slice))); - *bp = g_core_codegen_interface->grpc_raw_byte_buffer_create(&slice, 1); - g_core_codegen_interface->grpc_slice_unref(slice); - return g_core_codegen_interface->ok(); - } else { - BufferWriter writer(bp, internal::kGrpcBufferWriterMaxBufferLength); - return msg.SerializeToZeroCopyStream(&writer) - ? g_core_codegen_interface->ok() - : Status(StatusCode::INTERNAL, "Failed to serialize message"); - } -} - -template -Status GenericDeserialize(grpc_byte_buffer* buffer, - grpc::protobuf::Message* msg) { - static_assert( - std::is_base_of::value, - "BufferReader must be a subclass of io::ZeroCopyInputStream"); - if (buffer == nullptr) { - return Status(StatusCode::INTERNAL, "No payload"); - } - Status result = g_core_codegen_interface->ok(); - { - BufferReader reader(buffer); - if (!reader.status().ok()) { - return reader.status(); - } - ::grpc::protobuf::io::CodedInputStream decoder(&reader); - decoder.SetTotalBytesLimit(INT_MAX, INT_MAX); - if (!msg->ParseFromCodedStream(&decoder)) { - result = Status(StatusCode::INTERNAL, msg->InitializationErrorString()); - } - if (!decoder.ConsumedEntireMessage()) { - result = Status(StatusCode::INTERNAL, "Did not read entire message"); - } - } - g_core_codegen_interface->grpc_byte_buffer_destroy(buffer); - return result; -} - } // namespace internal -// this is needed so the following class does not conflict with protobuf -// serializers that utilize internal-only tools. -#ifdef GRPC_OPEN_SOURCE_PROTO -// This class provides a protobuf serializer. It translates between protobuf -// objects and grpc_byte_buffers. More information about SerializationTraits can -// be found in include/grpc++/impl/codegen/serialization_traits.h. template class SerializationTraits::value>::type> { public: static Status Serialize(const grpc::protobuf::Message& msg, grpc_byte_buffer** bp, bool* own_buffer) { - return internal::GenericSerialize( - msg, bp, own_buffer); + *own_buffer = true; + int byte_size = msg.ByteSize(); + if (byte_size <= internal::kGrpcBufferWriterMaxBufferLength) { + grpc_slice slice = g_core_codegen_interface->grpc_slice_malloc(byte_size); + GPR_CODEGEN_ASSERT( + GRPC_SLICE_END_PTR(slice) == + msg.SerializeWithCachedSizesToArray(GRPC_SLICE_START_PTR(slice))); + *bp = g_core_codegen_interface->grpc_raw_byte_buffer_create(&slice, 1); + g_core_codegen_interface->grpc_slice_unref(slice); + return g_core_codegen_interface->ok(); + } else { + internal::GrpcBufferWriter writer( + bp, internal::kGrpcBufferWriterMaxBufferLength); + return msg.SerializeToZeroCopyStream(&writer) + ? g_core_codegen_interface->ok() + : Status(StatusCode::INTERNAL, "Failed to serialize message"); + } } static Status Deserialize(grpc_byte_buffer* buffer, grpc::protobuf::Message* msg) { - return internal::GenericDeserialize(buffer, - msg); + if (buffer == nullptr) { + return Status(StatusCode::INTERNAL, "No payload"); + } + Status result = g_core_codegen_interface->ok(); + { + internal::GrpcBufferReader reader(buffer); + if (!reader.status().ok()) { + return reader.status(); + } + ::grpc::protobuf::io::CodedInputStream decoder(&reader); + decoder.SetTotalBytesLimit(INT_MAX, INT_MAX); + if (!msg->ParseFromCodedStream(&decoder)) { + result = Status(StatusCode::INTERNAL, msg->InitializationErrorString()); + } + if (!decoder.ConsumedEntireMessage()) { + result = Status(StatusCode::INTERNAL, "Did not read entire message"); + } + } + g_core_codegen_interface->grpc_byte_buffer_destroy(buffer); + return result; } }; -#endif } // namespace grpc From 519318f752a523b407357029ef464e2d04fd855f Mon Sep 17 00:00:00 2001 From: Adele Zhou Date: Wed, 12 Jul 2017 22:30:40 -0700 Subject: [PATCH 20/42] Make it executable. --- tools/internal_ci/linux/grpc_interop_toprod.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 tools/internal_ci/linux/grpc_interop_toprod.sh diff --git a/tools/internal_ci/linux/grpc_interop_toprod.sh b/tools/internal_ci/linux/grpc_interop_toprod.sh old mode 100644 new mode 100755 From e2810d2f53994ca18858cd4eae2e5022681b5da9 Mon Sep 17 00:00:00 2001 From: Adele Zhou Date: Wed, 12 Jul 2017 22:32:47 -0700 Subject: [PATCH 21/42] Pull from dockerhub. --- tools/run_tests/dockerize/build_interop_image.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tools/run_tests/dockerize/build_interop_image.sh b/tools/run_tests/dockerize/build_interop_image.sh index fa631851b1a..61105b0da40 100755 --- a/tools/run_tests/dockerize/build_interop_image.sh +++ b/tools/run_tests/dockerize/build_interop_image.sh @@ -67,8 +67,14 @@ else BASE_IMAGE=${BASE_NAME}_base:`md5 -r tools/dockerfile/interoptest/$BASE_NAME/Dockerfile | cut -f1 -d\ ` fi -# Make sure base docker image has been built. Should be instantaneous if so. -docker build -t $BASE_IMAGE --force-rm=true tools/dockerfile/interoptest/$BASE_NAME || exit $? +if [ "$DOCKERHUB_ORGANIZATION" != "" ] +then + DOCKER_IMAGE_NAME=$DOCKERHUB_ORGANIZATION/$BASE_IMAGE + docker pull $DOCKER_IMAGE_NAME +else + # Make sure docker image has been built. Should be instantaneous if so. + docker build -t $BASE_IMAGE --force-rm=true tools/dockerfile/interoptest/$BASE_NAME || exit $? +fi # Create a local branch so the child Docker script won't complain git branch -f jenkins-docker From a3899426fe160743605e8eb6f6303139525818fe Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Thu, 13 Jul 2017 11:24:02 +0200 Subject: [PATCH 22/42] shard basictests --- .../linux/grpc_basictests_c_cpp_dbg.cfg | 29 ++++++++++ .../linux/grpc_basictests_c_cpp_opt.cfg | 29 ++++++++++ .../linux/grpc_basictests_multilang.cfg | 29 ++++++++++ tools/run_tests/run_tests_matrix.py | 56 ++++++++++++------- 4 files changed, 122 insertions(+), 21 deletions(-) create mode 100644 tools/internal_ci/linux/grpc_basictests_c_cpp_dbg.cfg create mode 100644 tools/internal_ci/linux/grpc_basictests_c_cpp_opt.cfg create mode 100644 tools/internal_ci/linux/grpc_basictests_multilang.cfg diff --git a/tools/internal_ci/linux/grpc_basictests_c_cpp_dbg.cfg b/tools/internal_ci/linux/grpc_basictests_c_cpp_dbg.cfg new file mode 100644 index 00000000000..ca547a0a4f7 --- /dev/null +++ b/tools/internal_ci/linux/grpc_basictests_c_cpp_dbg.cfg @@ -0,0 +1,29 @@ +# Copyright 2017 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Config file for the internal CI (in protobuf text format) + +# Location of the continuous shell script in repository. +build_file: "grpc/tools/internal_ci/linux/grpc_run_tests_matrix.sh" +timeout_mins: 240 +action { + define_artifacts { + regex: "**/*sponge_log.xml" + } +} + +env_vars { + key: "RUN_TESTS_FLAGS" + value: "-f basictests linux corelang dbg --inner_jobs 16 -j 1 --internal_ci --bq_result_table aggregate_results" +} diff --git a/tools/internal_ci/linux/grpc_basictests_c_cpp_opt.cfg b/tools/internal_ci/linux/grpc_basictests_c_cpp_opt.cfg new file mode 100644 index 00000000000..62f05cef2ef --- /dev/null +++ b/tools/internal_ci/linux/grpc_basictests_c_cpp_opt.cfg @@ -0,0 +1,29 @@ +# Copyright 2017 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Config file for the internal CI (in protobuf text format) + +# Location of the continuous shell script in repository. +build_file: "grpc/tools/internal_ci/linux/grpc_run_tests_matrix.sh" +timeout_mins: 240 +action { + define_artifacts { + regex: "**/*sponge_log.xml" + } +} + +env_vars { + key: "RUN_TESTS_FLAGS" + value: "-f basictests linux corelang opt --inner_jobs 16 -j 1 --internal_ci --bq_result_table aggregate_results" +} diff --git a/tools/internal_ci/linux/grpc_basictests_multilang.cfg b/tools/internal_ci/linux/grpc_basictests_multilang.cfg new file mode 100644 index 00000000000..0a1afa2604c --- /dev/null +++ b/tools/internal_ci/linux/grpc_basictests_multilang.cfg @@ -0,0 +1,29 @@ +# Copyright 2017 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Config file for the internal CI (in protobuf text format) + +# Location of the continuous shell script in repository. +build_file: "grpc/tools/internal_ci/linux/grpc_run_tests_matrix.sh" +timeout_mins: 240 +action { + define_artifacts { + regex: "**/*sponge_log.xml" + } +} + +env_vars { + key: "RUN_TESTS_FLAGS" + value: "-f basictests linux multilang --inner_jobs 16 -j 1 --internal_ci --bq_result_table aggregate_results" +} diff --git a/tools/run_tests/run_tests_matrix.py b/tools/run_tests/run_tests_matrix.py index 635d87f4762..6fe1609f1c8 100755 --- a/tools/run_tests/run_tests_matrix.py +++ b/tools/run_tests/run_tests_matrix.py @@ -126,23 +126,37 @@ def _create_test_jobs(extra_args=[], inner_jobs=_DEFAULT_INNER_JOBS): test_jobs += _generate_jobs(languages=['sanity', 'php7'], configs=['dbg', 'opt'], platforms=['linux'], - labels=['basictests'], + labels=['basictests', 'multilang'], extra_args=extra_args, inner_jobs=inner_jobs) # supported on all platforms. - test_jobs += _generate_jobs(languages=['c', 'csharp', 'node', 'python'], + test_jobs += _generate_jobs(languages=['c'], + configs=['dbg', 'opt'], + platforms=['linux', 'macos', 'windows'], + labels=['basictests', 'corelang'], + extra_args=extra_args, + inner_jobs=inner_jobs) + + test_jobs += _generate_jobs(languages=['csharp', 'node', 'python'], configs=['dbg', 'opt'], platforms=['linux', 'macos', 'windows'], - labels=['basictests'], + labels=['basictests', 'multilang'], extra_args=extra_args, inner_jobs=inner_jobs) # supported on linux and mac. - test_jobs += _generate_jobs(languages=['c++', 'ruby', 'php'], + test_jobs += _generate_jobs(languages=['c++'], + configs=['dbg', 'opt'], + platforms=['linux', 'macos'], + labels=['basictests', 'corelang'], + extra_args=extra_args, + inner_jobs=inner_jobs) + + test_jobs += _generate_jobs(languages=['ruby', 'php'], configs=['dbg', 'opt'], platforms=['linux', 'macos'], - labels=['basictests'], + labels=['basictests', 'multilang'], extra_args=extra_args, inner_jobs=inner_jobs) @@ -150,7 +164,7 @@ def _create_test_jobs(extra_args=[], inner_jobs=_DEFAULT_INNER_JOBS): test_jobs += _generate_jobs(languages=['objc'], configs=['dbg', 'opt'], platforms=['macos'], - labels=['basictests'], + labels=['basictests', 'multilang'], extra_args=extra_args, inner_jobs=inner_jobs) @@ -158,13 +172,13 @@ def _create_test_jobs(extra_args=[], inner_jobs=_DEFAULT_INNER_JOBS): test_jobs += _generate_jobs(languages=['c'], configs=['msan', 'asan', 'tsan', 'ubsan'], platforms=['linux'], - labels=['sanitizers'], + labels=['sanitizers', 'corelang'], extra_args=extra_args, inner_jobs=inner_jobs) test_jobs += _generate_jobs(languages=['c++'], configs=['asan', 'tsan'], platforms=['linux'], - labels=['sanitizers'], + labels=['sanitizers', 'corelang'], extra_args=extra_args, inner_jobs=inner_jobs) @@ -179,7 +193,7 @@ def _create_portability_test_jobs(extra_args=[], inner_jobs=_DEFAULT_INNER_JOBS) platforms=['linux'], arch='x86', compiler='default', - labels=['portability'], + labels=['portability', 'corelang'], extra_args=extra_args, inner_jobs=inner_jobs) @@ -191,7 +205,7 @@ def _create_portability_test_jobs(extra_args=[], inner_jobs=_DEFAULT_INNER_JOBS) platforms=['linux'], arch='x64', compiler=compiler, - labels=['portability'], + labels=['portability', 'corelang'], extra_args=extra_args, inner_jobs=inner_jobs) @@ -203,14 +217,14 @@ def _create_portability_test_jobs(extra_args=[], inner_jobs=_DEFAULT_INNER_JOBS) platforms=['windows'], arch=arch, compiler=compiler, - labels=['portability'], + labels=['portability', 'corelang'], extra_args=extra_args, inner_jobs=inner_jobs) # C and C++ with the c-ares DNS resolver on Linux test_jobs += _generate_jobs(languages=['c', 'c++'], configs=['dbg'], platforms=['linux'], - labels=['portability'], + labels=['portability', 'corelang'], extra_args=extra_args, extra_envs={'GRPC_DNS_RESOLVER': 'ares'}) @@ -218,7 +232,7 @@ def _create_portability_test_jobs(extra_args=[], inner_jobs=_DEFAULT_INNER_JOBS) # C with the c-ares DNS resolver on Windonws # test_jobs += _generate_jobs(languages=['c'], # configs=['dbg'], platforms=['windows'], - # labels=['portability'], + # labels=['portability', 'corelang'], # extra_args=extra_args, # extra_envs={'GRPC_DNS_RESOLVER': 'ares'}) @@ -230,7 +244,7 @@ def _create_portability_test_jobs(extra_args=[], inner_jobs=_DEFAULT_INNER_JOBS) platforms=['linux', 'windows'], arch='default', compiler='cmake', - labels=['portability'], + labels=['portability', 'corelang'], extra_args=extra_args + ['--build_only'], inner_jobs=inner_jobs) @@ -239,7 +253,7 @@ def _create_portability_test_jobs(extra_args=[], inner_jobs=_DEFAULT_INNER_JOBS) platforms=['linux'], arch='default', compiler='python_alpine', - labels=['portability'], + labels=['portability', 'multilang'], extra_args=extra_args, inner_jobs=inner_jobs) @@ -248,7 +262,7 @@ def _create_portability_test_jobs(extra_args=[], inner_jobs=_DEFAULT_INNER_JOBS) platforms=['linux'], arch='default', compiler='coreclr', - labels=['portability'], + labels=['portability', 'multilang'], extra_args=extra_args, inner_jobs=inner_jobs) @@ -256,7 +270,7 @@ def _create_portability_test_jobs(extra_args=[], inner_jobs=_DEFAULT_INNER_JOBS) configs=['dbg'], platforms=['linux'], iomgr_platform='uv', - labels=['portability'], + labels=['portability', 'corelang'], extra_args=extra_args, inner_jobs=inner_jobs) @@ -265,7 +279,7 @@ def _create_portability_test_jobs(extra_args=[], inner_jobs=_DEFAULT_INNER_JOBS) platforms=['linux'], arch='default', compiler='electron1.6', - labels=['portability'], + labels=['portability', 'multilang'], extra_args=extra_args, inner_jobs=inner_jobs) @@ -274,7 +288,7 @@ def _create_portability_test_jobs(extra_args=[], inner_jobs=_DEFAULT_INNER_JOBS) platforms=['linux'], arch='default', compiler='node4', - labels=['portability'], + labels=['portability', 'multilang'], extra_args=extra_args, inner_jobs=inner_jobs) @@ -283,7 +297,7 @@ def _create_portability_test_jobs(extra_args=[], inner_jobs=_DEFAULT_INNER_JOBS) platforms=['linux'], arch='default', compiler='node6', - labels=['portability'], + labels=['portability', 'multilang'], extra_args=extra_args, inner_jobs=inner_jobs) @@ -292,7 +306,7 @@ def _create_portability_test_jobs(extra_args=[], inner_jobs=_DEFAULT_INNER_JOBS) platforms=['linux'], arch='default', compiler='node7', - labels=['portability'], + labels=['portability', 'multilang'], extra_args=extra_args, inner_jobs=inner_jobs) From 06bce6e020c8cbd07b4634e603251ae4032e8925 Mon Sep 17 00:00:00 2001 From: ncteisen Date: Mon, 10 Jul 2017 07:58:49 -0700 Subject: [PATCH 23/42] Tracers know their name --- .../filters/client_channel/client_channel.c | 2 +- .../client_channel/client_channel_plugin.c | 4 +- .../ext/filters/client_channel/lb_policy.c | 2 +- .../client_channel/lb_policy/grpclb/grpclb.c | 6 +-- .../lb_policy/pick_first/pick_first.c | 4 +- .../lb_policy/round_robin/round_robin.c | 4 +- .../ext/filters/client_channel/resolver.c | 2 +- .../ext/filters/http/http_filters_plugin.c | 2 +- .../chttp2/transport/chttp2_plugin.c | 6 +-- .../chttp2/transport/chttp2_transport.c | 6 +-- src/core/lib/channel/channel_stack.c | 2 +- src/core/lib/channel/channel_stack_builder.c | 2 +- src/core/lib/debug/trace.c | 6 +-- src/core/lib/debug/trace.h | 11 ++--- src/core/lib/http/parser.c | 2 +- src/core/lib/iomgr/closure.c | 2 +- src/core/lib/iomgr/combiner.c | 2 +- src/core/lib/iomgr/error.c | 2 +- src/core/lib/iomgr/ev_posix.c | 6 +-- src/core/lib/iomgr/ev_windows.c | 2 +- src/core/lib/iomgr/iomgr_posix.c | 2 +- src/core/lib/iomgr/iomgr_uv.c | 2 +- src/core/lib/iomgr/pollset_uv.c | 2 +- src/core/lib/iomgr/pollset_windows.c | 2 +- src/core/lib/iomgr/resource_quota.c | 2 +- src/core/lib/iomgr/tcp_posix.c | 2 +- src/core/lib/iomgr/tcp_uv.c | 2 +- src/core/lib/iomgr/tcp_windows.c | 2 +- src/core/lib/iomgr/timer_generic.c | 8 ++-- src/core/lib/iomgr/timer_uv.c | 4 +- .../lib/security/context/security_context.c | 2 +- .../lib/security/transport/secure_endpoint.c | 2 +- .../security/transport/security_connector.c | 2 +- src/core/lib/surface/api_trace.c | 2 +- src/core/lib/surface/call.c | 4 +- src/core/lib/surface/completion_queue.c | 10 ++--- src/core/lib/surface/init.c | 40 +++++++++---------- src/core/lib/surface/init_secure.c | 8 ++-- src/core/lib/surface/server.c | 2 +- src/core/lib/transport/bdp_estimator.c | 2 +- src/core/lib/transport/connectivity_state.c | 2 +- src/core/lib/transport/metadata.c | 2 +- src/core/lib/transport/transport.c | 2 +- src/core/tsi/transport_security.c | 2 +- 44 files changed, 92 insertions(+), 93 deletions(-) diff --git a/src/core/ext/filters/client_channel/client_channel.c b/src/core/ext/filters/client_channel/client_channel.c index 7add4325895..428fc97fba1 100644 --- a/src/core/ext/filters/client_channel/client_channel.c +++ b/src/core/ext/filters/client_channel/client_channel.c @@ -52,7 +52,7 @@ /* Client channel implementation */ -grpc_tracer_flag grpc_client_channel_trace = GRPC_TRACER_INITIALIZER(false); +grpc_tracer_flag grpc_client_channel_trace = GRPC_TRACER_INITIALIZER(false, "client_channel"); /************************************************************************* * METHOD-CONFIG TABLE diff --git a/src/core/ext/filters/client_channel/client_channel_plugin.c b/src/core/ext/filters/client_channel/client_channel_plugin.c index 6f133a648b6..c32e83d0125 100644 --- a/src/core/ext/filters/client_channel/client_channel_plugin.c +++ b/src/core/ext/filters/client_channel/client_channel_plugin.c @@ -78,9 +78,9 @@ void grpc_client_channel_init(void) { GRPC_CLIENT_CHANNEL, GRPC_CHANNEL_INIT_BUILTIN_PRIORITY, append_filter, (void *)&grpc_client_channel_filter); grpc_http_connect_register_handshaker_factory(); - grpc_register_tracer("client_channel", &grpc_client_channel_trace); + grpc_register_tracer(&grpc_client_channel_trace); #ifndef NDEBUG - grpc_register_tracer("resolver_refcount", &grpc_trace_resolver_refcount); + grpc_register_tracer(&grpc_trace_resolver_refcount); #endif } diff --git a/src/core/ext/filters/client_channel/lb_policy.c b/src/core/ext/filters/client_channel/lb_policy.c index 8d69ba6af52..1b499d61c17 100644 --- a/src/core/ext/filters/client_channel/lb_policy.c +++ b/src/core/ext/filters/client_channel/lb_policy.c @@ -22,7 +22,7 @@ #define WEAK_REF_BITS 16 #ifndef NDEBUG -grpc_tracer_flag grpc_trace_lb_policy_refcount = GRPC_TRACER_INITIALIZER(false); +grpc_tracer_flag grpc_trace_lb_policy_refcount = GRPC_TRACER_INITIALIZER(false, "lb_policy_refcount"); #endif void grpc_lb_policy_init(grpc_lb_policy *policy, diff --git a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.c b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.c index 5a5ff2902d0..cccc3e871a6 100644 --- a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.c +++ b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.c @@ -123,7 +123,7 @@ #define GRPC_GRPCLB_RECONNECT_MAX_BACKOFF_SECONDS 120 #define GRPC_GRPCLB_RECONNECT_JITTER 0.2 -grpc_tracer_flag grpc_lb_glb_trace = GRPC_TRACER_INITIALIZER(false); +grpc_tracer_flag grpc_lb_glb_trace = GRPC_TRACER_INITIALIZER(false, "glb"); /* add lb_token of selected subchannel (address) to the call's initial * metadata */ @@ -1879,9 +1879,9 @@ static bool maybe_add_client_load_reporting_filter( void grpc_lb_policy_grpclb_init() { grpc_register_lb_policy(grpc_glb_lb_factory_create()); - grpc_register_tracer("glb", &grpc_lb_glb_trace); + grpc_register_tracer(&grpc_lb_glb_trace); #ifndef NDEBUG - grpc_register_tracer("lb_policy_refcount", &grpc_trace_lb_policy_refcount); + grpc_register_tracer(&grpc_trace_lb_policy_refcount); #endif grpc_channel_init_register_stage(GRPC_CLIENT_SUBCHANNEL, GRPC_CHANNEL_INIT_BUILTIN_PRIORITY, diff --git a/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.c b/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.c index d0acd7a9019..a812767be46 100644 --- a/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.c +++ b/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.c @@ -28,7 +28,7 @@ #include "src/core/lib/iomgr/sockaddr_utils.h" #include "src/core/lib/transport/connectivity_state.h" -grpc_tracer_flag grpc_lb_pick_first_trace = GRPC_TRACER_INITIALIZER(false); +grpc_tracer_flag grpc_lb_pick_first_trace = GRPC_TRACER_INITIALIZER(false, "pick_first"); typedef struct pending_pick { struct pending_pick *next; @@ -707,7 +707,7 @@ static grpc_lb_policy_factory *pick_first_lb_factory_create() { void grpc_lb_policy_pick_first_init() { grpc_register_lb_policy(pick_first_lb_factory_create()); - grpc_register_tracer("pick_first", &grpc_lb_pick_first_trace); + grpc_register_tracer(&grpc_lb_pick_first_trace); } void grpc_lb_policy_pick_first_shutdown() {} diff --git a/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.c b/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.c index fbef79ec312..2a20ae88317 100644 --- a/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.c +++ b/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.c @@ -37,7 +37,7 @@ #include "src/core/lib/transport/connectivity_state.h" #include "src/core/lib/transport/static_metadata.h" -grpc_tracer_flag grpc_lb_round_robin_trace = GRPC_TRACER_INITIALIZER(false); +grpc_tracer_flag grpc_lb_round_robin_trace = GRPC_TRACER_INITIALIZER(false, "round_robin"); /** List of entities waiting for a pick. * @@ -868,7 +868,7 @@ static grpc_lb_policy_factory *round_robin_lb_factory_create() { void grpc_lb_policy_round_robin_init() { grpc_register_lb_policy(round_robin_lb_factory_create()); - grpc_register_tracer("round_robin", &grpc_lb_round_robin_trace); + grpc_register_tracer(&grpc_lb_round_robin_trace); } void grpc_lb_policy_round_robin_shutdown() {} diff --git a/src/core/ext/filters/client_channel/resolver.c b/src/core/ext/filters/client_channel/resolver.c index de9a8ce41b9..0a30eac6099 100644 --- a/src/core/ext/filters/client_channel/resolver.c +++ b/src/core/ext/filters/client_channel/resolver.c @@ -20,7 +20,7 @@ #include "src/core/lib/iomgr/combiner.h" #ifndef NDEBUG -grpc_tracer_flag grpc_trace_resolver_refcount = GRPC_TRACER_INITIALIZER(false); +grpc_tracer_flag grpc_trace_resolver_refcount = GRPC_TRACER_INITIALIZER(false, "resolver_refcount"); #endif void grpc_resolver_init(grpc_resolver *resolver, diff --git a/src/core/ext/filters/http/http_filters_plugin.c b/src/core/ext/filters/http/http_filters_plugin.c index 3e4ec01a316..a5c1b920547 100644 --- a/src/core/ext/filters/http/http_filters_plugin.c +++ b/src/core/ext/filters/http/http_filters_plugin.c @@ -65,7 +65,7 @@ static bool maybe_add_required_filter(grpc_exec_ctx *exec_ctx, } void grpc_http_filters_init(void) { - grpc_register_tracer("compression", &grpc_compression_trace); + grpc_register_tracer(&grpc_compression_trace); grpc_channel_init_register_stage(GRPC_CLIENT_SUBCHANNEL, GRPC_CHANNEL_INIT_BUILTIN_PRIORITY, maybe_add_optional_filter, &compress_filter); diff --git a/src/core/ext/transport/chttp2/transport/chttp2_plugin.c b/src/core/ext/transport/chttp2/transport/chttp2_plugin.c index 6a8c81445a1..78551df9c3c 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_plugin.c +++ b/src/core/ext/transport/chttp2/transport/chttp2_plugin.c @@ -21,10 +21,10 @@ #include "src/core/lib/transport/metadata.h" void grpc_chttp2_plugin_init(void) { - grpc_register_tracer("http", &grpc_http_trace); - grpc_register_tracer("flowctl", &grpc_flowctl_trace); + grpc_register_tracer(&grpc_http_trace); + grpc_register_tracer(&grpc_flowctl_trace); #ifndef NDEBUG - grpc_register_tracer("chttp2_refcount", &grpc_trace_chttp2_refcount); + grpc_register_tracer(&grpc_trace_chttp2_refcount); #endif } diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c index f7902679441..b378d9fbcc0 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c @@ -74,11 +74,11 @@ static bool g_default_keepalive_permit_without_calls = DEFAULT_KEEPALIVE_PERMIT_WITHOUT_CALLS; #define MAX_CLIENT_STREAM_ID 0x7fffffffu -grpc_tracer_flag grpc_http_trace = GRPC_TRACER_INITIALIZER(false); -grpc_tracer_flag grpc_flowctl_trace = GRPC_TRACER_INITIALIZER(false); +grpc_tracer_flag grpc_http_trace = GRPC_TRACER_INITIALIZER(false, "http"); +grpc_tracer_flag grpc_flowctl_trace = GRPC_TRACER_INITIALIZER(false, "flowctl"); #ifndef NDEBUG -grpc_tracer_flag grpc_trace_chttp2_refcount = GRPC_TRACER_INITIALIZER(false); +grpc_tracer_flag grpc_trace_chttp2_refcount = GRPC_TRACER_INITIALIZER(false, "chttp2_refcount"); #endif static const grpc_transport_vtable vtable; diff --git a/src/core/lib/channel/channel_stack.c b/src/core/lib/channel/channel_stack.c index 106666410a5..0f8e33c4be9 100644 --- a/src/core/lib/channel/channel_stack.c +++ b/src/core/lib/channel/channel_stack.c @@ -23,7 +23,7 @@ #include #include -grpc_tracer_flag grpc_trace_channel = GRPC_TRACER_INITIALIZER(false); +grpc_tracer_flag grpc_trace_channel = GRPC_TRACER_INITIALIZER(false, "channel"); /* Memory layouts. diff --git a/src/core/lib/channel/channel_stack_builder.c b/src/core/lib/channel/channel_stack_builder.c index 01529df80a5..c369e330738 100644 --- a/src/core/lib/channel/channel_stack_builder.c +++ b/src/core/lib/channel/channel_stack_builder.c @@ -24,7 +24,7 @@ #include grpc_tracer_flag grpc_trace_channel_stack_builder = - GRPC_TRACER_INITIALIZER(false); + GRPC_TRACER_INITIALIZER(false, "channel_stack_builder"); typedef struct filter_node { struct filter_node *next; diff --git a/src/core/lib/debug/trace.c b/src/core/lib/debug/trace.c index 8249b2ebd62..4b9e3d20d26 100644 --- a/src/core/lib/debug/trace.c +++ b/src/core/lib/debug/trace.c @@ -27,7 +27,6 @@ int grpc_tracer_set_enabled(const char *name, int enabled); typedef struct tracer { - const char *name; grpc_tracer_flag *flag; struct tracer *next; } tracer; @@ -39,9 +38,8 @@ static tracer *tracers; #define TRACER_SET(flag, on) (flag).value = (on) #endif -void grpc_register_tracer(const char *name, grpc_tracer_flag *flag) { +void grpc_register_tracer(grpc_tracer_flag *flag) { tracer *t = gpr_malloc(sizeof(*t)); - t->name = name; t->flag = flag; t->next = tracers; TRACER_SET(*flag, false); @@ -118,7 +116,7 @@ int grpc_tracer_set_enabled(const char *name, int enabled) { } else { int found = 0; for (t = tracers; t; t = t->next) { - if (0 == strcmp(name, t->name)) { + if (0 == strcmp(name, t->flag->name)) { TRACER_SET(*t->flag, enabled); found = 1; } diff --git a/src/core/lib/debug/trace.h b/src/core/lib/debug/trace.h index 7cc9fb4e41d..ab6d53487c1 100644 --- a/src/core/lib/debug/trace.h +++ b/src/core/lib/debug/trace.h @@ -35,19 +35,20 @@ typedef struct { #else bool value; #endif + char* name; } grpc_tracer_flag; #ifdef GRPC_THREADSAFE_TRACER #define GRPC_TRACER_ON(flag) (gpr_atm_no_barrier_load(&(flag).value) != 0) -#define GRPC_TRACER_INITIALIZER(on) \ - { (gpr_atm)(on) } +#define GRPC_TRACER_INITIALIZER(on, name) \ + { (gpr_atm)(on), (name) } #else #define GRPC_TRACER_ON(flag) ((flag).value) -#define GRPC_TRACER_INITIALIZER(on) \ - { (on) } +#define GRPC_TRACER_INITIALIZER(on, name) \ + { (on), (name) } #endif -void grpc_register_tracer(const char *name, grpc_tracer_flag *flag); +void grpc_register_tracer(grpc_tracer_flag *flag); void grpc_tracer_init(const char *env_var_name); void grpc_tracer_shutdown(void); diff --git a/src/core/lib/http/parser.c b/src/core/lib/http/parser.c index 71d697c278b..9c5e93f4e5a 100644 --- a/src/core/lib/http/parser.c +++ b/src/core/lib/http/parser.c @@ -25,7 +25,7 @@ #include #include -grpc_tracer_flag grpc_http1_trace = GRPC_TRACER_INITIALIZER(false); +grpc_tracer_flag grpc_http1_trace = GRPC_TRACER_INITIALIZER(false, "http1"); static char *buf2str(void *buffer, size_t length) { char *out = gpr_malloc(length + 1); diff --git a/src/core/lib/iomgr/closure.c b/src/core/lib/iomgr/closure.c index e028e72ed6d..26f9cbe0fad 100644 --- a/src/core/lib/iomgr/closure.c +++ b/src/core/lib/iomgr/closure.c @@ -25,7 +25,7 @@ #include "src/core/lib/profiling/timers.h" #ifndef NDEBUG -grpc_tracer_flag grpc_trace_closure = GRPC_TRACER_INITIALIZER(false); +grpc_tracer_flag grpc_trace_closure = GRPC_TRACER_INITIALIZER(false, "closure"); #endif #ifndef NDEBUG diff --git a/src/core/lib/iomgr/combiner.c b/src/core/lib/iomgr/combiner.c index 7f9c5d837f8..12823847ab5 100644 --- a/src/core/lib/iomgr/combiner.c +++ b/src/core/lib/iomgr/combiner.c @@ -27,7 +27,7 @@ #include "src/core/lib/iomgr/executor.h" #include "src/core/lib/profiling/timers.h" -grpc_tracer_flag grpc_combiner_trace = GRPC_TRACER_INITIALIZER(false); +grpc_tracer_flag grpc_combiner_trace = GRPC_TRACER_INITIALIZER(false, "combiner"); #define GRPC_COMBINER_TRACE(fn) \ do { \ diff --git a/src/core/lib/iomgr/error.c b/src/core/lib/iomgr/error.c index a95929a1fb5..e3e0b353588 100644 --- a/src/core/lib/iomgr/error.c +++ b/src/core/lib/iomgr/error.c @@ -36,7 +36,7 @@ #include "src/core/lib/slice/slice_internal.h" #ifndef NDEBUG -grpc_tracer_flag grpc_trace_error_refcount = GRPC_TRACER_INITIALIZER(false); +grpc_tracer_flag grpc_trace_error_refcount = GRPC_TRACER_INITIALIZER(false, "error_refcount"); #endif static const char *error_int_name(grpc_error_ints key) { diff --git a/src/core/lib/iomgr/ev_posix.c b/src/core/lib/iomgr/ev_posix.c index 2648df393d7..4428489fc2c 100644 --- a/src/core/lib/iomgr/ev_posix.c +++ b/src/core/lib/iomgr/ev_posix.c @@ -39,10 +39,10 @@ #include "src/core/lib/support/env.h" grpc_tracer_flag grpc_polling_trace = - GRPC_TRACER_INITIALIZER(false); /* Disabled by default */ + GRPC_TRACER_INITIALIZER(false, "polling"); /* Disabled by default */ #ifndef NDEBUG -grpc_tracer_flag grpc_trace_fd_refcount = GRPC_TRACER_INITIALIZER(false); +grpc_tracer_flag grpc_trace_fd_refcount = GRPC_TRACER_INITIALIZER(false, "fd_refcount"); #endif /** Default poll() function - a pointer so that it can be overridden by some @@ -124,7 +124,7 @@ void grpc_set_event_engine_test_only( const char *grpc_get_poll_strategy_name() { return g_poll_strategy_name; } void grpc_event_engine_init(void) { - grpc_register_tracer("polling", &grpc_polling_trace); + grpc_register_tracer(&grpc_polling_trace); char *s = gpr_getenv("GRPC_POLL_STRATEGY"); if (s == NULL) { diff --git a/src/core/lib/iomgr/ev_windows.c b/src/core/lib/iomgr/ev_windows.c index 027609c7e80..c24dfaeaf7c 100644 --- a/src/core/lib/iomgr/ev_windows.c +++ b/src/core/lib/iomgr/ev_windows.c @@ -23,6 +23,6 @@ #include "src/core/lib/debug/trace.h" grpc_tracer_flag grpc_polling_trace = - GRPC_TRACER_INITIALIZER(false); /* Disabled by default */ + GRPC_TRACER_INITIALIZER(false, "polling"); /* Disabled by default */ #endif // GRPC_WINSOCK_SOCKET diff --git a/src/core/lib/iomgr/iomgr_posix.c b/src/core/lib/iomgr/iomgr_posix.c index 43f5d0406e0..f5875a247ee 100644 --- a/src/core/lib/iomgr/iomgr_posix.c +++ b/src/core/lib/iomgr/iomgr_posix.c @@ -28,7 +28,7 @@ void grpc_iomgr_platform_init(void) { grpc_wakeup_fd_global_init(); grpc_event_engine_init(); - grpc_register_tracer("tcp", &grpc_tcp_trace); + grpc_register_tracer(&grpc_tcp_trace); } void grpc_iomgr_platform_flush(void) {} diff --git a/src/core/lib/iomgr/iomgr_uv.c b/src/core/lib/iomgr/iomgr_uv.c index 49d1a03c322..8b1245c6407 100644 --- a/src/core/lib/iomgr/iomgr_uv.c +++ b/src/core/lib/iomgr/iomgr_uv.c @@ -26,7 +26,7 @@ void grpc_iomgr_platform_init(void) { grpc_pollset_global_init(); - grpc_register_tracer("tcp", &grpc_tcp_trace); + grpc_register_tracer(&grpc_tcp_trace); } void grpc_iomgr_platform_flush(void) {} void grpc_iomgr_platform_shutdown(void) { grpc_pollset_global_shutdown(); } diff --git a/src/core/lib/iomgr/pollset_uv.c b/src/core/lib/iomgr/pollset_uv.c index 1a54065a914..7bf8d15ffd4 100644 --- a/src/core/lib/iomgr/pollset_uv.c +++ b/src/core/lib/iomgr/pollset_uv.c @@ -34,7 +34,7 @@ #include "src/core/lib/debug/trace.h" #ifndef NDEBUG -grpc_tracer_flag grpc_trace_fd_refcount = GRPC_TRACER_INITIALIZER(false); +grpc_tracer_flag grpc_trace_fd_refcount = GRPC_TRACER_INITIALIZER(false, "fd_refcount"); #endif struct grpc_pollset { diff --git a/src/core/lib/iomgr/pollset_windows.c b/src/core/lib/iomgr/pollset_windows.c index 1bfc2a22a8b..40631b776f2 100644 --- a/src/core/lib/iomgr/pollset_windows.c +++ b/src/core/lib/iomgr/pollset_windows.c @@ -31,7 +31,7 @@ #define GRPC_POLLSET_KICK_BROADCAST ((grpc_pollset_worker *)1) #ifndef NDEBUG -grpc_tracer_flag grpc_trace_fd_refcount = GRPC_TRACER_INITIALIZER(false); +grpc_tracer_flag grpc_trace_fd_refcount = GRPC_TRACER_INITIALIZER(false, "fd_refcount"); #endif gpr_mu grpc_polling_mu; diff --git a/src/core/lib/iomgr/resource_quota.c b/src/core/lib/iomgr/resource_quota.c index f2cc1be74e6..c84d0e42534 100644 --- a/src/core/lib/iomgr/resource_quota.c +++ b/src/core/lib/iomgr/resource_quota.c @@ -29,7 +29,7 @@ #include "src/core/lib/iomgr/combiner.h" -grpc_tracer_flag grpc_resource_quota_trace = GRPC_TRACER_INITIALIZER(false); +grpc_tracer_flag grpc_resource_quota_trace = GRPC_TRACER_INITIALIZER(false, "resource_quota"); #define MEMORY_USAGE_ESTIMATION_MAX 65536 diff --git a/src/core/lib/iomgr/tcp_posix.c b/src/core/lib/iomgr/tcp_posix.c index 5de2b0f4ee0..b6dcd15cb08 100644 --- a/src/core/lib/iomgr/tcp_posix.c +++ b/src/core/lib/iomgr/tcp_posix.c @@ -59,7 +59,7 @@ typedef GRPC_MSG_IOVLEN_TYPE msg_iovlen_type; typedef size_t msg_iovlen_type; #endif -grpc_tracer_flag grpc_tcp_trace = GRPC_TRACER_INITIALIZER(false); +grpc_tracer_flag grpc_tcp_trace = GRPC_TRACER_INITIALIZER(false, "tcp"); typedef struct { grpc_endpoint base; diff --git a/src/core/lib/iomgr/tcp_uv.c b/src/core/lib/iomgr/tcp_uv.c index ff5fd3edc85..7c6a9b85f53 100644 --- a/src/core/lib/iomgr/tcp_uv.c +++ b/src/core/lib/iomgr/tcp_uv.c @@ -37,7 +37,7 @@ #include "src/core/lib/slice/slice_string_helpers.h" #include "src/core/lib/support/string.h" -grpc_tracer_flag grpc_tcp_trace = GRPC_TRACER_INITIALIZER(false); +grpc_tracer_flag grpc_tcp_trace = GRPC_TRACER_INITIALIZER(false, "tcp"); typedef struct { grpc_endpoint base; diff --git a/src/core/lib/iomgr/tcp_windows.c b/src/core/lib/iomgr/tcp_windows.c index 6704a158ceb..2cbb97403b0 100644 --- a/src/core/lib/iomgr/tcp_windows.c +++ b/src/core/lib/iomgr/tcp_windows.c @@ -48,7 +48,7 @@ #define GRPC_FIONBIO FIONBIO #endif -grpc_tracer_flag grpc_tcp_trace = GRPC_TRACER_INITIALIZER(false); +grpc_tracer_flag grpc_tcp_trace = GRPC_TRACER_INITIALIZER(false, "tcp"); static grpc_error *set_non_block(SOCKET sock) { int status; diff --git a/src/core/lib/iomgr/timer_generic.c b/src/core/lib/iomgr/timer_generic.c index e6a9eb0e86e..ba03521c2a7 100644 --- a/src/core/lib/iomgr/timer_generic.c +++ b/src/core/lib/iomgr/timer_generic.c @@ -41,8 +41,8 @@ #define MIN_QUEUE_WINDOW_DURATION 0.01 #define MAX_QUEUE_WINDOW_DURATION 1 -grpc_tracer_flag grpc_timer_trace = GRPC_TRACER_INITIALIZER(false); -grpc_tracer_flag grpc_timer_check_trace = GRPC_TRACER_INITIALIZER(false); +grpc_tracer_flag grpc_timer_trace = GRPC_TRACER_INITIALIZER(false, "timer"); +grpc_tracer_flag grpc_timer_check_trace = GRPC_TRACER_INITIALIZER(false, "timer_check"); /* A "timer shard". Contains a 'heap' and a 'list' of timers. All timers with * deadlines earlier than 'queue_deadline" cap are maintained in the heap and @@ -160,8 +160,8 @@ void grpc_timer_list_init(gpr_timespec now) { g_shared_mutables.min_timer = timespec_to_atm_round_down(now); gpr_tls_init(&g_last_seen_min_timer); gpr_tls_set(&g_last_seen_min_timer, 0); - grpc_register_tracer("timer", &grpc_timer_trace); - grpc_register_tracer("timer_check", &grpc_timer_check_trace); + grpc_register_tracer(&grpc_timer_trace); + grpc_register_tracer(&grpc_timer_check_trace); for (i = 0; i < NUM_SHARDS; i++) { timer_shard *shard = &g_shards[i]; diff --git a/src/core/lib/iomgr/timer_uv.c b/src/core/lib/iomgr/timer_uv.c index 4f204cfbf8c..13328e8bcf6 100644 --- a/src/core/lib/iomgr/timer_uv.c +++ b/src/core/lib/iomgr/timer_uv.c @@ -28,8 +28,8 @@ #include -grpc_tracer_flag grpc_timer_trace = GRPC_TRACER_INITIALIZER(false); -grpc_tracer_flag grpc_timer_check_trace = GRPC_TRACER_INITIALIZER(false); +grpc_tracer_flag grpc_timer_trace = GRPC_TRACER_INITIALIZER(false, "timer"); +grpc_tracer_flag grpc_timer_check_trace = GRPC_TRACER_INITIALIZER(false, "timer_check"); static void timer_close_callback(uv_handle_t *handle) { gpr_free(handle); } diff --git a/src/core/lib/security/context/security_context.c b/src/core/lib/security/context/security_context.c index dffe6d2e912..8fff2c92c50 100644 --- a/src/core/lib/security/context/security_context.c +++ b/src/core/lib/security/context/security_context.c @@ -31,7 +31,7 @@ #ifndef NDEBUG grpc_tracer_flag grpc_trace_auth_context_refcount = - GRPC_TRACER_INITIALIZER(false); + GRPC_TRACER_INITIALIZER(false, "auth_context_refcount"); #endif /* --- grpc_call --- */ diff --git a/src/core/lib/security/transport/secure_endpoint.c b/src/core/lib/security/transport/secure_endpoint.c index f4ed81db1a0..9df252f7d72 100644 --- a/src/core/lib/security/transport/secure_endpoint.c +++ b/src/core/lib/security/transport/secure_endpoint.c @@ -60,7 +60,7 @@ typedef struct { gpr_refcount ref; } secure_endpoint; -grpc_tracer_flag grpc_trace_secure_endpoint = GRPC_TRACER_INITIALIZER(false); +grpc_tracer_flag grpc_trace_secure_endpoint = GRPC_TRACER_INITIALIZER(false, "secure_endpoint"); static void destroy(grpc_exec_ctx *exec_ctx, secure_endpoint *secure_ep) { secure_endpoint *ep = secure_ep; diff --git a/src/core/lib/security/transport/security_connector.c b/src/core/lib/security/transport/security_connector.c index 29327107e5c..6788126769a 100644 --- a/src/core/lib/security/transport/security_connector.c +++ b/src/core/lib/security/transport/security_connector.c @@ -45,7 +45,7 @@ #ifndef NDEBUG grpc_tracer_flag grpc_trace_security_connector_refcount = - GRPC_TRACER_INITIALIZER(false); + GRPC_TRACER_INITIALIZER(false, "security_connector_refcount"); #endif /* -- Constants. -- */ diff --git a/src/core/lib/surface/api_trace.c b/src/core/lib/surface/api_trace.c index f88ffd57aa2..56973303dab 100644 --- a/src/core/lib/surface/api_trace.c +++ b/src/core/lib/surface/api_trace.c @@ -19,4 +19,4 @@ #include "src/core/lib/surface/api_trace.h" #include "src/core/lib/debug/trace.h" -grpc_tracer_flag grpc_api_trace = GRPC_TRACER_INITIALIZER(false); +grpc_tracer_flag grpc_api_trace = GRPC_TRACER_INITIALIZER(false, "api"); diff --git a/src/core/lib/surface/call.c b/src/core/lib/surface/call.c index aac443ed06b..bb1e3f901ba 100644 --- a/src/core/lib/surface/call.c +++ b/src/core/lib/surface/call.c @@ -229,8 +229,8 @@ struct grpc_call { void *saved_receiving_stream_ready_bctlp; }; -grpc_tracer_flag grpc_call_error_trace = GRPC_TRACER_INITIALIZER(false); -grpc_tracer_flag grpc_compression_trace = GRPC_TRACER_INITIALIZER(false); +grpc_tracer_flag grpc_call_error_trace = GRPC_TRACER_INITIALIZER(false, "call_error"); +grpc_tracer_flag grpc_compression_trace = GRPC_TRACER_INITIALIZER(false, "compression"); #define CALL_STACK_FROM_CALL(call) ((grpc_call_stack *)((call) + 1)) #define CALL_FROM_CALL_STACK(call_stack) (((grpc_call *)(call_stack)) - 1) diff --git a/src/core/lib/surface/completion_queue.c b/src/core/lib/surface/completion_queue.c index 14e55eda852..f3d0ef286aa 100644 --- a/src/core/lib/surface/completion_queue.c +++ b/src/core/lib/surface/completion_queue.c @@ -35,10 +35,10 @@ #include "src/core/lib/surface/call.h" #include "src/core/lib/surface/event_string.h" -grpc_tracer_flag grpc_trace_operation_failures = GRPC_TRACER_INITIALIZER(false); +grpc_tracer_flag grpc_trace_operation_failures = GRPC_TRACER_INITIALIZER(false, "op_failure"); #ifndef NDEBUG -grpc_tracer_flag grpc_trace_pending_tags = GRPC_TRACER_INITIALIZER(false); -grpc_tracer_flag grpc_trace_cq_refcount = GRPC_TRACER_INITIALIZER(false); +grpc_tracer_flag grpc_trace_pending_tags = GRPC_TRACER_INITIALIZER(false, "pending_tags"); +grpc_tracer_flag grpc_trace_cq_refcount = GRPC_TRACER_INITIALIZER(false, "cq_refcount"); #endif typedef struct { @@ -343,8 +343,8 @@ static const cq_vtable g_cq_vtable[] = { #define POLLSET_FROM_CQ(cq) \ ((grpc_pollset *)(cq->vtable->data_size + (char *)DATA_FROM_CQ(cq))) -grpc_tracer_flag grpc_cq_pluck_trace = GRPC_TRACER_INITIALIZER(true); -grpc_tracer_flag grpc_cq_event_timeout_trace = GRPC_TRACER_INITIALIZER(true); +grpc_tracer_flag grpc_cq_pluck_trace = GRPC_TRACER_INITIALIZER(true, "queue_pluck"); +grpc_tracer_flag grpc_cq_event_timeout_trace = GRPC_TRACER_INITIALIZER(true, "queue_timeout"); #define GRPC_SURFACE_TRACE_RETURNED_EVENT(cq, event) \ if (GRPC_TRACER_ON(grpc_api_trace) && \ diff --git a/src/core/lib/surface/init.c b/src/core/lib/surface/init.c index 14a86bfa0a8..93ab101648c 100644 --- a/src/core/lib/surface/init.c +++ b/src/core/lib/surface/init.c @@ -120,29 +120,29 @@ void grpc_init(void) { grpc_slice_intern_init(); grpc_mdctx_global_init(); grpc_channel_init_init(); - grpc_register_tracer("api", &grpc_api_trace); - grpc_register_tracer("channel", &grpc_trace_channel); - grpc_register_tracer("connectivity_state", &grpc_connectivity_state_trace); - grpc_register_tracer("channel_stack_builder", + grpc_register_tracer(&grpc_api_trace); + grpc_register_tracer(&grpc_trace_channel); + grpc_register_tracer(&grpc_connectivity_state_trace); + grpc_register_tracer( &grpc_trace_channel_stack_builder); - grpc_register_tracer("http1", &grpc_http1_trace); - grpc_register_tracer("queue_pluck", &grpc_cq_pluck_trace); // default on - grpc_register_tracer("combiner", &grpc_combiner_trace); - grpc_register_tracer("server_channel", &grpc_server_channel_trace); - grpc_register_tracer("bdp_estimator", &grpc_bdp_estimator_trace); - grpc_register_tracer("queue_timeout", + grpc_register_tracer(&grpc_http1_trace); + grpc_register_tracer(&grpc_cq_pluck_trace); // default on + grpc_register_tracer(&grpc_combiner_trace); + grpc_register_tracer(&grpc_server_channel_trace); + grpc_register_tracer(&grpc_bdp_estimator_trace); + grpc_register_tracer( &grpc_cq_event_timeout_trace); // default on - grpc_register_tracer("op_failure", &grpc_trace_operation_failures); - grpc_register_tracer("resource_quota", &grpc_resource_quota_trace); - grpc_register_tracer("call_error", &grpc_call_error_trace); + grpc_register_tracer(&grpc_trace_operation_failures); + grpc_register_tracer(&grpc_resource_quota_trace); + grpc_register_tracer(&grpc_call_error_trace); #ifndef NDEBUG - grpc_register_tracer("pending_tags", &grpc_trace_pending_tags); - grpc_register_tracer("queue_refcount", &grpc_trace_cq_refcount); - grpc_register_tracer("closure", &grpc_trace_closure); - grpc_register_tracer("error_refcount", &grpc_trace_error_refcount); - grpc_register_tracer("stream_refcount", &grpc_trace_stream_refcount); - grpc_register_tracer("fd_refcount", &grpc_trace_fd_refcount); - grpc_register_tracer("metadata", &grpc_trace_metadata); + grpc_register_tracer(&grpc_trace_pending_tags); + grpc_register_tracer(&grpc_trace_cq_refcount); + grpc_register_tracer(&grpc_trace_closure); + grpc_register_tracer(&grpc_trace_error_refcount); + grpc_register_tracer(&grpc_trace_stream_refcount); + grpc_register_tracer(&grpc_trace_fd_refcount); + grpc_register_tracer(&grpc_trace_metadata); #endif grpc_security_pre_init(); grpc_iomgr_init(&exec_ctx); diff --git a/src/core/lib/surface/init_secure.c b/src/core/lib/surface/init_secure.c index 7dbea581d01..5f9816135f5 100644 --- a/src/core/lib/surface/init_secure.c +++ b/src/core/lib/surface/init_secure.c @@ -37,12 +37,12 @@ #endif void grpc_security_pre_init(void) { - grpc_register_tracer("secure_endpoint", &grpc_trace_secure_endpoint); - grpc_register_tracer("transport_security", &tsi_tracing_enabled); + grpc_register_tracer(&grpc_trace_secure_endpoint); + grpc_register_tracer(&tsi_tracing_enabled); #ifndef NDEBUG - grpc_register_tracer("auth_context_refcount", + grpc_register_tracer( &grpc_trace_auth_context_refcount); - grpc_register_tracer("security_connector_refcount", + grpc_register_tracer( &grpc_trace_security_connector_refcount); #endif } diff --git a/src/core/lib/surface/server.c b/src/core/lib/surface/server.c index de0a91e2b2c..662a57766b7 100644 --- a/src/core/lib/surface/server.c +++ b/src/core/lib/surface/server.c @@ -58,7 +58,7 @@ typedef struct registered_method registered_method; typedef enum { BATCH_CALL, REGISTERED_CALL } requested_call_type; -grpc_tracer_flag grpc_server_channel_trace = GRPC_TRACER_INITIALIZER(false); +grpc_tracer_flag grpc_server_channel_trace = GRPC_TRACER_INITIALIZER(false, "server_channel"); typedef struct requested_call { requested_call_type type; diff --git a/src/core/lib/transport/bdp_estimator.c b/src/core/lib/transport/bdp_estimator.c index d33e3a48abb..cdfd521ce21 100644 --- a/src/core/lib/transport/bdp_estimator.c +++ b/src/core/lib/transport/bdp_estimator.c @@ -23,7 +23,7 @@ #include #include -grpc_tracer_flag grpc_bdp_estimator_trace = GRPC_TRACER_INITIALIZER(false); +grpc_tracer_flag grpc_bdp_estimator_trace = GRPC_TRACER_INITIALIZER(false, "bdp_estimator"); void grpc_bdp_estimator_init(grpc_bdp_estimator *estimator, const char *name) { estimator->estimate = 65536; diff --git a/src/core/lib/transport/connectivity_state.c b/src/core/lib/transport/connectivity_state.c index 6fe40af3b2f..a7ea9cc38e4 100644 --- a/src/core/lib/transport/connectivity_state.c +++ b/src/core/lib/transport/connectivity_state.c @@ -24,7 +24,7 @@ #include #include -grpc_tracer_flag grpc_connectivity_state_trace = GRPC_TRACER_INITIALIZER(false); +grpc_tracer_flag grpc_connectivity_state_trace = GRPC_TRACER_INITIALIZER(false, "connectivity_state"); const char *grpc_connectivity_state_name(grpc_connectivity_state state) { switch (state) { diff --git a/src/core/lib/transport/metadata.c b/src/core/lib/transport/metadata.c index 87a2abf3443..d699887b28f 100644 --- a/src/core/lib/transport/metadata.c +++ b/src/core/lib/transport/metadata.c @@ -48,7 +48,7 @@ */ #ifndef NDEBUG -grpc_tracer_flag grpc_trace_metadata = GRPC_TRACER_INITIALIZER(false); +grpc_tracer_flag grpc_trace_metadata = GRPC_TRACER_INITIALIZER(false, "metadata"); #define DEBUG_ARGS , const char *file, int line #define FWD_DEBUG_ARGS , file, line #define REF_MD_LOCKED(shard, s) ref_md_locked((shard), (s), __FILE__, __LINE__) diff --git a/src/core/lib/transport/transport.c b/src/core/lib/transport/transport.c index 6a9eba110d1..712c2ab8331 100644 --- a/src/core/lib/transport/transport.c +++ b/src/core/lib/transport/transport.c @@ -32,7 +32,7 @@ #include "src/core/lib/transport/transport_impl.h" #ifndef NDEBUG -grpc_tracer_flag grpc_trace_stream_refcount = GRPC_TRACER_INITIALIZER(false); +grpc_tracer_flag grpc_trace_stream_refcount = GRPC_TRACER_INITIALIZER(false, "stream_refcount"); #endif #ifndef NDEBUG diff --git a/src/core/tsi/transport_security.c b/src/core/tsi/transport_security.c index 08fa43138dd..be11d644721 100644 --- a/src/core/tsi/transport_security.c +++ b/src/core/tsi/transport_security.c @@ -26,7 +26,7 @@ /* --- Tracing. --- */ -grpc_tracer_flag tsi_tracing_enabled = GRPC_TRACER_INITIALIZER(false); +grpc_tracer_flag tsi_tracing_enabled = GRPC_TRACER_INITIALIZER(false, "tsi"); /* --- tsi_result common implementation. --- */ From 69191766473f835e53804f045823b9d9a638ae07 Mon Sep 17 00:00:00 2001 From: ncteisen Date: Mon, 10 Jul 2017 08:02:26 -0700 Subject: [PATCH 24/42] update doc --- doc/environment_variables.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/environment_variables.md b/doc/environment_variables.md index 339b705252b..7b222b9abf2 100644 --- a/doc/environment_variables.md +++ b/doc/environment_variables.md @@ -54,12 +54,14 @@ some configuration as environment variables that can be set. - op_failure - traces error information when failure is pushed onto a completion queue - round_robin - traces the round_robin load balancing policy + - resource_quota - trace resource quota objects internals - glb - traces the grpclb load balancer - queue_pluck - queue_timeout - server_channel - lightweight trace of significant server channel events - secure_endpoint - traces bytes flowing through encrypted channels - timer - timers (alarms) in the grpc internals + - timer_check - more detailed trace of timer logic in grpc internals - transport_security - traces metadata about secure channel establishment - tcp - traces bytes in and out of a channel From 2e85f6891a978f9e036e42f54965d46d53f8487a Mon Sep 17 00:00:00 2001 From: ncteisen Date: Wed, 12 Jul 2017 23:10:37 -0700 Subject: [PATCH 25/42] Add a list_tracer functionality --- src/core/lib/debug/trace.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/core/lib/debug/trace.c b/src/core/lib/debug/trace.c index 4b9e3d20d26..4c9d2b8e2e4 100644 --- a/src/core/lib/debug/trace.c +++ b/src/core/lib/debug/trace.c @@ -91,6 +91,14 @@ static void parse(const char *s) { gpr_free(strings); } +static void list_tracers() { + gpr_log(GPR_DEBUG, "available tracers:"); + tracer *t; + for (t = tracers; t; t = t->next) { + gpr_log(GPR_DEBUG, "\t%s", t->flag->name); + } +} + void grpc_tracer_init(const char *env_var) { char *e = gpr_getenv(env_var); if (e != NULL) { @@ -113,6 +121,8 @@ int grpc_tracer_set_enabled(const char *name, int enabled) { for (t = tracers; t; t = t->next) { TRACER_SET(*t->flag, enabled); } + } else if (0 == strcmp(name, "list_tracers")) { + list_tracers(); } else { int found = 0; for (t = tracers; t; t = t->next) { From 7712c7c4d5819a1222ecee8c89eb19696328b482 Mon Sep 17 00:00:00 2001 From: ncteisen Date: Wed, 12 Jul 2017 23:11:27 -0700 Subject: [PATCH 26/42] clang format --- .../ext/filters/client_channel/client_channel.c | 3 ++- src/core/ext/filters/client_channel/lb_policy.c | 3 ++- .../lb_policy/pick_first/pick_first.c | 3 ++- .../lb_policy/round_robin/round_robin.c | 3 ++- src/core/ext/filters/client_channel/resolver.c | 3 ++- .../transport/chttp2/transport/chttp2_transport.c | 3 ++- src/core/lib/debug/trace.h | 2 +- src/core/lib/iomgr/combiner.c | 3 ++- src/core/lib/iomgr/error.c | 3 ++- src/core/lib/iomgr/ev_posix.c | 3 ++- src/core/lib/iomgr/pollset_uv.c | 3 ++- src/core/lib/iomgr/pollset_windows.c | 3 ++- src/core/lib/iomgr/resource_quota.c | 3 ++- src/core/lib/iomgr/timer_generic.c | 3 ++- src/core/lib/iomgr/timer_uv.c | 3 ++- src/core/lib/security/transport/secure_endpoint.c | 3 ++- src/core/lib/surface/call.c | 6 ++++-- src/core/lib/surface/completion_queue.c | 15 ++++++++++----- src/core/lib/surface/init.c | 6 ++---- src/core/lib/surface/init_secure.c | 6 ++---- src/core/lib/surface/server.c | 3 ++- src/core/lib/transport/bdp_estimator.c | 3 ++- src/core/lib/transport/connectivity_state.c | 3 ++- src/core/lib/transport/metadata.c | 3 ++- src/core/lib/transport/transport.c | 3 ++- 25 files changed, 59 insertions(+), 36 deletions(-) diff --git a/src/core/ext/filters/client_channel/client_channel.c b/src/core/ext/filters/client_channel/client_channel.c index 428fc97fba1..1bf10454d1f 100644 --- a/src/core/ext/filters/client_channel/client_channel.c +++ b/src/core/ext/filters/client_channel/client_channel.c @@ -52,7 +52,8 @@ /* Client channel implementation */ -grpc_tracer_flag grpc_client_channel_trace = GRPC_TRACER_INITIALIZER(false, "client_channel"); +grpc_tracer_flag grpc_client_channel_trace = + GRPC_TRACER_INITIALIZER(false, "client_channel"); /************************************************************************* * METHOD-CONFIG TABLE diff --git a/src/core/ext/filters/client_channel/lb_policy.c b/src/core/ext/filters/client_channel/lb_policy.c index 1b499d61c17..10b032214b8 100644 --- a/src/core/ext/filters/client_channel/lb_policy.c +++ b/src/core/ext/filters/client_channel/lb_policy.c @@ -22,7 +22,8 @@ #define WEAK_REF_BITS 16 #ifndef NDEBUG -grpc_tracer_flag grpc_trace_lb_policy_refcount = GRPC_TRACER_INITIALIZER(false, "lb_policy_refcount"); +grpc_tracer_flag grpc_trace_lb_policy_refcount = + GRPC_TRACER_INITIALIZER(false, "lb_policy_refcount"); #endif void grpc_lb_policy_init(grpc_lb_policy *policy, diff --git a/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.c b/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.c index a812767be46..fd0fb41fb9a 100644 --- a/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.c +++ b/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.c @@ -28,7 +28,8 @@ #include "src/core/lib/iomgr/sockaddr_utils.h" #include "src/core/lib/transport/connectivity_state.h" -grpc_tracer_flag grpc_lb_pick_first_trace = GRPC_TRACER_INITIALIZER(false, "pick_first"); +grpc_tracer_flag grpc_lb_pick_first_trace = + GRPC_TRACER_INITIALIZER(false, "pick_first"); typedef struct pending_pick { struct pending_pick *next; diff --git a/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.c b/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.c index 2a20ae88317..37580087a7d 100644 --- a/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.c +++ b/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.c @@ -37,7 +37,8 @@ #include "src/core/lib/transport/connectivity_state.h" #include "src/core/lib/transport/static_metadata.h" -grpc_tracer_flag grpc_lb_round_robin_trace = GRPC_TRACER_INITIALIZER(false, "round_robin"); +grpc_tracer_flag grpc_lb_round_robin_trace = + GRPC_TRACER_INITIALIZER(false, "round_robin"); /** List of entities waiting for a pick. * diff --git a/src/core/ext/filters/client_channel/resolver.c b/src/core/ext/filters/client_channel/resolver.c index 0a30eac6099..8401504fcf6 100644 --- a/src/core/ext/filters/client_channel/resolver.c +++ b/src/core/ext/filters/client_channel/resolver.c @@ -20,7 +20,8 @@ #include "src/core/lib/iomgr/combiner.h" #ifndef NDEBUG -grpc_tracer_flag grpc_trace_resolver_refcount = GRPC_TRACER_INITIALIZER(false, "resolver_refcount"); +grpc_tracer_flag grpc_trace_resolver_refcount = + GRPC_TRACER_INITIALIZER(false, "resolver_refcount"); #endif void grpc_resolver_init(grpc_resolver *resolver, diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c index b378d9fbcc0..0859ce8942e 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c @@ -78,7 +78,8 @@ grpc_tracer_flag grpc_http_trace = GRPC_TRACER_INITIALIZER(false, "http"); grpc_tracer_flag grpc_flowctl_trace = GRPC_TRACER_INITIALIZER(false, "flowctl"); #ifndef NDEBUG -grpc_tracer_flag grpc_trace_chttp2_refcount = GRPC_TRACER_INITIALIZER(false, "chttp2_refcount"); +grpc_tracer_flag grpc_trace_chttp2_refcount = + GRPC_TRACER_INITIALIZER(false, "chttp2_refcount"); #endif static const grpc_transport_vtable vtable; diff --git a/src/core/lib/debug/trace.h b/src/core/lib/debug/trace.h index ab6d53487c1..dd9e6a30fe2 100644 --- a/src/core/lib/debug/trace.h +++ b/src/core/lib/debug/trace.h @@ -35,7 +35,7 @@ typedef struct { #else bool value; #endif - char* name; + char *name; } grpc_tracer_flag; #ifdef GRPC_THREADSAFE_TRACER diff --git a/src/core/lib/iomgr/combiner.c b/src/core/lib/iomgr/combiner.c index 12823847ab5..c72c37e2b53 100644 --- a/src/core/lib/iomgr/combiner.c +++ b/src/core/lib/iomgr/combiner.c @@ -27,7 +27,8 @@ #include "src/core/lib/iomgr/executor.h" #include "src/core/lib/profiling/timers.h" -grpc_tracer_flag grpc_combiner_trace = GRPC_TRACER_INITIALIZER(false, "combiner"); +grpc_tracer_flag grpc_combiner_trace = + GRPC_TRACER_INITIALIZER(false, "combiner"); #define GRPC_COMBINER_TRACE(fn) \ do { \ diff --git a/src/core/lib/iomgr/error.c b/src/core/lib/iomgr/error.c index e3e0b353588..3759dda992c 100644 --- a/src/core/lib/iomgr/error.c +++ b/src/core/lib/iomgr/error.c @@ -36,7 +36,8 @@ #include "src/core/lib/slice/slice_internal.h" #ifndef NDEBUG -grpc_tracer_flag grpc_trace_error_refcount = GRPC_TRACER_INITIALIZER(false, "error_refcount"); +grpc_tracer_flag grpc_trace_error_refcount = + GRPC_TRACER_INITIALIZER(false, "error_refcount"); #endif static const char *error_int_name(grpc_error_ints key) { diff --git a/src/core/lib/iomgr/ev_posix.c b/src/core/lib/iomgr/ev_posix.c index 4428489fc2c..a5ae04cb5b6 100644 --- a/src/core/lib/iomgr/ev_posix.c +++ b/src/core/lib/iomgr/ev_posix.c @@ -42,7 +42,8 @@ grpc_tracer_flag grpc_polling_trace = GRPC_TRACER_INITIALIZER(false, "polling"); /* Disabled by default */ #ifndef NDEBUG -grpc_tracer_flag grpc_trace_fd_refcount = GRPC_TRACER_INITIALIZER(false, "fd_refcount"); +grpc_tracer_flag grpc_trace_fd_refcount = + GRPC_TRACER_INITIALIZER(false, "fd_refcount"); #endif /** Default poll() function - a pointer so that it can be overridden by some diff --git a/src/core/lib/iomgr/pollset_uv.c b/src/core/lib/iomgr/pollset_uv.c index 7bf8d15ffd4..946f0c8c609 100644 --- a/src/core/lib/iomgr/pollset_uv.c +++ b/src/core/lib/iomgr/pollset_uv.c @@ -34,7 +34,8 @@ #include "src/core/lib/debug/trace.h" #ifndef NDEBUG -grpc_tracer_flag grpc_trace_fd_refcount = GRPC_TRACER_INITIALIZER(false, "fd_refcount"); +grpc_tracer_flag grpc_trace_fd_refcount = + GRPC_TRACER_INITIALIZER(false, "fd_refcount"); #endif struct grpc_pollset { diff --git a/src/core/lib/iomgr/pollset_windows.c b/src/core/lib/iomgr/pollset_windows.c index 40631b776f2..ea017a60546 100644 --- a/src/core/lib/iomgr/pollset_windows.c +++ b/src/core/lib/iomgr/pollset_windows.c @@ -31,7 +31,8 @@ #define GRPC_POLLSET_KICK_BROADCAST ((grpc_pollset_worker *)1) #ifndef NDEBUG -grpc_tracer_flag grpc_trace_fd_refcount = GRPC_TRACER_INITIALIZER(false, "fd_refcount"); +grpc_tracer_flag grpc_trace_fd_refcount = + GRPC_TRACER_INITIALIZER(false, "fd_refcount"); #endif gpr_mu grpc_polling_mu; diff --git a/src/core/lib/iomgr/resource_quota.c b/src/core/lib/iomgr/resource_quota.c index c84d0e42534..a31d9eef93e 100644 --- a/src/core/lib/iomgr/resource_quota.c +++ b/src/core/lib/iomgr/resource_quota.c @@ -29,7 +29,8 @@ #include "src/core/lib/iomgr/combiner.h" -grpc_tracer_flag grpc_resource_quota_trace = GRPC_TRACER_INITIALIZER(false, "resource_quota"); +grpc_tracer_flag grpc_resource_quota_trace = + GRPC_TRACER_INITIALIZER(false, "resource_quota"); #define MEMORY_USAGE_ESTIMATION_MAX 65536 diff --git a/src/core/lib/iomgr/timer_generic.c b/src/core/lib/iomgr/timer_generic.c index ba03521c2a7..12efce241f8 100644 --- a/src/core/lib/iomgr/timer_generic.c +++ b/src/core/lib/iomgr/timer_generic.c @@ -42,7 +42,8 @@ #define MAX_QUEUE_WINDOW_DURATION 1 grpc_tracer_flag grpc_timer_trace = GRPC_TRACER_INITIALIZER(false, "timer"); -grpc_tracer_flag grpc_timer_check_trace = GRPC_TRACER_INITIALIZER(false, "timer_check"); +grpc_tracer_flag grpc_timer_check_trace = + GRPC_TRACER_INITIALIZER(false, "timer_check"); /* A "timer shard". Contains a 'heap' and a 'list' of timers. All timers with * deadlines earlier than 'queue_deadline" cap are maintained in the heap and diff --git a/src/core/lib/iomgr/timer_uv.c b/src/core/lib/iomgr/timer_uv.c index 13328e8bcf6..1ab82ef1d51 100644 --- a/src/core/lib/iomgr/timer_uv.c +++ b/src/core/lib/iomgr/timer_uv.c @@ -29,7 +29,8 @@ #include grpc_tracer_flag grpc_timer_trace = GRPC_TRACER_INITIALIZER(false, "timer"); -grpc_tracer_flag grpc_timer_check_trace = GRPC_TRACER_INITIALIZER(false, "timer_check"); +grpc_tracer_flag grpc_timer_check_trace = + GRPC_TRACER_INITIALIZER(false, "timer_check"); static void timer_close_callback(uv_handle_t *handle) { gpr_free(handle); } diff --git a/src/core/lib/security/transport/secure_endpoint.c b/src/core/lib/security/transport/secure_endpoint.c index 9df252f7d72..5e41b94ff82 100644 --- a/src/core/lib/security/transport/secure_endpoint.c +++ b/src/core/lib/security/transport/secure_endpoint.c @@ -60,7 +60,8 @@ typedef struct { gpr_refcount ref; } secure_endpoint; -grpc_tracer_flag grpc_trace_secure_endpoint = GRPC_TRACER_INITIALIZER(false, "secure_endpoint"); +grpc_tracer_flag grpc_trace_secure_endpoint = + GRPC_TRACER_INITIALIZER(false, "secure_endpoint"); static void destroy(grpc_exec_ctx *exec_ctx, secure_endpoint *secure_ep) { secure_endpoint *ep = secure_ep; diff --git a/src/core/lib/surface/call.c b/src/core/lib/surface/call.c index bb1e3f901ba..2365d27307c 100644 --- a/src/core/lib/surface/call.c +++ b/src/core/lib/surface/call.c @@ -229,8 +229,10 @@ struct grpc_call { void *saved_receiving_stream_ready_bctlp; }; -grpc_tracer_flag grpc_call_error_trace = GRPC_TRACER_INITIALIZER(false, "call_error"); -grpc_tracer_flag grpc_compression_trace = GRPC_TRACER_INITIALIZER(false, "compression"); +grpc_tracer_flag grpc_call_error_trace = + GRPC_TRACER_INITIALIZER(false, "call_error"); +grpc_tracer_flag grpc_compression_trace = + GRPC_TRACER_INITIALIZER(false, "compression"); #define CALL_STACK_FROM_CALL(call) ((grpc_call_stack *)((call) + 1)) #define CALL_FROM_CALL_STACK(call_stack) (((grpc_call *)(call_stack)) - 1) diff --git a/src/core/lib/surface/completion_queue.c b/src/core/lib/surface/completion_queue.c index f3d0ef286aa..978d7b41719 100644 --- a/src/core/lib/surface/completion_queue.c +++ b/src/core/lib/surface/completion_queue.c @@ -35,10 +35,13 @@ #include "src/core/lib/surface/call.h" #include "src/core/lib/surface/event_string.h" -grpc_tracer_flag grpc_trace_operation_failures = GRPC_TRACER_INITIALIZER(false, "op_failure"); +grpc_tracer_flag grpc_trace_operation_failures = + GRPC_TRACER_INITIALIZER(false, "op_failure"); #ifndef NDEBUG -grpc_tracer_flag grpc_trace_pending_tags = GRPC_TRACER_INITIALIZER(false, "pending_tags"); -grpc_tracer_flag grpc_trace_cq_refcount = GRPC_TRACER_INITIALIZER(false, "cq_refcount"); +grpc_tracer_flag grpc_trace_pending_tags = + GRPC_TRACER_INITIALIZER(false, "pending_tags"); +grpc_tracer_flag grpc_trace_cq_refcount = + GRPC_TRACER_INITIALIZER(false, "cq_refcount"); #endif typedef struct { @@ -343,8 +346,10 @@ static const cq_vtable g_cq_vtable[] = { #define POLLSET_FROM_CQ(cq) \ ((grpc_pollset *)(cq->vtable->data_size + (char *)DATA_FROM_CQ(cq))) -grpc_tracer_flag grpc_cq_pluck_trace = GRPC_TRACER_INITIALIZER(true, "queue_pluck"); -grpc_tracer_flag grpc_cq_event_timeout_trace = GRPC_TRACER_INITIALIZER(true, "queue_timeout"); +grpc_tracer_flag grpc_cq_pluck_trace = + GRPC_TRACER_INITIALIZER(true, "queue_pluck"); +grpc_tracer_flag grpc_cq_event_timeout_trace = + GRPC_TRACER_INITIALIZER(true, "queue_timeout"); #define GRPC_SURFACE_TRACE_RETURNED_EVENT(cq, event) \ if (GRPC_TRACER_ON(grpc_api_trace) && \ diff --git a/src/core/lib/surface/init.c b/src/core/lib/surface/init.c index 93ab101648c..db111e597f6 100644 --- a/src/core/lib/surface/init.c +++ b/src/core/lib/surface/init.c @@ -123,15 +123,13 @@ void grpc_init(void) { grpc_register_tracer(&grpc_api_trace); grpc_register_tracer(&grpc_trace_channel); grpc_register_tracer(&grpc_connectivity_state_trace); - grpc_register_tracer( - &grpc_trace_channel_stack_builder); + grpc_register_tracer(&grpc_trace_channel_stack_builder); grpc_register_tracer(&grpc_http1_trace); grpc_register_tracer(&grpc_cq_pluck_trace); // default on grpc_register_tracer(&grpc_combiner_trace); grpc_register_tracer(&grpc_server_channel_trace); grpc_register_tracer(&grpc_bdp_estimator_trace); - grpc_register_tracer( - &grpc_cq_event_timeout_trace); // default on + grpc_register_tracer(&grpc_cq_event_timeout_trace); // default on grpc_register_tracer(&grpc_trace_operation_failures); grpc_register_tracer(&grpc_resource_quota_trace); grpc_register_tracer(&grpc_call_error_trace); diff --git a/src/core/lib/surface/init_secure.c b/src/core/lib/surface/init_secure.c index 5f9816135f5..2366c24910c 100644 --- a/src/core/lib/surface/init_secure.c +++ b/src/core/lib/surface/init_secure.c @@ -40,10 +40,8 @@ void grpc_security_pre_init(void) { grpc_register_tracer(&grpc_trace_secure_endpoint); grpc_register_tracer(&tsi_tracing_enabled); #ifndef NDEBUG - grpc_register_tracer( - &grpc_trace_auth_context_refcount); - grpc_register_tracer( - &grpc_trace_security_connector_refcount); + grpc_register_tracer(&grpc_trace_auth_context_refcount); + grpc_register_tracer(&grpc_trace_security_connector_refcount); #endif } diff --git a/src/core/lib/surface/server.c b/src/core/lib/surface/server.c index 662a57766b7..fce7f8dca11 100644 --- a/src/core/lib/surface/server.c +++ b/src/core/lib/surface/server.c @@ -58,7 +58,8 @@ typedef struct registered_method registered_method; typedef enum { BATCH_CALL, REGISTERED_CALL } requested_call_type; -grpc_tracer_flag grpc_server_channel_trace = GRPC_TRACER_INITIALIZER(false, "server_channel"); +grpc_tracer_flag grpc_server_channel_trace = + GRPC_TRACER_INITIALIZER(false, "server_channel"); typedef struct requested_call { requested_call_type type; diff --git a/src/core/lib/transport/bdp_estimator.c b/src/core/lib/transport/bdp_estimator.c index cdfd521ce21..311ae6390df 100644 --- a/src/core/lib/transport/bdp_estimator.c +++ b/src/core/lib/transport/bdp_estimator.c @@ -23,7 +23,8 @@ #include #include -grpc_tracer_flag grpc_bdp_estimator_trace = GRPC_TRACER_INITIALIZER(false, "bdp_estimator"); +grpc_tracer_flag grpc_bdp_estimator_trace = + GRPC_TRACER_INITIALIZER(false, "bdp_estimator"); void grpc_bdp_estimator_init(grpc_bdp_estimator *estimator, const char *name) { estimator->estimate = 65536; diff --git a/src/core/lib/transport/connectivity_state.c b/src/core/lib/transport/connectivity_state.c index a7ea9cc38e4..73a9178ae26 100644 --- a/src/core/lib/transport/connectivity_state.c +++ b/src/core/lib/transport/connectivity_state.c @@ -24,7 +24,8 @@ #include #include -grpc_tracer_flag grpc_connectivity_state_trace = GRPC_TRACER_INITIALIZER(false, "connectivity_state"); +grpc_tracer_flag grpc_connectivity_state_trace = + GRPC_TRACER_INITIALIZER(false, "connectivity_state"); const char *grpc_connectivity_state_name(grpc_connectivity_state state) { switch (state) { diff --git a/src/core/lib/transport/metadata.c b/src/core/lib/transport/metadata.c index d699887b28f..2fea3660728 100644 --- a/src/core/lib/transport/metadata.c +++ b/src/core/lib/transport/metadata.c @@ -48,7 +48,8 @@ */ #ifndef NDEBUG -grpc_tracer_flag grpc_trace_metadata = GRPC_TRACER_INITIALIZER(false, "metadata"); +grpc_tracer_flag grpc_trace_metadata = + GRPC_TRACER_INITIALIZER(false, "metadata"); #define DEBUG_ARGS , const char *file, int line #define FWD_DEBUG_ARGS , file, line #define REF_MD_LOCKED(shard, s) ref_md_locked((shard), (s), __FILE__, __LINE__) diff --git a/src/core/lib/transport/transport.c b/src/core/lib/transport/transport.c index 712c2ab8331..7281602d66b 100644 --- a/src/core/lib/transport/transport.c +++ b/src/core/lib/transport/transport.c @@ -32,7 +32,8 @@ #include "src/core/lib/transport/transport_impl.h" #ifndef NDEBUG -grpc_tracer_flag grpc_trace_stream_refcount = GRPC_TRACER_INITIALIZER(false, "stream_refcount"); +grpc_tracer_flag grpc_trace_stream_refcount = + GRPC_TRACER_INITIALIZER(false, "stream_refcount"); #endif #ifndef NDEBUG From 780ba5dd223790a5e7cc71f2e37d75e8838c5082 Mon Sep 17 00:00:00 2001 From: ncteisen Date: Wed, 12 Jul 2017 23:22:01 -0700 Subject: [PATCH 27/42] Add all refcount flag --- src/core/lib/debug/trace.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/core/lib/debug/trace.c b/src/core/lib/debug/trace.c index 4c9d2b8e2e4..c6c1853e20b 100644 --- a/src/core/lib/debug/trace.c +++ b/src/core/lib/debug/trace.c @@ -123,6 +123,12 @@ int grpc_tracer_set_enabled(const char *name, int enabled) { } } else if (0 == strcmp(name, "list_tracers")) { list_tracers(); + } else if (0 == strcmp(name, "refcount")) { + for (t = tracers; t; t = t->next) { + if (strstr(t->flag->name, "refcount") != NULL) { + TRACER_SET(*t->flag, enabled); + } + } } else { int found = 0; for (t = tracers; t; t = t->next) { From 05dbac6b39ffd1b2df1af0f361e029884dc0bfb7 Mon Sep 17 00:00:00 2001 From: ncteisen Date: Thu, 13 Jul 2017 07:15:58 -0700 Subject: [PATCH 28/42] Update doc --- doc/environment_variables.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/doc/environment_variables.md b/doc/environment_variables.md index 7b222b9abf2..a283a5ab009 100644 --- a/doc/environment_variables.md +++ b/doc/environment_variables.md @@ -85,6 +85,11 @@ some configuration as environment variables that can be set. 'all' can additionally be used to turn all traces on. Individual traces can be disabled by prefixing them with '-'. + 'refcount' will turn on all of the tracers for refcount debugging. + + if 'list_tracers' is present, then all of the available tracers will be + printed when the program starts up. + Example: export GRPC_TRACE=all,-pending_tags From e476f7d33f38ed8c946a51336e0a0d23f8e5056d Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 12 Jul 2017 10:40:56 -0700 Subject: [PATCH 29/42] Strawman OWNERS --> CODEOWNERS script --- .github/CODEOWNERS | 22 +++ OWNERS | 6 + bazel/OWNERS | 2 + cmake/OWNERS | 2 + doc/OWNERS | 2 + etc/OWNERS | 2 + include/OWNERS | 4 + src/core/OWNERS | 4 + src/cpp/OWNERS | 4 + src/csharp/OWNERS | 3 + src/node/OWNERS | 2 + src/objective-c/OWNERS | 3 + src/php/OWNERS | 3 + src/python/OWNERS | 3 + src/ruby/OWNERS | 3 + tools/OWNERS | 4 + tools/codegen/core/OWNERS | 5 + tools/dockerfile/OWNERS | 3 + tools/mkowners/mkowners.py | 190 +++++++++++++++++++++++ tools/run_tests/OWNERS | 4 + tools/run_tests/sanity/check_owners.sh | 45 ++++++ tools/run_tests/sanity/sanity_tests.yaml | 1 + 22 files changed, 317 insertions(+) create mode 100644 .github/CODEOWNERS create mode 100644 OWNERS create mode 100644 bazel/OWNERS create mode 100644 cmake/OWNERS create mode 100644 doc/OWNERS create mode 100644 etc/OWNERS create mode 100644 include/OWNERS create mode 100644 src/core/OWNERS create mode 100644 src/cpp/OWNERS create mode 100644 src/csharp/OWNERS create mode 100644 src/node/OWNERS create mode 100644 src/objective-c/OWNERS create mode 100644 src/php/OWNERS create mode 100644 src/python/OWNERS create mode 100644 src/ruby/OWNERS create mode 100644 tools/OWNERS create mode 100644 tools/codegen/core/OWNERS create mode 100644 tools/dockerfile/OWNERS create mode 100755 tools/mkowners/mkowners.py create mode 100644 tools/run_tests/OWNERS create mode 100755 tools/run_tests/sanity/check_owners.sh diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 00000000000..f5dab5aa0e2 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,22 @@ +# Auto-generated by the tools/mkowners/mkowners.py tool +# Uses OWNERS files in different modules throughout the +# repository as the source of truth for module ownership. +* @a11r @nicolasnoble @ctiller +bazel/* @nicolasnoble @a11r @ctiller +cmake/* @jtattermusch @a11r @nicolasnoble @ctiller +doc/PROTOCOL-HTTP2.md @ejona86 @a11r @nicolasnoble @ctiller +doc/interop-test-descriptions.md @ejona86 @a11r @nicolasnoble @ctiller +etc/* @jboeuf @nicolasnoble @a11r @ctiller +include/* @ctiller @markdroth @dgquintas @a11r @nicolasnoble +src/core/* @ctiller @markdroth @dgquintas @a11r @nicolasnoble +src/cpp/* @ctiller @markdroth @dgquintas @a11r @nicolasnoble +src/csharp/* @jtattermusch @apolcyn @a11r @nicolasnoble @ctiller +src/node/* @murgatroid99 @a11r @nicolasnoble @ctiller +src/objective-c/* @muxi @makdharma @a11r @nicolasnoble @ctiller +src/php/* @stanley-cheung @murgatroid99 @a11r @nicolasnoble @ctiller +src/python/* @nathanielmanistaatgoogle @kpayson64 @a11r @nicolasnoble @ctiller +src/ruby/* @apolcyn @murgatroid99 @a11r @nicolasnoble @ctiller +tools/* @matt-kwong @jtattermusch @nicolasnoble @a11r @ctiller +tools/codegen/core/* @ctiller @dgquintas @markdroth +tools/dockerfile/* @matt-kwong @jtattermusch @nicolasnoble @a11r @ctiller +tools/run_tests/* @matt-kwong @jtattermusch @nicolasnoble @a11r @ctiller diff --git a/OWNERS b/OWNERS new file mode 100644 index 00000000000..78fc2513b10 --- /dev/null +++ b/OWNERS @@ -0,0 +1,6 @@ +# Top level ownership + +@a11r +@nicolasnoble +@ctiller + diff --git a/bazel/OWNERS b/bazel/OWNERS new file mode 100644 index 00000000000..40d21e8e0d6 --- /dev/null +++ b/bazel/OWNERS @@ -0,0 +1,2 @@ +@nicolasnoble + diff --git a/cmake/OWNERS b/cmake/OWNERS new file mode 100644 index 00000000000..c0ae0533b35 --- /dev/null +++ b/cmake/OWNERS @@ -0,0 +1,2 @@ +@jtattermusch + diff --git a/doc/OWNERS b/doc/OWNERS new file mode 100644 index 00000000000..f05861799e2 --- /dev/null +++ b/doc/OWNERS @@ -0,0 +1,2 @@ +@ejona86 PROTOCOL-HTTP2.md interop-test-descriptions.md + diff --git a/etc/OWNERS b/etc/OWNERS new file mode 100644 index 00000000000..2dfd7cd61e6 --- /dev/null +++ b/etc/OWNERS @@ -0,0 +1,2 @@ +@jboeuf +@nicolasnoble diff --git a/include/OWNERS b/include/OWNERS new file mode 100644 index 00000000000..8dca75ce916 --- /dev/null +++ b/include/OWNERS @@ -0,0 +1,4 @@ +@ctiller +@markdroth +@dgquintas + diff --git a/src/core/OWNERS b/src/core/OWNERS new file mode 100644 index 00000000000..8dca75ce916 --- /dev/null +++ b/src/core/OWNERS @@ -0,0 +1,4 @@ +@ctiller +@markdroth +@dgquintas + diff --git a/src/cpp/OWNERS b/src/cpp/OWNERS new file mode 100644 index 00000000000..8dca75ce916 --- /dev/null +++ b/src/cpp/OWNERS @@ -0,0 +1,4 @@ +@ctiller +@markdroth +@dgquintas + diff --git a/src/csharp/OWNERS b/src/csharp/OWNERS new file mode 100644 index 00000000000..bde3ed985c8 --- /dev/null +++ b/src/csharp/OWNERS @@ -0,0 +1,3 @@ +@jtattermusch +@apolcyn + diff --git a/src/node/OWNERS b/src/node/OWNERS new file mode 100644 index 00000000000..3a49353d845 --- /dev/null +++ b/src/node/OWNERS @@ -0,0 +1,2 @@ +@murgatroid99 + diff --git a/src/objective-c/OWNERS b/src/objective-c/OWNERS new file mode 100644 index 00000000000..2bc91186e75 --- /dev/null +++ b/src/objective-c/OWNERS @@ -0,0 +1,3 @@ +@muxi +@makdharma + diff --git a/src/php/OWNERS b/src/php/OWNERS new file mode 100644 index 00000000000..7065b41132b --- /dev/null +++ b/src/php/OWNERS @@ -0,0 +1,3 @@ +@stanley-cheung +@murgatroid99 + diff --git a/src/python/OWNERS b/src/python/OWNERS new file mode 100644 index 00000000000..73a707c67d3 --- /dev/null +++ b/src/python/OWNERS @@ -0,0 +1,3 @@ +@nathanielmanistaatgoogle +@kpayson64 + diff --git a/src/ruby/OWNERS b/src/ruby/OWNERS new file mode 100644 index 00000000000..b01fd8061e9 --- /dev/null +++ b/src/ruby/OWNERS @@ -0,0 +1,3 @@ +@apolcyn +@murgatroid99 + diff --git a/tools/OWNERS b/tools/OWNERS new file mode 100644 index 00000000000..8f6de536742 --- /dev/null +++ b/tools/OWNERS @@ -0,0 +1,4 @@ +@matt-kwong +@jtattermusch +@nicolasnoble + diff --git a/tools/codegen/core/OWNERS b/tools/codegen/core/OWNERS new file mode 100644 index 00000000000..17e66479b6e --- /dev/null +++ b/tools/codegen/core/OWNERS @@ -0,0 +1,5 @@ +set noparent +@ctiller +@dgquintas +@markdroth + diff --git a/tools/dockerfile/OWNERS b/tools/dockerfile/OWNERS new file mode 100644 index 00000000000..20ee8085c21 --- /dev/null +++ b/tools/dockerfile/OWNERS @@ -0,0 +1,3 @@ +@matt-kwong +@jtattermusch + diff --git a/tools/mkowners/mkowners.py b/tools/mkowners/mkowners.py new file mode 100755 index 00000000000..e24b052d671 --- /dev/null +++ b/tools/mkowners/mkowners.py @@ -0,0 +1,190 @@ +#!/usr/bin/env python3 +# Copyright 2017, Google Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +import argparse +import collections +import operator +import os +import re +import subprocess + +# +# Find the root of the git tree +# + +git_root = (subprocess + .check_output(['git', 'rev-parse', '--show-toplevel']) + .decode('utf-8') + .strip()) + +# +# Parse command line arguments +# + +default_out = os.path.join(git_root, '.github', 'CODEOWNERS') + +argp = argparse.ArgumentParser('Generate .github/CODEOWNERS file') +argp.add_argument('--out', '-o', + type=str, + default=default_out, + help='Output file (default %s)' % default_out) +args = argp.parse_args() + +# +# Walk git tree to locate all OWNERS files +# + +owners_files = [os.path.join(root, 'OWNERS') + for root, dirs, files in os.walk(git_root) + if 'OWNERS' in files] + +# +# Parse owners files +# + +Owners = collections.namedtuple('Owners', 'parent directives dir') +Directive = collections.namedtuple('Directive', 'who globs') + +def parse_owners(filename): + with open(filename) as f: + src = f.read().splitlines() + parent = True + directives = [] + for line in src: + line = line.strip() + # line := directive | comment + if not line: continue + if line[0] == '#': continue + # it's a directive + directive = None + if line == 'set noparent': + parent = False + elif line == '*': + directive = Directive(who='*', globs=[]) + elif ' ' in line: + (who, globs) = line.split(' ', 1) + globs_list = [glob + for glob in globs.split(' ') + if glob] + directive = Directive(who=who, globs=globs_list) + else: + directive = Directive(who=line, globs=[]) + if directive: + directives.append(directive) + return Owners(parent=parent, + directives=directives, + dir=os.path.relpath(os.path.dirname(filename), git_root)) + +owners_data = sorted([parse_owners(filename) + for filename in owners_files], + key=operator.attrgetter('dir')) + +# +# Modify owners so that parented OWNERS files point to the actual +# Owners tuple with their parent field +# + +new_owners_data = [] +for owners in owners_data: + if owners.parent == True: + best_parent = None + best_parent_score = None + for possible_parent in owners_data: + if possible_parent is owners: continue + rel = os.path.relpath(owners.dir, possible_parent.dir) + # '..' ==> we had to walk up from possible_parent to get to owners + # ==> not a parent + if '..' in rel: continue + depth = len(rel.split(os.sep)) + if not best_parent or depth < best_parent_score: + best_parent = possible_parent + best_parent_score = depth + if best_parent: + owners = owners._replace(parent = best_parent.dir) + else: + owners = owners._replace(parent = None) + new_owners_data.append(owners) +owners_data = new_owners_data + +# +# In bottom to top order, process owners data structures to build up +# a CODEOWNERS file for GitHub +# + +def glob_intersect(g1, g2): + if not g2: + return all(c == '*' for c in g1) + if not g1: + return all(c == '*' for c in g2) + c1, *t1 = g1 + c2, *t2 = g2 + if c1 == '*': + return glob_intersect(g1, t2) or glob_intersect(t1, g2) + if c2 == '*': + return glob_intersect(t1, g2) or glob_intersect(g1, t2) + return c1 == c2 and glob_intersect(t1, t2) + +def add_parent_to_globs(parent, globs): + if not parent: return + for owners in owners_data: + if owners.dir == parent: + for directive in owners.directives: + for dglob in directive.globs or ['*']: + for gglob, glob in globs.items(): + if glob_intersect(dglob, gglob): + if directive.who not in glob: + glob.append(directive.who) + add_parent_to_globs(owners.parent, globs) + return + assert(False) + +todo = owners_data.copy() +done = set() +with open(args.out, 'w') as out: + out.write('# Auto-generated by the tools/mkowners/mkowners.py tool\n') + out.write('# Uses OWNERS files in different modules throughout the\n') + out.write('# repository as the source of truth for module ownership.\n') + while todo: + head, *todo = todo + if head.parent and not head.parent in done: + todo.append(head) + continue + globs = collections.OrderedDict() + for directive in head.directives: + for glob in directive.globs or ['*']: + if glob not in globs: + globs[glob] = [] + globs[glob].append(directive.who) + add_parent_to_globs(head.parent, globs) + for glob, owners in globs.items(): + out.write('%s %s\n' % ( + os.path.join(head.dir, glob) if head.dir != '.' else glob, + ' '.join(owners))) + done.add(head.dir) diff --git a/tools/run_tests/OWNERS b/tools/run_tests/OWNERS new file mode 100644 index 00000000000..8f6de536742 --- /dev/null +++ b/tools/run_tests/OWNERS @@ -0,0 +1,4 @@ +@matt-kwong +@jtattermusch +@nicolasnoble + diff --git a/tools/run_tests/sanity/check_owners.sh b/tools/run_tests/sanity/check_owners.sh new file mode 100755 index 00000000000..365a278b71b --- /dev/null +++ b/tools/run_tests/sanity/check_owners.sh @@ -0,0 +1,45 @@ +#!/bin/sh + +# Copyright 2017, Google Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +set -e + +export TEST=true + +cd `dirname $0`/../../.. + +owners=.github/CODEOWNERS +want_owners=`mktemp /tmp/submXXXXXX` + +tools/mkowners/mkowners.py -o $want_owners +diff -u $owners $want_owners + +rm $want_owners diff --git a/tools/run_tests/sanity/sanity_tests.yaml b/tools/run_tests/sanity/sanity_tests.yaml index 445f53e5558..65cb2fe6a73 100644 --- a/tools/run_tests/sanity/sanity_tests.yaml +++ b/tools/run_tests/sanity/sanity_tests.yaml @@ -1,5 +1,6 @@ # a set of tests that are run in parallel for sanity tests - script: tools/run_tests/sanity/check_cache_mk.sh +- script: tools/run_tests/sanity/check_owners.sh - script: tools/run_tests/sanity/check_sources_and_headers.py - script: tools/run_tests/sanity/check_submodules.sh - script: tools/run_tests/sanity/check_test_filtering.py From 7e813a2bc47fd5882eceec7890537d453b1177c3 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 13 Jul 2017 08:58:49 -0700 Subject: [PATCH 30/42] Remove bazel warning (we have owners now), set noparent on bazel/OWNERS --- .github/CODEOWNERS | 2 +- bazel/OWNERS | 3 ++ tools/jenkins/run_bazel_full.sh | 2 - .../run_tests/python_utils/check_bazel_dir.py | 41 ------------------- 4 files changed, 4 insertions(+), 44 deletions(-) delete mode 100755 tools/run_tests/python_utils/check_bazel_dir.py diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index f5dab5aa0e2..ea0a57f158c 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -2,7 +2,7 @@ # Uses OWNERS files in different modules throughout the # repository as the source of truth for module ownership. * @a11r @nicolasnoble @ctiller -bazel/* @nicolasnoble @a11r @ctiller +bazel/* @nicolasnoble @dgquintas @ctiller cmake/* @jtattermusch @a11r @nicolasnoble @ctiller doc/PROTOCOL-HTTP2.md @ejona86 @a11r @nicolasnoble @ctiller doc/interop-test-descriptions.md @ejona86 @a11r @nicolasnoble @ctiller diff --git a/bazel/OWNERS b/bazel/OWNERS index 40d21e8e0d6..8fc7502a915 100644 --- a/bazel/OWNERS +++ b/bazel/OWNERS @@ -1,2 +1,5 @@ +set noparent @nicolasnoble +@dgquintas +@ctiller diff --git a/tools/jenkins/run_bazel_full.sh b/tools/jenkins/run_bazel_full.sh index edde1bc5451..3436a8f8b69 100755 --- a/tools/jenkins/run_bazel_full.sh +++ b/tools/jenkins/run_bazel_full.sh @@ -20,6 +20,4 @@ set -ex -o igncr || set -ex export DOCKERFILE_DIR=tools/dockerfile/test/bazel export DOCKER_RUN_SCRIPT=tools/jenkins/run_bazel_full_in_docker.sh -# Warn PR author if they make a change to the bazel directory -tools/run_tests/python_utils/check_bazel_dir.py exec tools/run_tests/dockerize/build_and_run_docker.sh diff --git a/tools/run_tests/python_utils/check_bazel_dir.py b/tools/run_tests/python_utils/check_bazel_dir.py deleted file mode 100755 index 1daf6ee5959..00000000000 --- a/tools/run_tests/python_utils/check_bazel_dir.py +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/env python -# Copyright 2017 gRPC authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""This sends out a warning if any changes to the bazel dir are made.""" - -from __future__ import print_function -from subprocess import check_output - -import comment_on_pr -import os - -_WARNING_MESSAGE = 'WARNING: You are making changes in the Bazel subdirectory. ' \ - 'Please get explicit approval from @nicolasnoble before merging.' - - -def _get_changed_files(base_branch): - """ - Get list of changed files between current branch and base of target merge branch - """ - # Get file changes between branch and merge-base of specified branch - base_commit = check_output(["git", "merge-base", base_branch, "HEAD"]).rstrip() - return check_output(["git", "diff", base_commit, "--name-only"]).splitlines() - - -# ghprbTargetBranch environment variable only available during a Jenkins PR tests -if 'ghprbTargetBranch' in os.environ: - changed_files = _get_changed_files('origin/%s' % os.environ['ghprbTargetBranch']) - if any(file.startswith('bazel/') for file in changed_files): - comment_on_pr.comment_on_pr(_WARNING_MESSAGE) From 80a87ea820bfb5b4b454341394ad22888452015a Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 13 Jul 2017 09:11:06 -0700 Subject: [PATCH 31/42] Fix copyrights --- tools/mkowners/mkowners.py | 35 +++++++------------------ tools/run_tests/sanity/check_owners.sh | 36 +++++++------------------- 2 files changed, 20 insertions(+), 51 deletions(-) diff --git a/tools/mkowners/mkowners.py b/tools/mkowners/mkowners.py index e24b052d671..81f26b1164d 100755 --- a/tools/mkowners/mkowners.py +++ b/tools/mkowners/mkowners.py @@ -1,32 +1,17 @@ #!/usr/bin/env python3 -# Copyright 2017, Google Inc. -# All rights reserved. +# Copyright 2017 gRPC authors. # -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at # -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. +# http://www.apache.org/licenses/LICENSE-2.0 # -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. import argparse import collections diff --git a/tools/run_tests/sanity/check_owners.sh b/tools/run_tests/sanity/check_owners.sh index 365a278b71b..b681fed1bbf 100755 --- a/tools/run_tests/sanity/check_owners.sh +++ b/tools/run_tests/sanity/check_owners.sh @@ -1,33 +1,17 @@ #!/bin/sh - -# Copyright 2017, Google Inc. -# All rights reserved. +# Copyright 2017 gRPC authors. # -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at # -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. +# http://www.apache.org/licenses/LICENSE-2.0 # -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. set -e From b575a34e0536a297a9f9d66e52a3760cf9d5402e Mon Sep 17 00:00:00 2001 From: yang-g Date: Thu, 13 Jul 2017 09:47:27 -0700 Subject: [PATCH 32/42] Replace InitBenchmark with InitTest. Remove qps_test.cc --- test/cpp/qps/BUILD | 5 ++ test/cpp/qps/benchmark_config.cc | 4 -- test/cpp/qps/benchmark_config.h | 3 - test/cpp/qps/json_run_localhost.cc | 3 + test/cpp/qps/qps_interarrival_test.cc | 3 + test/cpp/qps/qps_json_driver.cc | 3 +- test/cpp/qps/qps_openloop_test.cc | 4 +- test/cpp/qps/qps_test.cc | 64 ------------------- .../qps/secure_sync_unary_ping_pong_test.cc | 3 +- 9 files changed, 17 insertions(+), 75 deletions(-) delete mode 100644 test/cpp/qps/qps_test.cc diff --git a/test/cpp/qps/BUILD b/test/cpp/qps/BUILD index 4d8b3b40e3c..ed2f9edac13 100644 --- a/test/cpp/qps/BUILD +++ b/test/cpp/qps/BUILD @@ -121,6 +121,7 @@ grpc_cc_binary( "//:gpr", "//test/core/util:gpr_test_util", "//test/core/util:grpc_test_util", + "//test/cpp/util:test_config", "//test/cpp/util:test_util", ], ) @@ -131,6 +132,7 @@ grpc_cc_test( deps = [ ":histogram", ":interarrival", + "//test/cpp/util:test_config", ], ) @@ -141,6 +143,7 @@ grpc_cc_binary( ":benchmark_config", ":driver_impl", "//:grpc++", + "//test/cpp/util:test_config", ], external_deps = [ "gflags", @@ -154,6 +157,7 @@ grpc_cc_test( ":benchmark_config", ":driver_impl", ":qps_worker_impl", + "//test/cpp/util:test_config", ], ) @@ -164,6 +168,7 @@ grpc_cc_test( ":benchmark_config", ":driver_impl", "//:grpc++", + "//test/cpp/util:test_config", ], ) diff --git a/test/cpp/qps/benchmark_config.cc b/test/cpp/qps/benchmark_config.cc index 8f53670324b..fb1e0608c52 100644 --- a/test/cpp/qps/benchmark_config.cc +++ b/test/cpp/qps/benchmark_config.cc @@ -54,10 +54,6 @@ using namespace gflags; namespace grpc { namespace testing { -void InitBenchmark(int* argc, char*** argv, bool remove_flags) { - ParseCommandLineFlags(argc, argv, remove_flags); -} - static std::shared_ptr InitBenchmarkReporters() { auto* composite_reporter = new CompositeReporter; if (FLAGS_enable_log_reporter) { diff --git a/test/cpp/qps/benchmark_config.h b/test/cpp/qps/benchmark_config.h index 054dbb276eb..d3d6910ff0b 100644 --- a/test/cpp/qps/benchmark_config.h +++ b/test/cpp/qps/benchmark_config.h @@ -20,15 +20,12 @@ #define GRPC_TEST_CPP_UTIL_BENCHMARK_CONFIG_H #include -#include #include "test/cpp/qps/report.h" namespace grpc { namespace testing { -void InitBenchmark(int* argc, char*** argv, bool remove_flags); - /** Returns the benchmark Reporter instance. * * The returned instance will take care of generating reports for all the actual diff --git a/test/cpp/qps/json_run_localhost.cc b/test/cpp/qps/json_run_localhost.cc index 1d394b216f0..74b114f1674 100644 --- a/test/cpp/qps/json_run_localhost.cc +++ b/test/cpp/qps/json_run_localhost.cc @@ -29,6 +29,7 @@ #include "src/core/lib/support/env.h" #include "test/core/util/port.h" #include "test/cpp/util/subprocess.h" +#include "test/cpp/util/test_config.h" using grpc::SubProcess; @@ -75,6 +76,8 @@ static void LogStatus(int status, const char* label) { } int main(int argc, char** argv) { + grpc::testing::InitTest(&argc, &argv, true); + register_sighandler(); std::string my_bin = argv[0]; diff --git a/test/cpp/qps/qps_interarrival_test.cc b/test/cpp/qps/qps_interarrival_test.cc index d19266ff9c0..87f09e8c5f4 100644 --- a/test/cpp/qps/qps_interarrival_test.cc +++ b/test/cpp/qps/qps_interarrival_test.cc @@ -23,6 +23,7 @@ #include #include "test/cpp/qps/interarrival.h" +#include "test/cpp/util/test_config.h" using grpc::testing::RandomDistInterface; using grpc::testing::InterarrivalTimer; @@ -50,6 +51,8 @@ static void RunTest(RandomDistInterface &&r, int threads, std::string title) { using grpc::testing::ExpDist; int main(int argc, char **argv) { + grpc::testing::InitTest(&argc, &argv, true); + RunTest(ExpDist(10.0), 5, std::string("Exponential(10)")); return 0; } diff --git a/test/cpp/qps/qps_json_driver.cc b/test/cpp/qps/qps_json_driver.cc index 590c22ec29f..e1e5802d136 100644 --- a/test/cpp/qps/qps_json_driver.cc +++ b/test/cpp/qps/qps_json_driver.cc @@ -30,6 +30,7 @@ #include "test/cpp/qps/driver.h" #include "test/cpp/qps/parse_json.h" #include "test/cpp/qps/report.h" +#include "test/cpp/util/test_config.h" DEFINE_string(scenarios_file, "", "JSON file containing an array of Scenario objects"); @@ -219,7 +220,7 @@ static bool QpsDriver() { } // namespace grpc int main(int argc, char** argv) { - grpc::testing::InitBenchmark(&argc, &argv, true); + grpc::testing::InitTest(&argc, &argv, true); bool ok = grpc::testing::QpsDriver(); diff --git a/test/cpp/qps/qps_openloop_test.cc b/test/cpp/qps/qps_openloop_test.cc index 28dec4f8c69..5b28c460011 100644 --- a/test/cpp/qps/qps_openloop_test.cc +++ b/test/cpp/qps/qps_openloop_test.cc @@ -20,10 +20,10 @@ #include -#include "test/core/util/test_config.h" #include "test/cpp/qps/benchmark_config.h" #include "test/cpp/qps/driver.h" #include "test/cpp/qps/report.h" +#include "test/core/util/test_config.h" namespace grpc { namespace testing { @@ -58,7 +58,7 @@ static void RunQPS() { } // namespace grpc int main(int argc, char** argv) { - grpc::testing::InitBenchmark(&argc, &argv, true); + grpc::testing::InitTest(&argc, &argv, true); grpc::testing::RunQPS(); diff --git a/test/cpp/qps/qps_test.cc b/test/cpp/qps/qps_test.cc deleted file mode 100644 index 6ab2102e402..00000000000 --- a/test/cpp/qps/qps_test.cc +++ /dev/null @@ -1,64 +0,0 @@ -/* - * - * Copyright 2015 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include - -#include - -#include "test/cpp/qps/benchmark_config.h" -#include "test/cpp/qps/driver.h" -#include "test/cpp/qps/report.h" - -namespace grpc { -namespace testing { - -static const int WARMUP = 20; -static const int BENCHMARK = 20; - -static void RunQPS() { - gpr_log(GPR_INFO, "Running QPS test"); - - ClientConfig client_config; - client_config.set_client_type(ASYNC_CLIENT); - client_config.set_outstanding_rpcs_per_channel(100); - client_config.set_client_channels(64); - client_config.set_async_client_threads(8); - client_config.set_rpc_type(STREAMING); - client_config.mutable_load_params()->mutable_closed_loop(); - - ServerConfig server_config; - server_config.set_server_type(ASYNC_SERVER); - server_config.set_async_server_threads(8); - - const auto result = - RunScenario(client_config, 1, server_config, 1, WARMUP, BENCHMARK, -2); - - GetReporter()->ReportQPSPerCore(*result); - GetReporter()->ReportLatency(*result); -} - -} // namespace testing -} // namespace grpc - -int main(int argc, char** argv) { - grpc::testing::InitBenchmark(&argc, &argv, true); - - grpc::testing::RunQPS(); - - return 0; -} diff --git a/test/cpp/qps/secure_sync_unary_ping_pong_test.cc b/test/cpp/qps/secure_sync_unary_ping_pong_test.cc index 586392692e4..1ee6e374749 100644 --- a/test/cpp/qps/secure_sync_unary_ping_pong_test.cc +++ b/test/cpp/qps/secure_sync_unary_ping_pong_test.cc @@ -23,6 +23,7 @@ #include "test/cpp/qps/benchmark_config.h" #include "test/cpp/qps/driver.h" #include "test/cpp/qps/report.h" +#include "test/cpp/util/test_config.h" namespace grpc { namespace testing { @@ -61,7 +62,7 @@ static void RunSynchronousUnaryPingPong() { } // namespace grpc int main(int argc, char** argv) { - grpc::testing::InitBenchmark(&argc, &argv, true); + grpc::testing::InitTest(&argc, &argv, true); grpc::testing::RunSynchronousUnaryPingPong(); From 22d9516434dd11d6ed06a89080aa267492fa17fe Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 13 Jul 2017 10:02:30 -0700 Subject: [PATCH 33/42] Use ** for OWNERS files for trees --- .github/CODEOWNERS | 34 +++++++++++++++++----------------- tools/mkowners/mkowners.py | 4 ++-- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index ea0a57f158c..996e5f619c1 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1,22 +1,22 @@ # Auto-generated by the tools/mkowners/mkowners.py tool # Uses OWNERS files in different modules throughout the # repository as the source of truth for module ownership. -* @a11r @nicolasnoble @ctiller -bazel/* @nicolasnoble @dgquintas @ctiller -cmake/* @jtattermusch @a11r @nicolasnoble @ctiller +** @a11r @nicolasnoble @ctiller +bazel/** @nicolasnoble @dgquintas @ctiller +cmake/** @jtattermusch @a11r @nicolasnoble @ctiller doc/PROTOCOL-HTTP2.md @ejona86 @a11r @nicolasnoble @ctiller doc/interop-test-descriptions.md @ejona86 @a11r @nicolasnoble @ctiller -etc/* @jboeuf @nicolasnoble @a11r @ctiller -include/* @ctiller @markdroth @dgquintas @a11r @nicolasnoble -src/core/* @ctiller @markdroth @dgquintas @a11r @nicolasnoble -src/cpp/* @ctiller @markdroth @dgquintas @a11r @nicolasnoble -src/csharp/* @jtattermusch @apolcyn @a11r @nicolasnoble @ctiller -src/node/* @murgatroid99 @a11r @nicolasnoble @ctiller -src/objective-c/* @muxi @makdharma @a11r @nicolasnoble @ctiller -src/php/* @stanley-cheung @murgatroid99 @a11r @nicolasnoble @ctiller -src/python/* @nathanielmanistaatgoogle @kpayson64 @a11r @nicolasnoble @ctiller -src/ruby/* @apolcyn @murgatroid99 @a11r @nicolasnoble @ctiller -tools/* @matt-kwong @jtattermusch @nicolasnoble @a11r @ctiller -tools/codegen/core/* @ctiller @dgquintas @markdroth -tools/dockerfile/* @matt-kwong @jtattermusch @nicolasnoble @a11r @ctiller -tools/run_tests/* @matt-kwong @jtattermusch @nicolasnoble @a11r @ctiller +etc/** @jboeuf @nicolasnoble @a11r @ctiller +include/** @ctiller @markdroth @dgquintas @a11r @nicolasnoble +src/core/** @ctiller @markdroth @dgquintas @a11r @nicolasnoble +src/cpp/** @ctiller @markdroth @dgquintas @a11r @nicolasnoble +src/csharp/** @jtattermusch @apolcyn @a11r @nicolasnoble @ctiller +src/node/** @murgatroid99 @a11r @nicolasnoble @ctiller +src/objective-c/** @muxi @makdharma @a11r @nicolasnoble @ctiller +src/php/** @stanley-cheung @murgatroid99 @a11r @nicolasnoble @ctiller +src/python/** @nathanielmanistaatgoogle @kpayson64 @a11r @nicolasnoble @ctiller +src/ruby/** @apolcyn @murgatroid99 @a11r @nicolasnoble @ctiller +tools/** @matt-kwong @jtattermusch @nicolasnoble @a11r @ctiller +tools/codegen/core/** @ctiller @dgquintas @markdroth +tools/dockerfile/** @matt-kwong @jtattermusch @nicolasnoble @a11r @ctiller +tools/run_tests/** @matt-kwong @jtattermusch @nicolasnoble @a11r @ctiller diff --git a/tools/mkowners/mkowners.py b/tools/mkowners/mkowners.py index 81f26b1164d..d4a3b56a858 100755 --- a/tools/mkowners/mkowners.py +++ b/tools/mkowners/mkowners.py @@ -141,7 +141,7 @@ def add_parent_to_globs(parent, globs): for owners in owners_data: if owners.dir == parent: for directive in owners.directives: - for dglob in directive.globs or ['*']: + for dglob in directive.globs or ['**']: for gglob, glob in globs.items(): if glob_intersect(dglob, gglob): if directive.who not in glob: @@ -163,7 +163,7 @@ with open(args.out, 'w') as out: continue globs = collections.OrderedDict() for directive in head.directives: - for glob in directive.globs or ['*']: + for glob in directive.globs or ['**']: if glob not in globs: globs[glob] = [] globs[glob].append(directive.who) From e4985cbbb785d25ad60a9f508d35649700c95ec3 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 13 Jul 2017 10:11:42 -0700 Subject: [PATCH 34/42] Add test tree owners for C/C++ --- .github/CODEOWNERS | 3 +++ test/build/OWNERS | 4 ++++ test/core/OWNERS | 4 ++++ test/cpp/OWNERS | 4 ++++ 4 files changed, 15 insertions(+) create mode 100644 test/build/OWNERS create mode 100644 test/core/OWNERS create mode 100644 test/cpp/OWNERS diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 996e5f619c1..5e5c26c101f 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -16,6 +16,9 @@ src/objective-c/** @muxi @makdharma @a11r @nicolasnoble @ctiller src/php/** @stanley-cheung @murgatroid99 @a11r @nicolasnoble @ctiller src/python/** @nathanielmanistaatgoogle @kpayson64 @a11r @nicolasnoble @ctiller src/ruby/** @apolcyn @murgatroid99 @a11r @nicolasnoble @ctiller +test/build/** @ctiller @markdroth @dgquintas @a11r @nicolasnoble +test/core/** @ctiller @markdroth @dgquintas @a11r @nicolasnoble +test/cpp/** @ctiller @markdroth @dgquintas @a11r @nicolasnoble tools/** @matt-kwong @jtattermusch @nicolasnoble @a11r @ctiller tools/codegen/core/** @ctiller @dgquintas @markdroth tools/dockerfile/** @matt-kwong @jtattermusch @nicolasnoble @a11r @ctiller diff --git a/test/build/OWNERS b/test/build/OWNERS new file mode 100644 index 00000000000..8dca75ce916 --- /dev/null +++ b/test/build/OWNERS @@ -0,0 +1,4 @@ +@ctiller +@markdroth +@dgquintas + diff --git a/test/core/OWNERS b/test/core/OWNERS new file mode 100644 index 00000000000..8dca75ce916 --- /dev/null +++ b/test/core/OWNERS @@ -0,0 +1,4 @@ +@ctiller +@markdroth +@dgquintas + diff --git a/test/cpp/OWNERS b/test/cpp/OWNERS new file mode 100644 index 00000000000..8dca75ce916 --- /dev/null +++ b/test/cpp/OWNERS @@ -0,0 +1,4 @@ +@ctiller +@markdroth +@dgquintas + From a7e5a0bd9cbb3f8625a23fdc0987dbef90648921 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 13 Jul 2017 10:17:11 -0700 Subject: [PATCH 35/42] Add a test of repeatedly calling grpc_init then grpc_shutdown --- test/core/surface/init_test.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/core/surface/init_test.c b/test/core/surface/init_test.c index 47900c51d73..78789824512 100644 --- a/test/core/surface/init_test.c +++ b/test/core/surface/init_test.c @@ -52,6 +52,13 @@ static void test_plugin() { GPR_ASSERT(g_flag == 2); } +static void test_repeatedly() { + for (int i=0; i<100000; i++) { + grpc_init(); + grpc_shutdown(); + } +} + int main(int argc, char **argv) { grpc_test_init(argc, argv); test(1); @@ -59,5 +66,6 @@ int main(int argc, char **argv) { test(3); test_mixed(); test_plugin(); + test_repeatedly(); return 0; } From fdcb774ceae507312bd84b4895e1e57b55bc4112 Mon Sep 17 00:00:00 2001 From: yang-g Date: Thu, 13 Jul 2017 10:25:42 -0700 Subject: [PATCH 36/42] Regenerate projects and fixes --- CMakeLists.txt | 2 ++ Makefile | 12 ++++++------ build.yaml | 2 ++ test/cpp/qps/json_run_localhost.cc | 3 --- test/cpp/qps/qps_openloop_test.cc | 1 + tools/run_tests/generated/sources_and_headers.json | 2 ++ 6 files changed, 13 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b535d7f546b..3dd8ec45037 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11405,6 +11405,7 @@ target_link_libraries(qps_interarrival_test grpc gpr_test_util gpr + grpc++_test_config ${_gRPC_GFLAGS_LIBRARIES} ) @@ -11756,6 +11757,7 @@ target_link_libraries(secure_sync_unary_ping_pong_test grpc gpr_test_util gpr + grpc++_test_config ${_gRPC_GFLAGS_LIBRARIES} ) diff --git a/Makefile b/Makefile index 23f8706e9f6..f58a02df9ae 100644 --- a/Makefile +++ b/Makefile @@ -15398,16 +15398,16 @@ $(BINDIR)/$(CONFIG)/qps_interarrival_test: protobuf_dep_error else -$(BINDIR)/$(CONFIG)/qps_interarrival_test: $(PROTOBUF_DEP) $(QPS_INTERARRIVAL_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libqps.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a +$(BINDIR)/$(CONFIG)/qps_interarrival_test: $(PROTOBUF_DEP) $(QPS_INTERARRIVAL_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libqps.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_config.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LDXX) $(LDFLAGS) $(QPS_INTERARRIVAL_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libqps.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(LDLIBS_SECURE) $(GTEST_LIB) -o $(BINDIR)/$(CONFIG)/qps_interarrival_test + $(Q) $(LDXX) $(LDFLAGS) $(QPS_INTERARRIVAL_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libqps.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_config.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(LDLIBS_SECURE) $(GTEST_LIB) -o $(BINDIR)/$(CONFIG)/qps_interarrival_test endif endif -$(OBJDIR)/$(CONFIG)/test/cpp/qps/qps_interarrival_test.o: $(LIBDIR)/$(CONFIG)/libqps.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a +$(OBJDIR)/$(CONFIG)/test/cpp/qps/qps_interarrival_test.o: $(LIBDIR)/$(CONFIG)/libqps.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_config.a deps_qps_interarrival_test: $(QPS_INTERARRIVAL_TEST_OBJS:.o=.dep) @@ -15719,16 +15719,16 @@ $(BINDIR)/$(CONFIG)/secure_sync_unary_ping_pong_test: protobuf_dep_error else -$(BINDIR)/$(CONFIG)/secure_sync_unary_ping_pong_test: $(PROTOBUF_DEP) $(SECURE_SYNC_UNARY_PING_PONG_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libqps.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a +$(BINDIR)/$(CONFIG)/secure_sync_unary_ping_pong_test: $(PROTOBUF_DEP) $(SECURE_SYNC_UNARY_PING_PONG_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libqps.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_config.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LDXX) $(LDFLAGS) $(SECURE_SYNC_UNARY_PING_PONG_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libqps.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(LDLIBS_SECURE) $(GTEST_LIB) -o $(BINDIR)/$(CONFIG)/secure_sync_unary_ping_pong_test + $(Q) $(LDXX) $(LDFLAGS) $(SECURE_SYNC_UNARY_PING_PONG_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libqps.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_config.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(LDLIBS_SECURE) $(GTEST_LIB) -o $(BINDIR)/$(CONFIG)/secure_sync_unary_ping_pong_test endif endif -$(OBJDIR)/$(CONFIG)/test/cpp/qps/secure_sync_unary_ping_pong_test.o: $(LIBDIR)/$(CONFIG)/libqps.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a +$(OBJDIR)/$(CONFIG)/test/cpp/qps/secure_sync_unary_ping_pong_test.o: $(LIBDIR)/$(CONFIG)/libqps.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_config.a deps_secure_sync_unary_ping_pong_test: $(SECURE_SYNC_UNARY_PING_PONG_TEST_OBJS:.o=.dep) diff --git a/build.yaml b/build.yaml index e55c4ca3012..8a2fbe19077 100644 --- a/build.yaml +++ b/build.yaml @@ -4162,6 +4162,7 @@ targets: - grpc - gpr_test_util - gpr + - grpc++_test_config platforms: - mac - linux @@ -4280,6 +4281,7 @@ targets: - grpc - gpr_test_util - gpr + - grpc++_test_config platforms: - mac - linux diff --git a/test/cpp/qps/json_run_localhost.cc b/test/cpp/qps/json_run_localhost.cc index 74b114f1674..1d394b216f0 100644 --- a/test/cpp/qps/json_run_localhost.cc +++ b/test/cpp/qps/json_run_localhost.cc @@ -29,7 +29,6 @@ #include "src/core/lib/support/env.h" #include "test/core/util/port.h" #include "test/cpp/util/subprocess.h" -#include "test/cpp/util/test_config.h" using grpc::SubProcess; @@ -76,8 +75,6 @@ static void LogStatus(int status, const char* label) { } int main(int argc, char** argv) { - grpc::testing::InitTest(&argc, &argv, true); - register_sighandler(); std::string my_bin = argv[0]; diff --git a/test/cpp/qps/qps_openloop_test.cc b/test/cpp/qps/qps_openloop_test.cc index 5b28c460011..b2503dabe24 100644 --- a/test/cpp/qps/qps_openloop_test.cc +++ b/test/cpp/qps/qps_openloop_test.cc @@ -24,6 +24,7 @@ #include "test/cpp/qps/driver.h" #include "test/cpp/qps/report.h" #include "test/core/util/test_config.h" +#include "test/cpp/util/test_config.h" namespace grpc { namespace testing { diff --git a/tools/run_tests/generated/sources_and_headers.json b/tools/run_tests/generated/sources_and_headers.json index 477a258daa6..02562bfae4d 100644 --- a/tools/run_tests/generated/sources_and_headers.json +++ b/tools/run_tests/generated/sources_and_headers.json @@ -3646,6 +3646,7 @@ "gpr_test_util", "grpc", "grpc++", + "grpc++_test_config", "grpc++_test_util", "grpc_test_util", "qps" @@ -3815,6 +3816,7 @@ "gpr_test_util", "grpc", "grpc++", + "grpc++_test_config", "grpc++_test_util", "grpc_test_util", "qps" From 61f21d91b8fb62e402bbd2e32dcd27b9548425a4 Mon Sep 17 00:00:00 2001 From: "Nicolas \"Pixel\" Noble" Date: Thu, 13 Jul 2017 19:36:00 +0200 Subject: [PATCH 37/42] Fixing merge failures on test/cpp/interop. --- test/cpp/interop/BUILD | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/test/cpp/interop/BUILD b/test/cpp/interop/BUILD index 2beed814807..0de5a6f4da4 100644 --- a/test/cpp/interop/BUILD +++ b/test/cpp/interop/BUILD @@ -25,31 +25,30 @@ package( grpc_cc_library( name = "server_helper_lib", - language = "c++", srcs = [ "server_helper.cc", ], hdrs = [ "server_helper.h", ], - deps = [ - "//test/cpp/util:test_util", - ], external_deps = [ "gflags", ], + language = "C++", + deps = [ + "//test/cpp/util:test_util", + ], ) grpc_cc_binary( name = "interop_server", - language = "c++", srcs = [ "interop_server_bootstrap.cc", ], language = "C++", deps = [ - "//:grpc++", ":interop_server_lib", + "//:grpc++", ], ) @@ -70,7 +69,6 @@ grpc_cc_library( grpc_cc_library( name = "client_helper_lib", - language = "c++", srcs = [ "client_helper.cc", "interop_client.cc", @@ -79,13 +77,14 @@ grpc_cc_library( "client_helper.h", "interop_client.h", ], + language = "C++", deps = [ - "//test/cpp/util:test_util", "//src/proto/grpc/testing:empty_proto", "//src/proto/grpc/testing:messages_proto", "//src/proto/grpc/testing:test_proto", "//test/core/security:oauth2_utils", "//test/cpp/util:test_config", + "//test/cpp/util:test_util", ], ) @@ -115,7 +114,7 @@ grpc_cc_binary( grpc_cc_binary( name = "reconnect_interop_server", srcs = [ - "reconnect_interop_server.cc" + "reconnect_interop_server.cc", ], language = "C++", deps = [ @@ -128,18 +127,14 @@ grpc_cc_binary( grpc_cc_binary( name = "stress_test", srcs = [ - "stress_test.cc", "stress_interop_client.cc", "stress_interop_client.h", + "stress_test.cc", ], deps = [ ":client_helper_lib", "//:grpc++", "//test/cpp/util:metrics_server_lib", "//test/cpp/util:test_config", - name = "interop_client", - language = "c++", - deps = [ - ":interop_client_main", ], ) From e251fbac20bd27d0b57c3a87696cc300575e04f2 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 13 Jul 2017 10:41:17 -0700 Subject: [PATCH 38/42] clang-format --- test/core/surface/init_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/core/surface/init_test.c b/test/core/surface/init_test.c index 78789824512..a9e80575af1 100644 --- a/test/core/surface/init_test.c +++ b/test/core/surface/init_test.c @@ -53,7 +53,7 @@ static void test_plugin() { } static void test_repeatedly() { - for (int i=0; i<100000; i++) { + for (int i = 0; i < 100000; i++) { grpc_init(); grpc_shutdown(); } From 44360ab64f9dea17c92cb07441a4abcb344cf8bf Mon Sep 17 00:00:00 2001 From: Adele Zhou Date: Thu, 13 Jul 2017 11:40:57 -0700 Subject: [PATCH 39/42] Modify image names to match the one in dockerhub. --- tools/run_tests/dockerize/build_interop_image.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/run_tests/dockerize/build_interop_image.sh b/tools/run_tests/dockerize/build_interop_image.sh index 61105b0da40..77c7a84828e 100755 --- a/tools/run_tests/dockerize/build_interop_image.sh +++ b/tools/run_tests/dockerize/build_interop_image.sh @@ -62,9 +62,9 @@ fi # on OSX use md5 instead of sha1sum if which sha1sum > /dev/null; then - BASE_IMAGE=${BASE_NAME}_base:`sha1sum tools/dockerfile/interoptest/$BASE_NAME/Dockerfile | cut -f1 -d\ ` + BASE_IMAGE=${BASE_NAME}_`sha1sum tools/dockerfile/interoptest/$BASE_NAME/Dockerfile | cut -f1 -d\ ` else - BASE_IMAGE=${BASE_NAME}_base:`md5 -r tools/dockerfile/interoptest/$BASE_NAME/Dockerfile | cut -f1 -d\ ` + BASE_IMAGE=${BASE_NAME}_`md5 -r tools/dockerfile/interoptest/$BASE_NAME/Dockerfile | cut -f1 -d\ ` fi if [ "$DOCKERHUB_ORGANIZATION" != "" ] From eb020ce29d36894c0a337eb4d6ac6d65d74b8558 Mon Sep 17 00:00:00 2001 From: Nicolas Noble Date: Thu, 13 Jul 2017 13:20:13 -0700 Subject: [PATCH 40/42] Few fixes for mkowners.py. -) Paths should all be absolute to / -) Computing the intersection of two globs should happen with the full path in there, not just the directory's glob. --- .github/CODEOWNERS | 44 +++++++++++++++++++------------------- tools/mkowners/mkowners.py | 17 +++++++++------ 2 files changed, 32 insertions(+), 29 deletions(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 5e5c26c101f..de5dace21d8 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1,25 +1,25 @@ # Auto-generated by the tools/mkowners/mkowners.py tool # Uses OWNERS files in different modules throughout the # repository as the source of truth for module ownership. -** @a11r @nicolasnoble @ctiller -bazel/** @nicolasnoble @dgquintas @ctiller -cmake/** @jtattermusch @a11r @nicolasnoble @ctiller -doc/PROTOCOL-HTTP2.md @ejona86 @a11r @nicolasnoble @ctiller -doc/interop-test-descriptions.md @ejona86 @a11r @nicolasnoble @ctiller -etc/** @jboeuf @nicolasnoble @a11r @ctiller -include/** @ctiller @markdroth @dgquintas @a11r @nicolasnoble -src/core/** @ctiller @markdroth @dgquintas @a11r @nicolasnoble -src/cpp/** @ctiller @markdroth @dgquintas @a11r @nicolasnoble -src/csharp/** @jtattermusch @apolcyn @a11r @nicolasnoble @ctiller -src/node/** @murgatroid99 @a11r @nicolasnoble @ctiller -src/objective-c/** @muxi @makdharma @a11r @nicolasnoble @ctiller -src/php/** @stanley-cheung @murgatroid99 @a11r @nicolasnoble @ctiller -src/python/** @nathanielmanistaatgoogle @kpayson64 @a11r @nicolasnoble @ctiller -src/ruby/** @apolcyn @murgatroid99 @a11r @nicolasnoble @ctiller -test/build/** @ctiller @markdroth @dgquintas @a11r @nicolasnoble -test/core/** @ctiller @markdroth @dgquintas @a11r @nicolasnoble -test/cpp/** @ctiller @markdroth @dgquintas @a11r @nicolasnoble -tools/** @matt-kwong @jtattermusch @nicolasnoble @a11r @ctiller -tools/codegen/core/** @ctiller @dgquintas @markdroth -tools/dockerfile/** @matt-kwong @jtattermusch @nicolasnoble @a11r @ctiller -tools/run_tests/** @matt-kwong @jtattermusch @nicolasnoble @a11r @ctiller +/** @a11r @nicolasnoble @ctiller +/bazel/** @nicolasnoble @dgquintas @ctiller +/cmake/** @jtattermusch @a11r @nicolasnoble @ctiller +/doc/PROTOCOL-HTTP2.md @ejona86 @a11r @nicolasnoble @ctiller +/doc/interop-test-descriptions.md @ejona86 @a11r @nicolasnoble @ctiller +/etc/** @jboeuf @nicolasnoble @a11r @ctiller +/include/** @ctiller @markdroth @dgquintas @a11r @nicolasnoble +/src/core/** @ctiller @markdroth @dgquintas @a11r @nicolasnoble +/src/cpp/** @ctiller @markdroth @dgquintas @a11r @nicolasnoble +/src/csharp/** @jtattermusch @apolcyn @a11r @nicolasnoble @ctiller +/src/node/** @murgatroid99 @a11r @nicolasnoble @ctiller +/src/objective-c/** @muxi @makdharma @a11r @nicolasnoble @ctiller +/src/php/** @stanley-cheung @murgatroid99 @a11r @nicolasnoble @ctiller +/src/python/** @nathanielmanistaatgoogle @kpayson64 @a11r @nicolasnoble @ctiller +/src/ruby/** @apolcyn @murgatroid99 @a11r @nicolasnoble @ctiller +/test/build/** @ctiller @markdroth @dgquintas @a11r @nicolasnoble +/test/core/** @ctiller @markdroth @dgquintas @a11r @nicolasnoble +/test/cpp/** @ctiller @markdroth @dgquintas @a11r @nicolasnoble +/tools/** @matt-kwong @jtattermusch @nicolasnoble @a11r @ctiller +/tools/codegen/core/** @ctiller @dgquintas @markdroth +/tools/dockerfile/** @matt-kwong @jtattermusch @nicolasnoble @a11r @ctiller +/tools/run_tests/** @matt-kwong @jtattermusch @nicolasnoble @a11r @ctiller diff --git a/tools/mkowners/mkowners.py b/tools/mkowners/mkowners.py index d4a3b56a858..18afe3a2f03 100755 --- a/tools/mkowners/mkowners.py +++ b/tools/mkowners/mkowners.py @@ -123,6 +123,9 @@ owners_data = new_owners_data # a CODEOWNERS file for GitHub # +def full_dir(rules_dir, sub_path): + return os.path.join(rules_dir, sub_path) if rules_dir != '.' else sub_path + def glob_intersect(g1, g2): if not g2: return all(c == '*' for c in g1) @@ -136,17 +139,18 @@ def glob_intersect(g1, g2): return glob_intersect(t1, g2) or glob_intersect(g1, t2) return c1 == c2 and glob_intersect(t1, t2) -def add_parent_to_globs(parent, globs): +def add_parent_to_globs(parent, globs, globs_dir): if not parent: return for owners in owners_data: if owners.dir == parent: for directive in owners.directives: for dglob in directive.globs or ['**']: for gglob, glob in globs.items(): - if glob_intersect(dglob, gglob): + if glob_intersect(full_dir(globs_dir, gglob), + full_dir(owners.dir, dglob)): if directive.who not in glob: glob.append(directive.who) - add_parent_to_globs(owners.parent, globs) + add_parent_to_globs(owners.parent, globs, globs_dir) return assert(False) @@ -167,9 +171,8 @@ with open(args.out, 'w') as out: if glob not in globs: globs[glob] = [] globs[glob].append(directive.who) - add_parent_to_globs(head.parent, globs) + add_parent_to_globs(head.parent, globs, head.dir) for glob, owners in globs.items(): - out.write('%s %s\n' % ( - os.path.join(head.dir, glob) if head.dir != '.' else glob, - ' '.join(owners))) + out.write('/%s %s\n' % ( + full_dir(head.dir, glob), ' '.join(owners))) done.add(head.dir) From 68ce2564fd593b30e34decd103b49232a5e23ef8 Mon Sep 17 00:00:00 2001 From: "Nicolas \"Pixel\" Noble" Date: Thu, 13 Jul 2017 22:45:33 +0200 Subject: [PATCH 41/42] Sanitizing repo. --- test/cpp/qps/qps_openloop_test.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/cpp/qps/qps_openloop_test.cc b/test/cpp/qps/qps_openloop_test.cc index b2503dabe24..2f8a3d75f0c 100644 --- a/test/cpp/qps/qps_openloop_test.cc +++ b/test/cpp/qps/qps_openloop_test.cc @@ -20,10 +20,10 @@ #include +#include "test/core/util/test_config.h" #include "test/cpp/qps/benchmark_config.h" #include "test/cpp/qps/driver.h" #include "test/cpp/qps/report.h" -#include "test/core/util/test_config.h" #include "test/cpp/util/test_config.h" namespace grpc { From b5984601b83f916810fe34e476659f472a84f3e5 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Thu, 13 Jul 2017 13:58:06 -0700 Subject: [PATCH 42/42] Add myself as owner of files in several directories --- .github/CODEOWNERS | 11 +++++++++++ OWNERS | 1 + examples/node/OWNERS | 1 + src/core/lib/iomgr/OWNERS | 1 + test/distrib/node/OWNERS | 1 + tools/run_tests/artifacts/OWNERS | 1 + tools/run_tests/helper_scripts/OWNERS | 1 + 7 files changed, 17 insertions(+) create mode 100644 examples/node/OWNERS create mode 100644 src/core/lib/iomgr/OWNERS create mode 100644 test/distrib/node/OWNERS create mode 100644 tools/run_tests/artifacts/OWNERS create mode 100644 tools/run_tests/helper_scripts/OWNERS diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index de5dace21d8..953e0a4aade 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -2,13 +2,21 @@ # Uses OWNERS files in different modules throughout the # repository as the source of truth for module ownership. /** @a11r @nicolasnoble @ctiller +/binding.gyp @murgatroid99 +/Gemfile @murgatroid99 +/grpc.gemspec @murgatroid99 +/package.json @murgatroid99 +/Rakefile @murgatroid99 /bazel/** @nicolasnoble @dgquintas @ctiller /cmake/** @jtattermusch @a11r @nicolasnoble @ctiller /doc/PROTOCOL-HTTP2.md @ejona86 @a11r @nicolasnoble @ctiller /doc/interop-test-descriptions.md @ejona86 @a11r @nicolasnoble @ctiller /etc/** @jboeuf @nicolasnoble @a11r @ctiller +/examples/node/** @murgatroid99 @a11r @nicolasnoble @ctiller /include/** @ctiller @markdroth @dgquintas @a11r @nicolasnoble /src/core/** @ctiller @markdroth @dgquintas @a11r @nicolasnoble +/src/core/lib/iomgr/*_uv.c @murgatroid99 @ctiller @markdroth @dgquintas @a11r @nicolasnoble +/src/core/lib/iomgr/*_uv.h @murgatroid99 @ctiller @markdroth @dgquintas @a11r @nicolasnoble /src/cpp/** @ctiller @markdroth @dgquintas @a11r @nicolasnoble /src/csharp/** @jtattermusch @apolcyn @a11r @nicolasnoble @ctiller /src/node/** @murgatroid99 @a11r @nicolasnoble @ctiller @@ -19,7 +27,10 @@ /test/build/** @ctiller @markdroth @dgquintas @a11r @nicolasnoble /test/core/** @ctiller @markdroth @dgquintas @a11r @nicolasnoble /test/cpp/** @ctiller @markdroth @dgquintas @a11r @nicolasnoble +/test/distrib/node/** @murgatroid99 @a11r @nicolasnoble @ctiller /tools/** @matt-kwong @jtattermusch @nicolasnoble @a11r @ctiller /tools/codegen/core/** @ctiller @dgquintas @markdroth /tools/dockerfile/** @matt-kwong @jtattermusch @nicolasnoble @a11r @ctiller /tools/run_tests/** @matt-kwong @jtattermusch @nicolasnoble @a11r @ctiller +/tools/run_tests/artifacts/*_node* @murgatroid99 @matt-kwong @jtattermusch @nicolasnoble @a11r @ctiller +/tools/run_tests/helper_scripts/*_node* @murgatroid99 @matt-kwong @jtattermusch @nicolasnoble @a11r @ctiller diff --git a/OWNERS b/OWNERS index 78fc2513b10..87958a45669 100644 --- a/OWNERS +++ b/OWNERS @@ -4,3 +4,4 @@ @nicolasnoble @ctiller +@murgatroid99 binding.gyp Gemfile grpc.gemspec package.json Rakefile diff --git a/examples/node/OWNERS b/examples/node/OWNERS new file mode 100644 index 00000000000..567d1b6691c --- /dev/null +++ b/examples/node/OWNERS @@ -0,0 +1 @@ +@murgatroid99 diff --git a/src/core/lib/iomgr/OWNERS b/src/core/lib/iomgr/OWNERS new file mode 100644 index 00000000000..8ee86c26182 --- /dev/null +++ b/src/core/lib/iomgr/OWNERS @@ -0,0 +1 @@ +@murgatroid99 *_uv.c *_uv.h diff --git a/test/distrib/node/OWNERS b/test/distrib/node/OWNERS new file mode 100644 index 00000000000..567d1b6691c --- /dev/null +++ b/test/distrib/node/OWNERS @@ -0,0 +1 @@ +@murgatroid99 diff --git a/tools/run_tests/artifacts/OWNERS b/tools/run_tests/artifacts/OWNERS new file mode 100644 index 00000000000..490031985ee --- /dev/null +++ b/tools/run_tests/artifacts/OWNERS @@ -0,0 +1 @@ +@murgatroid99 *_node* diff --git a/tools/run_tests/helper_scripts/OWNERS b/tools/run_tests/helper_scripts/OWNERS new file mode 100644 index 00000000000..490031985ee --- /dev/null +++ b/tools/run_tests/helper_scripts/OWNERS @@ -0,0 +1 @@ +@murgatroid99 *_node*