Merge github.com:grpc/grpc into thread_pool

reviewable/pr11119/r1
Craig Tiller 8 years ago
commit 321b7d8fb0
  1. 383
      BUILD
  2. 79
      CMakeLists.txt
  3. 69
      Makefile
  4. 4
      WORKSPACE
  5. 66
      bazel/grpc_build_system.bzl
  6. 2
      binding.gyp
  7. 23
      build.yaml
  8. 3
      config.m4
  9. 175
      doc/unit_testing.md
  10. 4
      examples/BUILD
  11. 9
      gRPC-Core.podspec
  12. 5
      grpc.gemspec
  13. 2
      include/grpc++/server_builder.h
  14. 5
      include/grpc/impl/codegen/grpc_types.h
  15. 46
      include/grpc/support/workaround_list.h
  16. 5
      package.xml
  17. 7
      src/compiler/config.h
  18. 15
      src/compiler/cpp_generator.cc
  19. 223
      src/core/ext/filters/workarounds/workaround_cronet_compression_filter.c
  20. 40
      src/core/ext/filters/workarounds/workaround_cronet_compression_filter.h
  21. 65
      src/core/ext/filters/workarounds/workaround_utils.c
  22. 52
      src/core/ext/filters/workarounds/workaround_utils.h
  23. 2
      src/core/lib/channel/channel_args.c
  24. 2
      src/core/lib/iomgr/error.c
  25. 25
      src/core/lib/support/mpscq.c
  26. 27
      src/core/lib/support/mpscq.h
  27. 687
      src/core/lib/surface/completion_queue.c
  28. 12
      src/core/lib/surface/completion_queue.h
  29. 112
      src/core/lib/surface/server.c
  30. 4
      src/core/plugin_registry/grpc_plugin_registry.c
  31. 4
      src/core/plugin_registry/grpc_unsecure_plugin_registry.c
  32. 1
      src/cpp/server/server_cc.cc
  33. 12
      src/csharp/Grpc.Core/Grpc.Core.csproj
  34. 24
      src/csharp/Grpc.Tools.nuspec
  35. 21
      src/csharp/build_packages_dotnetcli.bat
  36. 28
      src/csharp/build_packages_dotnetcli.sh
  37. 10
      src/proto/grpc/testing/BUILD
  38. 4
      src/proto/grpc/testing/control.proto
  39. 6
      src/proto/grpc/testing/stats.proto
  40. 2
      src/python/grpcio/grpc_core_dependencies.py
  41. 3
      src/python/grpcio_tests/setup.py
  42. 38
      src/python/grpcio_tests/tests/interop/client.py
  43. 27
      src/python/grpcio_tests/tests/interop/methods.py
  44. 21
      templates/src/csharp/build_packages_dotnetcli.bat.template
  45. 28
      templates/src/csharp/build_packages_dotnetcli.sh.template
  46. 2
      test/core/bad_client/BUILD
  47. 4
      test/core/bad_client/tests/large_metadata.c
  48. 2
      test/core/bad_ssl/BUILD
  49. 18
      test/core/census/BUILD
  50. 10
      test/core/channel/BUILD
  51. 28
      test/core/client_channel/BUILD
  52. 18
      test/core/client_channel/resolvers/BUILD
  53. 14
      test/core/compression/BUILD
  54. 22
      test/core/end2end/BUILD
  55. 8
      test/core/end2end/end2end_nosec_tests.c
  56. 8
      test/core/end2end/end2end_tests.c
  57. 1
      test/core/end2end/end2end_tests.h
  58. 137
      test/core/end2end/fixtures/h2_full+workarounds.c
  59. 45
      test/core/end2end/fuzzers/BUILD
  60. 2
      test/core/end2end/gen_build_yaml.py
  61. 25
      test/core/end2end/generate_tests.bzl
  62. 411
      test/core/end2end/tests/workaround_cronet_compression.c
  63. 60
      test/core/fling/BUILD
  64. 10
      test/core/handshake/BUILD
  65. 70
      test/core/http/BUILD
  66. 237
      test/core/iomgr/BUILD
  67. 69
      test/core/json/BUILD
  68. 31
      test/core/nanopb/BUILD
  69. 13
      test/core/network_benchmarks/BUILD
  70. 94
      test/core/security/BUILD
  71. 61
      test/core/slice/BUILD
  72. 173
      test/core/support/BUILD
  73. 54
      test/core/surface/BUILD
  74. 1
      test/core/surface/public_headers_must_be_c89.c
  75. 79
      test/core/transport/BUILD
  76. 101
      test/core/transport/chttp2/BUILD
  77. 13
      test/core/tsi/BUILD
  78. 40
      test/core/util/BUILD
  79. 4
      test/core/util/grpc_fuzzer.bzl
  80. 2
      test/core/util/port.c
  81. 28
      test/cpp/codegen/BUILD
  82. 54
      test/cpp/common/BUILD
  83. 130
      test/cpp/end2end/BUILD
  84. 3
      test/cpp/end2end/async_end2end_test.cc
  85. 3
      test/cpp/end2end/client_crash_test.cc
  86. 3
      test/cpp/end2end/end2end_test.cc
  87. 3
      test/cpp/end2end/filter_end2end_test.cc
  88. 24
      test/cpp/end2end/generic_end2end_test.cc
  89. 3
      test/cpp/end2end/health_service_end2end_test.cc
  90. 3
      test/cpp/end2end/hybrid_end2end_test.cc
  91. 3
      test/cpp/end2end/mock_test.cc
  92. 3
      test/cpp/end2end/proto_server_reflection_test.cc
  93. 3
      test/cpp/end2end/round_robin_end2end_test.cc
  94. 3
      test/cpp/end2end/server_builder_plugin_test.cc
  95. 3
      test/cpp/end2end/server_crash_test.cc
  96. 4
      test/cpp/end2end/shutdown_test.cc
  97. 4
      test/cpp/end2end/streaming_throughput_test.cc
  98. 4
      test/cpp/end2end/test_service_impl.cc
  99. 3
      test/cpp/end2end/thread_stress_test.cc
  100. 39
      test/cpp/microbenchmarks/BUILD
  101. Some files were not shown because too many files have changed in this diff Show More

383
BUILD

