diff options
152 files changed, 1291 insertions, 518 deletions
diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000000..73c3609aa0 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,37 @@ +# 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 +/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 +/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 +/test/cpp/qps/** @vjpai @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 @@ -40,9 +40,154 @@ core_version = "4.0.0-dev" version = "1.5.0-dev" +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_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_SECURE_PUBLIC_HDRS = [ + "include/grpc/grpc_security.h", +] + +# 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 = "gpr", language = "c", + public_hdrs = GPR_PUBLIC_HDRS, standalone = True, deps = [ "gpr_base", @@ -57,6 +202,7 @@ grpc_cc_library( "src/core/plugin_registry/grpc_unsecure_plugin_registry.c", ], language = "c", + public_hdrs = GRPC_PUBLIC_HDRS, standalone = True, deps = [ "grpc_common", @@ -70,6 +216,7 @@ grpc_cc_library( "src/core/plugin_registry/grpc_plugin_registry.c", ], language = "c", + public_hdrs = GRPC_PUBLIC_HDRS + GRPC_SECURE_PUBLIC_HDRS, standalone = True, deps = [ "grpc_common", @@ -114,6 +261,7 @@ grpc_cc_library( "src/cpp/server/secure_server_credentials.h", ], language = "c++", + public_hdrs = GRPCXX_PUBLIC_HDRS, standalone = True, deps = [ "gpr", @@ -379,34 +527,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", ], @@ -434,6 +555,7 @@ grpc_cc_library( name = "grpc_trace", srcs = ["src/core/lib/debug/trace.c"], hdrs = ["src/core/lib/debug/trace.h"], + language = "c", deps = [":gpr"], ) @@ -679,19 +801,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", @@ -712,6 +822,7 @@ grpc_cc_library( grpc_cc_library( name = "grpc_common", + language = "c", deps = [ "grpc_base", # standard plugins @@ -1083,9 +1194,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", @@ -1299,103 +1408,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, diff --git a/CMakeLists.txt b/CMakeLists.txt index b535d7f546..3dd8ec4503 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} ) @@ -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/OWNERS b/OWNERS new file mode 100644 index 0000000000..87958a4566 --- /dev/null +++ b/OWNERS @@ -0,0 +1,7 @@ +# Top level ownership + +@a11r +@nicolasnoble +@ctiller + +@murgatroid99 binding.gyp Gemfile grpc.gemspec package.json Rakefile diff --git a/bazel/OWNERS b/bazel/OWNERS new file mode 100644 index 0000000000..8fc7502a91 --- /dev/null +++ b/bazel/OWNERS @@ -0,0 +1,5 @@ +set noparent +@nicolasnoble +@dgquintas +@ctiller + diff --git a/bazel/cc_grpc_library.bzl b/bazel/cc_grpc_library.bzl index 0600bb9e30..afc5543795 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 d05509fc15..7fffb58218 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 8c29611a22..8057f27a12 100644 --- a/bazel/grpc_build_system.bzl +++ b/bazel/grpc_build_system.bzl @@ -52,7 +52,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, @@ -95,11 +95,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/build.yaml b/build.yaml index e55c4ca301..8a2fbe1907 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/cmake/OWNERS b/cmake/OWNERS new file mode 100644 index 0000000000..c0ae0533b3 --- /dev/null +++ b/cmake/OWNERS @@ -0,0 +1,2 @@ +@jtattermusch + diff --git a/doc/OWNERS b/doc/OWNERS new file mode 100644 index 0000000000..f05861799e --- /dev/null +++ b/doc/OWNERS @@ -0,0 +1,2 @@ +@ejona86 PROTOCOL-HTTP2.md interop-test-descriptions.md + diff --git a/doc/environment_variables.md b/doc/environment_variables.md index 339b705252..a283a5ab00 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 @@ -83,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 diff --git a/etc/OWNERS b/etc/OWNERS new file mode 100644 index 0000000000..2dfd7cd61e --- /dev/null +++ b/etc/OWNERS @@ -0,0 +1,2 @@ +@jboeuf +@nicolasnoble diff --git a/examples/BUILD b/examples/BUILD index f38c1d9bd9..3e9e508ec2 100644 --- a/examples/BUILD +++ b/examples/BUILD @@ -12,6 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. +licenses(["notice"]) # 3-clause BSD + package(default_visibility = ["//visibility:public"]) load("//bazel:grpc_build_system.bzl", "grpc_proto_library") diff --git a/examples/node/OWNERS b/examples/node/OWNERS new file mode 100644 index 0000000000..567d1b6691 --- /dev/null +++ b/examples/node/OWNERS @@ -0,0 +1 @@ +@murgatroid99 diff --git a/include/OWNERS b/include/OWNERS new file mode 100644 index 0000000000..8dca75ce91 --- /dev/null +++ b/include/OWNERS @@ -0,0 +1,4 @@ +@ctiller +@markdroth +@dgquintas + diff --git a/include/grpc++/impl/codegen/config_protobuf.h b/include/grpc++/impl/codegen/config_protobuf.h index 7387fa25c6..c5e5bdf0db 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 <google/protobuf/stubs/common.h> #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 fcb4453d83..67e8f71a89 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 <class BufferWriter, class T> -Status GenericSerialize(const grpc::protobuf::Message& msg, - grpc_byte_buffer** bp, bool* own_buffer) { - static_assert( - std::is_base_of<protobuf::io::ZeroCopyOutputStream, BufferWriter>::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 <class BufferReader, class T> -Status GenericDeserialize(grpc_byte_buffer* buffer, - grpc::protobuf::Message* msg) { - static_assert( - std::is_base_of<protobuf::io::ZeroCopyInputStream, BufferReader>::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 T> class SerializationTraits<T, typename std::enable_if<std::is_base_of< grpc::protobuf::Message, T>::value>::type> { public: static Status Serialize(const grpc::protobuf::Message& msg, grpc_byte_buffer** bp, bool* own_buffer) { - return internal::GenericSerialize<internal::GrpcBufferWriter, T>( - 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<internal::GrpcBufferReader, T>(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 diff --git a/include/grpc++/impl/codegen/status.h b/include/grpc++/impl/codegen/status.h index 51fca9fc9f..6f013cf0ca 100644 --- a/include/grpc++/impl/codegen/status.h +++ b/include/grpc++/impl/codegen/status.h @@ -63,6 +63,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/OWNERS b/src/core/OWNERS new file mode 100644 index 0000000000..8dca75ce91 --- /dev/null +++ b/src/core/OWNERS @@ -0,0 +1,4 @@ +@ctiller +@markdroth +@dgquintas + diff --git a/src/core/ext/filters/client_channel/client_channel.c b/src/core/ext/filters/client_channel/client_channel.c index 7add432589..58e31d7b45 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); +grpc_tracer_flag grpc_client_channel_trace = + GRPC_TRACER_INITIALIZER(false, "client_channel"); /************************************************************************* * METHOD-CONFIG TABLE @@ -370,6 +371,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 +426,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 +572,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); 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 6f133a648b..c32e83d012 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 8d69ba6af5..10b032214b 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); +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 5a5ff2902d..cccc3e871a 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 d0acd7a901..fd0fb41fb9 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); +grpc_tracer_flag grpc_lb_pick_first_trace = + GRPC_TRACER_INITIALIZER(false, "pick_first"); typedef struct pending_pick { struct pending_pick *next; @@ -707,7 +708,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 fbef79ec31..37580087a7 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); +grpc_tracer_flag grpc_lb_round_robin_trace = + GRPC_TRACER_INITIALIZER(false, "round_robin"); /** List of entities waiting for a pick. * @@ -868,7 +869,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 de9a8ce41b..8401504fcf 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); +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 3e4ec01a31..a5c1b92054 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 6a8c81445a..78551df9c3 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 f790267944..0859ce8942 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c @@ -74,11 +74,12 @@ 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 106666410a..0f8e33c4be 100644 --- a/src/core/lib/channel/channel_stack.c +++ b/src/core/lib/channel/channel_stack.c @@ -23,7 +23,7 @@ #include <stdlib.h> #include <string.h> -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 01529df80a..c369e33073 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/support/string_util.h> 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 8249b2ebd6..c6c1853e20 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); @@ -93,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) { @@ -115,10 +121,18 @@ 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 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) { - 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 7cc9fb4e41..dd9e6a30fe 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 71d697c278..9c5e93f4e5 100644 --- a/src/core/lib/http/parser.c +++ b/src/core/lib/http/parser.c @@ -25,7 +25,7 @@ #include <grpc/support/log.h> #include <grpc/support/useful.h> -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/OWNERS b/src/core/lib/iomgr/OWNERS new file mode 100644 index 0000000000..8ee86c2618 --- /dev/null +++ b/src/core/lib/iomgr/OWNERS @@ -0,0 +1 @@ +@murgatroid99 *_uv.c *_uv.h diff --git a/src/core/lib/iomgr/closure.c b/src/core/lib/iomgr/closure.c index e028e72ed6..26f9cbe0fa 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 7f9c5d837f..c72c37e2b5 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); +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 a95929a1fb..3759dda992 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); +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 2648df393d..a5ae04cb5b 100644 --- a/src/core/lib/iomgr/ev_posix.c +++ b/src/core/lib/iomgr/ev_posix.c @@ -39,10 +39,11 @@ #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 +125,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 027609c7e8..c24dfaeaf7 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 43f5d0406e..f5875a247e 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 49d1a03c32..8b1245c640 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 1a54065a91..946f0c8c60 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); +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 1bfc2a22a8..ea017a6054 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); +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 f2cc1be74e..a31d9eef93 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); +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 5de2b0f4ee..b6dcd15cb0 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 ff5fd3edc8..7c6a9b85f5 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 6704a158ce..2cbb97403b 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 e6a9eb0e86..12efce241f 100644 --- a/src/core/lib/iomgr/timer_generic.c +++ b/src/core/lib/iomgr/timer_generic.c @@ -41,8 +41,9 @@ #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 +161,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_manager.c b/src/core/lib/iomgr/timer_manager.c index cb7998db97..b9bea9a2ab 100644 --- a/src/core/lib/iomgr/timer_manager.c +++ b/src/core/lib/iomgr/timer_manager.c @@ -56,7 +56,7 @@ static gpr_timespec g_timed_waiter_deadline; // generation counter to track which thread is waiting for the next timer static uint64_t g_timed_waiter_generation; -static void timer_thread(void *unused); +static void timer_thread(void *completed_thread_ptr); static void gc_completed_threads(void) { if (g_completed_threads != NULL) { @@ -81,10 +81,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() { @@ -245,7 +245,7 @@ static void timer_main_loop(grpc_exec_ctx *exec_ctx) { } } -static void timer_thread_cleanup(void) { +static void timer_thread_cleanup(completed_thread *ct) { gpr_mu_lock(&g_mu); // terminate the thread: drop the waiter count, thread count, and let whomever // stopped the threading stuff know that we're done @@ -254,8 +254,6 @@ static void timer_thread_cleanup(void) { if (0 == g_thread_count) { gpr_cv_signal(&g_cv_shutdown); } - completed_thread *ct = gpr_malloc(sizeof(*ct)); - ct->t = gpr_thd_currentid(); ct->next = g_completed_threads; g_completed_threads = ct; gpr_mu_unlock(&g_mu); @@ -264,14 +262,14 @@ static void timer_thread_cleanup(void) { } } -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 = GRPC_EXEC_CTX_INITIALIZER(0, grpc_never_ready_to_finish, NULL); timer_main_loop(&exec_ctx); grpc_exec_ctx_finish(&exec_ctx); - timer_thread_cleanup(); + timer_thread_cleanup(completed_thread_ptr); } static void start_threads(void) { diff --git a/src/core/lib/iomgr/timer_uv.c b/src/core/lib/iomgr/timer_uv.c index 4f204cfbf8..1ab82ef1d5 100644 --- a/src/core/lib/iomgr/timer_uv.c +++ b/src/core/lib/iomgr/timer_uv.c @@ -28,8 +28,9 @@ #include <uv.h> -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 dffe6d2e91..8fff2c92c5 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 f4ed81db1a..5e41b94ff8 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); +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 29327107e5..6788126769 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 f88ffd57aa..56973303da 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 aac443ed06..2365d27307 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); -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 14e55eda85..978d7b4171 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); +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 +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); -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 14a86bfa0a..db111e597f 100644 --- a/src/core/lib/surface/init.c +++ b/src/core/lib/surface/init.c @@ -120,29 +120,27 @@ 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_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_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_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_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_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 7dbea581d0..2366c24910 100644 --- a/src/core/lib/surface/init_secure.c +++ b/src/core/lib/surface/init_secure.c @@ -37,13 +37,11 @@ #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_trace_auth_context_refcount); - grpc_register_tracer("security_connector_refcount", - &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 de0a91e2b2..fce7f8dca1 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); +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 d33e3a48ab..311ae6390d 100644 --- a/src/core/lib/transport/bdp_estimator.c +++ b/src/core/lib/transport/bdp_estimator.c @@ -23,7 +23,8 @@ #include <grpc/support/log.h> #include <grpc/support/useful.h> -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 6fe40af3b2..73a9178ae2 100644 --- a/src/core/lib/transport/connectivity_state.c +++ b/src/core/lib/transport/connectivity_state.c @@ -24,7 +24,8 @@ #include <grpc/support/log.h> #include <grpc/support/string_util.h> -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 87a2abf344..2fea366072 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); +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 6a9eba110d..7281602d66 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); +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 08fa43138d..be11d64472 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. --- */ diff --git a/src/cpp/OWNERS b/src/cpp/OWNERS new file mode 100644 index 0000000000..8dca75ce91 --- /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 0000000000..bde3ed985c --- /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 0000000000..3a49353d84 --- /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 0000000000..2bc91186e7 --- /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 0000000000..7065b41132 --- /dev/null +++ b/src/php/OWNERS @@ -0,0 +1,3 @@ +@stanley-cheung +@murgatroid99 + diff --git a/src/proto/grpc/health/v1/BUILD b/src/proto/grpc/health/v1/BUILD index db04f3798d..6f6779594b 100644 --- a/src/proto/grpc/health/v1/BUILD +++ b/src/proto/grpc/health/v1/BUILD @@ -14,7 +14,13 @@ licenses(["notice"]) # Apache v2 -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 7fbfdfec72..61b28ee3bb 100644 --- a/src/proto/grpc/lb/v1/BUILD +++ b/src/proto/grpc/lb/v1/BUILD @@ -14,7 +14,13 @@ licenses(["notice"]) # Apache v2 -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 0d9df4fb47..b60784e9d9 100644 --- a/src/proto/grpc/reflection/v1alpha/BUILD +++ b/src/proto/grpc/reflection/v1alpha/BUILD @@ -14,7 +14,13 @@ licenses(["notice"]) # Apache v2 -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 10c162d3b2..61688e5f96 100644 --- a/src/proto/grpc/status/BUILD +++ b/src/proto/grpc/status/BUILD @@ -14,7 +14,13 @@ licenses(["notice"]) # Apache v2 -package(default_visibility = ["//visibility:public"]) +package( + default_visibility = ["//visibility:public"], + features = [ + "-layering_check", + "-parse_headers", + ], +) load("//bazel:grpc_build_system.bzl", "grpc_proto_library") @@ -22,5 +28,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/src/proto/grpc/testing/BUILD b/src/proto/grpc/testing/BUILD index 0c27297ad1..c8e7d03cb0 100644 --- a/src/proto/grpc/testing/BUILD +++ b/src/proto/grpc/testing/BUILD @@ -14,7 +14,13 @@ licenses(["notice"]) # Apache v2 -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 dd715d8da0..8f91710999 100644 --- a/src/proto/grpc/testing/duplicate/BUILD +++ b/src/proto/grpc/testing/duplicate/BUILD @@ -14,7 +14,13 @@ licenses(["notice"]) # Apache v2 -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/python/OWNERS b/src/python/OWNERS new file mode 100644 index 0000000000..73a707c67d --- /dev/null +++ b/src/python/OWNERS @@ -0,0 +1,3 @@ +@nathanielmanistaatgoogle +@kpayson64 + diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/security.pyx.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/security.pyx.pxi index 929aaa153c..7decae95bb 100644 --- a/src/python/grpcio/grpc/_cython/_cygrpc/security.pyx.pxi +++ b/src/python/grpcio/grpc/_cython/_cygrpc/security.pyx.pxi @@ -34,7 +34,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: @@ -52,7 +52,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 @@ -67,7 +67,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: diff --git a/src/ruby/OWNERS b/src/ruby/OWNERS new file mode 100644 index 0000000000..b01fd8061e --- /dev/null +++ b/src/ruby/OWNERS @@ -0,0 +1,3 @@ +@apolcyn +@murgatroid99 + diff --git a/src/ruby/lib/grpc/generic/active_call.rb b/src/ruby/lib/grpc/generic/active_call.rb index cb407d236d..67c984ab49 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, diff --git a/test/build/OWNERS b/test/build/OWNERS new file mode 100644 index 0000000000..8dca75ce91 --- /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 0000000000..8dca75ce91 --- /dev/null +++ b/test/core/OWNERS @@ -0,0 +1,4 @@ +@ctiller +@markdroth +@dgquintas + diff --git a/test/core/bad_client/BUILD b/test/core/bad_client/BUILD index c23c046061..8cc9dfa77a 100644 --- a/test/core/bad_client/BUILD +++ b/test/core/bad_client/BUILD @@ -14,6 +14,13 @@ load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary") +package( + features = [ + "-layering_check", + "-parse_headers", + ], +) + licenses(["notice"]) # Apache v2 load(":generate_tests.bzl", "grpc_bad_client_tests") diff --git a/test/core/bad_ssl/BUILD b/test/core/bad_ssl/BUILD index cb285d02cb..e13d43258a 100644 --- a/test/core/bad_ssl/BUILD +++ b/test/core/bad_ssl/BUILD @@ -14,6 +14,13 @@ load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary") +package( + features = [ + "-layering_check", + "-parse_headers", + ], +) + licenses(["notice"]) # Apache v2 load(":generate_tests.bzl", "grpc_bad_ssl_tests") diff --git a/test/core/census/BUILD b/test/core/census/BUILD index 5de149a99b..988d9a813a 100644 --- a/test/core/census/BUILD +++ b/test/core/census/BUILD @@ -16,6 +16,13 @@ load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_c licenses(["notice"]) # Apache v2 +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 da2389a1d1..18dd112eb7 100644 --- a/test/core/channel/BUILD +++ b/test/core/channel/BUILD @@ -16,6 +16,13 @@ load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_c licenses(["notice"]) # Apache v2 +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 41ba792b8c..7fc5b977a9 100644 --- a/test/core/client_channel/BUILD +++ b/test/core/client_channel/BUILD @@ -16,6 +16,13 @@ load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_c licenses(["notice"]) # Apache v2 +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 59826aea28..8af4a2d5f0 100644 --- a/test/core/client_channel/resolvers/BUILD +++ b/test/core/client_channel/resolvers/BUILD @@ -16,6 +16,13 @@ load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_c licenses(["notice"]) # Apache v2 +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 a4fefc5c12..e4432b3b9d 100644 --- a/test/core/compression/BUILD +++ b/test/core/compression/BUILD @@ -16,6 +16,13 @@ load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_c licenses(["notice"]) # Apache v2 +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 e27303ce8c..9e788bf7e5 100644 --- a/test/core/end2end/BUILD +++ b/test/core/end2end/BUILD @@ -16,6 +16,13 @@ load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_c licenses(["notice"]) # Apache v2 +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 a9583d6eb4..bf3a62ad37 100644 --- a/test/core/end2end/fuzzers/BUILD +++ b/test/core/end2end/fuzzers/BUILD @@ -16,6 +16,13 @@ load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_c licenses(["notice"]) # Apache v2 +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 39e132fd79..b0d34e9eb0 100644 --- a/test/core/fling/BUILD +++ b/test/core/fling/BUILD @@ -16,6 +16,13 @@ load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_c licenses(["notice"]) # Apache v2 +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 1c1a8f634e..c93ddc8c21 100644 --- a/test/core/handshake/BUILD +++ b/test/core/handshake/BUILD @@ -16,6 +16,13 @@ load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_c licenses(["notice"]) # Apache v2 +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 85f1c181ec..28313082c6 100644 --- a/test/core/http/BUILD +++ b/test/core/http/BUILD @@ -16,6 +16,13 @@ load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_c licenses(["notice"]) # Apache v2 +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 806c647262..3e6fd37ec6 100644 --- a/test/core/iomgr/BUILD +++ b/test/core/iomgr/BUILD @@ -18,7 +18,13 @@ licenses(["notice"]) # Apache v2 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 764d9bfbc1..36b0897d80 100644 --- a/test/core/json/BUILD +++ b/test/core/json/BUILD @@ -16,6 +16,13 @@ load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_c licenses(["notice"]) # Apache v2 +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 d602a7dae3..bdb468867d 100644 --- a/test/core/nanopb/BUILD +++ b/test/core/nanopb/BUILD @@ -16,6 +16,13 @@ load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_c licenses(["notice"]) # Apache v2 +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 daef680f62..cee23ecd51 100644 --- a/test/core/network_benchmarks/BUILD +++ b/test/core/network_benchmarks/BUILD @@ -16,6 +16,13 @@ load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_c licenses(["notice"]) # Apache v2 +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 96127e1cd0..241ffc0591 100644 --- a/test/core/security/BUILD +++ b/test/core/security/BUILD @@ -16,6 +16,13 @@ load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_c licenses(["notice"]) # Apache v2 +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 d8473b792f..9f2225adfb 100644 --- a/test/core/slice/BUILD +++ b/test/core/slice/BUILD @@ -16,6 +16,13 @@ load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_c licenses(["notice"]) # Apache v2 +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 37870d922d..7e142c1e3f 100644 --- a/test/core/support/BUILD +++ b/test/core/support/BUILD @@ -16,6 +16,13 @@ load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_c licenses(["notice"]) # Apache v2 +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 ad0f3e2b2a..2923927412 100644 --- a/test/core/surface/BUILD +++ b/test/core/surface/BUILD @@ -16,6 +16,13 @@ load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_c licenses(["notice"]) # Apache v2 +package( + features = [ + "-layering_check", + "-parse_headers", + ], +) + grpc_cc_test( name = "alarm_test", srcs = ["alarm_test.c"], diff --git a/test/core/surface/init_test.c b/test/core/surface/init_test.c index 47900c51d7..a9e80575af 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; } diff --git a/test/core/transport/BUILD b/test/core/transport/BUILD index f8a99251be..8091cf9c63 100644 --- a/test/core/transport/BUILD +++ b/test/core/transport/BUILD @@ -16,6 +16,13 @@ load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_c licenses(["notice"]) # Apache v2 +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 587e0ae4b3..e3989f7059 100644 --- a/test/core/transport/chttp2/BUILD +++ b/test/core/transport/chttp2/BUILD @@ -16,6 +16,13 @@ load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_c licenses(["notice"]) # Apache v2 +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 c9e75d0d17..3bbc50b27e 100644 --- a/test/core/tsi/BUILD +++ b/test/core/tsi/BUILD @@ -16,6 +16,13 @@ load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_c licenses(["notice"]) # Apache v2 +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 bc3640dda5..9d899bc7be 100644 --- a/test/core/util/BUILD +++ b/test/core/util/BUILD @@ -16,7 +16,13 @@ load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_c licenses(["notice"]) # Apache v2 -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/OWNERS b/test/cpp/OWNERS new file mode 100644 index 0000000000..8dca75ce91 --- /dev/null +++ b/test/cpp/OWNERS @@ -0,0 +1,4 @@ +@ctiller +@markdroth +@dgquintas + diff --git a/test/cpp/codegen/BUILD b/test/cpp/codegen/BUILD index 984440e455..4780800645 100644 --- a/test/cpp/codegen/BUILD +++ b/test/cpp/codegen/BUILD @@ -16,6 +16,13 @@ licenses(["notice"]) # Apache v2 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 ae287a4c93..bd1173322a 100644 --- a/test/cpp/common/BUILD +++ b/test/cpp/common/BUILD @@ -16,6 +16,13 @@ licenses(["notice"]) # Apache v2 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 ac742c2921..27c5492c17 100644 --- a/test/cpp/end2end/BUILD +++ b/test/cpp/end2end/BUILD @@ -16,10 +16,17 @@ licenses(["notice"]) # Apache v2 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", + testonly = True, srcs = ["test_service_impl.cc"], hdrs = ["test_service_impl.h"], deps = [ diff --git a/test/cpp/end2end/grpclb_end2end_test.cc b/test/cpp/end2end/grpclb_end2end_test.cc index 4f839f7788..a8ac631fbd 100644 --- a/test/cpp/end2end/grpclb_end2end_test.cc +++ b/test/cpp/end2end/grpclb_end2end_test.cc @@ -32,7 +32,6 @@ #include <grpc/support/string_util.h> #include <grpc/support/thd.h> #include <grpc/support/time.h> -#include <gtest/gtest.h> extern "C" { #include "src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h" @@ -46,6 +45,8 @@ extern "C" { #include "src/proto/grpc/lb/v1/load_balancer.grpc.pb.h" #include "src/proto/grpc/testing/echo.grpc.pb.h" +#include <gtest/gtest.h> + // 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 diff --git a/test/cpp/end2end/mock_test.cc b/test/cpp/end2end/mock_test.cc index 8ca91363d8..0b63c25055 100644 --- a/test/cpp/end2end/mock_test.cc +++ b/test/cpp/end2end/mock_test.cc @@ -19,7 +19,6 @@ #include <climits> #include <thread> -#include <gmock/gmock.h> #include <grpc++/channel.h> #include <grpc++/client_context.h> #include <grpc++/create_channel.h> @@ -31,14 +30,15 @@ #include <grpc/support/thd.h> #include <grpc/support/time.h> -#include <grpc++/test/mock_stream.h> - #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 <grpc++/test/mock_stream.h> + +#include <gmock/gmock.h> #include <gtest/gtest.h> #include <iostream> diff --git a/test/cpp/interop/BUILD b/test/cpp/interop/BUILD index 93e01fee4b..0de5a6f4da 100644 --- a/test/cpp/interop/BUILD +++ b/test/cpp/interop/BUILD @@ -14,7 +14,16 @@ licenses(["notice"]) # Apache v2 -cc_library( +load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary") + +package( + features = [ + "-layering_check", + "-parse_headers", + ], +) + +grpc_cc_library( name = "server_helper_lib", srcs = [ "server_helper.cc", @@ -22,21 +31,35 @@ cc_library( hdrs = [ "server_helper.h", ], + external_deps = [ + "gflags", + ], + language = "C++", deps = [ "//test/cpp/util:test_util", - "//external:gflags", ], ) -cc_binary( +grpc_cc_binary( name = "interop_server", srcs = [ - "interop_server.cc", "interop_server_bootstrap.cc", ], + language = "C++", deps = [ - ":server_helper_lib", + ":interop_server_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", @@ -44,7 +67,7 @@ cc_binary( ], ) -cc_library( +grpc_cc_library( name = "client_helper_lib", srcs = [ "client_helper.cc", @@ -54,22 +77,64 @@ 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", ], ) -cc_binary( +grpc_cc_binary( name = "interop_client", srcs = [ "client.cc", ], deps = [ ":client_helper_lib", + "//: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 = [ + ":interop_server_lib", + "//:grpc++", + "//test/core/util:grpc_test_util", + ], +) + +grpc_cc_binary( + name = "stress_test", + srcs = [ + "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", ], ) diff --git a/test/cpp/microbenchmarks/BUILD b/test/cpp/microbenchmarks/BUILD index 10df1cb781..5e1bcee89f 100644 --- a/test/cpp/microbenchmarks/BUILD +++ b/test/cpp/microbenchmarks/BUILD @@ -16,6 +16,13 @@ licenses(["notice"]) # Apache v2 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 4d8b3b40e3..93fb53446c 100644 --- a/test/cpp/qps/BUILD +++ b/test/cpp/qps/BUILD @@ -16,6 +16,13 @@ licenses(["notice"]) # Apache v2 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"], @@ -52,9 +59,6 @@ grpc_cc_library( "//test/core/util:grpc_test_util", "//test/cpp/util:test_util", ], - external_deps = [ - "gtest", - ], ) grpc_cc_library( @@ -121,6 +125,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 +136,7 @@ grpc_cc_test( deps = [ ":histogram", ":interarrival", + "//test/cpp/util:test_config", ], ) @@ -141,6 +147,7 @@ grpc_cc_binary( ":benchmark_config", ":driver_impl", "//:grpc++", + "//test/cpp/util:test_config", ], external_deps = [ "gflags", @@ -154,6 +161,7 @@ grpc_cc_test( ":benchmark_config", ":driver_impl", ":qps_worker_impl", + "//test/cpp/util:test_config", ], ) @@ -164,6 +172,7 @@ grpc_cc_test( ":benchmark_config", ":driver_impl", "//:grpc++", + "//test/cpp/util:test_config", ], ) diff --git a/test/cpp/qps/OWNERS b/test/cpp/qps/OWNERS new file mode 100644 index 0000000000..8ccea9ad9b --- /dev/null +++ b/test/cpp/qps/OWNERS @@ -0,0 +1,2 @@ +@vjpai + diff --git a/test/cpp/qps/benchmark_config.cc b/test/cpp/qps/benchmark_config.cc index 8f53670324..fb1e0608c5 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<Reporter> 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 054dbb276e..d3d6910ff0 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 <memory> -#include <vector> #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/client_sync.cc b/test/cpp/qps/client_sync.cc index 6b934920df..5d212f1acc 100644 --- a/test/cpp/qps/client_sync.cc +++ b/test/cpp/qps/client_sync.cc @@ -140,7 +140,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 } }); diff --git a/test/cpp/qps/qps_interarrival_test.cc b/test/cpp/qps/qps_interarrival_test.cc index d19266ff9c..87f09e8c5f 100644 --- a/test/cpp/qps/qps_interarrival_test.cc +++ b/test/cpp/qps/qps_interarrival_test.cc @@ -23,6 +23,7 @@ #include <grpc/support/histogram.h> #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 590c22ec29..e1e5802d13 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 28dec4f8c6..2f8a3d75f0 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/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 { @@ -58,7 +59,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 6ab2102e40..0000000000 --- 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 <set> - -#include <grpc/support/log.h> - -#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 586392692e..1ee6e37474 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(); diff --git a/test/cpp/util/BUILD b/test/cpp/util/BUILD index 6db61abfda..33240f6f69 100644 --- a/test/cpp/util/BUILD +++ b/test/cpp/util/BUILD @@ -14,9 +14,15 @@ licenses(["notice"]) # Apache v2 -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"]) +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 @@ -126,19 +132,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", @@ -160,7 +168,9 @@ cc_binary( ], deps = [ "//:grpc++", - "//external:gflags", "//src/proto/grpc/reflection/v1alpha:reflection_proto", ], + external_deps = [ + "gflags", + ], ) diff --git a/test/distrib/node/OWNERS b/test/distrib/node/OWNERS new file mode 100644 index 0000000000..567d1b6691 --- /dev/null +++ b/test/distrib/node/OWNERS @@ -0,0 +1 @@ +@murgatroid99 diff --git a/tools/OWNERS b/tools/OWNERS new file mode 100644 index 0000000000..8f6de53674 --- /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 0000000000..17e66479b6 --- /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 0000000000..20ee8085c2 --- /dev/null +++ b/tools/dockerfile/OWNERS @@ -0,0 +1,3 @@ +@matt-kwong +@jtattermusch + 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 0000000000..ca547a0a4f --- /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 0000000000..62f05cef2e --- /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 0000000000..0a1afa2604 --- /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/internal_ci/linux/grpc_interop_tocloud.cfg b/tools/internal_ci/linux/grpc_interop_tocloud.cfg index 1f6421c83d..0c31b497af 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_tocloud.sh b/tools/internal_ci/linux/grpc_interop_tocloud.sh index fe5c9a5130..e3ba25af5d 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/internal_ci/linux/grpc_interop_toprod.cfg b/tools/internal_ci/linux/grpc_interop_toprod.cfg new file mode 100644 index 0000000000..18978b87e5 --- /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 100755 index 0000000000..3d06185406 --- /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/jenkins/run_bazel_full.sh b/tools/jenkins/run_bazel_full.sh index edde1bc545..3436a8f8b6 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/mkowners/mkowners.py b/tools/mkowners/mkowners.py new file mode 100755 index 0000000000..18afe3a2f0 --- /dev/null +++ b/tools/mkowners/mkowners.py @@ -0,0 +1,178 @@ +#!/usr/bin/env python3 +# 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. + +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 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) + 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, 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(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, globs_dir) + 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, head.dir) + for glob, owners in globs.items(): + out.write('/%s %s\n' % ( + full_dir(head.dir, glob), ' '.join(owners))) + done.add(head.dir) diff --git a/tools/run_tests/OWNERS b/tools/run_tests/OWNERS new file mode 100644 index 0000000000..8f6de53674 --- /dev/null +++ b/tools/run_tests/OWNERS @@ -0,0 +1,4 @@ +@matt-kwong +@jtattermusch +@nicolasnoble + diff --git a/tools/run_tests/artifacts/OWNERS b/tools/run_tests/artifacts/OWNERS new file mode 100644 index 0000000000..490031985e --- /dev/null +++ b/tools/run_tests/artifacts/OWNERS @@ -0,0 +1 @@ +@murgatroid99 *_node* diff --git a/tools/run_tests/artifacts/artifact_targets.py b/tools/run_tests/artifacts/artifact_targets.py index 9373db2948..841bbdf912 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: diff --git a/tools/run_tests/dockerize/build_interop_image.sh b/tools/run_tests/dockerize/build_interop_image.sh index fa631851b1..77c7a84828 100755 --- a/tools/run_tests/dockerize/build_interop_image.sh +++ b/tools/run_tests/dockerize/build_interop_image.sh @@ -62,13 +62,19 @@ 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 -# 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 diff --git a/tools/run_tests/generated/sources_and_headers.json b/tools/run_tests/generated/sources_and_headers.json index 477a258daa..02562bfae4 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" diff --git a/tools/run_tests/helper_scripts/OWNERS b/tools/run_tests/helper_scripts/OWNERS new file mode 100644 index 0000000000..490031985e --- /dev/null +++ b/tools/run_tests/helper_scripts/OWNERS @@ -0,0 +1 @@ +@murgatroid99 *_node* 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 1daf6ee595..0000000000 --- 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) diff --git a/tools/run_tests/run_interop_tests.py b/tools/run_tests/run_interop_tests.py index 80062aa37d..1e702a8636 100755 --- a/tools/run_tests/run_interop_tests.py +++ b/tools/run_tests/run_interop_tests.py @@ -63,6 +63,13 @@ _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_XML_REPORT = 'sponge_log.xml' + +# report suffix is important for reports to get picked up by internal CI +_XML_REPORT = 'report.xml' + + class CXXLanguage: def __init__(self): @@ -943,7 +950,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 +1213,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 = _XML_REPORT + if args.internal_ci: + xml_report_name = _INTERNAL_CL_XML_REPORT + report_utils.render_junit_xml_report(resultset, xml_report_name) for name, job in resultset.items(): if "http2" in name: diff --git a/tools/run_tests/run_tests_matrix.py b/tools/run_tests/run_tests_matrix.py index 635d87f476..6fe1609f1c 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) diff --git a/tools/run_tests/sanity/check_owners.sh b/tools/run_tests/sanity/check_owners.sh new file mode 100755 index 0000000000..b681fed1bb --- /dev/null +++ b/tools/run_tests/sanity/check_owners.sh @@ -0,0 +1,29 @@ +#!/bin/sh +# 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 -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 445f53e555..65cb2fe6a7 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 |