@ -33,13 +33,19 @@ licenses(["notice"]) # 3-clause BSD
exports_files(["LICENSE"])
package(default_visibility = ["//visibility:public"])
package(
default_visibility = ["//visibility:public"],
features = [
"-layering_check",
"-parse_headers",
],
)
load(
"//bazel:grpc_build_system.bzl",
"grpc_cc_library",
"grpc_proto_plugin",
"grpc_cc_libraries",
"grpc_generate_one_off_targets",
)
# This should be updated along with build.yaml
@ -58,48 +64,35 @@ grpc_cc_library(
],
)
grpc_cc_libraries(
grpc_cc_library(
name = "grpc_unsecure",
srcs = [
"src/core/lib/surface/init.c",
],
additional_dep_list = [
[
"grpc_secure",
"grpc_resolver_dns_ares",
"grpc_lb_policy_grpclb_secure",
"grpc_transport_chttp2_client_secure",
"grpc_transport_chttp2_server_secure",
],
[],
],
additional_src_list = [
[
"src/core/plugin_registry/grpc_plugin_registry.c",
],
[
"src/core/lib/surface/init_unsecure.c",
"src/core/plugin_registry/grpc_unsecure_plugin_registry.c",
],
"src/core/lib/surface/init_unsecure.c",
"src/core/plugin_registry/grpc_unsecure_plugin_registry.c",
],
language = "c",
name_list = [
"grpc",
"grpc_unsecure",
standalone = True,
deps = [
"grpc_common",
],
)
grpc_cc_library(
name = "grpc",
srcs = [
"src/core/lib/surface/init.c",
"src/core/plugin_registry/grpc_plugin_registry.c",
],
language = "c",
standalone = True,
deps = [
"census",
"grpc_base",
"grpc_deadline_filter",
"grpc_lb_policy_pick_first",
"grpc_lb_policy_round_robin",
"grpc_load_reporting",
"grpc_max_age_filter",
"grpc_message_size_filter",
"grpc_resolver_dns_native",
"grpc_resolver_sockaddr",
"grpc_transport_chttp2_client_insecure",
"grpc_transport_chttp2_server_insecure",
"grpc_common",
"grpc_lb_policy_grpclb_secure",
"grpc_resolver_dns_ares",
"grpc_secure",
"grpc_transport_chttp2_client_secure",
"grpc_transport_chttp2_server_secure",
],
)
@ -457,7 +450,7 @@ grpc_cc_library(
)
grpc_cc_library(
name = "grpc_base",
name = "grpc_base_c",
srcs = [
"src/core/lib/channel/channel_args.c",
"src/core/lib/channel/channel_stack.c",
@ -479,11 +472,10 @@ grpc_cc_library(
"src/core/lib/iomgr/endpoint_pair_windows.c",
"src/core/lib/iomgr/error.c",
"src/core/lib/iomgr/ev_epoll1_linux.c",
"src/core/lib/iomgr/ev_epollsig_linux.c",
"src/core/lib/iomgr/ev_epollex_linux.c",
"src/core/lib/iomgr/is_epollexclusive_available.c",
"src/core/lib/iomgr/ev_epoll_thread_pool_linux.c",
"src/core/lib/iomgr/ev_epoll_limited_pollers_linux.c",
"src/core/lib/iomgr/ev_epoll_thread_pool_linux.c",
"src/core/lib/iomgr/ev_epollex_linux.c",
"src/core/lib/iomgr/ev_epollsig_linux.c",
"src/core/lib/iomgr/ev_poll_posix.c",
"src/core/lib/iomgr/ev_posix.c",
"src/core/lib/iomgr/exec_ctx.c",
@ -493,6 +485,7 @@ grpc_cc_library(
"src/core/lib/iomgr/iomgr_posix.c",
"src/core/lib/iomgr/iomgr_uv.c",
"src/core/lib/iomgr/iomgr_windows.c",
"src/core/lib/iomgr/is_epollexclusive_available.c",
"src/core/lib/iomgr/load_file.c",
"src/core/lib/iomgr/lockfree_event.c",
"src/core/lib/iomgr/network_status_tracker.c",
@ -528,8 +521,8 @@ grpc_cc_library(
"src/core/lib/iomgr/tcp_windows.c",
"src/core/lib/iomgr/time_averaged_stats.c",
"src/core/lib/iomgr/timer_generic.c",
"src/core/lib/iomgr/timer_manager.c",
"src/core/lib/iomgr/timer_heap.c",
"src/core/lib/iomgr/timer_manager.c",
"src/core/lib/iomgr/timer_uv.c",
"src/core/lib/iomgr/udp_server.c",
"src/core/lib/iomgr/unix_sockets_posix.c",
@ -566,7 +559,6 @@ grpc_cc_library(
"src/core/lib/surface/completion_queue.c",
"src/core/lib/surface/completion_queue_factory.c",
"src/core/lib/surface/event_string.c",
"src/core/lib/surface/lame_client.cc",
"src/core/lib/surface/metadata_array.c",
"src/core/lib/surface/server.c",
"src/core/lib/surface/validate_metadata.c",
@ -606,12 +598,10 @@ grpc_cc_library(
"src/core/lib/iomgr/error.h",
"src/core/lib/iomgr/error_internal.h",
"src/core/lib/iomgr/ev_epoll1_linux.h",
"src/core/lib/iomgr/ev_epollsig_linux.h",
"src/core/lib/iomgr/ev_epollex_linux.h",
"src/core/lib/iomgr/is_epollexclusive_available.h",
"src/core/lib/iomgr/sys_epoll_wrapper.h",
"src/core/lib/iomgr/ev_epoll_thread_pool_linux.h",
"src/core/lib/iomgr/ev_epoll_limited_pollers_linux.h",
"src/core/lib/iomgr/ev_epoll_thread_pool_linux.h",
"src/core/lib/iomgr/ev_epollex_linux.h",
"src/core/lib/iomgr/ev_epollsig_linux.h",
"src/core/lib/iomgr/ev_poll_posix.h",
"src/core/lib/iomgr/ev_posix.h",
"src/core/lib/iomgr/exec_ctx.h",
@ -620,6 +610,7 @@ grpc_cc_library(
"src/core/lib/iomgr/iomgr.h",
"src/core/lib/iomgr/iomgr_internal.h",
"src/core/lib/iomgr/iomgr_posix.h",
"src/core/lib/iomgr/is_epollexclusive_available.h",
"src/core/lib/iomgr/load_file.h",
"src/core/lib/iomgr/lockfree_event.h",
"src/core/lib/iomgr/network_status_tracker.h",
@ -641,6 +632,7 @@ grpc_cc_library(
"src/core/lib/iomgr/socket_utils.h",
"src/core/lib/iomgr/socket_utils_posix.h",
"src/core/lib/iomgr/socket_windows.h",
"src/core/lib/iomgr/sys_epoll_wrapper.h",
"src/core/lib/iomgr/tcp_client.h",
"src/core/lib/iomgr/tcp_client_posix.h",
"src/core/lib/iomgr/tcp_posix.h",
@ -651,8 +643,8 @@ grpc_cc_library(
"src/core/lib/iomgr/time_averaged_stats.h",
"src/core/lib/iomgr/timer.h",
"src/core/lib/iomgr/timer_generic.h",
"src/core/lib/iomgr/timer_manager.h",
"src/core/lib/iomgr/timer_heap.h",
"src/core/lib/iomgr/timer_manager.h",
"src/core/lib/iomgr/timer_uv.h",
"src/core/lib/iomgr/udp_server.h",
"src/core/lib/iomgr/unix_sockets_posix.h",
@ -714,6 +706,7 @@ grpc_cc_library(
"include/grpc/slice.h",
"include/grpc/slice_buffer.h",
"include/grpc/status.h",
"include/grpc/support/workaround_list.h",
],
deps = [
"gpr_base",
@ -722,6 +715,38 @@ grpc_cc_library(
],
)
grpc_cc_library(
name = "grpc_base",
srcs = [
"src/core/lib/surface/lame_client.cc",
],
language = "c++",
deps = [
"grpc_base_c",
],
)
grpc_cc_library(
name = "grpc_common",
deps = [
"grpc_base",
# standard plugins
"census",
"grpc_deadline_filter",
"grpc_lb_policy_pick_first",
"grpc_lb_policy_round_robin",
"grpc_load_reporting",
"grpc_max_age_filter",
"grpc_message_size_filter",
"grpc_resolver_dns_native",
"grpc_resolver_sockaddr",
"grpc_transport_chttp2_client_insecure",
"grpc_transport_chttp2_server_insecure",
"grpc_workaround_cronet_compression_filter",
"grpc_server_backward_compatibility",
]
)
grpc_cc_library(
name = "grpc_client_channel",
srcs = [
@ -834,6 +859,21 @@ grpc_cc_library(
],
)
grpc_cc_library(
name = "grpc_workaround_cronet_compression_filter",
srcs = [
"src/core/ext/filters/workarounds/workaround_cronet_compression_filter.c",
],
hdrs = [
"src/core/ext/filters/workarounds/workaround_cronet_compression_filter.h",
],
language = "c",
deps = [
"grpc_base",
"grpc_server_backward_compatibility",
],
)
grpc_cc_library(
name = "grpc_codegen",
language = "c",
@ -1260,111 +1300,124 @@ grpc_cc_library(
],
)
grpc_cc_libraries(
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",
],
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",
],
additional_dep_list = [
["grpc"],
["grpc_unsecure"],
],
# 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",
hdrs = GRPCXX_HDRS,
srcs = GRPCXX_SRCS,
public_hdrs = GRPCXX_PUBLIC_HDRS,
language = "c++",
name_list = [
"grpc++_base",
"grpc++_base_unsecure",
],
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",
deps = [
"grpc++_codegen_base",
"grpc",
],
)
grpc_cc_library(
name = "grpc++_base_unsecure",
hdrs = GRPCXX_HDRS,
srcs = GRPCXX_SRCS,
public_hdrs = GRPCXX_PUBLIC_HDRS,
language = "c++",
deps = [
"grpc++_codegen_base",
"grpc_unsecure",
],
)
@ -1459,3 +1512,31 @@ grpc_cc_library(
"//src/proto/grpc/reflection/v1alpha:reflection_proto",
],
)
grpc_cc_library(
name = "grpc++_test",
public_hdrs = [
"include/grpc++/test/mock_stream.h",
"include/grpc++/test/server_context_test_spouse.h",
],
deps = [
":grpc++",
],
)
grpc_cc_library(
name = "grpc_server_backward_compatibility",
srcs = [
"src/core/ext/filters/workarounds/workaround_utils.c",
],
hdrs = [
"src/core/ext/filters/workarounds/workaround_utils.h",
],
language = "c",
deps = [
"grpc_base",
],
)
grpc_generate_one_off_targets()

@ -563,6 +563,7 @@ if(_gRPC_PLATFORM_LINUX)
add_dependencies(buildtests_c h2_full+pipe_test)
endif()
add_dependencies(buildtests_c h2_full+trace_test)
add_dependencies(buildtests_c h2_full+workarounds_test)
add_dependencies(buildtests_c h2_http_proxy_test)
add_dependencies(buildtests_c h2_load_reporting_test)
add_dependencies(buildtests_c h2_oauth2_test)
@ -586,6 +587,7 @@ if(_gRPC_PLATFORM_LINUX)
add_dependencies(buildtests_c h2_full+pipe_nosec_test)
endif()
add_dependencies(buildtests_c h2_full+trace_nosec_test)
add_dependencies(buildtests_c h2_full+workarounds_nosec_test)
add_dependencies(buildtests_c h2_http_proxy_nosec_test)
add_dependencies(buildtests_c h2_load_reporting_nosec_test)
add_dependencies(buildtests_c h2_proxy_nosec_test)
@ -1160,6 +1162,8 @@ add_library(grpc
src/core/ext/census/tracing.c
src/core/ext/filters/max_age/max_age_filter.c
src/core/ext/filters/message_size/message_size_filter.c
src/core/ext/filters/workarounds/workaround_cronet_compression_filter.c
src/core/ext/filters/workarounds/workaround_utils.c
src/core/plugin_registry/grpc_plugin_registry.c
)
@ -1210,6 +1214,7 @@ foreach(_hdr
include/grpc/slice.h
include/grpc/slice_buffer.h
include/grpc/status.h
include/grpc/support/workaround_list.h
include/grpc/impl/codegen/byte_buffer_reader.h
include/grpc/impl/codegen/compression_types.h
include/grpc/impl/codegen/connectivity_state.h
@ -1505,6 +1510,7 @@ foreach(_hdr
include/grpc/slice.h
include/grpc/slice_buffer.h
include/grpc/status.h
include/grpc/support/workaround_list.h
include/grpc/impl/codegen/byte_buffer_reader.h
include/grpc/impl/codegen/compression_types.h
include/grpc/impl/codegen/connectivity_state.h
@ -1737,6 +1743,7 @@ foreach(_hdr
include/grpc/slice.h
include/grpc/slice_buffer.h
include/grpc/status.h
include/grpc/support/workaround_list.h
include/grpc/impl/codegen/byte_buffer_reader.h
include/grpc/impl/codegen/compression_types.h
include/grpc/impl/codegen/connectivity_state.h
@ -2037,6 +2044,8 @@ add_library(grpc_unsecure
src/core/ext/census/tracing.c
src/core/ext/filters/max_age/max_age_filter.c
src/core/ext/filters/message_size/message_size_filter.c
src/core/ext/filters/workarounds/workaround_cronet_compression_filter.c
src/core/ext/filters/workarounds/workaround_utils.c
src/core/plugin_registry/grpc_unsecure_plugin_registry.c
)
@ -2084,6 +2093,7 @@ foreach(_hdr
include/grpc/slice.h
include/grpc/slice_buffer.h
include/grpc/status.h
include/grpc/support/workaround_list.h
include/grpc/impl/codegen/byte_buffer_reader.h
include/grpc/impl/codegen/compression_types.h
include/grpc/impl/codegen/connectivity_state.h
@ -2522,6 +2532,7 @@ foreach(_hdr
include/grpc/slice.h
include/grpc/slice_buffer.h
include/grpc/status.h
include/grpc/support/workaround_list.h
include/grpc++/impl/codegen/proto_utils.h
include/grpc++/impl/codegen/config_protobuf.h
)
@ -2918,6 +2929,7 @@ foreach(_hdr
include/grpc/slice.h
include/grpc/slice_buffer.h
include/grpc/status.h
include/grpc/support/workaround_list.h
include/grpc/census.h
)
string(REPLACE "include/" "" _path ${_hdr})
@ -3623,6 +3635,7 @@ foreach(_hdr
include/grpc/slice.h
include/grpc/slice_buffer.h
include/grpc/status.h
include/grpc/support/workaround_list.h
)
string(REPLACE "include/" "" _path ${_hdr})
get_filename_component(_path ${_path} PATH)
@ -4564,6 +4577,7 @@ add_library(end2end_tests
test/core/end2end/tests/simple_request.c
test/core/end2end/tests/streaming_error_response.c
test/core/end2end/tests/trailing_metadata.c
test/core/end2end/tests/workaround_cronet_compression.c
test/core/end2end/tests/write_buffering.c
test/core/end2end/tests/write_buffering_at_end.c
)
@ -4661,6 +4675,7 @@ add_library(end2end_nosec_tests
test/core/end2end/tests/simple_request.c
test/core/end2end/tests/streaming_error_response.c
test/core/end2end/tests/trailing_metadata.c
test/core/end2end/tests/workaround_cronet_compression.c
test/core/end2end/tests/write_buffering.c
test/core/end2end/tests/write_buffering_at_end.c
)
@ -13115,6 +13130,38 @@ target_link_libraries(h2_full+trace_test
endif (gRPC_BUILD_TESTS)
if (gRPC_BUILD_TESTS)
add_executable(h2_full+workarounds_test
test/core/end2end/fixtures/h2_full+workarounds.c
)
target_include_directories(h2_full+workarounds_test
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include
PRIVATE ${BORINGSSL_ROOT_DIR}/include
PRIVATE ${PROTOBUF_ROOT_DIR}/src
PRIVATE ${BENCHMARK_ROOT_DIR}/include
PRIVATE ${ZLIB_ROOT_DIR}
PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/zlib
PRIVATE ${CARES_BUILD_INCLUDE_DIR}
PRIVATE ${CARES_INCLUDE_DIR}
PRIVATE ${CARES_PLATFORM_INCLUDE_DIR}
PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares
PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include
)
target_link_libraries(h2_full+workarounds_test
${_gRPC_ALLTARGETS_LIBRARIES}
end2end_tests
grpc_test_util
grpc
gpr_test_util
gpr
)
endif (gRPC_BUILD_TESTS)
if (gRPC_BUILD_TESTS)
add_executable(h2_http_proxy_test
test/core/end2end/fixtures/h2_http_proxy.c
)
@ -13665,6 +13712,38 @@ target_link_libraries(h2_full+trace_nosec_test
endif (gRPC_BUILD_TESTS)
if (gRPC_BUILD_TESTS)
add_executable(h2_full+workarounds_nosec_test
test/core/end2end/fixtures/h2_full+workarounds.c
)
target_include_directories(h2_full+workarounds_nosec_test
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include
PRIVATE ${BORINGSSL_ROOT_DIR}/include
PRIVATE ${PROTOBUF_ROOT_DIR}/src
PRIVATE ${BENCHMARK_ROOT_DIR}/include
PRIVATE ${ZLIB_ROOT_DIR}
PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/zlib
PRIVATE ${CARES_BUILD_INCLUDE_DIR}
PRIVATE ${CARES_INCLUDE_DIR}
PRIVATE ${CARES_PLATFORM_INCLUDE_DIR}
PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares
PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include
)
target_link_libraries(h2_full+workarounds_nosec_test
${_gRPC_ALLTARGETS_LIBRARIES}
end2end_nosec_tests
grpc_test_util_unsecure
grpc_unsecure
gpr_test_util
gpr
)
endif (gRPC_BUILD_TESTS)
if (gRPC_BUILD_TESTS)
add_executable(h2_http_proxy_nosec_test
test/core/end2end/fixtures/h2_http_proxy.c
)

@ -1249,6 +1249,7 @@ h2_fd_test: $(BINDIR)/$(CONFIG)/h2_fd_test
h2_full_test: $(BINDIR)/$(CONFIG)/h2_full_test
h2_full+pipe_test: $(BINDIR)/$(CONFIG)/h2_full+pipe_test
h2_full+trace_test: $(BINDIR)/$(CONFIG)/h2_full+trace_test
h2_full+workarounds_test: $(BINDIR)/$(CONFIG)/h2_full+workarounds_test
h2_http_proxy_test: $(BINDIR)/$(CONFIG)/h2_http_proxy_test
h2_load_reporting_test: $(BINDIR)/$(CONFIG)/h2_load_reporting_test
h2_oauth2_test: $(BINDIR)/$(CONFIG)/h2_oauth2_test
@ -1266,6 +1267,7 @@ h2_fd_nosec_test: $(BINDIR)/$(CONFIG)/h2_fd_nosec_test
h2_full_nosec_test: $(BINDIR)/$(CONFIG)/h2_full_nosec_test
h2_full+pipe_nosec_test: $(BINDIR)/$(CONFIG)/h2_full+pipe_nosec_test
h2_full+trace_nosec_test: $(BINDIR)/$(CONFIG)/h2_full+trace_nosec_test
h2_full+workarounds_nosec_test: $(BINDIR)/$(CONFIG)/h2_full+workarounds_nosec_test
h2_http_proxy_nosec_test: $(BINDIR)/$(CONFIG)/h2_http_proxy_nosec_test
h2_load_reporting_nosec_test: $(BINDIR)/$(CONFIG)/h2_load_reporting_nosec_test
h2_proxy_nosec_test: $(BINDIR)/$(CONFIG)/h2_proxy_nosec_test
@ -1494,6 +1496,7 @@ buildtests_c: privatelibs_c \
$(BINDIR)/$(CONFIG)/h2_full_test \
$(BINDIR)/$(CONFIG)/h2_full+pipe_test \
$(BINDIR)/$(CONFIG)/h2_full+trace_test \
$(BINDIR)/$(CONFIG)/h2_full+workarounds_test \
$(BINDIR)/$(CONFIG)/h2_http_proxy_test \
$(BINDIR)/$(CONFIG)/h2_load_reporting_test \
$(BINDIR)/$(CONFIG)/h2_oauth2_test \
@ -1511,6 +1514,7 @@ buildtests_c: privatelibs_c \
$(BINDIR)/$(CONFIG)/h2_full_nosec_test \
$(BINDIR)/$(CONFIG)/h2_full+pipe_nosec_test \
$(BINDIR)/$(CONFIG)/h2_full+trace_nosec_test \
$(BINDIR)/$(CONFIG)/h2_full+workarounds_nosec_test \
$(BINDIR)/$(CONFIG)/h2_http_proxy_nosec_test \
$(BINDIR)/$(CONFIG)/h2_load_reporting_nosec_test \
$(BINDIR)/$(CONFIG)/h2_proxy_nosec_test \
@ -3135,6 +3139,8 @@ LIBGRPC_SRC = \
src/core/ext/census/tracing.c \
src/core/ext/filters/max_age/max_age_filter.c \
src/core/ext/filters/message_size/message_size_filter.c \
src/core/ext/filters/workarounds/workaround_cronet_compression_filter.c \
src/core/ext/filters/workarounds/workaround_utils.c \
src/core/plugin_registry/grpc_plugin_registry.c \
PUBLIC_HEADERS_C += \
@ -3148,6 +3154,7 @@ PUBLIC_HEADERS_C += \
include/grpc/slice.h \
include/grpc/slice_buffer.h \
include/grpc/status.h \
include/grpc/support/workaround_list.h \
include/grpc/impl/codegen/byte_buffer_reader.h \
include/grpc/impl/codegen/compression_types.h \
include/grpc/impl/codegen/connectivity_state.h \
@ -3443,6 +3450,7 @@ PUBLIC_HEADERS_C += \
include/grpc/slice.h \
include/grpc/slice_buffer.h \
include/grpc/status.h \
include/grpc/support/workaround_list.h \
include/grpc/impl/codegen/byte_buffer_reader.h \
include/grpc/impl/codegen/compression_types.h \
include/grpc/impl/codegen/connectivity_state.h \
@ -3674,6 +3682,7 @@ PUBLIC_HEADERS_C += \
include/grpc/slice.h \
include/grpc/slice_buffer.h \
include/grpc/status.h \
include/grpc/support/workaround_list.h \
include/grpc/impl/codegen/byte_buffer_reader.h \
include/grpc/impl/codegen/compression_types.h \
include/grpc/impl/codegen/connectivity_state.h \
@ -3981,6 +3990,8 @@ LIBGRPC_UNSECURE_SRC = \
src/core/ext/census/tracing.c \
src/core/ext/filters/max_age/max_age_filter.c \
src/core/ext/filters/message_size/message_size_filter.c \
src/core/ext/filters/workarounds/workaround_cronet_compression_filter.c \
src/core/ext/filters/workarounds/workaround_utils.c \
src/core/plugin_registry/grpc_unsecure_plugin_registry.c \
PUBLIC_HEADERS_C += \
@ -3994,6 +4005,7 @@ PUBLIC_HEADERS_C += \
include/grpc/slice.h \
include/grpc/slice_buffer.h \
include/grpc/status.h \
include/grpc/support/workaround_list.h \
include/grpc/impl/codegen/byte_buffer_reader.h \
include/grpc/impl/codegen/compression_types.h \
include/grpc/impl/codegen/connectivity_state.h \
@ -4405,6 +4417,7 @@ PUBLIC_HEADERS_CXX += \
include/grpc/slice.h \
include/grpc/slice_buffer.h \
include/grpc/status.h \
include/grpc/support/workaround_list.h \
include/grpc++/impl/codegen/proto_utils.h \
include/grpc++/impl/codegen/config_protobuf.h \
@ -4809,6 +4822,7 @@ PUBLIC_HEADERS_CXX += \
include/grpc/slice.h \
include/grpc/slice_buffer.h \
include/grpc/status.h \
include/grpc/support/workaround_list.h \
include/grpc/census.h \
LIBGRPC++_CRONET_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBGRPC++_CRONET_SRC))))
@ -5505,6 +5519,7 @@ PUBLIC_HEADERS_CXX += \
include/grpc/slice.h \
include/grpc/slice_buffer.h \
include/grpc/status.h \
include/grpc/support/workaround_list.h \
LIBGRPC++_UNSECURE_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBGRPC++_UNSECURE_SRC))))
@ -8452,6 +8467,7 @@ LIBEND2END_TESTS_SRC = \
test/core/end2end/tests/simple_request.c \
test/core/end2end/tests/streaming_error_response.c \
test/core/end2end/tests/trailing_metadata.c \
test/core/end2end/tests/workaround_cronet_compression.c \
test/core/end2end/tests/write_buffering.c \
test/core/end2end/tests/write_buffering_at_end.c \
@ -8544,6 +8560,7 @@ LIBEND2END_NOSEC_TESTS_SRC = \
test/core/end2end/tests/simple_request.c \
test/core/end2end/tests/streaming_error_response.c \
test/core/end2end/tests/trailing_metadata.c \
test/core/end2end/tests/workaround_cronet_compression.c \
test/core/end2end/tests/write_buffering.c \
test/core/end2end/tests/write_buffering_at_end.c \
@ -18589,6 +18606,38 @@ endif
endif
H2_FULL+WORKAROUNDS_TEST_SRC = \
test/core/end2end/fixtures/h2_full+workarounds.c \
H2_FULL+WORKAROUNDS_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(H2_FULL+WORKAROUNDS_TEST_SRC))))
ifeq ($(NO_SECURE),true)
# You can't build secure targets if you don't have OpenSSL.
$(BINDIR)/$(CONFIG)/h2_full+workarounds_test: openssl_dep_error
else
$(BINDIR)/$(CONFIG)/h2_full+workarounds_test: $(H2_FULL+WORKAROUNDS_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
$(E) "[LD] Linking $@"
$(Q) mkdir -p `dirname $@`
$(Q) $(LD) $(LDFLAGS) $(H2_FULL+WORKAROUNDS_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/h2_full+workarounds_test
endif
$(OBJDIR)/$(CONFIG)/test/core/end2end/fixtures/h2_full+workarounds.o: $(LIBDIR)/$(CONFIG)/libend2end_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
deps_h2_full+workarounds_test: $(H2_FULL+WORKAROUNDS_TEST_OBJS:.o=.dep)
ifneq ($(NO_SECURE),true)
ifneq ($(NO_DEPS),true)
-include $(H2_FULL+WORKAROUNDS_TEST_OBJS:.o=.dep)
endif
endif
H2_HTTP_PROXY_TEST_SRC = \
test/core/end2end/fixtures/h2_http_proxy.c \
@ -19061,6 +19110,26 @@ ifneq ($(NO_DEPS),true)
endif
H2_FULL+WORKAROUNDS_NOSEC_TEST_SRC = \
test/core/end2end/fixtures/h2_full+workarounds.c \
H2_FULL+WORKAROUNDS_NOSEC_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(H2_FULL+WORKAROUNDS_NOSEC_TEST_SRC))))
$(BINDIR)/$(CONFIG)/h2_full+workarounds_nosec_test: $(H2_FULL+WORKAROUNDS_NOSEC_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_nosec_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
$(E) "[LD] Linking $@"
$(Q) mkdir -p `dirname $@`
$(Q) $(LD) $(LDFLAGS) $(H2_FULL+WORKAROUNDS_NOSEC_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_nosec_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) -o $(BINDIR)/$(CONFIG)/h2_full+workarounds_nosec_test
$(OBJDIR)/$(CONFIG)/test/core/end2end/fixtures/h2_full+workarounds.o: $(LIBDIR)/$(CONFIG)/libend2end_nosec_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
deps_h2_full+workarounds_nosec_test: $(H2_FULL+WORKAROUNDS_NOSEC_TEST_OBJS:.o=.dep)
ifneq ($(NO_DEPS),true)
-include $(H2_FULL+WORKAROUNDS_NOSEC_TEST_OBJS:.o=.dep)
endif
H2_HTTP_PROXY_NOSEC_TEST_SRC = \
test/core/end2end/fixtures/h2_http_proxy.c \

@ -5,7 +5,7 @@ bind(
bind(
name = "libssl",
actual = "@submodule_boringssl//:ssl",
actual = "@boringssl//:ssl",
)
bind(
@ -49,7 +49,7 @@ bind(
)
local_repository(
name = "submodule_boringssl",
name = "boringssl",
path = "third_party/boringssl-with-bazel",
)

@ -32,8 +32,15 @@
# the BUILD file for gRPC. It contains the mapping for the template system we
# use to generate other platform's build system files.
#
# Please consider that there should be a high bar for additions and changes to
# this file.
# Each rule listed must be re-written for Google's internal build system, and
# each change must be ported from one to the other.
#
def grpc_cc_library(name, srcs = [], public_hdrs = [], hdrs = [], external_deps = [], deps = [], standalone = False, language = "C++"):
def grpc_cc_library(name, srcs = [], public_hdrs = [], hdrs = [],
external_deps = [], deps = [], standalone = False,
language = "C++", testonly = False, visibility = None):
copts = []
if language.upper() == "C":
copts = ["-std=c99"]
@ -43,28 +50,14 @@ def grpc_cc_library(name, srcs = [], public_hdrs = [], hdrs = [], external_deps
hdrs = hdrs + public_hdrs,
deps = deps + ["//external:" + dep for dep in external_deps],
copts = copts,
visibility = visibility,
testonly = testonly,
linkopts = ["-pthread"],
includes = [
"include"
]
)
def grpc_cc_libraries(name_list, additional_src_list = [], additional_dep_list = [], srcs = [], public_hdrs = [], hdrs = [], external_deps = [], deps = [], standalone = False, language="C++"):
names = len(name_list)
asl = additional_src_list + [[]]*(names - len(additional_src_list))
adl = additional_dep_list + [[]]*(names - len(additional_dep_list))
for i in range(names):
grpc_cc_library(
name = name_list[i],
srcs = srcs + asl[i],
hdrs = hdrs,
public_hdrs = public_hdrs,
deps = deps + adl[i],
external_deps = external_deps,
standalone = standalone,
language = language
)
def grpc_proto_plugin(name, srcs = [], deps = []):
native.cc_binary(
name = name,
@ -86,3 +79,42 @@ def grpc_proto_library(name, srcs = [], deps = [], well_known_protos = None,
generate_mock = generate_mock,
)
def grpc_cc_test(name, srcs = [], deps = [], external_deps = [], args = [], data = [], language = "C++"):
copts = []
if language.upper() == "C":
copts = ["-std=c99"]
native.cc_test(
name = name,
srcs = srcs,
args = args,
data = data,
deps = deps + ["//external:" + dep for dep in external_deps],
copts = copts,
linkopts = ["-pthread"],
)
def grpc_cc_binary(name, srcs = [], deps = [], external_deps = [], args = [], data = [], language = "C++", testonly = False, linkshared = False):
copts = []
if language.upper() == "C":
copts = ["-std=c99"]
native.cc_binary(
name = name,
srcs = srcs,
args = args,
data = data,
testonly = testonly,
linkshared = linkshared,
deps = deps + ["//external:" + dep for dep in external_deps],
copts = copts,
linkopts = ["-pthread"],
)
def grpc_generate_one_off_targets():
pass
def grpc_sh_test(name, srcs, args = [], data = []):
native.sh_test(
name = name,
srcs = srcs,
args = args,
data = data)

@ -895,6 +895,8 @@
'src/core/ext/census/tracing.c',
'src/core/ext/filters/max_age/max_age_filter.c',
'src/core/ext/filters/message_size/message_size_filter.c',
'src/core/ext/filters/workarounds/workaround_cronet_compression_filter.c',
'src/core/ext/filters/workarounds/workaround_utils.c',
'src/core/plugin_registry/grpc_plugin_registry.c',
],
"conditions": [

@ -176,6 +176,7 @@ filegroups:
- include/grpc/slice.h
- include/grpc/slice_buffer.h
- include/grpc/status.h
- include/grpc/support/workaround_list.h
headers:
- src/core/lib/channel/channel_args.h
- src/core/lib/channel/channel_stack.h
@ -653,6 +654,13 @@ filegroups:
- grpc_base
- grpc_transport_chttp2_alpn
- tsi
- name: grpc_server_backward_compatibility
headers:
- src/core/ext/filters/workarounds/workaround_utils.h
src:
- src/core/ext/filters/workarounds/workaround_utils.c
uses:
- grpc_base
- name: grpc_test_util_base
build: test
headers:
@ -819,6 +827,15 @@ filegroups:
- grpc_base
- grpc_transport_chttp2
- grpc_http_filters
- name: grpc_workaround_cronet_compression_filter
headers:
- src/core/ext/filters/workarounds/workaround_cronet_compression_filter.h
src:
- src/core/ext/filters/workarounds/workaround_cronet_compression_filter.c
plugin: grpc_workaround_cronet_compression_filter
uses:
- grpc_base
- grpc_server_backward_compatibility
- name: nanopb
headers:
- third_party/nanopb/pb.h
@ -1048,6 +1065,8 @@ libs:
- grpc_max_age_filter
- grpc_message_size_filter
- grpc_deadline_filter
- grpc_workaround_cronet_compression_filter
- grpc_server_backward_compatibility
generate_plugin_registry: true
secure: true
vs_packages:
@ -1147,6 +1166,8 @@ libs:
- grpc_max_age_filter
- grpc_message_size_filter
- grpc_deadline_filter
- grpc_workaround_cronet_compression_filter
- grpc_server_backward_compatibility
generate_plugin_registry: true
secure: false
vs_project_guid: '{46CEDFFF-9692-456A-AA24-38B5D6BCF4C5}'
@ -3338,7 +3359,7 @@ targets:
- gpr_test_util
- gpr
args:
- --benchmark_min_time=0
- --benchmark_min_time=4
defaults: benchmark
platforms:
- mac

@ -329,6 +329,8 @@ if test "$PHP_GRPC" != "no"; then
src/core/ext/census/tracing.c \
src/core/ext/filters/max_age/max_age_filter.c \
src/core/ext/filters/message_size/message_size_filter.c \
src/core/ext/filters/workarounds/workaround_cronet_compression_filter.c \
src/core/ext/filters/workarounds/workaround_utils.c \
src/core/plugin_registry/grpc_plugin_registry.c \
src/boringssl/err_data.c \
third_party/boringssl/crypto/aes/aes.c \
@ -709,6 +711,7 @@ if test "$PHP_GRPC" != "no"; then
PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/filters/load_reporting)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/filters/max_age)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/filters/message_size)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/filters/workarounds)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/transport/chttp2/alpn)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/transport/chttp2/client)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/transport/chttp2/client/insecure)

@ -0,0 +1,175 @@
# How to write unit tests for gRPC C client.
tl;dr: [Example code](https://github.com/grpc/grpc/blob/master/test/cpp/end2end/mock_test.cc).
To unit-test client-side logic via the synchronous API, gRPC provides a mocked Stub based on googletest(googlemock) that can be programmed upon and easily incorporated in the test code.
For instance, consider an EchoService like this:
```proto
service EchoTestService {
rpc Echo(EchoRequest) returns (EchoResponse);
rpc BidiStream(stream EchoRequest) returns (stream EchoResponse);
}
```
The code generated would look something like this:
```c
class EchoTestService final {
public:
class StubInterface {
virtual ::grpc::Status Echo(::grpc::ClientContext* context, const ::grpc::testing::EchoRequest& request, ::grpc::testing::EchoResponse* response) = 0;
std::unique_ptr< ::grpc::ClientReaderWriterInterface< ::grpc::testing::EchoRequest, ::grpc::testing::EchoResponse>> BidiStream(::grpc::ClientContext* context) {
return std::unique_ptr< ::grpc::ClientReaderWriterInterface< ::grpc::testing::EchoRequest, ::grpc::testing::EchoResponse>>(BidiStreamRaw(context));
}
private:
virtual ::grpc::ClientReaderWriterInterface< ::grpc::testing::EchoRequest, ::grpc::testing::EchoResponse>* BidiStreamRaw(::grpc::ClientContext* context) = 0;
} // End StubInterface
} // End EchoTestService
```
If we mock the StubInterface and set expectations on the pure-virtual methods we can test client-side logic without having to make any rpcs.
A mock for this StubInterface will look like this:
```c
class MockEchoTestServiceStub : public EchoTestService::StubInterface {
public:
MOCK_METHOD3(Echo, ::grpc::Status(::grpc::ClientContext* context, const ::grpc::testing::EchoRequest& request, ::grpc::testing::EchoResponse* response));
MOCK_METHOD1(BidiStreamRaw, ::grpc::ClientReaderWriterInterface< ::grpc::testing::EchoRequest, ::grpc::testing::EchoResponse>*(::grpc::ClientContext* context));
};
```
**Generating mock code:**
Such a mock can be auto-generated by:
1. Setting flag(generate_mock_code=true) on grpc plugin for protoc, or
1. Setting an attribute(generate_mock) in your bazel rule.
Protoc plugin flag:
```sh
protoc -I . --grpc_out=generate_mock_code=true:. --plugin=protoc-gen-grpc=`which grpc_cpp_plugin` echo.proto
```
Bazel rule:
```py
grpc_proto_library(
name = "echo_proto",
srcs = ["echo.proto"],
generate_mock = True,
)
```
By adding such a flag now a header file `echo_mock.grpc.pb.h` containing the mocked stub will also be generated.
This header file can then be included in test files along with a gmock dependency.
**Writing tests with mocked Stub.**
Consider the following client a user might have:
```c
class FakeClient {
public:
explicit FakeClient(EchoTestService::StubInterface* stub) : stub_(stub) {}
void DoEcho() {
ClientContext context;
EchoRequest request;
EchoResponse response;
request.set_message("hello world");
Status s = stub_->Echo(&context, request, &response);
EXPECT_EQ(request.message(), response.message());
EXPECT_TRUE(s.ok());
}
void DoBidiStream() {
EchoRequest request;
EchoResponse response;
ClientContext context;
grpc::string msg("hello");
std::unique_ptr<ClientReaderWriterInterface<EchoRequest, EchoResponse>>
stream = stub_->BidiStream(&context);
request.set_message(msg "0");
EXPECT_TRUE(stream->Write(request));
EXPECT_TRUE(stream->Read(&response));
EXPECT_EQ(response.message(), request.message());
request.set_message(msg "1");
EXPECT_TRUE(stream->Write(request));
EXPECT_TRUE(stream->Read(&response));
EXPECT_EQ(response.message(), request.message());
request.set_message(msg "2");
EXPECT_TRUE(stream->Write(request));
EXPECT_TRUE(stream->Read(&response));
EXPECT_EQ(response.message(), request.message());
stream->WritesDone();
EXPECT_FALSE(stream->Read(&response));
Status s = stream->Finish();
EXPECT_TRUE(s.ok());
}
void ResetStub(EchoTestService::StubInterface* stub) { stub_ = stub; }
private:
EchoTestService::StubInterface* stub_;
};
```
A test could initialize this FakeClient with a mocked stub having set expectations on it:
Unary RPC:
```c
MockEchoTestServiceStub stub;
EchoResponse resp;
resp.set_message("hello world");
Expect_CALL(stub, Echo(_,_,_)).Times(Atleast(1)).WillOnce(DoAll(SetArgPointee<2>(resp), Return(Status::OK)));
FakeClient client(stub);
client.DoEcho();
```
Streaming RPC:
```c
ACTION_P(copy, msg) {
arg0->set_message(msg->message());
}
auto rw = new MockClientReaderWriter<EchoRequest, EchoResponse>();
EchoRequest msg;
EXPECT_CALL(*rw, Write(_, _)).Times(3).WillRepeatedly(DoAll(SaveArg<0>(&msg), Return(true)));
EXPECT_CALL(*rw, Read(_)).
WillOnce(DoAll(WithArg<0>(copy(&msg)), Return(true))).
WillOnce(DoAll(WithArg<0>(copy(&msg)), Return(true))).
WillOnce(DoAll(WithArg<0>(copy(&msg)), Return(true))).
WillOnce(Return(false));
MockEchoTestServiceStub stub;
EXPECT_CALL(stub, BidiStreamRaw(_)).Times(AtLeast(1)).WillOnce(Return(rw));
FakeClient client(stub);
client.DoBidiStream();
```

@ -54,13 +54,13 @@ grpc_proto_library(
cc_binary(
name = "greeter_client",
srcs = ["cpp/helloworld/greeter_client.cc"],
deps = ["helloworld"],
defines = ["BAZEL_BUILD"],
deps = [":helloworld"],
)
cc_binary(
name = "greeter_server",
srcs = ["cpp/helloworld/greeter_server.cc"],
deps = ["helloworld"],
defines = ["BAZEL_BUILD"],
deps = [":helloworld"],
)

@ -166,6 +166,7 @@ Pod::Spec.new do |s|
'include/grpc/slice.h',
'include/grpc/slice_buffer.h',
'include/grpc/status.h',
'include/grpc/support/workaround_list.h',
'include/grpc/impl/codegen/byte_buffer_reader.h',
'include/grpc/impl/codegen/compression_types.h',
'include/grpc/impl/codegen/connectivity_state.h',
@ -470,6 +471,8 @@ Pod::Spec.new do |s|
'src/core/ext/census/tracing.h',
'src/core/ext/filters/max_age/max_age_filter.h',
'src/core/ext/filters/message_size/message_size_filter.h',
'src/core/ext/filters/workarounds/workaround_cronet_compression_filter.h',
'src/core/ext/filters/workarounds/workaround_utils.h',
'src/core/lib/surface/init.c',
'src/core/lib/channel/channel_args.c',
'src/core/lib/channel/channel_stack.c',
@ -712,6 +715,8 @@ Pod::Spec.new do |s|
'src/core/ext/census/tracing.c',
'src/core/ext/filters/max_age/max_age_filter.c',
'src/core/ext/filters/message_size/message_size_filter.c',
'src/core/ext/filters/workarounds/workaround_cronet_compression_filter.c',
'src/core/ext/filters/workarounds/workaround_utils.c',
'src/core/plugin_registry/grpc_plugin_registry.c'
ss.private_header_files = 'src/core/lib/profiling/timers.h',
@ -942,7 +947,9 @@ Pod::Spec.new do |s|
'src/core/ext/census/trace_string.h',
'src/core/ext/census/tracing.h',
'src/core/ext/filters/max_age/max_age_filter.h',
'src/core/ext/filters/message_size/message_size_filter.h'
'src/core/ext/filters/message_size/message_size_filter.h',
'src/core/ext/filters/workarounds/workaround_cronet_compression_filter.h',
'src/core/ext/filters/workarounds/workaround_utils.h'
end
s.subspec 'Cronet-Interface' do |ss|

@ -154,6 +154,7 @@ Gem::Specification.new do |s|
s.files += %w( include/grpc/slice.h )
s.files += %w( include/grpc/slice_buffer.h )
s.files += %w( include/grpc/status.h )
s.files += %w( include/grpc/support/workaround_list.h )
s.files += %w( include/grpc/impl/codegen/byte_buffer_reader.h )
s.files += %w( include/grpc/impl/codegen/compression_types.h )
s.files += %w( include/grpc/impl/codegen/connectivity_state.h )
@ -386,6 +387,8 @@ Gem::Specification.new do |s|
s.files += %w( src/core/ext/census/tracing.h )
s.files += %w( src/core/ext/filters/max_age/max_age_filter.h )
s.files += %w( src/core/ext/filters/message_size/message_size_filter.h )
s.files += %w( src/core/ext/filters/workarounds/workaround_cronet_compression_filter.h )
s.files += %w( src/core/ext/filters/workarounds/workaround_utils.h )
s.files += %w( src/core/lib/surface/init.c )
s.files += %w( src/core/lib/channel/channel_args.c )
s.files += %w( src/core/lib/channel/channel_stack.c )
@ -628,6 +631,8 @@ Gem::Specification.new do |s|
s.files += %w( src/core/ext/census/tracing.c )
s.files += %w( src/core/ext/filters/max_age/max_age_filter.c )
s.files += %w( src/core/ext/filters/message_size/message_size_filter.c )
s.files += %w( src/core/ext/filters/workarounds/workaround_cronet_compression_filter.c )
s.files += %w( src/core/ext/filters/workarounds/workaround_utils.c )
s.files += %w( src/core/plugin_registry/grpc_plugin_registry.c )
s.files += %w( third_party/boringssl/crypto/aes/internal.h )
s.files += %w( third_party/boringssl/crypto/asn1/asn1_locl.h )

@ -195,7 +195,7 @@ class ServerBuilder {
struct SyncServerSettings {
SyncServerSettings()
: num_cqs(gpr_cpu_num_cores()),
: num_cqs(GPR_MAX(1, gpr_cpu_num_cores())),
min_pollers(1),
max_pollers(2),
cq_timeout_msec(10000) {}

@ -296,6 +296,9 @@ each time recvmsg (or equivalent) is called */
/* Timeout in milliseconds to use for calls to the grpclb load balancer.
If 0 or unset, the balancer calls will have no deadline. */
#define GRPC_ARG_GRPCLB_CALL_TIMEOUT_MS "grpc.grpclb_timeout_ms"
/** If non-zero, grpc server's cronet compression workaround will be enabled */
#define GRPC_ARG_WORKAROUND_CRONET_COMPRESSION \
"grpc.workaround.cronet_compression"
/** \} */
/** Result of a grpc call. If the caller satisfies the prerequisites of a
@ -589,7 +592,7 @@ typedef enum {
/** Specifies the type of APIs to use to pop events from the completion queue */
typedef enum {
/** Events are popped out by calling grpc_completion_queue_next() API ONLY */
GRPC_CQ_NEXT = 1,
GRPC_CQ_NEXT,
/** Events are popped out by calling grpc_completion_queue_pluck() API ONLY*/
GRPC_CQ_PLUCK

@ -0,0 +1,46 @@
/*
*
* Copyright 2015, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef GRPC_SUPPORT_WORKAROUND_LIST_H
#define GRPC_SUPPORT_WORKAROUND_LIST_H
/* The list of IDs of server workarounds currently maintained by gRPC. For
* explanation and detailed descriptions of workarounds, see
* /docs/workarounds.md
*/
typedef enum {
GRPC_WORKAROUND_ID_CRONET_COMPRESSION = 0,
GRPC_MAX_WORKAROUND_ID
} grpc_workaround_list;
#endif

@ -163,6 +163,7 @@
<file baseinstalldir="/" name="include/grpc/slice.h" role="src" />
<file baseinstalldir="/" name="include/grpc/slice_buffer.h" role="src" />
<file baseinstalldir="/" name="include/grpc/status.h" role="src" />
<file baseinstalldir="/" name="include/grpc/support/workaround_list.h" role="src" />
<file baseinstalldir="/" name="include/grpc/impl/codegen/byte_buffer_reader.h" role="src" />
<file baseinstalldir="/" name="include/grpc/impl/codegen/compression_types.h" role="src" />
<file baseinstalldir="/" name="include/grpc/impl/codegen/connectivity_state.h" role="src" />
@ -395,6 +396,8 @@
<file baseinstalldir="/" name="src/core/ext/census/tracing.h" role="src" />
<file baseinstalldir="/" name="src/core/ext/filters/max_age/max_age_filter.h" role="src" />
<file baseinstalldir="/" name="src/core/ext/filters/message_size/message_size_filter.h" role="src" />
<file baseinstalldir="/" name="src/core/ext/filters/workarounds/workaround_cronet_compression_filter.h" role="src" />
<file baseinstalldir="/" name="src/core/ext/filters/workarounds/workaround_utils.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/surface/init.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/channel/channel_args.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/channel/channel_stack.c" role="src" />
@ -637,6 +640,8 @@
<file baseinstalldir="/" name="src/core/ext/census/tracing.c" role="src" />
<file baseinstalldir="/" name="src/core/ext/filters/max_age/max_age_filter.c" role="src" />
<file baseinstalldir="/" name="src/core/ext/filters/message_size/message_size_filter.c" role="src" />
<file baseinstalldir="/" name="src/core/ext/filters/workarounds/workaround_cronet_compression_filter.c" role="src" />
<file baseinstalldir="/" name="src/core/ext/filters/workarounds/workaround_utils.c" role="src" />
<file baseinstalldir="/" name="src/core/plugin_registry/grpc_plugin_registry.c" role="src" />
<file baseinstalldir="/" name="third_party/boringssl/crypto/aes/internal.h" role="src" />
<file baseinstalldir="/" name="third_party/boringssl/crypto/asn1/asn1_locl.h" role="src" />

@ -96,4 +96,11 @@ typedef GRPC_CUSTOM_STRINGOUTPUTSTREAM StringOutputStream;
} // namespace protobuf
} // namespace grpc
namespace grpc_cpp_generator {
static const char* const kCppGeneratorMessageHeaderExt = ".pb.h";
static const char* const kCppGeneratorServiceHeaderExt = ".grpc.pb.h";
} // namespace grpc_cpp_generator
#endif // SRC_COMPILER_CONFIG_H

@ -40,9 +40,6 @@
namespace grpc_cpp_generator {
namespace {
grpc::string message_header_ext() { return ".pb.h"; }
grpc::string service_header_ext() { return ".grpc.pb.h"; }
template <class T>
grpc::string as_string(T x) {
std::ostringstream out;
@ -113,7 +110,7 @@ grpc::string GetHeaderPrologue(grpc_generator::File *file,
vars["filename"] = file->filename();
vars["filename_identifier"] = FilenameIdentifier(file->filename());
vars["filename_base"] = file->filename_without_ext();
vars["message_header_ext"] = message_header_ext();
vars["message_header_ext"] = kCppGeneratorMessageHeaderExt;
printer->Print(vars, "// Generated by the gRPC C++ plugin.\n");
printer->Print(vars,
@ -128,6 +125,7 @@ grpc::string GetHeaderPrologue(grpc_generator::File *file,
printer->Print(vars, "#define GRPC_$filename_identifier$__INCLUDED\n");
printer->Print(vars, "\n");
printer->Print(vars, "#include \"$filename_base$$message_header_ext$\"\n");
printer->Print(vars, file->additional_headers().c_str());
printer->Print(vars, "\n");
}
return output;
@ -1039,8 +1037,8 @@ grpc::string GetSourcePrologue(grpc_generator::File *file,
vars["filename"] = file->filename();
vars["filename_base"] = file->filename_without_ext();
vars["message_header_ext"] = message_header_ext();
vars["service_header_ext"] = service_header_ext();
vars["message_header_ext"] = kCppGeneratorMessageHeaderExt;
vars["service_header_ext"] = kCppGeneratorServiceHeaderExt;
printer->Print(vars, "// Generated by the gRPC C++ plugin.\n");
printer->Print(vars,
@ -1049,7 +1047,6 @@ grpc::string GetSourcePrologue(grpc_generator::File *file,
printer->Print(vars, "#include \"$filename_base$$message_header_ext$\"\n");
printer->Print(vars, "#include \"$filename_base$$service_header_ext$\"\n");
printer->Print(vars, file->additional_headers().c_str());
printer->Print(vars, "\n");
}
return output;
@ -1425,8 +1422,8 @@ grpc::string GetMockPrologue(grpc_generator::File *file,
vars["filename"] = file->filename();
vars["filename_base"] = file->filename_without_ext();
vars["message_header_ext"] = message_header_ext();
vars["service_header_ext"] = service_header_ext();
vars["message_header_ext"] = kCppGeneratorMessageHeaderExt;
vars["service_header_ext"] = kCppGeneratorServiceHeaderExt;
printer->Print(vars, "// Generated by the gRPC C++ plugin.\n");
printer->Print(vars,

@ -0,0 +1,223 @@
//
// Copyright 2017, Google Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
#include "src/core/ext/filters/workarounds/workaround_cronet_compression_filter.h"
#include <string.h>
#include <grpc/support/alloc.h>
#include "src/core/ext/filters/workarounds/workaround_utils.h"
#include "src/core/lib/channel/channel_stack_builder.h"
#include "src/core/lib/surface/channel_init.h"
#include "src/core/lib/transport/metadata.h"
typedef struct call_data {
// Receive closures are chained: we inject this closure as the
// recv_initial_metadata_ready up-call on transport_stream_op, and remember to
// call our next_recv_initial_metadata_ready member after handling it.
grpc_closure recv_initial_metadata_ready;
// Used by recv_initial_metadata_ready.
grpc_metadata_batch* recv_initial_metadata;
// Original recv_initial_metadata_ready callback, invoked after our own.
grpc_closure* next_recv_initial_metadata_ready;
// Marks whether the workaround is active
bool workaround_active;
} call_data;
// Find the user agent metadata element in the batch
static bool get_user_agent_mdelem(const grpc_metadata_batch* batch,
grpc_mdelem* md) {
if (batch->idx.named.user_agent != NULL) {
*md = batch->idx.named.user_agent->md;
return true;
}
return false;
}
// Callback invoked when we receive an initial metadata.
static void recv_initial_metadata_ready(grpc_exec_ctx* exec_ctx,
void* user_data, grpc_error* error) {
grpc_call_element* elem = user_data;
call_data* calld = elem->call_data;
if (GRPC_ERROR_NONE == error) {
grpc_mdelem md;
if (get_user_agent_mdelem(calld->recv_initial_metadata, &md)) {
grpc_workaround_user_agent_md* user_agent_md = grpc_parse_user_agent(md);
if (user_agent_md
->workaround_active[GRPC_WORKAROUND_ID_CRONET_COMPRESSION]) {
calld->workaround_active = true;
}
}
}
// Invoke the next callback.
grpc_closure_run(exec_ctx, calld->next_recv_initial_metadata_ready,
GRPC_ERROR_REF(error));
}
// Start transport stream op.
static void start_transport_stream_op_batch(
grpc_exec_ctx* exec_ctx, grpc_call_element* elem,
grpc_transport_stream_op_batch* op) {
call_data* calld = elem->call_data;
// Inject callback for receiving initial metadata
if (op->recv_initial_metadata) {
calld->next_recv_initial_metadata_ready =
op->payload->recv_initial_metadata.recv_initial_metadata_ready;
op->payload->recv_initial_metadata.recv_initial_metadata_ready =
&calld->recv_initial_metadata_ready;
calld->recv_initial_metadata =
op->payload->recv_initial_metadata.recv_initial_metadata;
}
if (op->send_message) {
/* Send message happens after client's user-agent (initial metadata) is
* received, so workaround_active must be set already */
if (calld->workaround_active) {
op->payload->send_message.send_message->flags |= GRPC_WRITE_NO_COMPRESS;
}
}
// Chain to the next filter.
grpc_call_next_op(exec_ctx, elem, op);
}
// Constructor for call_data.
static grpc_error* init_call_elem(grpc_exec_ctx* exec_ctx,
grpc_call_element* elem,
const grpc_call_element_args* args) {
call_data* calld = elem->call_data;
calld->next_recv_initial_metadata_ready = NULL;
calld->workaround_active = false;
grpc_closure_init(&calld->recv_initial_metadata_ready,
recv_initial_metadata_ready, elem,
grpc_schedule_on_exec_ctx);
return GRPC_ERROR_NONE;
}
// Destructor for call_data.
static void destroy_call_elem(grpc_exec_ctx* exec_ctx, grpc_call_element* elem,
const grpc_call_final_info* final_info,
grpc_closure* ignored) {}
// Constructor for channel_data.
static grpc_error* init_channel_elem(grpc_exec_ctx* exec_ctx,
grpc_channel_element* elem,
grpc_channel_element_args* args) {
return GRPC_ERROR_NONE;
}
// Destructor for channel_data.
static void destroy_channel_elem(grpc_exec_ctx* exec_ctx,
grpc_channel_element* elem) {}
// Parse the user agent
static bool parse_user_agent(grpc_mdelem md) {
const char grpc_objc_specifier[] = "grpc-objc/";
const size_t grpc_objc_specifier_len = sizeof(grpc_objc_specifier) - 1;
const char cronet_specifier[] = "cronet_http";
const size_t cronet_specifier_len = sizeof(cronet_specifier) - 1;
char* user_agent_str = grpc_slice_to_c_string(GRPC_MDVALUE(md));
bool grpc_objc_specifier_seen = false;
bool cronet_specifier_seen = false;
char *major_version_str = user_agent_str, *minor_version_str;
long major_version, minor_version;
char* head = strtok(user_agent_str, " ");
while (head != NULL) {
if (!grpc_objc_specifier_seen &&
0 == strncmp(head, grpc_objc_specifier, grpc_objc_specifier_len)) {
major_version_str = head + grpc_objc_specifier_len;
grpc_objc_specifier_seen = true;
} else if (grpc_objc_specifier_seen &&
0 == strncmp(head, cronet_specifier, cronet_specifier_len)) {
cronet_specifier_seen = true;
break;
}
head = strtok(NULL, " ");
}
if (grpc_objc_specifier_seen) {
major_version_str = strtok(major_version_str, ".");
minor_version_str = strtok(NULL, ".");
major_version = atol(major_version_str);
minor_version = atol(minor_version_str);
}
gpr_free(user_agent_str);
return (grpc_objc_specifier_seen && cronet_specifier_seen &&
(major_version < 1 || (major_version == 1 && minor_version <= 3)));
}
const grpc_channel_filter grpc_workaround_cronet_compression_filter = {
start_transport_stream_op_batch,
grpc_channel_next_op,
sizeof(call_data),
init_call_elem,
grpc_call_stack_ignore_set_pollset_or_pollset_set,
destroy_call_elem,
0,
init_channel_elem,
destroy_channel_elem,
grpc_call_next_get_peer,
grpc_channel_next_get_info,
"workaround_cronet_compression"};
static bool register_workaround_cronet_compression(
grpc_exec_ctx* exec_ctx, grpc_channel_stack_builder* builder, void* arg) {
const grpc_channel_args* channel_args =
grpc_channel_stack_builder_get_channel_arguments(builder);
const grpc_arg* a = grpc_channel_args_find(
channel_args, GRPC_ARG_WORKAROUND_CRONET_COMPRESSION);
if (a == NULL) {
return true;
}
if (grpc_channel_arg_get_bool(a, false) == false) {
return true;
}
return grpc_channel_stack_builder_prepend_filter(
builder, &grpc_workaround_cronet_compression_filter, NULL, NULL);
}
void grpc_workaround_cronet_compression_filter_init(void) {
grpc_channel_init_register_stage(
GRPC_SERVER_CHANNEL, GRPC_WORKAROUND_PRIORITY_HIGH,
register_workaround_cronet_compression, NULL);
grpc_register_workaround(GRPC_WORKAROUND_ID_CRONET_COMPRESSION,
parse_user_agent);
}
void grpc_workaround_cronet_compression_filter_shutdown(void) {}

@ -0,0 +1,40 @@
//
// Copyright 2017, Google Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
#ifndef GRPC_CORE_EXT_FILTERS_WORKAROUNDS_WORKAROUND_CRONET_COMPRESSION_FILTER_H
#define GRPC_CORE_EXT_FILTERS_WORKAROUNDS_WORKAROUND_CRONET_COMPRESSION_FILTER_H
#include "src/core/lib/channel/channel_stack.h"
extern const grpc_channel_filter grpc_workaround_cronet_compression_filter;
#endif /* GRPC_CORE_EXT_FILTERS_WORKAROUNDS_WORKAROUND_CRONET_COMPRESSION_FILTER_H \
*/

@ -0,0 +1,65 @@
//
// Copyright 2017, Google Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
#include "src/core/ext/filters/workarounds/workaround_utils.h"
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
user_agent_parser ua_parser[GRPC_MAX_WORKAROUND_ID];
static void destroy_user_agent_md(void *user_agent_md) {
gpr_free(user_agent_md);
}
grpc_workaround_user_agent_md *grpc_parse_user_agent(grpc_mdelem md) {
grpc_workaround_user_agent_md *user_agent_md =
(grpc_workaround_user_agent_md *)grpc_mdelem_get_user_data(
md, destroy_user_agent_md);
if (NULL != user_agent_md) {
return user_agent_md;
}
user_agent_md = gpr_malloc(sizeof(grpc_workaround_user_agent_md));
for (int i = 0; i < GRPC_MAX_WORKAROUND_ID; i++) {
if (ua_parser[i]) {
user_agent_md->workaround_active[i] = ua_parser[i](md);
}
}
grpc_mdelem_set_user_data(md, destroy_user_agent_md, (void *)user_agent_md);
return user_agent_md;
}
void grpc_register_workaround(uint32_t id, user_agent_parser parser) {
GPR_ASSERT(id < GRPC_MAX_WORKAROUND_ID);
ua_parser[id] = parser;
}

@ -0,0 +1,52 @@
//
// Copyright 2017, Google Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
#ifndef GRPC_CORE_EXT_FILTERS_WORKAROUNDS_WORKAROUND_UTILS_H
#define GRPC_CORE_EXT_FILTERS_WORKAROUNDS_WORKAROUND_UTILS_H
#include <grpc/support/workaround_list.h>
#include "src/core/lib/transport/metadata.h"
#define GRPC_WORKAROUND_PRIORITY_HIGH 10001
#define GRPC_WORKAROUND_PROIRITY_LOW 9999
typedef struct grpc_workaround_user_agent_md {
bool workaround_active[GRPC_MAX_WORKAROUND_ID];
} grpc_workaround_user_agent_md;
grpc_workaround_user_agent_md *grpc_parse_user_agent(grpc_mdelem md);
typedef bool (*user_agent_parser)(grpc_mdelem);
void grpc_register_workaround(uint32_t id, user_agent_parser parser);
#endif

@ -31,6 +31,8 @@
*
*/
#include <grpc/support/port_platform.h>
#include <limits.h>
#include <string.h>

@ -769,7 +769,7 @@ grpc_error *grpc_os_error(const char *file, int line, int err,
GRPC_ERROR_INT_ERRNO, err),
GRPC_ERROR_STR_OS_ERROR,
grpc_slice_from_static_string(strerror(err))),
GRPC_ERROR_STR_SYSCALL, grpc_slice_from_static_string(call_name));
GRPC_ERROR_STR_SYSCALL, grpc_slice_from_copied_string(call_name));
}
#ifdef GPR_WINDOWS

@ -46,11 +46,12 @@ void gpr_mpscq_destroy(gpr_mpscq *q) {
GPR_ASSERT(q->tail == &q->stub);
}
void gpr_mpscq_push(gpr_mpscq *q, gpr_mpscq_node *n) {
bool gpr_mpscq_push(gpr_mpscq *q, gpr_mpscq_node *n) {
gpr_atm_no_barrier_store(&n->next, (gpr_atm)NULL);
gpr_mpscq_node *prev =
(gpr_mpscq_node *)gpr_atm_full_xchg(&q->head, (gpr_atm)n);
gpr_atm_rel_store(&prev->next, (gpr_atm)n);
return prev == &q->stub;
}
gpr_mpscq_node *gpr_mpscq_pop(gpr_mpscq *q) {
@ -92,3 +93,25 @@ gpr_mpscq_node *gpr_mpscq_pop_and_check_end(gpr_mpscq *q, bool *empty) {
*empty = false;
return NULL;
}
void gpr_locked_mpscq_init(gpr_locked_mpscq *q) {
gpr_mpscq_init(&q->queue);
q->read_lock = GPR_SPINLOCK_INITIALIZER;
}
void gpr_locked_mpscq_destroy(gpr_locked_mpscq *q) {
gpr_mpscq_destroy(&q->queue);
}
bool gpr_locked_mpscq_push(gpr_locked_mpscq *q, gpr_mpscq_node *n) {
return gpr_mpscq_push(&q->queue, n);
}
gpr_mpscq_node *gpr_locked_mpscq_pop(gpr_locked_mpscq *q) {
if (gpr_spinlock_trylock(&q->read_lock)) {
gpr_mpscq_node *n = gpr_mpscq_pop(&q->queue);
gpr_spinlock_unlock(&q->read_lock);
return n;
}
return NULL;
}

@ -37,6 +37,7 @@
#include <grpc/support/atm.h>
#include <stdbool.h>
#include <stddef.h>
#include "src/core/lib/support/spinlock.h"
// Multiple-producer single-consumer lock free queue, based upon the
// implementation from Dmitry Vyukov here:
@ -58,12 +59,34 @@ typedef struct gpr_mpscq {
void gpr_mpscq_init(gpr_mpscq *q);
void gpr_mpscq_destroy(gpr_mpscq *q);
// Push a node
void gpr_mpscq_push(gpr_mpscq *q, gpr_mpscq_node *n);
// Thread safe - can be called from multiple threads concurrently
// Returns true if this was possibly the first node (may return true
// sporadically, will not return false sporadically)
bool gpr_mpscq_push(gpr_mpscq *q, gpr_mpscq_node *n);
// Pop a node (returns NULL if no node is ready - which doesn't indicate that
// the queue is empty!!)
// Thread compatible - can only be called from one thread at a time
gpr_mpscq_node *gpr_mpscq_pop(gpr_mpscq *q);
// Pop a node; sets *empty to true if the queue is empty, or false if it is not
gpr_mpscq_node *gpr_mpscq_pop_and_check_end(gpr_mpscq *q, bool *empty);
// An mpscq with a spinlock: it's safe to pop from multiple threads, but doing
// only one thread will succeed concurrently
typedef struct gpr_locked_mpscq {
gpr_mpscq queue;
gpr_spinlock read_lock;
} gpr_locked_mpscq;
void gpr_locked_mpscq_init(gpr_locked_mpscq *q);
void gpr_locked_mpscq_destroy(gpr_locked_mpscq *q);
// Push a node
// Thread safe - can be called from multiple threads concurrently
// Returns true if this was possibly the first node (may return true
// sporadically, will not return false sporadically)
bool gpr_locked_mpscq_push(gpr_locked_mpscq *q, gpr_mpscq_node *n);
// Pop a node (returns NULL if no node is ready - which doesn't indicate that
// the queue is empty!!)
// Thread safe - can be called from multiple threads concurrently
gpr_mpscq_node *gpr_locked_mpscq_pop(gpr_locked_mpscq *q);
#endif /* GRPC_CORE_LIB_SUPPORT_MPSCQ_H */

File diff suppressed because it is too large Load Diff

@ -49,7 +49,13 @@ extern grpc_tracer_flag grpc_trace_operation_failures;
extern grpc_tracer_flag grpc_trace_pending_tags;
#endif
#ifdef __cplusplus
extern "C" {
#endif
typedef struct grpc_cq_completion {
gpr_mpscq_node node;
/** user supplied tag */
void *tag;
/** done callback - called when this queue element is no longer
@ -101,7 +107,13 @@ bool grpc_cq_can_listen(grpc_completion_queue *cc);
grpc_cq_completion_type grpc_get_cq_completion_type(grpc_completion_queue *cc);
int grpc_get_cq_poll_num(grpc_completion_queue *cc);
grpc_completion_queue *grpc_completion_queue_create_internal(
grpc_cq_completion_type completion_type, grpc_cq_polling_type polling_type);
#ifdef __cplusplus
}
#endif
#endif /* GRPC_CORE_LIB_SURFACE_COMPLETION_QUEUE_H */

@ -47,7 +47,8 @@
#include "src/core/lib/iomgr/executor.h"
#include "src/core/lib/iomgr/iomgr.h"
#include "src/core/lib/slice/slice_internal.h"
#include "src/core/lib/support/stack_lockfree.h"
#include "src/core/lib/support/mpscq.h"
#include "src/core/lib/support/spinlock.h"
#include "src/core/lib/support/string.h"
#include "src/core/lib/surface/api_trace.h"
#include "src/core/lib/surface/call.h"
@ -76,6 +77,7 @@ typedef enum { BATCH_CALL, REGISTERED_CALL } requested_call_type;
grpc_tracer_flag grpc_server_channel_trace = GRPC_TRACER_INITIALIZER(false);
typedef struct requested_call {
gpr_mpscq_node request_link; /* must be first */
requested_call_type type;
size_t cq_idx;
void *tag;
@ -175,7 +177,7 @@ struct request_matcher {
grpc_server *server;
call_data *pending_head;
call_data *pending_tail;
gpr_stack_lockfree **requests_per_cq;
gpr_locked_mpscq *requests_per_cq;
};
struct registered_method {
@ -220,11 +222,6 @@ struct grpc_server {
registered_method *registered_methods;
/** one request matcher for unregistered methods */
request_matcher unregistered_request_matcher;
/** free list of available requested_calls_per_cq indices */
gpr_stack_lockfree **request_freelist_per_cq;
/** requested call backing data */
requested_call **requested_calls_per_cq;
int max_requested_calls_per_cq;
gpr_atm shutdown_flag;
uint8_t shutdown_published;
@ -324,21 +321,20 @@ static void channel_broadcaster_shutdown(grpc_exec_ctx *exec_ctx,
* request_matcher
*/
static void request_matcher_init(request_matcher *rm, size_t entries,
grpc_server *server) {
static void request_matcher_init(request_matcher *rm, grpc_server *server) {
memset(rm, 0, sizeof(*rm));
rm->server = server;
rm->requests_per_cq =
gpr_malloc(sizeof(*rm->requests_per_cq) * server->cq_count);
for (size_t i = 0; i < server->cq_count; i++) {
rm->requests_per_cq[i] = gpr_stack_lockfree_create(entries);
gpr_locked_mpscq_init(&rm->requests_per_cq[i]);
}
}
static void request_matcher_destroy(request_matcher *rm) {
for (size_t i = 0; i < rm->server->cq_count; i++) {
GPR_ASSERT(gpr_stack_lockfree_pop(rm->requests_per_cq[i]) == -1);
gpr_stack_lockfree_destroy(rm->requests_per_cq[i]);
GPR_ASSERT(gpr_locked_mpscq_pop(&rm->requests_per_cq[i]) == NULL);
gpr_locked_mpscq_destroy(&rm->requests_per_cq[i]);
}
gpr_free(rm->requests_per_cq);
}
@ -368,13 +364,17 @@ static void request_matcher_kill_requests(grpc_exec_ctx *exec_ctx,
grpc_server *server,
request_matcher *rm,
grpc_error *error) {
int request_id;
requested_call *rc;
for (size_t i = 0; i < server->cq_count; i++) {
while ((request_id = gpr_stack_lockfree_pop(rm->requests_per_cq[i])) !=
-1) {
fail_call(exec_ctx, server, i,
&server->requested_calls_per_cq[i][request_id],
GRPC_ERROR_REF(error));
/* Here we know:
1. no requests are being added (since the server is shut down)
2. no other threads are pulling (since the shut down process is single
threaded)
So, we can ignore the queue lock and just pop, with the guarantee that a
NULL returned here truly means that the queue is empty */
while ((rc = (requested_call *)gpr_mpscq_pop(
&rm->requests_per_cq[i].queue)) != NULL) {
fail_call(exec_ctx, server, i, rc, GRPC_ERROR_REF(error));
}
}
GRPC_ERROR_UNREF(error);
@ -409,13 +409,7 @@ static void server_delete(grpc_exec_ctx *exec_ctx, grpc_server *server) {
}
for (i = 0; i < server->cq_count; i++) {
GRPC_CQ_INTERNAL_UNREF(exec_ctx, server->cqs[i], "server");
if (server->started) {
gpr_stack_lockfree_destroy(server->request_freelist_per_cq[i]);
gpr_free(server->requested_calls_per_cq[i]);
}
}
gpr_free(server->request_freelist_per_cq);
gpr_free(server->requested_calls_per_cq);
gpr_free(server->cqs);
gpr_free(server->pollsets);
gpr_free(server->shutdown_tags);
@ -473,21 +467,7 @@ static void destroy_channel(grpc_exec_ctx *exec_ctx, channel_data *chand,
static void done_request_event(grpc_exec_ctx *exec_ctx, void *req,
grpc_cq_completion *c) {
requested_call *rc = req;
grpc_server *server = rc->server;
if (rc >= server->requested_calls_per_cq[rc->cq_idx] &&
rc < server->requested_calls_per_cq[rc->cq_idx] +
server->max_requested_calls_per_cq) {
GPR_ASSERT(rc - server->requested_calls_per_cq[rc->cq_idx] <= INT_MAX);
gpr_stack_lockfree_push(
server->request_freelist_per_cq[rc->cq_idx],
(int)(rc - server->requested_calls_per_cq[rc->cq_idx]));
} else {
gpr_free(req);
}
server_unref(exec_ctx, server);
gpr_free(req);
}
static void publish_call(grpc_exec_ctx *exec_ctx, grpc_server *server,
@ -516,10 +496,6 @@ static void publish_call(grpc_exec_ctx *exec_ctx, grpc_server *server,
GPR_UNREACHABLE_CODE(return );
}
grpc_call_element *elem =
grpc_call_stack_element(grpc_call_get_call_stack(call), 0);
channel_data *chand = elem->channel_data;
server_ref(chand->server);
grpc_cq_end_op(exec_ctx, calld->cq_new, rc->tag, GRPC_ERROR_NONE,
done_request_event, rc, &rc->completion);
}
@ -547,15 +523,15 @@ static void publish_new_rpc(grpc_exec_ctx *exec_ctx, void *arg,
for (size_t i = 0; i < server->cq_count; i++) {
size_t cq_idx = (chand->cq_idx + i) % server->cq_count;
int request_id = gpr_stack_lockfree_pop(rm->requests_per_cq[cq_idx]);
if (request_id == -1) {
requested_call *rc =
(requested_call *)gpr_locked_mpscq_pop(&rm->requests_per_cq[cq_idx]);
if (rc == NULL) {
continue;
} else {
gpr_mu_lock(&calld->mu_state);
calld->state = ACTIVATED;
gpr_mu_unlock(&calld->mu_state);
publish_call(exec_ctx, server, calld, cq_idx,
&server->requested_calls_per_cq[cq_idx][request_id]);
publish_call(exec_ctx, server, calld, cq_idx, rc);
return; /* early out */
}
}
@ -1029,8 +1005,6 @@ grpc_server *grpc_server_create(const grpc_channel_args *args, void *reserved) {
server->root_channel_data.next = server->root_channel_data.prev =
&server->root_channel_data;
/* TODO(ctiller): expose a channel_arg for this */
server->max_requested_calls_per_cq = 32768;
server->channel_args = grpc_channel_args_copy(args);
return server;
@ -1103,29 +1077,15 @@ void grpc_server_start(grpc_server *server) {
server->started = true;
server->pollset_count = 0;
server->pollsets = gpr_malloc(sizeof(grpc_pollset *) * server->cq_count);
server->request_freelist_per_cq =
gpr_malloc(sizeof(*server->request_freelist_per_cq) * server->cq_count);
server->requested_calls_per_cq =
gpr_malloc(sizeof(*server->requested_calls_per_cq) * server->cq_count);
for (i = 0; i < server->cq_count; i++) {
if (grpc_cq_can_listen(server->cqs[i])) {
server->pollsets[server->pollset_count++] =
grpc_cq_pollset(server->cqs[i]);
}
server->request_freelist_per_cq[i] =
gpr_stack_lockfree_create((size_t)server->max_requested_calls_per_cq);
for (int j = 0; j < server->max_requested_calls_per_cq; j++) {
gpr_stack_lockfree_push(server->request_freelist_per_cq[i], j);
}
server->requested_calls_per_cq[i] =
gpr_malloc((size_t)server->max_requested_calls_per_cq *
sizeof(*server->requested_calls_per_cq[i]));
}
request_matcher_init(&server->unregistered_request_matcher,
(size_t)server->max_requested_calls_per_cq, server);
request_matcher_init(&server->unregistered_request_matcher, server);
for (registered_method *rm = server->registered_methods; rm; rm = rm->next) {
request_matcher_init(&rm->request_matcher,
(size_t)server->max_requested_calls_per_cq, server);
request_matcher_init(&rm->request_matcher, server);
}
server_ref(server);
@ -1379,21 +1339,11 @@ static grpc_call_error queue_call_request(grpc_exec_ctx *exec_ctx,
requested_call *rc) {
call_data *calld = NULL;
request_matcher *rm = NULL;
int request_id;
if (gpr_atm_acq_load(&server->shutdown_flag)) {
fail_call(exec_ctx, server, cq_idx, rc,
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Server Shutdown"));
return GRPC_CALL_OK;
}
request_id = gpr_stack_lockfree_pop(server->request_freelist_per_cq[cq_idx]);
if (request_id == -1) {
/* out of request ids: just fail this one */
fail_call(exec_ctx, server, cq_idx, rc,
grpc_error_set_int(
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Out of request ids"),
GRPC_ERROR_INT_LIMIT, server->max_requested_calls_per_cq));
return GRPC_CALL_OK;
}
switch (rc->type) {
case BATCH_CALL:
rm = &server->unregistered_request_matcher;
@ -1402,15 +1352,13 @@ static grpc_call_error queue_call_request(grpc_exec_ctx *exec_ctx,
rm = &rc->data.registered.registered_method->request_matcher;
break;
}
server->requested_calls_per_cq[cq_idx][request_id] = *rc;
gpr_free(rc);
if (gpr_stack_lockfree_push(rm->requests_per_cq[cq_idx], request_id)) {
if (gpr_locked_mpscq_push(&rm->requests_per_cq[cq_idx], &rc->request_link)) {
/* this was the first queued request: we need to lock and start
matching calls */
gpr_mu_lock(&server->mu_call);
while ((calld = rm->pending_head) != NULL) {
request_id = gpr_stack_lockfree_pop(rm->requests_per_cq[cq_idx]);
if (request_id == -1) break;
rc = (requested_call *)gpr_locked_mpscq_pop(&rm->requests_per_cq[cq_idx]);
if (rc == NULL) break;
rm->pending_head = calld->pending_next;
gpr_mu_unlock(&server->mu_call);
gpr_mu_lock(&calld->mu_state);
@ -1426,8 +1374,7 @@ static grpc_call_error queue_call_request(grpc_exec_ctx *exec_ctx,
GPR_ASSERT(calld->state == PENDING);
calld->state = ACTIVATED;
gpr_mu_unlock(&calld->mu_state);
publish_call(exec_ctx, server, calld, cq_idx,
&server->requested_calls_per_cq[cq_idx][request_id]);
publish_call(exec_ctx, server, calld, cq_idx, rc);
}
gpr_mu_lock(&server->mu_call);
}
@ -1534,7 +1481,6 @@ static void fail_call(grpc_exec_ctx *exec_ctx, grpc_server *server,
rc->initial_metadata->count = 0;
GPR_ASSERT(error != GRPC_ERROR_NONE);
server_ref(server);
grpc_cq_end_op(exec_ctx, server->cqs[cq_idx], rc->tag, error,
done_request_event, rc, &rc->completion);
}

@ -61,6 +61,8 @@ extern void grpc_max_age_filter_init(void);
extern void grpc_max_age_filter_shutdown(void);
extern void grpc_message_size_filter_init(void);
extern void grpc_message_size_filter_shutdown(void);
extern void grpc_workaround_cronet_compression_filter_init(void);
extern void grpc_workaround_cronet_compression_filter_shutdown(void);
void grpc_register_built_in_plugins(void) {
grpc_register_plugin(grpc_http_filters_init,
@ -91,4 +93,6 @@ void grpc_register_built_in_plugins(void) {
grpc_max_age_filter_shutdown);
grpc_register_plugin(grpc_message_size_filter_init,
grpc_message_size_filter_shutdown);
grpc_register_plugin(grpc_workaround_cronet_compression_filter_init,
grpc_workaround_cronet_compression_filter_shutdown);
}

@ -61,6 +61,8 @@ extern void grpc_max_age_filter_init(void);
extern void grpc_max_age_filter_shutdown(void);
extern void grpc_message_size_filter_init(void);
extern void grpc_message_size_filter_shutdown(void);
extern void grpc_workaround_cronet_compression_filter_init(void);
extern void grpc_workaround_cronet_compression_filter_shutdown(void);
void grpc_register_built_in_plugins(void) {
grpc_register_plugin(grpc_http_filters_init,
@ -91,4 +93,6 @@ void grpc_register_built_in_plugins(void) {
grpc_max_age_filter_shutdown);
grpc_register_plugin(grpc_message_size_filter_init,
grpc_message_size_filter_shutdown);
grpc_register_plugin(grpc_workaround_cronet_compression_filter_init,
grpc_workaround_cronet_compression_filter_shutdown);
}

@ -686,6 +686,7 @@ bool ServerInterface::GenericAsyncRequest::FinalizeResult(void** tag,
StringFromCopiedSlice(call_details_.method);
static_cast<GenericServerContext*>(context_)->host_ =
StringFromCopiedSlice(call_details_.host);
context_->deadline_ = call_details_.deadline;
}
grpc_slice_unref(call_details_.method);
grpc_slice_unref(call_details_.host);

@ -19,27 +19,27 @@
<ItemGroup>
<EmbeddedResource Include="..\..\..\etc\roots.pem" />
<Content Include="..\nativelibs\macosx_x64\libgrpc_csharp_ext.dylib">
<Content Include="..\nativelibs\csharp_ext_macos_x64\libgrpc_csharp_ext.dylib">
<PackagePath>runtimes/osx/native/libgrpc_csharp_ext.x64.dylib</PackagePath>
<Pack>true</Pack>
</Content>
<Content Include="..\nativelibs\macosx_x86\libgrpc_csharp_ext.dylib">
<Content Include="..\nativelibs\csharp_ext_macos_x86\libgrpc_csharp_ext.dylib">
<PackagePath>runtimes/osx/native/libgrpc_csharp_ext.x86.dylib</PackagePath>
<Pack>true</Pack>
</Content>
<Content Include="..\nativelibs\linux_x64\libgrpc_csharp_ext.so">
<Content Include="..\nativelibs\csharp_ext_linux_x64\libgrpc_csharp_ext.so">
<PackagePath>runtimes/linux/native/libgrpc_csharp_ext.x64.so</PackagePath>
<Pack>true</Pack>
</Content>
<Content Include="..\nativelibs\linux_x86\libgrpc_csharp_ext.so">
<Content Include="..\nativelibs\csharp_ext_linux_x86\libgrpc_csharp_ext.so">
<PackagePath>runtimes/linux/native/libgrpc_csharp_ext.x86.so</PackagePath>
<Pack>true</Pack>
</Content>
<Content Include="..\nativelibs\windows_x64\grpc_csharp_ext.dll">
<Content Include="..\nativelibs\csharp_ext_windows_x64\grpc_csharp_ext.dll">
<PackagePath>runtimes/win/native/grpc_csharp_ext.x64.dll</PackagePath>
<Pack>true</Pack>
</Content>
<Content Include="..\nativelibs\windows_x86\grpc_csharp_ext.dll">
<Content Include="..\nativelibs\csharp_ext_windows_x86\grpc_csharp_ext.dll">
<PackagePath>runtimes/win/native/grpc_csharp_ext.x86.dll</PackagePath>
<Pack>true</Pack>
</Content>

@ -17,17 +17,17 @@
</metadata>
<files>
<!-- forward slashes in src path enable building on Linux -->
<file src="protoc_plugins/windows_x86/protoc.exe" target="tools/windows_x86/protoc.exe" />
<file src="protoc_plugins/windows_x86/grpc_csharp_plugin.exe" target="tools/windows_x86/grpc_csharp_plugin.exe" />
<file src="protoc_plugins/windows_x64/protoc.exe" target="tools/windows_x64/protoc.exe" />
<file src="protoc_plugins/windows_x64/grpc_csharp_plugin.exe" target="tools/windows_x64/grpc_csharp_plugin.exe" />
<file src="protoc_plugins/linux_x86/protoc" target="tools/linux_x86/protoc" />
<file src="protoc_plugins/linux_x86/grpc_csharp_plugin" target="tools/linux_x86/grpc_csharp_plugin" />
<file src="protoc_plugins/linux_x64/protoc" target="tools/linux_x64/protoc" />
<file src="protoc_plugins/linux_x64/grpc_csharp_plugin" target="tools/linux_x64/grpc_csharp_plugin" />
<file src="protoc_plugins/macosx_x86/protoc" target="tools/macosx_x86/protoc" />
<file src="protoc_plugins/macosx_x86/grpc_csharp_plugin" target="tools/macosx_x86/grpc_csharp_plugin" />
<file src="protoc_plugins/macosx_x64/protoc" target="tools/macosx_x64/protoc" />
<file src="protoc_plugins/macosx_x64/grpc_csharp_plugin" target="tools/macosx_x64/grpc_csharp_plugin" />
<file src="protoc_plugins/protoc_windows_x86/protoc.exe" target="tools/windows_x86/protoc.exe" />
<file src="protoc_plugins/protoc_windows_x86/grpc_csharp_plugin.exe" target="tools/windows_x86/grpc_csharp_plugin.exe" />
<file src="protoc_plugins/protoc_windows_x64/protoc.exe" target="tools/windows_x64/protoc.exe" />
<file src="protoc_plugins/protoc_windows_x64/grpc_csharp_plugin.exe" target="tools/windows_x64/grpc_csharp_plugin.exe" />
<file src="protoc_plugins/protoc_linux_x86/protoc" target="tools/linux_x86/protoc" />
<file src="protoc_plugins/protoc_linux_x86/grpc_csharp_plugin" target="tools/linux_x86/grpc_csharp_plugin" />
<file src="protoc_plugins/protoc_linux_x64/protoc" target="tools/linux_x64/protoc" />
<file src="protoc_plugins/protoc_linux_x64/grpc_csharp_plugin" target="tools/linux_x64/grpc_csharp_plugin" />
<file src="protoc_plugins/protoc_macos_x86/protoc" target="tools/macosx_x86/protoc" />
<file src="protoc_plugins/protoc_macos_x86/grpc_csharp_plugin" target="tools/macosx_x86/grpc_csharp_plugin" />
<file src="protoc_plugins/protoc_macos_x64/protoc" target="tools/macosx_x64/protoc" />
<file src="protoc_plugins/protoc_macos_x64/grpc_csharp_plugin" target="tools/macosx_x64/grpc_csharp_plugin" />
</files>
</package>

@ -36,29 +36,20 @@ set DOTNET=dotnet
set -ex
mkdir -p ..\..\artifacts\
mkdir ..\..\artifacts
@rem Collect the artifacts built by the previous build step if running on Jenkins
@rem TODO(jtattermusch): is there a better way to do this?
xcopy /Y /I ..\..\architecture=x86,language=csharp,platform=windows\artifacts\* nativelibs\windows_x86\
xcopy /Y /I ..\..\architecture=x64,language=csharp,platform=windows\artifacts\* nativelibs\windows_x64\
xcopy /Y /I ..\..\architecture=x86,language=csharp,platform=linux\artifacts\* nativelibs\linux_x86\
xcopy /Y /I ..\..\architecture=x64,language=csharp,platform=linux\artifacts\* nativelibs\linux_x64\
xcopy /Y /I ..\..\architecture=x86,language=csharp,platform=macos\artifacts\* nativelibs\macosx_x86\
xcopy /Y /I ..\..\architecture=x64,language=csharp,platform=macos\artifacts\* nativelibs\macosx_x64\
mkdir nativelibs
powershell -Command "cp -r ..\..\platform=*\artifacts\csharp_ext_* nativelibs"
@rem Collect protoc artifacts built by the previous build step
xcopy /Y /I ..\..\architecture=x86,language=protoc,platform=windows\artifacts\* protoc_plugins\windows_x86\
xcopy /Y /I ..\..\architecture=x64,language=protoc,platform=windows\artifacts\* protoc_plugins\windows_x64\
xcopy /Y /I ..\..\architecture=x86,language=protoc,platform=linux\artifacts\* protoc_plugins\linux_x86\
xcopy /Y /I ..\..\architecture=x64,language=protoc,platform=linux\artifacts\* protoc_plugins\linux_x64\
xcopy /Y /I ..\..\architecture=x86,language=protoc,platform=macos\artifacts\* protoc_plugins\macosx_x86\
xcopy /Y /I ..\..\architecture=x64,language=protoc,platform=macos\artifacts\* protoc_plugins\macosx_x64\
mkdir protoc_plugins
powershell -Command "cp -r ..\..\platform=*\artifacts\protoc_* protoc_plugins"
%DOTNET% restore Grpc.sln || goto :error
@rem To be able to build, we also need to put grpc_csharp_ext to its normal location
xcopy /Y /I nativelibs\windows_x64\grpc_csharp_ext.dll ..\..\cmake\build\x64\Release\
xcopy /Y /I nativelibs\csharp_ext_windows_x64\grpc_csharp_ext.dll ..\..\cmake\build\x64\Release\
%DOTNET% pack --configuration Release Grpc.Core --output ..\..\..\artifacts || goto :error
%DOTNET% pack --configuration Release Grpc.Core.Testing --output ..\..\..\artifacts || goto :error

@ -34,35 +34,19 @@ cd $(dirname $0)
mkdir -p ../../artifacts/
mkdir -p nativelibs/windows_x86 nativelibs/windows_x64 \
nativelibs/linux_x86 nativelibs/linux_x64 \
nativelibs/macosx_x86 nativelibs/macosx_x64
mkdir -p protoc_plugins/windows_x86 protoc_plugins/windows_x64 \
protoc_plugins/linux_x86 protoc_plugins/linux_x64 \
protoc_plugins/macosx_x86 protoc_plugins/macosx_x64
# Collect the artifacts built by the previous build step if running on Jenkins
cp $EXTERNAL_GIT_ROOT/architecture=x86,language=csharp,platform=windows/artifacts/* nativelibs/windows_x86 || true
cp $EXTERNAL_GIT_ROOT/architecture=x64,language=csharp,platform=windows/artifacts/* nativelibs/windows_x64 || true
cp $EXTERNAL_GIT_ROOT/architecture=x86,language=csharp,platform=linux/artifacts/* nativelibs/linux_x86 || true
cp $EXTERNAL_GIT_ROOT/architecture=x64,language=csharp,platform=linux/artifacts/* nativelibs/linux_x64 || true
cp $EXTERNAL_GIT_ROOT/architecture=x86,language=csharp,platform=macos/artifacts/* nativelibs/macosx_x86 || true
cp $EXTERNAL_GIT_ROOT/architecture=x64,language=csharp,platform=macos/artifacts/* nativelibs/macosx_x64 || true
# Collect the artifacts built by the previous build step
mkdir -p nativelibs
cp -r $EXTERNAL_GIT_ROOT/platform={windows,linux,macos}/artifacts/csharp_ext_* nativelibs || true
# Collect protoc artifacts built by the previous build step
cp $EXTERNAL_GIT_ROOT/architecture=x86,language=protoc,platform=windows/artifacts/* protoc_plugins/windows_x86 || true
cp $EXTERNAL_GIT_ROOT/architecture=x64,language=protoc,platform=windows/artifacts/* protoc_plugins/windows_x64 || true
cp $EXTERNAL_GIT_ROOT/architecture=x86,language=protoc,platform=linux/artifacts/* protoc_plugins/linux_x86 || true
cp $EXTERNAL_GIT_ROOT/architecture=x64,language=protoc,platform=linux/artifacts/* protoc_plugins/linux_x64 || true
cp $EXTERNAL_GIT_ROOT/architecture=x86,language=protoc,platform=macos/artifacts/* protoc_plugins/macosx_x86 || true
cp $EXTERNAL_GIT_ROOT/architecture=x64,language=protoc,platform=macos/artifacts/* protoc_plugins/macosx_x64 || true
mkdir -p protoc_plugins
cp -r $EXTERNAL_GIT_ROOT/platform={windows,linux,macos}/artifacts/protoc_* protoc_plugins || true
dotnet restore Grpc.sln
# To be able to build, we also need to put grpc_csharp_ext to its normal location
mkdir -p ../../libs/opt
cp nativelibs/linux_x64/libgrpc_csharp_ext.so ../../libs/opt
cp nativelibs/csharp_ext_linux_x64/libgrpc_csharp_ext.so ../../libs/opt
dotnet pack --configuration Release Grpc.Core --output ../../../artifacts
dotnet pack --configuration Release Grpc.Core.Testing --output ../../../artifacts

@ -42,8 +42,11 @@ grpc_proto_library(
grpc_proto_library(
name = "control_proto",
srcs = ["control.proto"],
deps = ["payloads_proto", "stats_proto"],
has_services = False,
deps = [
"payloads_proto",
"stats_proto",
],
)
grpc_proto_library(
@ -101,5 +104,8 @@ grpc_proto_library(
grpc_proto_library(
name = "test_proto",
srcs = ["test.proto"],
deps = ["empty_proto", "messages_proto"],
deps = [
"empty_proto",
"messages_proto",
],
)

@ -244,6 +244,10 @@ message ScenarioResultSummary
// Number of requests that succeeded/failed
double successful_requests_per_second = 13;
double failed_requests_per_second = 14;
// Number of polls called inside completion queue per request
double client_polls_per_request = 15;
double server_polls_per_request = 16;
}
// Results of a single benchmark scenario.

@ -47,6 +47,9 @@ message ServerStats {
// change in idle time of the server (data from proc/stat)
uint64 idle_cpu_time = 5;
// Number of polls called inside completion queue
uint64 cq_poll_count = 6;
}
// Histogram params based on grpc/support/histogram.c
@ -81,4 +84,7 @@ message ClientStats {
// Number of failed requests (one row per status code seen)
repeated RequestResultCount request_results = 5;
// Number of polls called inside completion queue
uint64 cq_poll_count = 6;
}

@ -318,6 +318,8 @@ CORE_SOURCE_FILES = [
'src/core/ext/census/tracing.c',
'src/core/ext/filters/max_age/max_age_filter.c',
'src/core/ext/filters/message_size/message_size_filter.c',
'src/core/ext/filters/workarounds/workaround_cronet_compression_filter.c',
'src/core/ext/filters/workarounds/workaround_utils.c',
'src/core/plugin_registry/grpc_plugin_registry.c',
'src/boringssl/err_data.c',
'third_party/boringssl/crypto/aes/aes.c',

@ -56,7 +56,8 @@ INSTALL_REQUIRES = (
'grpcio>={version}'.format(version=grpc_version.VERSION),
'grpcio-tools>={version}'.format(version=grpc_version.VERSION),
'grpcio-health-checking>={version}'.format(version=grpc_version.VERSION),
'oauth2client>=1.4.7', 'protobuf>=3.3.0', 'six>=1.10',)
'oauth2client>=1.4.7', 'protobuf>=3.3.0', 'six>=1.10', 'google-auth>=1.0.0',
'requests>=2.14.2')
COMMAND_CLASS = {
# Run `preprocess` *before* doing any packaging!

@ -29,10 +29,11 @@
"""The Python implementation of the GRPC interoperability test client."""
import argparse
from oauth2client import client as oauth2client_client
import os
from google import auth as google_auth
from google.auth import jwt as google_auth_jwt
import grpc
from grpc.beta import implementations
from src.proto.grpc.testing import test_pb2
from tests.interop import methods
@ -84,25 +85,24 @@ def _application_default_credentials():
def _stub(args):
target = '{}:{}'.format(args.server_host, args.server_port)
if args.test_case == 'oauth2_auth_token':
google_credentials = _application_default_credentials()
scoped_credentials = google_credentials.create_scoped(
[args.oauth_scope])
access_token = scoped_credentials.get_access_token().access_token
call_credentials = grpc.access_token_call_credentials(access_token)
google_credentials, unused_project_id = google_auth.default(
scopes=[args.oauth_scope])
google_credentials.refresh(google_auth.transport.requests.Request())
call_credentials = grpc.access_token_call_credentials(
google_credentials.token)
elif args.test_case == 'compute_engine_creds':
google_credentials = _application_default_credentials()
scoped_credentials = google_credentials.create_scoped(
[args.oauth_scope])
# TODO(https://github.com/grpc/grpc/issues/6799): Eliminate this last
# remaining use of the Beta API.
call_credentials = implementations.google_call_credentials(
scoped_credentials)
google_credentials, unused_project_id = google_auth.default(
scopes=[args.oauth_scope])
call_credentials = grpc.metadata_call_credentials(
google_auth.transport.grpc.AuthMetadataPlugin(
credentials=google_credentials,
request=google_auth.transport.requests.Request()))
elif args.test_case == 'jwt_token_creds':
google_credentials = _application_default_credentials()
# TODO(https://github.com/grpc/grpc/issues/6799): Eliminate this last
# remaining use of the Beta API.
call_credentials = implementations.google_call_credentials(
google_credentials)
google_credentials = google_auth_jwt.OnDemandCredentials.from_service_account_file(
os.environ[google_auth.environment_vars.CREDENTIALS])
call_credentials = grpc.metadata_call_credentials(
google_auth.transport.grpc.AuthMetadataPlugin(
credentials=google_credentials, request=None))
else:
call_credentials = None
if args.use_tls:

@ -33,8 +33,10 @@ import json
import os
import threading
from oauth2client import client as oauth2client_client
from google import auth as google_auth
from google.auth import environment_vars as google_auth_environment_vars
from google.auth.transport import grpc as google_auth_transport_grpc
from google.auth.transport import requests as google_auth_transport_requests
import grpc
from grpc.beta import implementations
@ -401,8 +403,7 @@ def _compute_engine_creds(stub, args):
def _oauth2_auth_token(stub, args):
json_key_filename = os.environ[
oauth2client_client.GOOGLE_APPLICATION_CREDENTIALS]
json_key_filename = os.environ[google_auth_environment_vars.CREDENTIALS]
wanted_email = json.load(open(json_key_filename, 'rb'))['client_email']
response = _large_unary_common_behavior(stub, True, True, None)
if wanted_email != response.username:
@ -414,8 +415,7 @@ def _oauth2_auth_token(stub, args):
def _jwt_token_creds(stub, args):
json_key_filename = os.environ[
oauth2client_client.GOOGLE_APPLICATION_CREDENTIALS]
json_key_filename = os.environ[google_auth_environment_vars.CREDENTIALS]
wanted_email = json.load(open(json_key_filename, 'rb'))['client_email']
response = _large_unary_common_behavior(stub, True, False, None)
if wanted_email != response.username:
@ -424,15 +424,14 @@ def _jwt_token_creds(stub, args):
def _per_rpc_creds(stub, args):
json_key_filename = os.environ[
oauth2client_client.GOOGLE_APPLICATION_CREDENTIALS]
json_key_filename = os.environ[google_auth_environment_vars.CREDENTIALS]
wanted_email = json.load(open(json_key_filename, 'rb'))['client_email']
credentials = oauth2client_client.GoogleCredentials.get_application_default()
scoped_credentials = credentials.create_scoped([args.oauth_scope])
# TODO(https://github.com/grpc/grpc/issues/6799): Eliminate this last
# remaining use of the Beta API.
call_credentials = implementations.google_call_credentials(
scoped_credentials)
google_credentials, unused_project_id = google_auth.default(
scopes=[args.oauth_scope])
call_credentials = grpc.metadata_call_credentials(
google_auth_transport_grpc.AuthMetadataPlugin(
credentials=google_credentials,
request=google_auth_transport_requests.Request()))
response = _large_unary_common_behavior(stub, True, False, call_credentials)
if wanted_email != response.username:
raise ValueError('expected username %s, got %s' %

@ -38,29 +38,20 @@
set -ex
mkdir -p ..\..\artifacts${"\\"}
mkdir ..\..\artifacts
@rem Collect the artifacts built by the previous build step if running on Jenkins
@rem TODO(jtattermusch): is there a better way to do this?
xcopy /Y /I ..\..\architecture=x86,language=csharp,platform=windows\artifacts\* nativelibs\windows_x86${"\\"}
xcopy /Y /I ..\..\architecture=x64,language=csharp,platform=windows\artifacts\* nativelibs\windows_x64${"\\"}
xcopy /Y /I ..\..\architecture=x86,language=csharp,platform=linux\artifacts\* nativelibs\linux_x86${"\\"}
xcopy /Y /I ..\..\architecture=x64,language=csharp,platform=linux\artifacts\* nativelibs\linux_x64${"\\"}
xcopy /Y /I ..\..\architecture=x86,language=csharp,platform=macos\artifacts\* nativelibs\macosx_x86${"\\"}
xcopy /Y /I ..\..\architecture=x64,language=csharp,platform=macos\artifacts\* nativelibs\macosx_x64${"\\"}
mkdir nativelibs
powershell -Command "cp -r ..\..\platform=*\artifacts\csharp_ext_* nativelibs"
@rem Collect protoc artifacts built by the previous build step
xcopy /Y /I ..\..\architecture=x86,language=protoc,platform=windows\artifacts\* protoc_plugins\windows_x86${"\\"}
xcopy /Y /I ..\..\architecture=x64,language=protoc,platform=windows\artifacts\* protoc_plugins\windows_x64${"\\"}
xcopy /Y /I ..\..\architecture=x86,language=protoc,platform=linux\artifacts\* protoc_plugins\linux_x86${"\\"}
xcopy /Y /I ..\..\architecture=x64,language=protoc,platform=linux\artifacts\* protoc_plugins\linux_x64${"\\"}
xcopy /Y /I ..\..\architecture=x86,language=protoc,platform=macos\artifacts\* protoc_plugins\macosx_x86${"\\"}
xcopy /Y /I ..\..\architecture=x64,language=protoc,platform=macos\artifacts\* protoc_plugins\macosx_x64${"\\"}
mkdir protoc_plugins
powershell -Command "cp -r ..\..\platform=*\artifacts\protoc_* protoc_plugins"
%%DOTNET% restore Grpc.sln || goto :error
@rem To be able to build, we also need to put grpc_csharp_ext to its normal location
xcopy /Y /I nativelibs\windows_x64\grpc_csharp_ext.dll ..\..\cmake\build\x64\Release${"\\"}
xcopy /Y /I nativelibs\csharp_ext_windows_x64\grpc_csharp_ext.dll ..\..\cmake\build\x64\Release${"\\"}
%%DOTNET% pack --configuration Release Grpc.Core --output ..\..\..\artifacts || goto :error
%%DOTNET% pack --configuration Release Grpc.Core.Testing --output ..\..\..\artifacts || goto :error

@ -36,35 +36,19 @@
mkdir -p ../../artifacts/
mkdir -p nativelibs/windows_x86 nativelibs/windows_x64 ${"\\"}
nativelibs/linux_x86 nativelibs/linux_x64 ${"\\"}
nativelibs/macosx_x86 nativelibs/macosx_x64
mkdir -p protoc_plugins/windows_x86 protoc_plugins/windows_x64 ${"\\"}
protoc_plugins/linux_x86 protoc_plugins/linux_x64 ${"\\"}
protoc_plugins/macosx_x86 protoc_plugins/macosx_x64
# Collect the artifacts built by the previous build step if running on Jenkins
cp $EXTERNAL_GIT_ROOT/architecture=x86,language=csharp,platform=windows/artifacts/* nativelibs/windows_x86 || true
cp $EXTERNAL_GIT_ROOT/architecture=x64,language=csharp,platform=windows/artifacts/* nativelibs/windows_x64 || true
cp $EXTERNAL_GIT_ROOT/architecture=x86,language=csharp,platform=linux/artifacts/* nativelibs/linux_x86 || true
cp $EXTERNAL_GIT_ROOT/architecture=x64,language=csharp,platform=linux/artifacts/* nativelibs/linux_x64 || true
cp $EXTERNAL_GIT_ROOT/architecture=x86,language=csharp,platform=macos/artifacts/* nativelibs/macosx_x86 || true
cp $EXTERNAL_GIT_ROOT/architecture=x64,language=csharp,platform=macos/artifacts/* nativelibs/macosx_x64 || true
# Collect the artifacts built by the previous build step
mkdir -p nativelibs
cp -r $EXTERNAL_GIT_ROOT/platform={windows,linux,macos}/artifacts/csharp_ext_* nativelibs || true
# Collect protoc artifacts built by the previous build step
cp $EXTERNAL_GIT_ROOT/architecture=x86,language=protoc,platform=windows/artifacts/* protoc_plugins/windows_x86 || true
cp $EXTERNAL_GIT_ROOT/architecture=x64,language=protoc,platform=windows/artifacts/* protoc_plugins/windows_x64 || true
cp $EXTERNAL_GIT_ROOT/architecture=x86,language=protoc,platform=linux/artifacts/* protoc_plugins/linux_x86 || true
cp $EXTERNAL_GIT_ROOT/architecture=x64,language=protoc,platform=linux/artifacts/* protoc_plugins/linux_x64 || true
cp $EXTERNAL_GIT_ROOT/architecture=x86,language=protoc,platform=macos/artifacts/* protoc_plugins/macosx_x86 || true
cp $EXTERNAL_GIT_ROOT/architecture=x64,language=protoc,platform=macos/artifacts/* protoc_plugins/macosx_x64 || true
mkdir -p protoc_plugins
cp -r $EXTERNAL_GIT_ROOT/platform={windows,linux,macos}/artifacts/protoc_* protoc_plugins || true
dotnet restore Grpc.sln
# To be able to build, we also need to put grpc_csharp_ext to its normal location
mkdir -p ../../libs/opt
cp nativelibs/linux_x64/libgrpc_csharp_ext.so ../../libs/opt
cp nativelibs/csharp_ext_linux_x64/libgrpc_csharp_ext.so ../../libs/opt
dotnet pack --configuration Release Grpc.Core --output ../../../artifacts
dotnet pack --configuration Release Grpc.Core.Testing --output ../../../artifacts

@ -27,6 +27,8 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary")
licenses(["notice"]) # 3-clause BSD
load(":generate_tests.bzl", "grpc_bad_client_tests")

@ -212,12 +212,14 @@ static void client_validator(grpc_slice_buffer *incoming) {
}
int main(int argc, char **argv) {
int i;
grpc_test_init(argc, argv);
// Test sending more metadata than the server will accept.
gpr_strvec headers;
gpr_strvec_init(&headers);
for (int i = 0; i < NUM_HEADERS; ++i) {
for (i = 0; i < NUM_HEADERS; ++i) {
char *str;
gpr_asprintf(&str, "%s%02d%s",
PFX_TOO_MUCH_METADATA_FROM_CLIENT_HEADER_START_STR, i,

@ -27,6 +27,8 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary")
licenses(["notice"]) # 3-clause BSD
load(":generate_tests.bzl", "grpc_bad_ssl_tests")

@ -27,12 +27,14 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary")
licenses(["notice"]) # 3-clause BSD
cc_test(
grpc_cc_test(
name = "context_test",
srcs = ["context_test.c"],
copts = ["-std=c99"],
language = "C",
deps = [
"//:gpr",
"//:grpc",
@ -41,10 +43,10 @@ cc_test(
],
)
cc_test(
grpc_cc_test(
name = "mlog_test",
srcs = ["mlog_test.c"],
copts = ["-std=c99"],
language = "C",
deps = [
"//:gpr",
"//:grpc",
@ -53,10 +55,10 @@ cc_test(
],
)
cc_test(
grpc_cc_test(
name = "resource_test",
srcs = ["resource_test.c"],
copts = ["-std=c99"],
language = "C",
data = [
":data/resource_empty_name.pb",
":data/resource_full.pb",
@ -73,10 +75,10 @@ cc_test(
],
)
cc_test(
grpc_cc_test(
name = "trace_context_test",
srcs = ["trace_context_test.c"],
copts = ["-std=c99"],
language = "C",
data = [
":data/context_empty.pb",
":data/context_full.pb",

@ -27,12 +27,14 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary")
licenses(["notice"]) # 3-clause BSD
cc_test(
grpc_cc_test(
name = "channel_args_test",
srcs = ["channel_args_test.c"],
copts = ["-std=c99"],
language = "C",
deps = [
"//:gpr",
"//:grpc",
@ -41,10 +43,10 @@ cc_test(
],
)
cc_test(
grpc_cc_test(
name = "channel_stack_test",
srcs = ["channel_stack_test.c"],
copts = ["-std=c99"],
language = "C",
deps = [
"//:gpr",
"//:grpc",

@ -27,21 +27,33 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary")
licenses(["notice"]) # 3-clause BSD
load("//test/core/util:grpc_fuzzer.bzl", "grpc_fuzzer")
grpc_fuzzer(
name = "uri_fuzzer_test",
srcs = ["uri_fuzzer_test.c"],
deps = ["//:gpr", "//:grpc", "//test/core/util:grpc_test_util"],
corpus = "uri_corpus",
copts = ["-std=c99"],
name = "uri_fuzzer_test",
srcs = ["uri_fuzzer_test.c"],
language = "C",
corpus = "uri_corpus",
deps = [
"//:gpr",
"//:grpc",
"//test/core/util:grpc_test_util",
],
)
cc_test(
grpc_cc_test(
name = "lb_policies_test",
srcs = ["lb_policies_test.c"],
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util", "//test/core/end2end:cq_verifier"],
copts = ['-std=c99']
language = "C",
deps = [
"//:gpr",
"//:grpc",
"//test/core/end2end:cq_verifier",
"//test/core/util:gpr_test_util",
"//test/core/util:grpc_test_util",
],
)

@ -27,12 +27,14 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary")
licenses(["notice"]) # 3-clause BSD
cc_test(
grpc_cc_test(
name = "dns_resolver_connectivity_test",
srcs = ["dns_resolver_connectivity_test.c"],
copts = ["-std=c99"],
language = "C",
deps = [
"//:gpr",
"//:grpc",
@ -41,10 +43,10 @@ cc_test(
],
)
cc_test(
grpc_cc_test(
name = "dns_resolver_test",
srcs = ["dns_resolver_test.c"],
copts = ["-std=c99"],
language = "C",
deps = [
"//:gpr",
"//:grpc",
@ -53,10 +55,10 @@ cc_test(
],
)
cc_test(
grpc_cc_test(
name = "sockaddr_resolver_test",
srcs = ["sockaddr_resolver_test.c"],
copts = ["-std=c99"],
language = "C",
deps = [
"//:gpr",
"//:grpc",
@ -65,10 +67,10 @@ cc_test(
],
)
cc_test(
grpc_cc_test(
name = "fake_resolver_test",
srcs = ["fake_resolver_test.c"],
copts = ["-std=c99"],
language = "C",
deps = [
"//:gpr",
"//:grpc",

@ -27,12 +27,14 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary")
licenses(["notice"]) # 3-clause BSD
cc_test(
grpc_cc_test(
name = "algorithm_test",
srcs = ["algorithm_test.c"],
copts = ["-std=c99"],
language = "C",
deps = [
"//:gpr",
"//:grpc",
@ -41,10 +43,10 @@ cc_test(
],
)
cc_test(
grpc_cc_test(
name = "compression_test",
srcs = ["compression_test.c"],
copts = ["-std=c99"],
language = "C",
deps = [
"//:gpr",
"//:grpc",
@ -53,10 +55,10 @@ cc_test(
],
)
cc_test(
grpc_cc_test(
name = "message_compress_test",
srcs = ["message_compress_test.c"],
copts = ["-std=c99"],
language = "C",
deps = [
"//:gpr",
"//:grpc",

@ -27,15 +27,17 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary")
licenses(["notice"]) # 3-clause BSD
load(":generate_tests.bzl", "grpc_end2end_tests")
cc_library(
grpc_cc_library(
name = "cq_verifier",
srcs = ["cq_verifier.c"],
hdrs = ["cq_verifier.h"],
copts = ["-std=c99"],
language = "C",
visibility = ["//test:__subpackages__"],
deps = [
"//:gpr",
@ -44,7 +46,7 @@ cc_library(
],
)
cc_library(
grpc_cc_library(
name = "ssl_test_data",
srcs = [
"data/client_certs.c",
@ -53,15 +55,15 @@ cc_library(
"data/test_root_cert.c",
],
hdrs = ["data/ssl_test_data.h"],
copts = ["-std=c99"],
language = "C",
visibility = ["//test:__subpackages__"],
)
cc_library(
grpc_cc_library(
name = "fake_resolver",
srcs = ["fake_resolver.c"],
hdrs = ["fake_resolver.h"],
copts = ["-std=c99"],
language = "C",
visibility = ["//test:__subpackages__"],
deps = [
"//:gpr",
@ -70,11 +72,11 @@ cc_library(
],
)
cc_library(
grpc_cc_library(
name = "http_proxy",
srcs = ["fixtures/http_proxy_fixture.c"],
hdrs = ["fixtures/http_proxy_fixture.h"],
copts = ["-std=c99"],
language = "C",
deps = [
"//:gpr",
"//:grpc",
@ -82,11 +84,11 @@ cc_library(
],
)
cc_library(
grpc_cc_library(
name = "proxy",
srcs = ["fixtures/proxy.c"],
hdrs = ["fixtures/proxy.h"],
copts = ["-std=c99"],
language = "C",
deps = [
"//:gpr",
"//:grpc",

@ -145,6 +145,8 @@ extern void streaming_error_response(grpc_end2end_test_config config);
extern void streaming_error_response_pre_init(void);
extern void trailing_metadata(grpc_end2end_test_config config);
extern void trailing_metadata_pre_init(void);
extern void workaround_cronet_compression(grpc_end2end_test_config config);
extern void workaround_cronet_compression_pre_init(void);
extern void write_buffering(grpc_end2end_test_config config);
extern void write_buffering_pre_init(void);
extern void write_buffering_at_end(grpc_end2end_test_config config);
@ -204,6 +206,7 @@ void grpc_end2end_tests_pre_init(void) {
simple_request_pre_init();
streaming_error_response_pre_init();
trailing_metadata_pre_init();
workaround_cronet_compression_pre_init();
write_buffering_pre_init();
write_buffering_at_end_pre_init();
}
@ -265,6 +268,7 @@ void grpc_end2end_tests(int argc, char **argv,
simple_request(config);
streaming_error_response(config);
trailing_metadata(config);
workaround_cronet_compression(config);
write_buffering(config);
write_buffering_at_end(config);
return;
@ -471,6 +475,10 @@ void grpc_end2end_tests(int argc, char **argv,
trailing_metadata(config);
continue;
}
if (0 == strcmp("workaround_cronet_compression", argv[i])) {
workaround_cronet_compression(config);
continue;
}
if (0 == strcmp("write_buffering", argv[i])) {
write_buffering(config);
continue;

@ -147,6 +147,8 @@ extern void streaming_error_response(grpc_end2end_test_config config);
extern void streaming_error_response_pre_init(void);
extern void trailing_metadata(grpc_end2end_test_config config);
extern void trailing_metadata_pre_init(void);
extern void workaround_cronet_compression(grpc_end2end_test_config config);
extern void workaround_cronet_compression_pre_init(void);
extern void write_buffering(grpc_end2end_test_config config);
extern void write_buffering_pre_init(void);
extern void write_buffering_at_end(grpc_end2end_test_config config);
@ -207,6 +209,7 @@ void grpc_end2end_tests_pre_init(void) {
simple_request_pre_init();
streaming_error_response_pre_init();
trailing_metadata_pre_init();
workaround_cronet_compression_pre_init();
write_buffering_pre_init();
write_buffering_at_end_pre_init();
}
@ -269,6 +272,7 @@ void grpc_end2end_tests(int argc, char **argv,
simple_request(config);
streaming_error_response(config);
trailing_metadata(config);
workaround_cronet_compression(config);
write_buffering(config);
write_buffering_at_end(config);
return;
@ -479,6 +483,10 @@ void grpc_end2end_tests(int argc, char **argv,
trailing_metadata(config);
continue;
}
if (0 == strcmp("workaround_cronet_compression", argv[i])) {
workaround_cronet_compression(config);
continue;
}
if (0 == strcmp("write_buffering", argv[i])) {
write_buffering(config);
continue;

@ -48,6 +48,7 @@ typedef struct grpc_end2end_test_config grpc_end2end_test_config;
#define FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER 32
#define FEATURE_MASK_DOES_NOT_SUPPORT_RESOURCE_QUOTA_SERVER 64
#define FEATURE_MASK_DOES_NOT_SUPPORT_NETWORK_STATUS_CHANGE 128
#define FEATURE_MASK_SUPPORTS_WORKAROUNDS 256
#define FAIL_AUTH_CHECK_SERVER_ARG_NAME "fail_auth_check"

@ -0,0 +1,137 @@
/*
*
* Copyright 2015, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include "test/core/end2end/end2end_tests.h"
#include <string.h>
#include <grpc/support/alloc.h>
#include <grpc/support/host_port.h>
#include <grpc/support/log.h>
#include <grpc/support/sync.h>
#include <grpc/support/thd.h>
#include <grpc/support/useful.h>
#include <grpc/support/workaround_list.h>
#include "src/core/ext/filters/client_channel/client_channel.h"
#include "src/core/ext/filters/http/server/http_server_filter.h"
#include "src/core/ext/transport/chttp2/transport/chttp2_transport.h"
#include "src/core/lib/channel/connected_channel.h"
#include "src/core/lib/surface/channel.h"
#include "src/core/lib/surface/server.h"
#include "test/core/util/port.h"
#include "test/core/util/test_config.h"
static char *workarounds_arg[GRPC_MAX_WORKAROUND_ID] = {
GRPC_ARG_WORKAROUND_CRONET_COMPRESSION};
typedef struct fullstack_fixture_data {
char *localaddr;
} fullstack_fixture_data;
static grpc_end2end_test_fixture chttp2_create_fixture_fullstack(
grpc_channel_args *client_args, grpc_channel_args *server_args) {
grpc_end2end_test_fixture f;
int port = grpc_pick_unused_port_or_die();
fullstack_fixture_data *ffd = gpr_malloc(sizeof(fullstack_fixture_data));
memset(&f, 0, sizeof(f));
gpr_join_host_port(&ffd->localaddr, "localhost", port);
f.fixture_data = ffd;
f.cq = grpc_completion_queue_create_for_next(NULL);
f.shutdown_cq = grpc_completion_queue_create_for_pluck(NULL);
return f;
}
void chttp2_init_client_fullstack(grpc_end2end_test_fixture *f,
grpc_channel_args *client_args) {
fullstack_fixture_data *ffd = f->fixture_data;
f->client = grpc_insecure_channel_create(ffd->localaddr, client_args, NULL);
GPR_ASSERT(f->client);
}
void chttp2_init_server_fullstack(grpc_end2end_test_fixture *f,
grpc_channel_args *server_args) {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
fullstack_fixture_data *ffd = f->fixture_data;
grpc_arg args[GRPC_MAX_WORKAROUND_ID];
for (uint32_t i = 0; i < GRPC_MAX_WORKAROUND_ID; i++) {
args[i].key = workarounds_arg[i];
args[i].type = GRPC_ARG_INTEGER;
args[i].value.integer = 1;
}
grpc_channel_args *server_args_new =
grpc_channel_args_copy_and_add(server_args, args, GRPC_MAX_WORKAROUND_ID);
if (f->server) {
grpc_server_destroy(f->server);
}
f->server = grpc_server_create(server_args_new, NULL);
grpc_server_register_completion_queue(f->server, f->cq, NULL);
GPR_ASSERT(grpc_server_add_insecure_http2_port(f->server, ffd->localaddr));
grpc_server_start(f->server);
grpc_channel_args_destroy(&exec_ctx, server_args_new);
grpc_exec_ctx_finish(&exec_ctx);
}
void chttp2_tear_down_fullstack(grpc_end2end_test_fixture *f) {
fullstack_fixture_data *ffd = f->fixture_data;
gpr_free(ffd->localaddr);
gpr_free(ffd);
}
/* All test configurations */
static grpc_end2end_test_config configs[] = {
{"chttp2/fullstack", FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION |
FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL |
FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER |
FEATURE_MASK_SUPPORTS_WORKAROUNDS,
chttp2_create_fixture_fullstack, chttp2_init_client_fullstack,
chttp2_init_server_fullstack, chttp2_tear_down_fullstack},
};
int main(int argc, char **argv) {
size_t i;
grpc_test_init(argc, argv);
grpc_end2end_tests_pre_init();
grpc_init();
for (i = 0; i < sizeof(configs) / sizeof(*configs); i++) {
grpc_end2end_tests(argc, argv, configs[i]);
}
grpc_shutdown();
return 0;
}

@ -27,30 +27,45 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary")
licenses(["notice"]) # 3-clause BSD
load("//test/core/util:grpc_fuzzer.bzl", "grpc_fuzzer")
grpc_fuzzer(
name = "api_fuzzer",
srcs = ["api_fuzzer.c"],
deps = ["//:gpr", "//:grpc", "//test/core/util:grpc_test_util", "//test/core/end2end:ssl_test_data"],
corpus = "api_fuzzer_corpus",
copts = ["-std=c99"],
name = "api_fuzzer",
srcs = ["api_fuzzer.c"],
language = "C",
corpus = "api_fuzzer_corpus",
deps = [
"//:gpr",
"//:grpc",
"//test/core/end2end:ssl_test_data",
"//test/core/util:grpc_test_util",
],
)
grpc_fuzzer(
name = "client_fuzzer",
srcs = ["client_fuzzer.c"],
deps = ["//:gpr", "//:grpc", "//test/core/util:grpc_test_util"],
corpus = "client_fuzzer_corpus",
copts = ["-std=c99"],
name = "client_fuzzer",
srcs = ["client_fuzzer.c"],
language = "C",
corpus = "client_fuzzer_corpus",
deps = [
"//:gpr",
"//:grpc",
"//test/core/util:grpc_test_util",
],
)
grpc_fuzzer(
name = "server_fuzzer",
srcs = ["server_fuzzer.c"],
deps = ["//:gpr", "//:grpc", "//test/core/util:grpc_test_util"],
corpus = "server_fuzzer_corpus",
copts = ["-std=c99"],
name = "server_fuzzer",
srcs = ["server_fuzzer.c"],
language = "C",
corpus = "server_fuzzer_corpus",
deps = [
"//:gpr",
"//:grpc",
"//test/core/util:grpc_test_util",
],
)

@ -60,6 +60,7 @@ END2END_FIXTURES = {
'h2_full+pipe': default_unsecure_fixture_options._replace(
platforms=['linux'], exclude_iomgrs=['uv']),
'h2_full+trace': default_unsecure_fixture_options._replace(tracing=True),
'h2_full+workarounds': default_unsecure_fixture_options,
'h2_http_proxy': default_unsecure_fixture_options._replace(
ci_mac=False, exclude_iomgrs=['uv']),
'h2_oauth2': default_secure_fixture_options._replace(
@ -151,6 +152,7 @@ END2END_TESTS = {
'simple_request': default_test_options,
'streaming_error_response': default_test_options._replace(cpu_cost=LOWCPU),
'trailing_metadata': default_test_options,
'workaround_cronet_compression': default_test_options,
'write_buffering': default_test_options._replace(cpu_cost=LOWCPU),
'write_buffering_at_end': default_test_options._replace(cpu_cost=LOWCPU),
}

@ -28,6 +28,7 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
load("//bazel:grpc_build_system.bzl", "grpc_sh_test", "grpc_cc_binary", "grpc_cc_library")
"""Generates the appropriate build.json data for all the end2end tests."""
@ -56,6 +57,7 @@ END2END_FIXTURES = {
'h2_full': fixture_options(),
'h2_full+pipe': fixture_options(platforms=['linux']),
'h2_full+trace': fixture_options(tracing=True),
'h2_full+workarounds': fixture_options(),
'h2_http_proxy': fixture_options(),
'h2_oauth2': fixture_options(),
'h2_proxy': fixture_options(includes_proxy=True),
@ -135,6 +137,7 @@ END2END_TESTS = {
'trailing_metadata': test_options(),
'authority_not_supported': test_options(),
'filter_latency': test_options(),
'workaround_cronet_compression': test_options(),
'write_buffering': test_options(),
'write_buffering_at_end': test_options(),
}
@ -157,7 +160,7 @@ def compatible(fopt, topt):
def grpc_end2end_tests():
native.cc_library(
grpc_cc_library(
name = 'end2end_tests',
srcs = ['end2end_tests.c', 'end2end_test_utils.c'] + [
'tests/%s.c' % t
@ -166,31 +169,33 @@ def grpc_end2end_tests():
'tests/cancel_test_helpers.h',
'end2end_tests.h'
],
copts = ['-std=c99'],
language = "C",
deps = [
':cq_verifier',
':ssl_test_data',
':fake_resolver',
':http_proxy',
':proxy',
'//test/core/util:grpc_test_util',
'//:grpc',
'//test/core/util:gpr_test_util',
'//:gpr',
]
)
for f, fopt in END2END_FIXTURES.items():
native.cc_binary(
grpc_cc_binary(
name = '%s_test' % f,
srcs = ['fixtures/%s.c' % f],
copts = ['-std=c99'],
deps = [':end2end_tests']
language = "C",
deps = [
':end2end_tests',
'//test/core/util:grpc_test_util',
'//:grpc',
'//test/core/util:gpr_test_util',
'//:gpr',
],
)
for t, topt in END2END_TESTS.items():
#print(compatible(fopt, topt), f, t, fopt, topt)
if not compatible(fopt, topt): continue
native.sh_test(
grpc_sh_test(
name = '%s_test@%s' % (f, t),
srcs = ['end2end_test.sh'],
args = ['$(location %s_test)' % f, t],

@ -0,0 +1,411 @@
/*
*
* Copyright 2015, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include "test/core/end2end/end2end_tests.h"
#include <stdio.h>
#include <string.h>
#include <grpc/byte_buffer.h>
#include <grpc/byte_buffer_reader.h>
#include <grpc/compression.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
#include <grpc/support/time.h>
#include <grpc/support/useful.h>
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/surface/call.h"
#include "src/core/lib/surface/call_test_only.h"
#include "src/core/lib/transport/static_metadata.h"
#include "test/core/end2end/cq_verifier.h"
static void *tag(intptr_t t) { return (void *)t; }
static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config,
const char *test_name,
grpc_channel_args *client_args,
grpc_channel_args *server_args) {
grpc_end2end_test_fixture f;
gpr_log(GPR_INFO, "Running test: %s/%s", test_name, config.name);
f = config.create_fixture(client_args, server_args);
config.init_server(&f, server_args);
config.init_client(&f, client_args);
return f;
}
static gpr_timespec n_seconds_from_now(int n) {
return grpc_timeout_seconds_to_deadline(n);
}
static gpr_timespec five_seconds_from_now(void) {
return n_seconds_from_now(5);
}
static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev;
do {
ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN);
}
static void shutdown_server(grpc_end2end_test_fixture *f) {
if (!f->server) return;
grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000));
GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000),
grpc_timeout_seconds_to_deadline(5),
NULL)
.type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server);
f->server = NULL;
}
static void shutdown_client(grpc_end2end_test_fixture *f) {
if (!f->client) return;
grpc_channel_destroy(f->client);
f->client = NULL;
}
static void end_test(grpc_end2end_test_fixture *f) {
shutdown_server(f);
shutdown_client(f);
grpc_completion_queue_shutdown(f->cq);
drain_cq(f->cq);
grpc_completion_queue_destroy(f->cq);
grpc_completion_queue_destroy(f->shutdown_cq);
}
static void request_with_payload_template(
grpc_end2end_test_config config, const char *test_name,
uint32_t client_send_flags_bitmask,
grpc_compression_algorithm default_client_channel_compression_algorithm,
grpc_compression_algorithm default_server_channel_compression_algorithm,
grpc_compression_algorithm expected_algorithm_from_client,
grpc_compression_algorithm expected_algorithm_from_server,
grpc_metadata *client_init_metadata, bool set_server_level,
grpc_compression_level server_compression_level,
char *user_agent_override) {
grpc_call *c;
grpc_call *s;
grpc_slice request_payload_slice;
grpc_byte_buffer *request_payload;
grpc_channel_args *client_args;
grpc_channel_args *server_args;
grpc_end2end_test_fixture f;
grpc_op ops[6];
grpc_op *op;
grpc_metadata_array initial_metadata_recv;
grpc_metadata_array trailing_metadata_recv;
grpc_metadata_array request_metadata_recv;
grpc_byte_buffer *request_payload_recv = NULL;
grpc_byte_buffer *response_payload;
grpc_byte_buffer *response_payload_recv;
grpc_call_details call_details;
grpc_status_code status;
grpc_call_error error;
grpc_slice details;
int was_cancelled = 2;
cq_verifier *cqv;
char request_str[1024];
char response_str[1024];
memset(request_str, 'x', 1023);
request_str[1023] = '\0';
memset(response_str, 'y', 1023);
response_str[1023] = '\0';
request_payload_slice = grpc_slice_from_copied_string(request_str);
grpc_slice response_payload_slice =
grpc_slice_from_copied_string(response_str);
client_args = grpc_channel_args_set_compression_algorithm(
NULL, default_client_channel_compression_algorithm);
server_args = grpc_channel_args_set_compression_algorithm(
NULL, default_server_channel_compression_algorithm);
if (user_agent_override) {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_channel_args *client_args_old = client_args;
grpc_arg arg;
arg.key = GRPC_ARG_PRIMARY_USER_AGENT_STRING;
arg.type = GRPC_ARG_STRING;
arg.value.string = user_agent_override;
client_args = grpc_channel_args_copy_and_add(client_args_old, &arg, 1);
grpc_channel_args_destroy(&exec_ctx, client_args_old);
grpc_exec_ctx_finish(&exec_ctx);
}
f = begin_test(config, test_name, client_args, server_args);
cqv = cq_verifier_create(f.cq);
gpr_timespec deadline = five_seconds_from_now();
c = grpc_channel_create_call(
f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq,
grpc_slice_from_static_string("/foo"),
get_host_override_slice("foo.test.google.fr:1234", config), deadline,
NULL);
GPR_ASSERT(c);
grpc_metadata_array_init(&initial_metadata_recv);
grpc_metadata_array_init(&trailing_metadata_recv);
grpc_metadata_array_init(&request_metadata_recv);
grpc_call_details_init(&call_details);
memset(ops, 0, sizeof(ops));
op = ops;
op->op = GRPC_OP_SEND_INITIAL_METADATA;
if (client_init_metadata != NULL) {
op->data.send_initial_metadata.count = 1;
op->data.send_initial_metadata.metadata = client_init_metadata;
} else {
op->data.send_initial_metadata.count = 0;
}
op->flags = 0;
op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_INITIAL_METADATA;
op->data.recv_initial_metadata.recv_initial_metadata = &initial_metadata_recv;
op->flags = 0;
op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_STATUS_ON_CLIENT;
op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv;
op->data.recv_status_on_client.status = &status;
op->data.recv_status_on_client.status_details = &details;
op->flags = 0;
op->reserved = NULL;
op++;
error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL);
GPR_ASSERT(GRPC_CALL_OK == error);
error =
grpc_server_request_call(f.server, &s, &call_details,
&request_metadata_recv, f.cq, f.cq, tag(100));
GPR_ASSERT(GRPC_CALL_OK == error);
CQ_EXPECT_COMPLETION(cqv, tag(100), true);
cq_verify(cqv);
GPR_ASSERT(GPR_BITCOUNT(grpc_call_test_only_get_encodings_accepted_by_peer(
s)) == GRPC_COMPRESS_ALGORITHMS_COUNT);
GPR_ASSERT(GPR_BITGET(grpc_call_test_only_get_encodings_accepted_by_peer(s),
GRPC_COMPRESS_NONE) != 0);
GPR_ASSERT(GPR_BITGET(grpc_call_test_only_get_encodings_accepted_by_peer(s),
GRPC_COMPRESS_DEFLATE) != 0);
GPR_ASSERT(GPR_BITGET(grpc_call_test_only_get_encodings_accepted_by_peer(s),
GRPC_COMPRESS_GZIP) != 0);
memset(ops, 0, sizeof(ops));
op = ops;
op->op = GRPC_OP_SEND_INITIAL_METADATA;
op->data.send_initial_metadata.count = 0;
if (set_server_level) {
op->data.send_initial_metadata.maybe_compression_level.is_set = true;
op->data.send_initial_metadata.maybe_compression_level.level =
server_compression_level;
}
op->flags = 0;
op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_CLOSE_ON_SERVER;
op->data.recv_close_on_server.cancelled = &was_cancelled;
op->flags = 0;
op->reserved = NULL;
op++;
error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(101), NULL);
GPR_ASSERT(GRPC_CALL_OK == error);
for (int i = 0; i < 2; i++) {
request_payload = grpc_raw_byte_buffer_create(&request_payload_slice, 1);
response_payload = grpc_raw_byte_buffer_create(&response_payload_slice, 1);
memset(ops, 0, sizeof(ops));
op = ops;
op->op = GRPC_OP_SEND_MESSAGE;
op->data.send_message.send_message = request_payload;
op->flags = client_send_flags_bitmask;
op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_MESSAGE;
op->data.recv_message.recv_message = &response_payload_recv;
op->flags = 0;
op->reserved = NULL;
op++;
error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(2), NULL);
GPR_ASSERT(GRPC_CALL_OK == error);
memset(ops, 0, sizeof(ops));
op = ops;
op->op = GRPC_OP_RECV_MESSAGE;
op->data.recv_message.recv_message = &request_payload_recv;
op->flags = 0;
op->reserved = NULL;
op++;
error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL);
GPR_ASSERT(GRPC_CALL_OK == error);
CQ_EXPECT_COMPLETION(cqv, tag(102), 1);
cq_verify(cqv);
GPR_ASSERT(request_payload_recv->type == GRPC_BB_RAW);
GPR_ASSERT(byte_buffer_eq_string(request_payload_recv, request_str));
GPR_ASSERT(request_payload_recv->data.raw.compression ==
expected_algorithm_from_client);
memset(ops, 0, sizeof(ops));
op = ops;
op->op = GRPC_OP_SEND_MESSAGE;
op->data.send_message.send_message = response_payload;
op->flags = 0;
op->reserved = NULL;
op++;
error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(103), NULL);
GPR_ASSERT(GRPC_CALL_OK == error);
CQ_EXPECT_COMPLETION(cqv, tag(103), 1);
CQ_EXPECT_COMPLETION(cqv, tag(2), 1);
cq_verify(cqv);
GPR_ASSERT(response_payload_recv->type == GRPC_BB_RAW);
GPR_ASSERT(byte_buffer_eq_string(response_payload_recv, response_str));
if (server_compression_level > GRPC_COMPRESS_LEVEL_NONE) {
const grpc_compression_algorithm algo_for_server_level =
grpc_call_compression_for_level(s, server_compression_level);
GPR_ASSERT(response_payload_recv->data.raw.compression ==
algo_for_server_level);
} else {
GPR_ASSERT(response_payload_recv->data.raw.compression ==
expected_algorithm_from_server);
}
grpc_byte_buffer_destroy(request_payload);
grpc_byte_buffer_destroy(response_payload);
grpc_byte_buffer_destroy(request_payload_recv);
grpc_byte_buffer_destroy(response_payload_recv);
}
grpc_slice_unref(request_payload_slice);
grpc_slice_unref(response_payload_slice);
memset(ops, 0, sizeof(ops));
op = ops;
op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT;
op->flags = 0;
op->reserved = NULL;
op++;
error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(3), NULL);
GPR_ASSERT(GRPC_CALL_OK == error);
memset(ops, 0, sizeof(ops));
op = ops;
op->op = GRPC_OP_SEND_STATUS_FROM_SERVER;
op->data.send_status_from_server.trailing_metadata_count = 0;
op->data.send_status_from_server.status = GRPC_STATUS_OK;
grpc_slice status_details = grpc_slice_from_static_string("xyz");
op->data.send_status_from_server.status_details = &status_details;
op->flags = 0;
op->reserved = NULL;
op++;
error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(104), NULL);
GPR_ASSERT(GRPC_CALL_OK == error);
CQ_EXPECT_COMPLETION(cqv, tag(1), 1);
CQ_EXPECT_COMPLETION(cqv, tag(3), 1);
CQ_EXPECT_COMPLETION(cqv, tag(101), 1);
CQ_EXPECT_COMPLETION(cqv, tag(104), 1);
cq_verify(cqv);
GPR_ASSERT(status == GRPC_STATUS_OK);
GPR_ASSERT(0 == grpc_slice_str_cmp(details, "xyz"));
GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo"));
validate_host_override_string("foo.test.google.fr:1234", call_details.host,
config);
GPR_ASSERT(was_cancelled == 0);
grpc_slice_unref(details);
grpc_metadata_array_destroy(&initial_metadata_recv);
grpc_metadata_array_destroy(&trailing_metadata_recv);
grpc_metadata_array_destroy(&request_metadata_recv);
grpc_call_details_destroy(&call_details);
grpc_call_unref(c);
grpc_call_unref(s);
cq_verifier_destroy(cqv);
{
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_channel_args_destroy(&exec_ctx, client_args);
grpc_channel_args_destroy(&exec_ctx, server_args);
grpc_exec_ctx_finish(&exec_ctx);
}
end_test(&f);
config.tear_down_data(&f);
}
typedef struct workaround_cronet_compression_config {
char *user_agent_override;
grpc_compression_algorithm expected_algorithm_from_server;
} workaround_cronet_compression_config;
static workaround_cronet_compression_config workaround_configs[] = {
{NULL, GRPC_COMPRESS_GZIP},
{"grpc-objc/1.3.0-dev grpc-c/3.0.0-dev (ios; cronet_http; gentle)",
GRPC_COMPRESS_NONE},
{"grpc-objc/1.3.0-dev grpc-c/3.0.0-dev (ios; chttp2; gentle)",
GRPC_COMPRESS_GZIP},
{"grpc-objc/1.4.0 grpc-c/3.0.0-dev (ios; cronet_http; gentle)",
GRPC_COMPRESS_GZIP}};
static const size_t workaround_configs_num =
sizeof(workaround_configs) / sizeof(*workaround_configs);
static void test_workaround_cronet_compression(
grpc_end2end_test_config config) {
for (uint32_t i = 0; i < workaround_configs_num; i++) {
request_with_payload_template(
config, "test_invoke_request_with_compressed_payload", 0,
GRPC_COMPRESS_GZIP, GRPC_COMPRESS_GZIP, GRPC_COMPRESS_GZIP,
workaround_configs[i].expected_algorithm_from_server, NULL, false,
/* ignored */ GRPC_COMPRESS_LEVEL_NONE,
workaround_configs[i].user_agent_override);
}
}
void workaround_cronet_compression(grpc_end2end_test_config config) {
if (config.feature_mask & FEATURE_MASK_SUPPORTS_WORKAROUNDS) {
test_workaround_cronet_compression(config);
}
}
void workaround_cronet_compression_pre_init(void) {}

@ -27,36 +27,68 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary")
licenses(["notice"]) # 3-clause BSD
load("//test/core/util:grpc_fuzzer.bzl", "grpc_fuzzer")
cc_binary(
grpc_cc_binary(
name = "client",
srcs = ["client.c"],
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util", "//test/core/end2end:ssl_test_data"],
testonly = 1,
copts = ['-std=c99']
srcs = ["client.c"],
language = "C",
deps = [
"//:gpr",
"//:grpc",
"//test/core/end2end:ssl_test_data",
"//test/core/util:gpr_test_util",
"//test/core/util:grpc_test_util",
],
)
cc_binary(
grpc_cc_binary(
name = "server",
srcs = ["server.c"],
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util", "//test/core/end2end:ssl_test_data"],
testonly = 1,
copts = ['-std=c99']
srcs = ["server.c"],
language = "C",
deps = [
"//:gpr",
"//:grpc",
"//test/core/end2end:ssl_test_data",
"//test/core/util:gpr_test_util",
"//test/core/util:grpc_test_util",
],
)
cc_test(
grpc_cc_test(
name = "fling",
srcs = ["fling_test.c"],
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util", "//test/core/end2end:ssl_test_data"],
data = [":client", ":server"]
data = [
":client",
":server",
],
deps = [
"//:gpr",
"//:grpc",
"//test/core/end2end:ssl_test_data",
"//test/core/util:gpr_test_util",
"//test/core/util:grpc_test_util",
],
)
cc_test(
grpc_cc_test(
name = "fling_stream",
srcs = ["fling_stream_test.c"],
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util", "//test/core/end2end:ssl_test_data"],
data = [":client", ":server"]
data = [
":client",
":server",
],
deps = [
"//:gpr",
"//:grpc",
"//test/core/end2end:ssl_test_data",
"//test/core/util:gpr_test_util",
"//test/core/util:grpc_test_util",
],
)

@ -27,12 +27,14 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary")
licenses(["notice"]) # 3-clause BSD
cc_test(
grpc_cc_test(
name = "client_ssl",
srcs = ["client_ssl.c"],
copts = ["-std=c99"],
language = "C",
data = [
"//src/core/tsi/test_creds:ca.pem",
"//src/core/tsi/test_creds:server1.key",
@ -46,10 +48,10 @@ cc_test(
],
)
cc_test(
grpc_cc_test(
name = "server_ssl",
srcs = ["server_ssl.c"],
copts = ["-std=c99"],
language = "C",
data = [
"//src/core/tsi/test_creds:ca.pem",
"//src/core/tsi/test_creds:server1.key",

@ -27,24 +27,34 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary")
licenses(["notice"]) # 3-clause BSD
load("//test/core/util:grpc_fuzzer.bzl", "grpc_fuzzer")
grpc_fuzzer(
name = "response_fuzzer",
srcs = ["response_fuzzer.c"],
deps = ["//:gpr", "//:grpc", "//test/core/util:grpc_test_util"],
corpus = "response_corpus",
copts = ["-std=c99"],
name = "response_fuzzer",
srcs = ["response_fuzzer.c"],
language = "C",
corpus = "response_corpus",
deps = [
"//:gpr",
"//:grpc",
"//test/core/util:grpc_test_util",
],
)
grpc_fuzzer(
name = "request_fuzzer",
srcs = ["request_fuzzer.c"],
deps = ["//:gpr", "//:grpc", "//test/core/util:grpc_test_util"],
corpus = "request_corpus",
copts = ["-std=c99"],
name = "request_fuzzer",
srcs = ["request_fuzzer.c"],
language = "C",
corpus = "request_corpus",
deps = [
"//:gpr",
"//:grpc",
"//test/core/util:grpc_test_util",
],
)
# Copyright 2017, Google Inc.
@ -80,25 +90,43 @@ licenses(["notice"]) # 3-clause BSD
load("//test/core/util:grpc_fuzzer.bzl", "grpc_fuzzer")
cc_test(
grpc_cc_test(
name = "httpcli_test",
srcs = ["httpcli_test.c"],
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util", "//test/core/end2end:ssl_test_data"],
copts = ['-std=c99'],
data = ['test_server.py']
language = "C",
data = ["test_server.py"],
deps = [
"//:gpr",
"//:grpc",
"//test/core/end2end:ssl_test_data",
"//test/core/util:gpr_test_util",
"//test/core/util:grpc_test_util",
],
)
cc_test(
grpc_cc_test(
name = "httpscli_test",
srcs = ["httpscli_test.c"],
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util", "//test/core/end2end:ssl_test_data"],
copts = ['-std=c99'],
data = ['test_server.py']
language = "C",
data = ["test_server.py"],
deps = [
"//:gpr",
"//:grpc",
"//test/core/end2end:ssl_test_data",
"//test/core/util:gpr_test_util",
"//test/core/util:grpc_test_util",
],
)
cc_test(
grpc_cc_test(
name = "parser_test",
srcs = ["parser_test.c"],
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util", "//test/core/end2end:ssl_test_data"],
copts = ['-std=c99']
language = "C",
deps = [
"//:gpr",
"//:grpc",
"//test/core/end2end:ssl_test_data",
"//test/core/util:gpr_test_util",
"//test/core/util:grpc_test_util",
],
)

@ -27,155 +27,266 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary")
licenses(["notice"]) # 3-clause BSD
load("//test/core/util:grpc_fuzzer.bzl", "grpc_fuzzer")
cc_library(
package(default_visibility = ["//visibility:public"]) # Useful for third party devs to test their io manager implementation.
grpc_cc_library(
name = "endpoint_tests",
srcs = ["endpoint_tests.c"],
hdrs = ["endpoint_tests.h"],
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"],
language = "C",
visibility = ["//test:__subpackages__"],
copts = ['-std=c99']
deps = [
"//:gpr",
"//:grpc",
"//test/core/util:gpr_test_util",
"//test/core/util:grpc_test_util",
],
)
cc_test(
grpc_cc_test(
name = "combiner_test",
srcs = ["combiner_test.c"],
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"],
copts = ['-std=c99']
language = "C",
deps = [
"//:gpr",
"//:grpc",
"//test/core/util:gpr_test_util",
"//test/core/util:grpc_test_util",
],
)
cc_test(
grpc_cc_test(
name = "endpoint_pair_test",
srcs = ["endpoint_pair_test.c"],
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util", ":endpoint_tests"],
copts = ['-std=c99']
language = "C",
deps = [
":endpoint_tests",
"//:gpr",
"//:grpc",
"//test/core/util:gpr_test_util",
"//test/core/util:grpc_test_util",
],
)
cc_test(
grpc_cc_test(
name = "ev_epollsig_linux_test",
srcs = ["ev_epollsig_linux_test.c"],
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"],
copts = ['-std=c99']
deps = [
"//:gpr",
"//:grpc",
"//test/core/util:gpr_test_util",
"//test/core/util:grpc_test_util",
],
language = "C",
)
cc_test(
grpc_cc_test(
name = "fd_conservation_posix_test",
srcs = ["fd_conservation_posix_test.c"],
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"],
copts = ['-std=c99']
language = "C",
deps = [
"//:gpr",
"//:grpc",
"//test/core/util:gpr_test_util",
"//test/core/util:grpc_test_util",
],
)
cc_test(
grpc_cc_test(
name = "fd_posix_test",
srcs = ["fd_posix_test.c"],
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"],
copts = ['-std=c99']
language = "C",
deps = [
"//:gpr",
"//:grpc",
"//test/core/util:gpr_test_util",
"//test/core/util:grpc_test_util",
],
)
cc_test(
grpc_cc_test(
name = "load_file_test",
srcs = ["load_file_test.c"],
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"],
copts = ['-std=c99']
language = "C",
deps = [
"//:gpr",
"//:grpc",
"//test/core/util:gpr_test_util",
"//test/core/util:grpc_test_util",
],
)
cc_test(
grpc_cc_test(
name = "pollset_set_test",
srcs = ["pollset_set_test.c"],
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"],
copts = ['-std=c99']
language = "C",
deps = [
"//:gpr",
"//:grpc",
"//test/core/util:gpr_test_util",
"//test/core/util:grpc_test_util",
],
)
cc_test(
grpc_cc_test(
name = "resolve_address_posix_test",
srcs = ["resolve_address_posix_test.c"],
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"],
copts = ['-std=c99']
language = "C",
deps = [
"//:gpr",
"//:grpc",
"//test/core/util:gpr_test_util",
"//test/core/util:grpc_test_util",
],
)
cc_test(
grpc_cc_test(
name = "resolve_address_test",
srcs = ["resolve_address_test.c"],
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"],
copts = ['-std=c99']
language = "C",
deps = [
"//:gpr",
"//:grpc",
"//test/core/util:gpr_test_util",
"//test/core/util:grpc_test_util",
],
)
cc_test(
grpc_cc_test(
name = "resource_quota_test",
srcs = ["resource_quota_test.c"],
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"],
copts = ['-std=c99']
language = "C",
deps = [
"//:gpr",
"//:grpc",
"//test/core/util:gpr_test_util",
"//test/core/util:grpc_test_util",
],
)
cc_test(
grpc_cc_test(
name = "sockaddr_utils_test",
srcs = ["sockaddr_utils_test.c"],
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"],
copts = ['-std=c99']
language = "C",
deps = [
"//:gpr",
"//:grpc",
"//test/core/util:gpr_test_util",
"//test/core/util:grpc_test_util",
],
)
cc_test(
grpc_cc_test(
name = "socket_utils_test",
srcs = ["socket_utils_test.c"],
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"],
copts = ['-std=c99']
language = "C",
deps = [
"//:gpr",
"//:grpc",
"//test/core/util:gpr_test_util",
"//test/core/util:grpc_test_util",
],
)
cc_test(
grpc_cc_test(
name = "tcp_client_posix_test",
srcs = ["tcp_client_posix_test.c"],
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"],
copts = ['-std=c99']
language = "C",
deps = [
"//:gpr",
"//:grpc",
"//test/core/util:gpr_test_util",
"//test/core/util:grpc_test_util",
],
)
cc_test(
grpc_cc_test(
name = "tcp_posix_test",
srcs = ["tcp_posix_test.c"],
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util", ":endpoint_tests"],
copts = ['-std=c99']
language = "C",
deps = [
":endpoint_tests",
"//:gpr",
"//:grpc",
"//test/core/util:gpr_test_util",
"//test/core/util:grpc_test_util",
],
)
cc_test(
grpc_cc_test(
name = "tcp_server_posix_test",
srcs = ["tcp_server_posix_test.c"],
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"],
copts = ['-std=c99']
language = "C",
deps = [
"//:gpr",
"//:grpc",
"//test/core/util:gpr_test_util",
"//test/core/util:grpc_test_util",
],
)
cc_test(
grpc_cc_test(
name = "time_averaged_stats_test",
srcs = ["time_averaged_stats_test.c"],
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"],
copts = ['-std=c99']
language = "C",
deps = [
"//:gpr",
"//:grpc",
"//test/core/util:gpr_test_util",
"//test/core/util:grpc_test_util",
],
)
cc_test(
grpc_cc_test(
name = "timer_heap_test",
srcs = ["timer_heap_test.c"],
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"],
copts = ['-std=c99']
language = "C",
deps = [
"//:gpr",
"//:grpc",
"//test/core/util:gpr_test_util",
"//test/core/util:grpc_test_util",
],
)
cc_test(
grpc_cc_test(
name = "timer_list_test",
srcs = ["timer_list_test.c"],
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"],
copts = ['-std=c99']
language = "C",
deps = [
"//:gpr",
"//:grpc",
"//test/core/util:gpr_test_util",
"//test/core/util:grpc_test_util",
],
)
cc_test(
grpc_cc_test(
name = "udp_server_test",
srcs = ["udp_server_test.c"],
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"],
copts = ['-std=c99']
language = "C",
deps = [
"//:gpr",
"//:grpc",
"//test/core/util:gpr_test_util",
"//test/core/util:grpc_test_util",
],
)
cc_test(
grpc_cc_test(
name = "wakeup_fd_cv_test",
srcs = ["wakeup_fd_cv_test.c"],
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"],
copts = ['-std=c99']
language = "C",
deps = [
"//:gpr",
"//:grpc",
"//test/core/util:gpr_test_util",
"//test/core/util:grpc_test_util",
],
)

@ -27,44 +27,75 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary")
licenses(["notice"]) # 3-clause BSD
load("//test/core/util:grpc_fuzzer.bzl", "grpc_fuzzer")
grpc_fuzzer(
name = "json_fuzzer",
srcs = ["fuzzer.c"],
deps = ["//:gpr", "//:grpc", "//test/core/util:grpc_test_util"],
corpus = "corpus",
copts = ["-std=c99"],
name = "json_fuzzer",
srcs = ["fuzzer.c"],
language = "C",
corpus = "corpus",
deps = [
"//:gpr",
"//:grpc",
"//test/core/util:grpc_test_util",
],
)
cc_binary(
grpc_cc_binary(
name = "json_rewrite",
srcs = ["json_rewrite.c"],
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"],
testonly = 1,
copts = ['-std=c99']
srcs = ["json_rewrite.c"],
language = "C",
deps = [
"//:gpr",
"//:grpc",
"//test/core/util:gpr_test_util",
"//test/core/util:grpc_test_util",
],
)
cc_test(
grpc_cc_test(
name = "json_rewrite_test",
srcs = ["json_rewrite_test.c"],
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"],
copts = ['-std=c99'],
data = ["rewrite_test_input.json", "rewrite_test_output_condensed.json", "rewrite_test_output_indented.json", ":json_stream_error_test"]
language = "C",
data = [
"rewrite_test_input.json",
"rewrite_test_output_condensed.json",
"rewrite_test_output_indented.json",
":json_stream_error_test",
],
deps = [
"//:gpr",
"//:grpc",
"//test/core/util:gpr_test_util",
"//test/core/util:grpc_test_util",
],
)
cc_test(
grpc_cc_test(
name = "json_stream_error_test",
srcs = ["json_stream_error_test.c"],
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"],
copts = ['-std=c99']
language = "C",
deps = [
"//:gpr",
"//:grpc",
"//test/core/util:gpr_test_util",
"//test/core/util:grpc_test_util",
],
)
cc_test(
grpc_cc_test(
name = "json_test",
srcs = ["json_test.c"],
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"],
copts = ['-std=c99']
language = "C",
deps = [
"//:gpr",
"//:grpc",
"//test/core/util:gpr_test_util",
"//test/core/util:grpc_test_util",
],
)

@ -27,23 +27,32 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary")
licenses(["notice"]) # 3-clause BSD
load("//test/core/util:grpc_fuzzer.bzl", "grpc_fuzzer")
grpc_fuzzer(
name = "fuzzer_response",
srcs = ["fuzzer_response.c"],
deps = ["//:gpr", "//:grpc", "//test/core/util:grpc_test_util"],
corpus = "corpus_response",
copts = ["-std=c99"],
name = "fuzzer_response",
srcs = ["fuzzer_response.c"],
language = "C",
corpus = "corpus_response",
deps = [
"//:gpr",
"//:grpc",
"//test/core/util:grpc_test_util",
],
)
grpc_fuzzer(
name = "fuzzer_serverlist",
srcs = ["fuzzer_serverlist.c"],
deps = ["//:gpr", "//:grpc", "//test/core/util:grpc_test_util"],
corpus = "corpus_serverlist",
copts = ["-std=c99"],
name = "fuzzer_serverlist",
srcs = ["fuzzer_serverlist.c"],
language = "C",
corpus = "corpus_serverlist",
deps = [
"//:gpr",
"//:grpc",
"//test/core/util:grpc_test_util",
],
)

@ -27,11 +27,18 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary")
licenses(["notice"]) # 3-clause BSD
cc_binary(
grpc_cc_binary(
name = "low_level_ping_pong",
srcs = ["low_level_ping_pong.c"],
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"],
copts = ['-std=c99']
language = "C",
deps = [
"//:gpr",
"//:grpc",
"//test/core/util:gpr_test_util",
"//test/core/util:grpc_test_util",
],
)

@ -27,72 +27,110 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary")
licenses(["notice"]) # 3-clause BSD
load("//test/core/util:grpc_fuzzer.bzl", "grpc_fuzzer")
grpc_fuzzer(
name = "ssl_server_fuzzer",
srcs = ["ssl_server_fuzzer.c"],
deps = ["//:gpr", "//:grpc", "//test/core/util:grpc_test_util", "//test/core/end2end:ssl_test_data"],
corpus = "corpus",
copts = ["-std=c99"],
name = "ssl_server_fuzzer",
srcs = ["ssl_server_fuzzer.c"],
language = "C",
corpus = "corpus",
deps = [
"//:gpr",
"//:grpc",
"//test/core/end2end:ssl_test_data",
"//test/core/util:grpc_test_util",
],
)
cc_library(
grpc_cc_library(
name = "oauth2_utils",
srcs = ["oauth2_utils.c"],
hdrs = ["oauth2_utils.h"],
language = "C",
deps = ["//:grpc"],
copts = ['-std=c99'],
visibility = ["//test/cpp:__subpackages__"],
)
cc_test(
grpc_cc_test(
name = "auth_context_test",
srcs = ["auth_context_test.c"],
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"],
copts = ['-std=c99']
language = "C",
deps = [
"//:gpr",
"//:grpc",
"//test/core/util:gpr_test_util",
"//test/core/util:grpc_test_util",
],
)
cc_test(
grpc_cc_test(
name = "credentials_test",
srcs = ["credentials_test.c"],
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"],
copts = ['-std=c99']
language = "C",
deps = [
"//:gpr",
"//:grpc",
"//test/core/util:gpr_test_util",
"//test/core/util:grpc_test_util",
],
)
cc_test(
grpc_cc_test(
name = "secure_endpoint_test",
srcs = ["secure_endpoint_test.c"],
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util", "//test/core/iomgr:endpoint_tests"],
copts = ['-std=c99']
language = "C",
deps = [
"//:gpr",
"//:grpc",
"//test/core/iomgr:endpoint_tests",
"//test/core/util:gpr_test_util",
"//test/core/util:grpc_test_util",
],
)
cc_test(
grpc_cc_test(
name = "security_connector_test",
srcs = ["security_connector_test.c"],
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"],
copts = ['-std=c99']
language = "C",
deps = [
"//:gpr",
"//:grpc",
"//test/core/util:gpr_test_util",
"//test/core/util:grpc_test_util",
],
)
cc_binary(
grpc_cc_binary(
name = "create_jwt",
srcs = ["create_jwt.c"],
deps = ["//:grpc", "//:gpr"],
copts = ['-std=c99']
language = "C",
deps = [
"//:gpr",
"//:grpc",
],
)
cc_binary(
grpc_cc_binary(
name = "fetch_oauth2",
srcs = ["fetch_oauth2.c"],
deps = ["//:grpc", "//:gpr", ":oauth2_utils"],
copts = ['-std=c99']
language = "C",
deps = [
":oauth2_utils",
"//:gpr",
"//:grpc",
],
)
cc_binary(
grpc_cc_binary(
name = "verify_jwt",
srcs = ["verify_jwt.c"],
deps = ["//:grpc", "//:gpr"],
copts = ['-std=c99']
language = "C",
deps = [
"//:gpr",
"//:grpc",
],
)

@ -27,56 +27,77 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary")
licenses(["notice"]) # 3-clause BSD
load("//test/core/util:grpc_fuzzer.bzl", "grpc_fuzzer")
grpc_fuzzer(
name = "percent_decode_fuzzer",
srcs = ["percent_decode_fuzzer.c"],
deps = ["//:gpr", "//:grpc", "//test/core/util:grpc_test_util"],
corpus = "response_corpus",
copts = ["-std=c99"],
name = "percent_decode_fuzzer",
srcs = ["percent_decode_fuzzer.c"],
language = "C",
corpus = "response_corpus",
deps = [
"//:gpr",
"//:grpc",
"//test/core/util:grpc_test_util",
],
)
cc_test(
grpc_cc_test(
name = "percent_encoding_test",
srcs = ["percent_encoding_test.c"],
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"],
copts = ['-std=c99']
language = "C",
deps = [
"//:gpr",
"//:grpc",
"//test/core/util:gpr_test_util",
"//test/core/util:grpc_test_util",
],
)
cc_test(
grpc_cc_test(
name = "slice_test",
srcs = ["slice_test.c"],
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"],
copts = ['-std=c99']
language = "C",
)
cc_test(
grpc_cc_test(
name = "slice_string_helpers_test",
srcs = ["slice_string_helpers_test.c"],
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"],
copts = ['-std=c99']
language = "C",
deps = [
"//:gpr",
"//:grpc",
"//test/core/util:gpr_test_util",
"//test/core/util:grpc_test_util",
],
)
cc_test(
grpc_cc_test(
name = "slice_buffer_test",
srcs = ["slice_buffer_test.c"],
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"],
copts = ['-std=c99']
language = "C",
)
cc_test(
grpc_cc_test(
name = "slice_hash_table_test",
srcs = ["slice_hash_table_test.c"],
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"],
copts = ['-std=c99']
language = "C",
)
cc_test(
grpc_cc_test(
name = "b64_test",
srcs = ["b64_test.c"],
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"],
copts = ['-std=c99']
language = "C",
deps = [
"//:gpr",
"//:grpc",
"//test/core/util:gpr_test_util",
"//test/core/util:grpc_test_util",
],
)

@ -27,137 +27,196 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary")
licenses(["notice"]) # 3-clause BSD
cc_test(
grpc_cc_test(
name = "alloc_test",
srcs = ["alloc_test.c"],
deps = ["//:gpr", "//test/core/util:gpr_test_util"],
copts = ['-std=c99']
language = "C",
deps = [
"//:gpr",
"//test/core/util:gpr_test_util",
],
)
cc_test(
grpc_cc_test(
name = "avl_test",
srcs = ["avl_test.c"],
deps = ["//:gpr", "//test/core/util:gpr_test_util"],
copts = ['-std=c99']
language = "C",
deps = [
"//:gpr",
"//test/core/util:gpr_test_util",
],
)
cc_test(
grpc_cc_test(
name = "backoff_test",
srcs = ["backoff_test.c"],
deps = ["//:gpr", "//test/core/util:gpr_test_util"],
copts = ['-std=c99']
language = "C",
deps = [
"//:gpr",
"//test/core/util:gpr_test_util",
],
)
cc_test(
grpc_cc_test(
name = "cmdline_test",
srcs = ["cmdline_test.c"],
deps = ["//:gpr", "//test/core/util:gpr_test_util"],
copts = ['-std=c99']
language = "C",
deps = [
"//:gpr",
"//test/core/util:gpr_test_util",
],
)
cc_test(
grpc_cc_test(
name = "cpu_test",
srcs = ["cpu_test.c"],
deps = ["//:gpr", "//test/core/util:gpr_test_util"],
copts = ['-std=c99']
language = "C",
deps = [
"//:gpr",
"//test/core/util:gpr_test_util",
],
)
cc_test(
grpc_cc_test(
name = "env_test",
srcs = ["env_test.c"],
deps = ["//:gpr", "//test/core/util:gpr_test_util"],
copts = ['-std=c99']
language = "C",
deps = [
"//:gpr",
"//test/core/util:gpr_test_util",
],
)
cc_test(
grpc_cc_test(
name = "histogram_test",
srcs = ["histogram_test.c"],
deps = ["//:gpr", "//test/core/util:gpr_test_util"],
copts = ['-std=c99']
language = "C",
deps = [
"//:gpr",
"//test/core/util:gpr_test_util",
],
)
cc_test(
grpc_cc_test(
name = "host_port_test",
srcs = ["host_port_test.c"],
deps = ["//:gpr", "//test/core/util:gpr_test_util"],
copts = ['-std=c99']
language = "C",
deps = [
"//:gpr",
"//test/core/util:gpr_test_util",
],
)
cc_test(
grpc_cc_test(
name = "log_test",
srcs = ["log_test.c"],
deps = ["//:gpr", "//test/core/util:gpr_test_util"],
copts = ['-std=c99']
language = "C",
deps = [
"//:gpr",
"//test/core/util:gpr_test_util",
],
)
cc_test(
grpc_cc_test(
name = "mpscq_test",
srcs = ["mpscq_test.c"],
deps = ["//:gpr", "//test/core/util:gpr_test_util"],
copts = ['-std=c99']
language = "C",
deps = [
"//:gpr",
"//test/core/util:gpr_test_util",
],
)
cc_test(
grpc_cc_test(
name = "murmur_hash_test",
srcs = ["murmur_hash_test.c"],
deps = ["//:gpr", "//test/core/util:gpr_test_util"],
copts = ['-std=c99']
language = "C",
deps = [
"//:gpr",
"//test/core/util:gpr_test_util",
],
)
cc_test(
grpc_cc_test(
name = "stack_lockfree_test",
srcs = ["stack_lockfree_test.c"],
deps = ["//:gpr", "//test/core/util:gpr_test_util"],
copts = ['-std=c99']
language = "C",
deps = [
"//:gpr",
"//test/core/util:gpr_test_util",
],
)
cc_test(
grpc_cc_test(
name = "string_test",
srcs = ["string_test.c"],
deps = ["//:gpr", "//test/core/util:gpr_test_util"],
copts = ['-std=c99']
language = "C",
deps = [
"//:gpr",
"//test/core/util:gpr_test_util",
],
)
cc_test(
grpc_cc_test(
name = "spinlock_test",
srcs = ["spinlock_test.c"],
deps = ["//:gpr", "//test/core/util:gpr_test_util"],
copts = ['-std=c99']
language = "C",
deps = [
"//:gpr",
"//test/core/util:gpr_test_util",
],
)
cc_test(
grpc_cc_test(
name = "sync_test",
srcs = ["sync_test.c"],
deps = ["//:gpr", "//test/core/util:gpr_test_util"],
copts = ['-std=c99']
language = "C",
deps = [
"//:gpr",
"//test/core/util:gpr_test_util",
],
)
cc_test(
grpc_cc_test(
name = "thd_test",
srcs = ["thd_test.c"],
deps = ["//:gpr", "//test/core/util:gpr_test_util"],
copts = ['-std=c99']
language = "C",
deps = [
"//:gpr",
"//test/core/util:gpr_test_util",
],
)
cc_test(
grpc_cc_test(
name = "time_test",
srcs = ["time_test.c"],
deps = ["//:gpr", "//test/core/util:gpr_test_util"],
copts = ['-std=c99']
language = "C",
deps = [
"//:gpr",
"//test/core/util:gpr_test_util",
],
)
cc_test(
grpc_cc_test(
name = "tls_test",
srcs = ["tls_test.c"],
deps = ["//:gpr", "//test/core/util:gpr_test_util"],
copts = ['-std=c99']
language = "C",
deps = [
"//:gpr",
"//test/core/util:gpr_test_util",
],
)
cc_test(
grpc_cc_test(
name = "useful_test",
srcs = ["useful_test.c"],
deps = ["//:gpr", "//test/core/util:gpr_test_util"],
copts = ['-std=c99']
language = "C",
deps = [
"//:gpr",
"//test/core/util:gpr_test_util",
],
)

@ -27,12 +27,14 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary")
licenses(["notice"]) # 3-clause BSD
cc_test(
grpc_cc_test(
name = "alarm_test",
srcs = ["alarm_test.c"],
copts = ["-std=c99"],
language = "C",
deps = [
"//:gpr",
"//:grpc",
@ -41,10 +43,10 @@ cc_test(
],
)
cc_test(
grpc_cc_test(
name = "grpc_byte_buffer_reader_test",
srcs = ["byte_buffer_reader_test.c"],
copts = ["-std=c99"],
language = "C",
deps = [
"//:gpr",
"//:grpc",
@ -53,10 +55,10 @@ cc_test(
],
)
cc_test(
grpc_cc_test(
name = "channel_create_test",
srcs = ["channel_create_test.c"],
copts = ["-std=c99"],
language = "C",
deps = [
"//:gpr",
"//:grpc",
@ -65,10 +67,10 @@ cc_test(
],
)
cc_test(
grpc_cc_test(
name = "grpc_completion_queue_test",
srcs = ["completion_queue_test.c"],
copts = ["-std=c99"],
language = "C",
deps = [
"//:gpr",
"//:grpc",
@ -77,10 +79,10 @@ cc_test(
],
)
cc_test(
grpc_cc_test(
name = "concurrent_connectivity_test",
srcs = ["concurrent_connectivity_test.c"],
copts = ["-std=c99"],
language = "C",
deps = [
"//:gpr",
"//:grpc",
@ -89,10 +91,10 @@ cc_test(
],
)
cc_test(
grpc_cc_test(
name = "init_test",
srcs = ["init_test.c"],
copts = ["-std=c99"],
language = "C",
deps = [
"//:gpr",
"//:grpc",
@ -101,10 +103,10 @@ cc_test(
],
)
cc_test(
grpc_cc_test(
name = "grpc_invalid_channel_args_test",
srcs = ["invalid_channel_args_test.c"],
copts = ["-std=c99"],
language = "C",
deps = [
"//:gpr",
"//:grpc",
@ -113,10 +115,10 @@ cc_test(
],
)
cc_test(
grpc_cc_test(
name = "lame_client_test",
srcs = ["lame_client_test.c"],
copts = ["-std=c99"],
language = "C",
deps = [
"//:gpr",
"//:grpc",
@ -126,10 +128,10 @@ cc_test(
],
)
cc_test(
grpc_cc_test(
name = "public_headers_must_be_c89",
srcs = ["public_headers_must_be_c89.c"],
copts = ["-std=c99"],
language = "C",
deps = [
"//:gpr",
"//:grpc",
@ -138,10 +140,10 @@ cc_test(
],
)
cc_test(
grpc_cc_test(
name = "secure_channel_create_test",
srcs = ["secure_channel_create_test.c"],
copts = ["-std=c99"],
language = "C",
deps = [
"//:gpr",
"//:grpc",
@ -150,10 +152,10 @@ cc_test(
],
)
cc_test(
grpc_cc_test(
name = "sequential_connectivity_test",
srcs = ["sequential_connectivity_test.c"],
copts = ["-std=c99"],
language = "C",
deps = [
"//:gpr",
"//:grpc",
@ -163,10 +165,10 @@ cc_test(
],
)
cc_test(
grpc_cc_test(
name = "server_chttp2_test",
srcs = ["server_chttp2_test.c"],
copts = ["-std=c99"],
language = "C",
deps = [
"//:gpr",
"//:grpc",
@ -175,10 +177,10 @@ cc_test(
],
)
cc_test(
grpc_cc_test(
name = "server_test",
srcs = ["server_test.c"],
copts = ["-std=c99"],
language = "C",
deps = [
"//:gpr",
"//:grpc",

@ -73,5 +73,6 @@
#include <grpc/support/time.h>
#include <grpc/support/tls.h>
#include <grpc/support/useful.h>
#include <grpc/support/workaround_list.h>
int main(int argc, char **argv) { return 0; }

@ -27,53 +27,90 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary")
licenses(["notice"]) # 3-clause BSD
cc_test(
grpc_cc_test(
name = "bdp_estimator_test",
srcs = ["bdp_estimator_test.c"],
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"],
copts = ['-std=c99']
language = "C",
deps = [
"//:gpr",
"//:grpc",
"//test/core/util:gpr_test_util",
"//test/core/util:grpc_test_util",
],
)
cc_test(
grpc_cc_test(
name = "connectivity_state_test",
srcs = ["connectivity_state_test.c"],
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"],
copts = ['-std=c99']
language = "C",
deps = [
"//:gpr",
"//:grpc",
"//test/core/util:gpr_test_util",
"//test/core/util:grpc_test_util",
],
)
cc_test(
grpc_cc_test(
name = "metadata_test",
srcs = ["metadata_test.c"],
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"],
copts = ['-std=c99']
language = "C",
deps = [
"//:gpr",
"//:grpc",
"//test/core/util:gpr_test_util",
"//test/core/util:grpc_test_util",
],
)
cc_test(
grpc_cc_test(
name = "pid_controller_test",
srcs = ["pid_controller_test.c"],
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"],
copts = ['-std=c99']
language = "C",
deps = [
"//:gpr",
"//:grpc",
"//test/core/util:gpr_test_util",
"//test/core/util:grpc_test_util",
],
)
cc_test(
grpc_cc_test(
name = "status_conversion_test",
srcs = ["status_conversion_test.c"],
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"],
copts = ['-std=c99']
language = "C",
deps = [
"//:gpr",
"//:grpc",
"//test/core/util:gpr_test_util",
"//test/core/util:grpc_test_util",
],
)
cc_test(
grpc_cc_test(
name = "stream_owned_slice_test",
srcs = ["stream_owned_slice_test.c"],
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"],
copts = ['-std=c99']
language = "C",
deps = [
"//:gpr",
"//:grpc",
"//test/core/util:gpr_test_util",
"//test/core/util:grpc_test_util",
],
)
cc_test(
grpc_cc_test(
name = "timeout_encoding_test",
srcs = ["timeout_encoding_test.c"],
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"],
copts = ['-std=c99']
language = "C",
deps = [
"//:gpr",
"//:grpc",
"//test/core/util:gpr_test_util",
"//test/core/util:grpc_test_util",
],
)

@ -27,69 +27,114 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary")
licenses(["notice"]) # 3-clause BSD
load("//test/core/util:grpc_fuzzer.bzl", "grpc_fuzzer")
grpc_fuzzer(
name = "hpack_parser_fuzzer",
srcs = ["hpack_parser_fuzzer_test.c"],
deps = ["//:grpc", "//test/core/util:grpc_test_util"],
corpus = "hpack_parser_corpus"
name = "hpack_parser_fuzzer",
srcs = ["hpack_parser_fuzzer_test.c"],
corpus = "hpack_parser_corpus",
deps = [
"//:grpc",
"//test/core/util:grpc_test_util",
],
)
cc_test(
grpc_cc_test(
name = "alpn_test",
srcs = ["alpn_test.c"],
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"],
copts = ['-std=c99']
language = "C",
deps = [
"//:gpr",
"//:grpc",
"//test/core/util:gpr_test_util",
"//test/core/util:grpc_test_util",
],
)
cc_test(
grpc_cc_test(
name = "bin_decoder_test",
srcs = ["bin_decoder_test.c"],
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"],
copts = ['-std=c99']
language = "C",
deps = [
"//:gpr",
"//:grpc",
"//test/core/util:gpr_test_util",
"//test/core/util:grpc_test_util",
],
)
cc_test(
grpc_cc_test(
name = "bin_encoder_test",
srcs = ["bin_encoder_test.c"],
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"],
copts = ['-std=c99']
language = "C",
deps = [
"//:gpr",
"//:grpc",
"//test/core/util:gpr_test_util",
"//test/core/util:grpc_test_util",
],
)
cc_test(
grpc_cc_test(
name = "hpack_encoder_test",
srcs = ["hpack_encoder_test.c"],
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"],
copts = ['-std=c99']
language = "C",
deps = [
"//:gpr",
"//:grpc",
"//test/core/util:gpr_test_util",
"//test/core/util:grpc_test_util",
],
)
cc_test(
grpc_cc_test(
name = "hpack_parser_test",
srcs = ["hpack_parser_test.c"],
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"],
copts = ['-std=c99']
language = "C",
deps = [
"//:gpr",
"//:grpc",
"//test/core/util:gpr_test_util",
"//test/core/util:grpc_test_util",
],
)
cc_test(
grpc_cc_test(
name = "hpack_table_test",
srcs = ["hpack_table_test.c"],
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"],
copts = ['-std=c99']
language = "C",
deps = [
"//:gpr",
"//:grpc",
"//test/core/util:gpr_test_util",
"//test/core/util:grpc_test_util",
],
)
cc_test(
grpc_cc_test(
name = "stream_map_test",
srcs = ["stream_map_test.c"],
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"],
copts = ['-std=c99']
language = "C",
deps = [
"//:gpr",
"//:grpc",
"//test/core/util:gpr_test_util",
"//test/core/util:grpc_test_util",
],
)
cc_test(
grpc_cc_test(
name = "varint_test",
srcs = ["varint_test.c"],
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"],
copts = ['-std=c99']
language = "C",
deps = [
"//:gpr",
"//:grpc",
"//test/core/util:gpr_test_util",
"//test/core/util:grpc_test_util",
],
)

@ -27,11 +27,18 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary")
licenses(["notice"]) # 3-clause BSD
cc_test(
grpc_cc_test(
name = "transport_security_test",
srcs = ["transport_security_test.c"],
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"],
copts = ['-std=c99']
language = "C",
deps = [
"//:gpr",
"//:grpc",
"//test/core/util:gpr_test_util",
"//test/core/util:grpc_test_util",
],
)

@ -27,23 +27,26 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary")
licenses(["notice"]) # 3-clause BSD
cc_library(
package(default_visibility = ["//visibility:public"])
grpc_cc_library(
name = "gpr_test_util",
srcs = [
"test_config.c",
"memory_counters.c",
"test_config.c",
],
hdrs = [
"test_config.h",
"memory_counters.h",
"test_config.h",
],
deps = ["//:gpr"],
visibility = ["//:__subpackages__"],
)
cc_library(
grpc_cc_library(
name = "grpc_test_util",
srcs = [
"debugger_macros.c",
@ -60,7 +63,6 @@ cc_library(
],
hdrs = [
"debugger_macros.h",
"trickle_endpoint.h",
"grpc_profiler.h",
"mock_endpoint.h",
"parse_hexstring.h",
@ -70,21 +72,25 @@ cc_library(
"reconnect_server.h",
"slice_splitter.h",
"test_tcp_server.h",
"trickle_endpoint.h",
],
language = "C",
deps = [
":gpr_test_util",
"//:grpc",
],
deps = [":gpr_test_util", "//:grpc"],
visibility = ["//test:__subpackages__"],
copts = ["-std=c99"],
)
cc_library(
name = "one_corpus_entry_fuzzer",
srcs = ["one_corpus_entry_fuzzer.c"],
deps = [":gpr_test_util", "//:grpc"],
visibility = ["//test:__subpackages__"],
grpc_cc_library(
name = "one_corpus_entry_fuzzer",
srcs = ["one_corpus_entry_fuzzer.c"],
deps = [
":gpr_test_util",
"//:grpc",
],
)
sh_library(
name = "fuzzer_one_entry_runner",
srcs = ["fuzzer_one_entry_runner.sh"],
visibility = ["//test:__subpackages__"],
name = "fuzzer_one_entry_runner",
srcs = ["fuzzer_one_entry_runner.sh"],
)

@ -27,8 +27,10 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
load("//bazel:grpc_build_system.bzl", "grpc_cc_binary")
def grpc_fuzzer(name, corpus, srcs = [], deps = [], **kwargs):
native.cc_binary(
grpc_cc_binary(
name = '%s/one_entry.bin' % name,
srcs = srcs,
deps = deps + ["//test/core/util:one_corpus_entry_fuzzer"],

@ -77,9 +77,11 @@ static int free_chosen_port(int port) {
static void free_chosen_ports(void) {
size_t i;
grpc_init();
for (i = 0; i < num_chosen_ports; i++) {
grpc_free_port_using_server(chosen_ports[i]);
}
grpc_shutdown();
gpr_free(chosen_ports);
}

@ -29,37 +29,45 @@
licenses(["notice"]) # 3-clause BSD
cc_test(
load("//bazel:grpc_build_system.bzl", "grpc_cc_test")
grpc_cc_test(
name = "codegen_test_full",
srcs = ["codegen_test_full.cc"],
deps = [
"//:grpc++",
"//external:gtest",
"//test/core/util:gpr_test_util",
],
external_deps = [
"gtest",
],
)
cc_test(
grpc_cc_test(
name = "codegen_test_minimal",
srcs = ["codegen_test_minimal.cc"],
deps = [
"//:grpc++",
"//external:gtest",
"//test/core/util:gpr_test_util",
],
external_deps = [
"gtest",
],
)
cc_test(
grpc_cc_test(
name = "proto_utils_test",
srcs = ["proto_utils_test.cc"],
deps = [
"//:grpc++",
"//external:gtest",
"//test/core/util:gpr_test_util",
],
external_deps = [
"gtest",
],
)
cc_test(
grpc_cc_test(
name = "golden_file_test",
srcs = ["golden_file_test.cc"],
args = ["--generated_file_path=$(GENDIR)/src/proto/grpc/testing/"],
@ -69,9 +77,11 @@ cc_test(
],
deps = [
"//:grpc++",
"//external:gflags",
"//external:gtest",
"//src/proto/grpc/testing:compiler_test_proto",
"//test/core/util:gpr_test_util",
],
external_deps = [
"gtest",
"gflags",
],
)

@ -29,32 +29,66 @@
licenses(["notice"]) # 3-clause BSD
cc_test(
load("//bazel:grpc_build_system.bzl", "grpc_cc_test")
grpc_cc_test(
name = "alarm_cpp_test",
srcs = ["alarm_cpp_test.cc"],
deps = ["//:grpc++", "//external:gtest", "//test/core/util:gpr_test_util"],
deps = [
"//:grpc++",
"//test/core/util:gpr_test_util",
],
external_deps = [
"gtest",
],
)
cc_test(
grpc_cc_test(
name = "auth_property_iterator_test",
srcs = ["auth_property_iterator_test.cc"],
deps = ["//:grpc++", "//external:gtest", "//test/core/util:gpr_test_util", "//test/cpp/util:test_util"],
deps = [
"//:grpc++",
"//test/core/util:gpr_test_util",
"//test/cpp/util:test_util",
],
external_deps = [
"gtest",
],
)
cc_test(
grpc_cc_test(
name = "channel_arguments_test",
srcs = ["channel_arguments_test.cc"],
deps = ["//:grpc++", "//external:gtest", "//test/core/util:gpr_test_util"],
deps = [
"//:grpc++",
"//test/core/util:gpr_test_util",
],
external_deps = [
"gtest",
],
)
cc_test(
grpc_cc_test(
name = "channel_filter_test",
srcs = ["channel_filter_test.cc"],
deps = ["//:grpc++", "//external:gtest", "//test/core/util:gpr_test_util"],
deps = [
"//:grpc++",
"//test/core/util:gpr_test_util",
],
external_deps = [
"gtest",
],
)
cc_test(
grpc_cc_test(
name = "secure_auth_context_test",
srcs = ["secure_auth_context_test.cc"],
deps = ["//:grpc++", "//external:gtest", "//test/core/util:gpr_test_util", "//test/cpp/util:test_util"],
deps = [
"//:grpc++",
"//test/core/util:gpr_test_util",
"//test/cpp/util:test_util",
],
external_deps = [
"gtest",
],
)

@ -29,25 +29,30 @@
licenses(["notice"]) # 3-clause BSD
cc_library(
load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test")
package(default_visibility=["//visibility:public"]) # Allows external users to implement end2end tests.
grpc_cc_library(
name = "test_service_impl",
srcs = ["test_service_impl.cc"],
hdrs = ["test_service_impl.h"],
deps = [
"//external:gtest",
"//src/proto/grpc/testing:echo_proto",
"//test/cpp/util:test_util",
],
external_deps = [
"gtest",
],
)
cc_test(
grpc_cc_test(
name = "async_end2end_test",
srcs = ["async_end2end_test.cc"],
deps = [
"//:gpr",
"//:grpc",
"//:grpc++",
"//external:gtest",
"//src/proto/grpc/health/v1:health_proto",
"//src/proto/grpc/testing:echo_messages_proto",
"//src/proto/grpc/testing:echo_proto",
@ -56,16 +61,18 @@ cc_test(
"//test/core/util:grpc_test_util",
"//test/cpp/util:test_util",
],
external_deps = [
"gtest",
],
)
cc_test(
grpc_cc_test(
name = "client_crash_test",
srcs = ["client_crash_test.cc"],
deps = [
"//:gpr",
"//:grpc",
"//:grpc++",
"//external:gtest",
"//src/proto/grpc/testing:echo_messages_proto",
"//src/proto/grpc/testing:echo_proto",
"//src/proto/grpc/testing/duplicate:echo_duplicate_proto",
@ -73,17 +80,18 @@ cc_test(
"//test/core/util:grpc_test_util",
"//test/cpp/util:test_util",
],
external_deps = [
"gtest",
],
)
cc_test(
grpc_cc_test(
name = "client_crash_test_server",
srcs = ["client_crash_test_server.cc"],
deps = [
"//:gpr",
"//:grpc",
"//:grpc++",
"//external:gflags",
"//external:gtest",
"//src/proto/grpc/testing:echo_messages_proto",
"//src/proto/grpc/testing:echo_proto",
"//src/proto/grpc/testing/duplicate:echo_duplicate_proto",
@ -91,17 +99,21 @@ cc_test(
"//test/core/util:grpc_test_util",
"//test/cpp/util:test_util",
],
external_deps = [
"gflags",
"gtest",
],
)
cc_test(
name = "end2end_test",
grpc_cc_library(
name = "end2end_test_lib",
srcs = ["end2end_test.cc"],
testonly = True,
deps = [
":test_service_impl",
"//:gpr",
"//:grpc",
"//:grpc++",
"//external:gtest",
"//src/proto/grpc/testing:echo_messages_proto",
"//src/proto/grpc/testing:echo_proto",
"//src/proto/grpc/testing/duplicate:echo_duplicate_proto",
@ -109,16 +121,25 @@ cc_test(
"//test/core/util:grpc_test_util",
"//test/cpp/util:test_util",
],
external_deps = [
"gtest",
],
)
cc_test(
grpc_cc_test(
name = "end2end_test",
deps = [
":end2end_test_lib"
],
)
grpc_cc_test(
name = "filter_end2end_test",
srcs = ["filter_end2end_test.cc"],
deps = [
"//:gpr",
"//:grpc",
"//:grpc++",
"//external:gtest",
"//src/proto/grpc/testing:echo_messages_proto",
"//src/proto/grpc/testing:echo_proto",
"//src/proto/grpc/testing/duplicate:echo_duplicate_proto",
@ -126,16 +147,18 @@ cc_test(
"//test/core/util:grpc_test_util",
"//test/cpp/util:test_util",
],
external_deps = [
"gtest",
],
)
cc_test(
grpc_cc_test(
name = "generic_end2end_test",
srcs = ["generic_end2end_test.cc"],
deps = [
"//:gpr",
"//:grpc",
"//:grpc++",
"//external:gtest",
"//src/proto/grpc/testing:echo_messages_proto",
"//src/proto/grpc/testing:echo_proto",
"//src/proto/grpc/testing/duplicate:echo_duplicate_proto",
@ -143,9 +166,12 @@ cc_test(
"//test/core/util:grpc_test_util",
"//test/cpp/util:test_util",
],
external_deps = [
"gtest",
],
)
cc_test(
grpc_cc_test(
name = "hybrid_end2end_test",
srcs = ["hybrid_end2end_test.cc"],
deps = [
@ -153,7 +179,6 @@ cc_test(
"//:gpr",
"//:grpc",
"//:grpc++",
"//external:gtest",
"//src/proto/grpc/testing:echo_messages_proto",
"//src/proto/grpc/testing:echo_proto",
"//src/proto/grpc/testing/duplicate:echo_duplicate_proto",
@ -161,16 +186,19 @@ cc_test(
"//test/core/util:grpc_test_util",
"//test/cpp/util:test_util",
],
external_deps = [
"gtest",
],
)
cc_test(
grpc_cc_test(
name = "mock_test",
srcs = ["mock_test.cc"],
deps = [
"//:gpr",
"//:grpc",
"//:grpc++",
"//external:gtest",
"//:grpc++_test",
"//src/proto/grpc/testing:echo_messages_proto",
"//src/proto/grpc/testing:echo_proto",
"//src/proto/grpc/testing/duplicate:echo_duplicate_proto",
@ -178,9 +206,12 @@ cc_test(
"//test/core/util:grpc_test_util",
"//test/cpp/util:test_util",
],
external_deps = [
"gtest",
],
)
cc_test(
grpc_cc_test(
name = "round_robin_end2end_test",
srcs = ["round_robin_end2end_test.cc"],
deps = [
@ -188,7 +219,6 @@ cc_test(
"//:gpr",
"//:grpc",
"//:grpc++",
"//external:gtest",
"//src/proto/grpc/testing:echo_messages_proto",
"//src/proto/grpc/testing:echo_proto",
"//src/proto/grpc/testing/duplicate:echo_duplicate_proto",
@ -196,10 +226,12 @@ cc_test(
"//test/core/util:grpc_test_util",
"//test/cpp/util:test_util",
],
external_deps = [
"gtest",
],
)
cc_test(
grpc_cc_test(
name = "grpclb_end2end_test",
srcs = ["grpclb_end2end_test.cc"],
deps = [
@ -207,7 +239,6 @@ cc_test(
"//:gpr",
"//:grpc",
"//:grpc++",
"//external:gtest",
"//src/proto/grpc/lb/v1:load_balancer_proto",
"//src/proto/grpc/testing:echo_messages_proto",
"//src/proto/grpc/testing:echo_proto",
@ -217,9 +248,12 @@ cc_test(
"//test/core/util:grpc_test_util",
"//test/cpp/util:test_util",
],
external_deps = [
"gtest",
],
)
cc_test(
grpc_cc_test(
name = "proto_server_reflection_test",
srcs = ["proto_server_reflection_test.cc"],
deps = [
@ -228,8 +262,6 @@ cc_test(
"//:grpc",
"//:grpc++",
"//:grpc++_reflection",
"//external:gflags",
"//external:gtest",
"//src/proto/grpc/testing:echo_messages_proto",
"//src/proto/grpc/testing:echo_proto",
"//src/proto/grpc/testing/duplicate:echo_duplicate_proto",
@ -238,9 +270,13 @@ cc_test(
"//test/cpp/util:grpc++_proto_reflection_desc_db",
"//test/cpp/util:test_util",
],
external_deps = [
"gtest",
"gflags",
],
)
cc_test(
grpc_cc_test(
name = "server_builder_plugin_test",
srcs = ["server_builder_plugin_test.cc"],
deps = [
@ -248,7 +284,6 @@ cc_test(
"//:gpr",
"//:grpc",
"//:grpc++",
"//external:gtest",
"//src/proto/grpc/testing:echo_messages_proto",
"//src/proto/grpc/testing:echo_proto",
"//src/proto/grpc/testing/duplicate:echo_duplicate_proto",
@ -256,16 +291,18 @@ cc_test(
"//test/core/util:grpc_test_util",
"//test/cpp/util:test_util",
],
external_deps = [
"gtest",
],
)
cc_test(
grpc_cc_test(
name = "server_crash_test",
srcs = ["server_crash_test.cc"],
deps = [
"//:gpr",
"//:grpc",
"//:grpc++",
"//external:gtest",
"//src/proto/grpc/testing:echo_messages_proto",
"//src/proto/grpc/testing:echo_proto",
"//src/proto/grpc/testing/duplicate:echo_duplicate_proto",
@ -273,17 +310,18 @@ cc_test(
"//test/core/util:grpc_test_util",
"//test/cpp/util:test_util",
],
external_deps = [
"gtest",
],
)
cc_test(
grpc_cc_test(
name = "server_crash_test_client",
srcs = ["server_crash_test_client.cc"],
deps = [
"//:gpr",
"//:grpc",
"//:grpc++",
"//external:gflags",
"//external:gtest",
"//src/proto/grpc/testing:echo_messages_proto",
"//src/proto/grpc/testing:echo_proto",
"//src/proto/grpc/testing/duplicate:echo_duplicate_proto",
@ -291,16 +329,19 @@ cc_test(
"//test/core/util:grpc_test_util",
"//test/cpp/util:test_util",
],
external_deps = [
"gflags",
"gtest",
],
)
cc_test(
grpc_cc_test(
name = "shutdown_test",
srcs = ["shutdown_test.cc"],
deps = [
"//:gpr",
"//:grpc",
"//:grpc++",
"//external:gtest",
"//src/proto/grpc/testing:echo_messages_proto",
"//src/proto/grpc/testing:echo_proto",
"//src/proto/grpc/testing/duplicate:echo_duplicate_proto",
@ -308,16 +349,18 @@ cc_test(
"//test/core/util:grpc_test_util",
"//test/cpp/util:test_util",
],
external_deps = [
"gtest",
],
)
cc_test(
grpc_cc_test(
name = "streaming_throughput_test",
srcs = ["streaming_throughput_test.cc"],
deps = [
"//:gpr",
"//:grpc",
"//:grpc++",
"//external:gtest",
"//src/proto/grpc/testing:echo_messages_proto",
"//src/proto/grpc/testing:echo_proto",
"//src/proto/grpc/testing/duplicate:echo_duplicate_proto",
@ -325,16 +368,18 @@ cc_test(
"//test/core/util:grpc_test_util",
"//test/cpp/util:test_util",
],
external_deps = [
"gtest",
],
)
cc_test(
grpc_cc_test(
name = "thread_stress_test",
srcs = ["thread_stress_test.cc"],
deps = [
"//:gpr",
"//:grpc",
"//:grpc++",
"//external:gtest",
"//src/proto/grpc/testing:echo_messages_proto",
"//src/proto/grpc/testing:echo_proto",
"//src/proto/grpc/testing/duplicate:echo_duplicate_proto",
@ -342,4 +387,7 @@ cc_test(
"//test/core/util:grpc_test_util",
"//test/cpp/util:test_util",
],
external_deps = [
"gtest",
],
)

@ -47,7 +47,6 @@
#include <grpc/support/thd.h>
#include <grpc/support/time.h>
#include <grpc/support/tls.h>
#include <gtest/gtest.h>
#include "src/core/lib/iomgr/port.h"
#include "src/proto/grpc/health/v1/health.grpc.pb.h"
@ -58,6 +57,8 @@
#include "test/cpp/util/string_ref_helper.h"
#include "test/cpp/util/test_credentials_provider.h"
#include <gtest/gtest.h>
#ifdef GRPC_POSIX_SOCKET
#include "src/core/lib/iomgr/ev_posix.h"
#endif

@ -41,7 +41,6 @@
#include <grpc/support/log.h>
#include <grpc/support/thd.h>
#include <grpc/support/time.h>
#include <gtest/gtest.h>
#include "src/proto/grpc/testing/duplicate/echo_duplicate.grpc.pb.h"
#include "src/proto/grpc/testing/echo.grpc.pb.h"
@ -49,6 +48,8 @@
#include "test/core/util/test_config.h"
#include "test/cpp/util/subprocess.h"
#include <gtest/gtest.h>
using grpc::testing::EchoRequest;
using grpc::testing::EchoResponse;
using std::chrono::system_clock;

@ -48,7 +48,6 @@
#include <grpc/support/log.h>
#include <grpc/support/thd.h>
#include <grpc/support/time.h>
#include <gtest/gtest.h>
#include "src/core/lib/security/credentials/credentials.h"
#include "src/proto/grpc/testing/duplicate/echo_duplicate.grpc.pb.h"
@ -59,6 +58,8 @@
#include "test/cpp/util/string_ref_helper.h"
#include "test/cpp/util/test_credentials_provider.h"
#include <gtest/gtest.h>
using grpc::testing::EchoRequest;
using grpc::testing::EchoResponse;
using grpc::testing::kTlsCredentialsType;

@ -48,7 +48,6 @@
#include <grpc/grpc.h>
#include <grpc/support/thd.h>
#include <grpc/support/time.h>
#include <gtest/gtest.h>
#include "src/cpp/common/channel_filter.h"
#include "src/proto/grpc/testing/echo.grpc.pb.h"
@ -56,6 +55,8 @@
#include "test/core/util/test_config.h"
#include "test/cpp/util/byte_buffer_proto_helper.h"
#include <gtest/gtest.h>
using grpc::testing::EchoRequest;
using grpc::testing::EchoResponse;
using std::chrono::system_clock;

@ -46,13 +46,14 @@
#include <grpc/grpc.h>
#include <grpc/support/thd.h>
#include <grpc/support/time.h>
#include <gtest/gtest.h>
#include "src/proto/grpc/testing/echo.grpc.pb.h"
#include "test/core/util/port.h"
#include "test/core/util/test_config.h"
#include "test/cpp/util/byte_buffer_proto_helper.h"
#include <gtest/gtest.h>
using grpc::testing::EchoRequest;
using grpc::testing::EchoResponse;
using std::chrono::system_clock;
@ -115,6 +116,10 @@ class GenericEnd2endTest : public ::testing::Test {
void client_fail(int i) { verify_ok(&cli_cq_, i, false); }
void SendRpc(int num_rpcs) {
SendRpc(num_rpcs, false, gpr_inf_future(GPR_CLOCK_MONOTONIC));
}
void SendRpc(int num_rpcs, bool check_deadline, gpr_timespec deadline) {
const grpc::string kMethodName("/grpc.cpp.test.util.EchoTestService/Echo");
for (int i = 0; i < num_rpcs; i++) {
EchoRequest send_request;
@ -129,6 +134,11 @@ class GenericEnd2endTest : public ::testing::Test {
// The string needs to be long enough to test heap-based slice.
send_request.set_message("Hello world. Hello world. Hello world.");
if (check_deadline) {
cli_ctx.set_deadline(deadline);
}
std::unique_ptr<GenericClientAsyncReaderWriter> call =
generic_stub_->Call(&cli_ctx, kMethodName, &cli_cq_, tag(1));
client_ok(1);
@ -147,6 +157,12 @@ class GenericEnd2endTest : public ::testing::Test {
verify_ok(srv_cq_.get(), 4, true);
EXPECT_EQ(server_host_, srv_ctx.host().substr(0, server_host_.length()));
EXPECT_EQ(kMethodName, srv_ctx.method());
if (check_deadline) {
EXPECT_TRUE(gpr_time_similar(deadline, srv_ctx.raw_deadline(),
gpr_time_from_millis(100, GPR_TIMESPAN)));
}
ByteBuffer recv_buffer;
stream.Read(&recv_buffer, tag(5));
server_ok(5);
@ -262,6 +278,12 @@ TEST_F(GenericEnd2endTest, SimpleBidiStreaming) {
EXPECT_TRUE(recv_status.ok());
}
TEST_F(GenericEnd2endTest, Deadline) {
ResetStub();
SendRpc(1, true, gpr_time_add(gpr_now(GPR_CLOCK_MONOTONIC),
gpr_time_from_seconds(10, GPR_TIMESPAN)));
}
} // namespace
} // namespace testing
} // namespace grpc

@ -46,7 +46,6 @@
#include <grpc++/server_context.h>
#include <grpc/grpc.h>
#include <grpc/support/log.h>
#include <gtest/gtest.h>
#include "src/proto/grpc/health/v1/health.grpc.pb.h"
#include "src/proto/grpc/testing/duplicate/echo_duplicate.grpc.pb.h"
@ -55,6 +54,8 @@
#include "test/core/util/test_config.h"
#include "test/cpp/end2end/test_service_impl.h"
#include <gtest/gtest.h>
using grpc::health::v1::Health;
using grpc::health::v1::HealthCheckRequest;
using grpc::health::v1::HealthCheckResponse;

@ -42,7 +42,6 @@
#include <grpc++/server_builder.h>
#include <grpc++/server_context.h>
#include <grpc/grpc.h>
#include <gtest/gtest.h>
#include "src/proto/grpc/testing/duplicate/echo_duplicate.grpc.pb.h"
#include "src/proto/grpc/testing/echo.grpc.pb.h"
@ -51,6 +50,8 @@
#include "test/cpp/end2end/test_service_impl.h"
#include "test/cpp/util/byte_buffer_proto_helper.h"
#include <gtest/gtest.h>
namespace grpc {
namespace testing {

@ -45,7 +45,6 @@
#include <grpc/support/log.h>
#include <grpc/support/thd.h>
#include <grpc/support/time.h>
#include <gtest/gtest.h>
#include <grpc++/test/mock_stream.h>
@ -55,6 +54,8 @@
#include "test/core/util/port.h"
#include "test/core/util/test_config.h"
#include <gtest/gtest.h>
#include <iostream>
using namespace std;

@ -41,7 +41,6 @@
#include <grpc++/server_builder.h>
#include <grpc++/server_context.h>
#include <grpc/grpc.h>
#include <gtest/gtest.h>
#include "src/proto/grpc/testing/echo.grpc.pb.h"
#include "test/core/util/port.h"
@ -49,6 +48,8 @@
#include "test/cpp/end2end/test_service_impl.h"
#include "test/cpp/util/proto_reflection_descriptor_database.h"
#include <gtest/gtest.h>
namespace grpc {
namespace testing {

@ -44,13 +44,14 @@
#include <grpc/support/log.h>
#include <grpc/support/thd.h>
#include <grpc/support/time.h>
#include <gtest/gtest.h>
#include "src/proto/grpc/testing/echo.grpc.pb.h"
#include "test/core/util/port.h"
#include "test/core/util/test_config.h"
#include "test/cpp/end2end/test_service_impl.h"
#include <gtest/gtest.h>
using grpc::testing::EchoRequest;
using grpc::testing::EchoResponse;
using std::chrono::system_clock;

@ -45,13 +45,14 @@
#include <grpc++/server_builder.h>
#include <grpc++/server_context.h>
#include <grpc/grpc.h>
#include <gtest/gtest.h>
#include "src/proto/grpc/testing/echo.grpc.pb.h"
#include "test/core/util/port.h"
#include "test/core/util/test_config.h"
#include "test/cpp/end2end/test_service_impl.h"
#include <gtest/gtest.h>
#define PLUGIN_NAME "TestServerBuilderPlugin"
namespace grpc {

@ -41,7 +41,6 @@
#include <grpc/support/log.h>
#include <grpc/support/thd.h>
#include <grpc/support/time.h>
#include <gtest/gtest.h>
#include "src/proto/grpc/testing/duplicate/echo_duplicate.grpc.pb.h"
#include "src/proto/grpc/testing/echo.grpc.pb.h"
@ -49,6 +48,8 @@
#include "test/core/util/test_config.h"
#include "test/cpp/util/subprocess.h"
#include <gtest/gtest.h>
using grpc::testing::EchoRequest;
using grpc::testing::EchoResponse;
using std::chrono::system_clock;

@ -33,8 +33,6 @@
#include <thread>
#include <gtest/gtest.h>
#include <grpc++/channel.h>
#include <grpc++/client_context.h>
#include <grpc++/create_channel.h>
@ -51,6 +49,8 @@
#include "test/core/util/test_config.h"
#include "test/cpp/util/test_credentials_provider.h"
#include <gtest/gtest.h>
using grpc::testing::EchoRequest;
using grpc::testing::EchoResponse;

@ -35,8 +35,6 @@
#include <mutex>
#include <thread>
#include <gtest/gtest.h>
#include <grpc++/channel.h>
#include <grpc++/client_context.h>
#include <grpc++/create_channel.h>
@ -56,6 +54,8 @@
#include "test/core/util/port.h"
#include "test/core/util/test_config.h"
#include <gtest/gtest.h>
using grpc::testing::EchoRequest;
using grpc::testing::EchoResponse;
using std::chrono::system_clock;

@ -40,11 +40,11 @@
#include <grpc++/server_context.h>
#include <grpc/support/log.h>
#include <gtest/gtest.h>
#include "src/proto/grpc/testing/echo.grpc.pb.h"
#include "test/cpp/util/string_ref_helper.h"
#include <gtest/gtest.h>
using std::chrono::system_clock;
namespace grpc {

@ -43,7 +43,6 @@
#include <grpc/grpc.h>
#include <grpc/support/thd.h>
#include <grpc/support/time.h>
#include <gtest/gtest.h>
#include "src/core/lib/surface/api_trace.h"
#include "src/proto/grpc/testing/duplicate/echo_duplicate.grpc.pb.h"
@ -51,6 +50,8 @@
#include "test/core/util/port.h"
#include "test/core/util/test_config.h"
#include <gtest/gtest.h>
using grpc::testing::EchoRequest;
using grpc::testing::EchoResponse;
using std::chrono::system_clock;

@ -29,14 +29,17 @@
licenses(["notice"]) # 3-clause BSD
cc_test(
load("//bazel:grpc_build_system.bzl", "grpc_cc_test", "grpc_cc_library")
grpc_cc_test(
name = "noop-benchmark",
srcs = ["noop-benchmark.cc"],
linkopts = ["-pthread"],
deps = ["//external:benchmark"],
external_deps = [
"benchmark",
],
)
cc_library(
grpc_cc_library(
name = "helpers",
srcs = ["helpers.cc"],
hdrs = [
@ -44,64 +47,68 @@ cc_library(
"fullstack_fixtures.h",
"helpers.h",
],
linkopts = ["-pthread"],
deps = [
"//:grpc++",
"//external:benchmark",
"//src/proto/grpc/testing:echo_proto",
"//test/core/util:grpc_test_util",
],
external_deps = [
"benchmark",
],
)
cc_test(
grpc_cc_test(
name = "bm_closure",
srcs = ["bm_closure.cc"],
deps = [":helpers"],
)
cc_test(
grpc_cc_test(
name = "bm_cq",
srcs = ["bm_cq.cc"],
deps = [":helpers"],
)
cc_test(
grpc_cc_test(
name = "bm_cq_multiple_threads",
srcs = ["bm_cq_multiple_threads.cc"],
deps = [":helpers"],
)
cc_test(
grpc_cc_test(
name = "bm_error",
srcs = ["bm_error.cc"],
deps = [":helpers"],
)
cc_test(
grpc_cc_test(
name = "bm_fullstack_streaming_ping_pong",
srcs = ["bm_fullstack_streaming_ping_pong.cc"],
deps = [":helpers"],
)
cc_test(
grpc_cc_test(
name = "bm_fullstack_streaming_pump",
srcs = ["bm_fullstack_streaming_pump.cc"],
deps = [":helpers"],
)
cc_test(
grpc_cc_test(
name = "bm_fullstack_trickle",
srcs = ["bm_fullstack_trickle.cc"],
deps = [":helpers", "//external:gflags"],
deps = [":helpers"],
external_deps = [
"gflags",
],
)
cc_test(
grpc_cc_test(
name = "bm_fullstack_unary_ping_pong",
srcs = ["bm_fullstack_unary_ping_pong.cc"],
deps = [":helpers"],
)
cc_test(
grpc_cc_test(
name = "bm_metadata",
srcs = ["bm_metadata.cc"],
deps = [":helpers"],

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save