rename all test core files to cc and a lot of C++ style conversions

pull/13147/head
Yash Tibrewal 7 years ago
parent c563b583cb
commit 34a57d0346
  1. 704
      CMakeLists.txt
  2. 754
      Makefile
  3. 342
      build.yaml
  4. 18
      gRPC-Core.podspec
  5. 312
      grpc.gyp
  6. 2
      include/grpc/support/cmdline.h
  7. 8
      src/core/lib/iomgr/network_status_tracker.h
  8. 2
      src/core/lib/support/cmdline.cc
  9. 2
      src/ruby/ext/grpc/rb_grpc_imports.generated.h
  10. 18
      templates/gRPC-Core.podspec.template
  11. 0
      templates/test/core/end2end/end2end_nosec_tests.cc.template
  12. 0
      templates/test/core/end2end/end2end_tests.cc.template
  13. 0
      test/core/backoff/backoff_test.cc
  14. 0
      test/core/bad_client/bad_client.cc
  15. 4
      test/core/bad_client/gen_build_yaml.py
  16. 4
      test/core/bad_client/generate_tests.bzl
  17. 0
      test/core/bad_client/tests/badreq.cc
  18. 0
      test/core/bad_client/tests/connection_prefix.cc
  19. 2
      test/core/bad_client/tests/head_of_line_blocking.cc
  20. 0
      test/core/bad_client/tests/headers.cc
  21. 0
      test/core/bad_client/tests/initial_settings_frame.cc
  22. 0
      test/core/bad_client/tests/large_metadata.cc
  23. 0
      test/core/bad_client/tests/server_registered_method.cc
  24. 0
      test/core/bad_client/tests/simple_request.cc
  25. 0
      test/core/bad_client/tests/unknown_frame.cc
  26. 2
      test/core/bad_client/tests/window_overflow.cc
  27. 9
      test/core/bad_ssl/bad_ssl_test.cc
  28. 6
      test/core/bad_ssl/gen_build_yaml.py
  29. 4
      test/core/bad_ssl/generate_tests.bzl
  30. 2
      test/core/bad_ssl/server_common.cc
  31. 0
      test/core/bad_ssl/servers/alpn.cc
  32. 0
      test/core/bad_ssl/servers/cert.cc
  33. 0
      test/core/census/context_test.cc
  34. 0
      test/core/census/intrusive_hash_map_test.cc
  35. 0
      test/core/census/mlog_test.cc
  36. 0
      test/core/census/resource_test.cc
  37. 0
      test/core/census/trace_context_test.cc
  38. 6
      test/core/channel/channel_args_test.cc
  39. 5
      test/core/channel/channel_stack_builder_test.cc
  40. 29
      test/core/channel/channel_stack_test.cc
  41. 18
      test/core/channel/minimal_stack_is_minimal_test.cc
  42. 106
      test/core/client_channel/lb_policies_test.cc
  43. 0
      test/core/client_channel/parse_address_test.cc
  44. 12
      test/core/client_channel/resolvers/dns_resolver_connectivity_test.cc
  45. 0
      test/core/client_channel/resolvers/dns_resolver_test.cc
  46. 6
      test/core/client_channel/resolvers/fake_resolver_test.cc
  47. 2
      test/core/client_channel/resolvers/sockaddr_resolver_test.cc
  48. 2
      test/core/client_channel/uri_fuzzer_test.cc
  49. 0
      test/core/client_channel/uri_parser_test.cc
  50. 9
      test/core/compression/algorithm_test.cc
  51. 12
      test/core/compression/compression_test.cc
  52. 28
      test/core/compression/message_compress_test.cc
  53. 3
      test/core/compression/stream_compression_test.cc
  54. 12
      test/core/end2end/BUILD
  55. 0
      test/core/end2end/bad_server_response_test.cc
  56. 6
      test/core/end2end/connection_refused_test.cc
  57. 0
      test/core/end2end/cq_verifier.cc
  58. 0
      test/core/end2end/cq_verifier_native.cc
  59. 0
      test/core/end2end/cq_verifier_uv.cc
  60. 2
      test/core/end2end/data/client_certs.cc
  61. 2
      test/core/end2end/data/server1_cert.cc
  62. 2
      test/core/end2end/data/server1_key.cc
  63. 8
      test/core/end2end/data/ssl_test_data.h
  64. 2
      test/core/end2end/data/test_root_cert.cc
  65. 3
      test/core/end2end/dualstack_socket_test.cc
  66. 0
      test/core/end2end/end2end_nosec_tests.cc
  67. 0
      test/core/end2end/end2end_test_utils.cc
  68. 0
      test/core/end2end/end2end_tests.cc
  69. 14
      test/core/end2end/fixtures/h2_census.cc
  70. 12
      test/core/end2end/fixtures/h2_compress.cc
  71. 12
      test/core/end2end/fixtures/h2_fakesec.cc
  72. 7
      test/core/end2end/fixtures/h2_fd.cc
  73. 12
      test/core/end2end/fixtures/h2_full+pipe.cc
  74. 12
      test/core/end2end/fixtures/h2_full+trace.cc
  75. 14
      test/core/end2end/fixtures/h2_full+workarounds.cc
  76. 12
      test/core/end2end/fixtures/h2_full.cc
  77. 12
      test/core/end2end/fixtures/h2_http_proxy.cc
  78. 13
      test/core/end2end/fixtures/h2_load_reporting.cc
  79. 22
      test/core/end2end/fixtures/h2_oauth2.cc
  80. 12
      test/core/end2end/fixtures/h2_proxy.cc
  81. 13
      test/core/end2end/fixtures/h2_sockpair+trace.cc
  82. 13
      test/core/end2end/fixtures/h2_sockpair.cc
  83. 34
      test/core/end2end/fixtures/h2_sockpair_1byte.cc
  84. 19
      test/core/end2end/fixtures/h2_ssl.cc
  85. 26
      test/core/end2end/fixtures/h2_ssl_proxy.cc
  86. 12
      test/core/end2end/fixtures/h2_uds.cc
  87. 0
      test/core/end2end/fixtures/http_proxy_fixture.cc
  88. 6
      test/core/end2end/fixtures/inproc.cc
  89. 0
      test/core/end2end/fixtures/proxy.cc
  90. 65
      test/core/end2end/fuzzers/api_fuzzer.cc
  91. 0
      test/core/end2end/fuzzers/client_fuzzer.cc
  92. 0
      test/core/end2end/fuzzers/server_fuzzer.cc
  93. 16
      test/core/end2end/gen_build_yaml.py
  94. 6
      test/core/end2end/generate_tests.bzl
  95. 12
      test/core/end2end/goaway_server_test.cc
  96. 2
      test/core/end2end/invalid_call_argument_test.cc
  97. 0
      test/core/end2end/multiple_server_queues_test.cc
  98. 0
      test/core/end2end/no_server_test.cc
  99. 0
      test/core/end2end/tests/authority_not_supported.cc
  100. 0
      test/core/end2end/tests/bad_hostname.cc
  101. Some files were not shown because too many files have changed in this diff Show More

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -1001,17 +1001,17 @@ Pod::Spec.new do |s|
ss.dependency "#{s.name}/Interface", version
ss.dependency "#{s.name}/Implementation", version
ss.source_files = 'test/core/end2end/cq_verifier.{c,h}',
'test/core/end2end/end2end_tests.{c,h}',
'test/core/end2end/end2end_test_utils.c',
'test/core/end2end/tests/*.{c,h}',
ss.source_files = 'test/core/end2end/cq_verifier.{cc,h}',
'test/core/end2end/end2end_tests.{cc,h}',
'test/core/end2end/end2end_test_utils.cc',
'test/core/end2end/tests/*.{cc,h}',
'test/core/end2end/fixtures/*.h',
'test/core/end2end/data/*.{c,h}',
'test/core/util/debugger_macros.{c,h}',
'test/core/util/test_config.{c,h}',
'test/core/end2end/data/*.{cc,h}',
'test/core/util/debugger_macros.{cc,h}',
'test/core/util/test_config.{cc,h}',
'test/core/util/port.h',
'test/core/util/port.c',
'test/core/util/port_server_client.{c,h}'
'test/core/util/port.cc',
'test/core/util/port_server_client.{cc,h}'
end
# TODO (mxyan): Instead of this hack, add include path "third_party" to C core's include path?

@ -215,7 +215,7 @@
'gpr',
],
'sources': [
'test/core/util/test_config.c',
'test/core/util/test_config.cc',
],
},
{
@ -508,26 +508,26 @@
'grpc',
],
'sources': [
'test/core/end2end/data/client_certs.c',
'test/core/end2end/data/server1_cert.c',
'test/core/end2end/data/server1_key.c',
'test/core/end2end/data/test_root_cert.c',
'test/core/security/oauth2_utils.c',
'test/core/end2end/data/client_certs.cc',
'test/core/end2end/data/server1_cert.cc',
'test/core/end2end/data/server1_key.cc',
'test/core/end2end/data/test_root_cert.cc',
'test/core/security/oauth2_utils.cc',
'src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc',
'test/core/end2end/cq_verifier.c',
'test/core/end2end/fixtures/http_proxy_fixture.c',
'test/core/end2end/fixtures/proxy.c',
'test/core/iomgr/endpoint_tests.c',
'test/core/end2end/cq_verifier.cc',
'test/core/end2end/fixtures/http_proxy_fixture.cc',
'test/core/end2end/fixtures/proxy.cc',
'test/core/iomgr/endpoint_tests.cc',
'test/core/util/debugger_macros.cc',
'test/core/util/grpc_profiler.c',
'test/core/util/memory_counters.c',
'test/core/util/mock_endpoint.c',
'test/core/util/parse_hexstring.c',
'test/core/util/passthru_endpoint.c',
'test/core/util/port.c',
'test/core/util/port_server_client.c',
'test/core/util/slice_splitter.c',
'test/core/util/trickle_endpoint.c',
'test/core/util/grpc_profiler.cc',
'test/core/util/memory_counters.cc',
'test/core/util/mock_endpoint.cc',
'test/core/util/parse_hexstring.cc',
'test/core/util/passthru_endpoint.cc',
'test/core/util/port.cc',
'test/core/util/port_server_client.cc',
'test/core/util/slice_splitter.cc',
'test/core/util/trickle_endpoint.cc',
'src/core/lib/backoff/backoff.cc',
'src/core/lib/channel/channel_args.cc',
'src/core/lib/channel/channel_stack.cc',
@ -721,20 +721,20 @@
],
'sources': [
'src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc',
'test/core/end2end/cq_verifier.c',
'test/core/end2end/fixtures/http_proxy_fixture.c',
'test/core/end2end/fixtures/proxy.c',
'test/core/iomgr/endpoint_tests.c',
'test/core/end2end/cq_verifier.cc',
'test/core/end2end/fixtures/http_proxy_fixture.cc',
'test/core/end2end/fixtures/proxy.cc',
'test/core/iomgr/endpoint_tests.cc',
'test/core/util/debugger_macros.cc',
'test/core/util/grpc_profiler.c',
'test/core/util/memory_counters.c',
'test/core/util/mock_endpoint.c',
'test/core/util/parse_hexstring.c',
'test/core/util/passthru_endpoint.c',
'test/core/util/port.c',
'test/core/util/port_server_client.c',
'test/core/util/slice_splitter.c',
'test/core/util/trickle_endpoint.c',
'test/core/util/grpc_profiler.cc',
'test/core/util/memory_counters.cc',
'test/core/util/mock_endpoint.cc',
'test/core/util/parse_hexstring.cc',
'test/core/util/passthru_endpoint.cc',
'test/core/util/port.cc',
'test/core/util/port_server_client.cc',
'test/core/util/slice_splitter.cc',
'test/core/util/trickle_endpoint.cc',
'src/core/lib/backoff/backoff.cc',
'src/core/lib/channel/channel_args.cc',
'src/core/lib/channel/channel_stack.cc',
@ -1169,7 +1169,7 @@
'gpr',
],
'sources': [
'test/core/util/reconnect_server.c',
'test/core/util/reconnect_server.cc',
],
},
{
@ -1182,7 +1182,7 @@
'gpr',
],
'sources': [
'test/core/util/test_tcp_server.c',
'test/core/util/test_tcp_server.cc',
],
},
{
@ -2358,7 +2358,7 @@
'gpr',
],
'sources': [
'test/core/bad_client/bad_client.c',
'test/core/bad_client/bad_client.cc',
],
},
{
@ -2371,67 +2371,67 @@
'gpr',
],
'sources': [
'test/core/end2end/end2end_tests.c',
'test/core/end2end/end2end_test_utils.c',
'test/core/end2end/tests/authority_not_supported.c',
'test/core/end2end/tests/bad_hostname.c',
'test/core/end2end/tests/bad_ping.c',
'test/core/end2end/tests/binary_metadata.c',
'test/core/end2end/tests/call_creds.c',
'test/core/end2end/tests/cancel_after_accept.c',
'test/core/end2end/tests/cancel_after_client_done.c',
'test/core/end2end/tests/cancel_after_invoke.c',
'test/core/end2end/tests/cancel_after_round_trip.c',
'test/core/end2end/tests/cancel_before_invoke.c',
'test/core/end2end/tests/cancel_in_a_vacuum.c',
'test/core/end2end/tests/cancel_with_status.c',
'test/core/end2end/tests/compressed_payload.c',
'test/core/end2end/tests/connectivity.c',
'test/core/end2end/tests/default_host.c',
'test/core/end2end/tests/disappearing_server.c',
'test/core/end2end/tests/empty_batch.c',
'test/core/end2end/tests/filter_call_init_fails.c',
'test/core/end2end/tests/filter_causes_close.c',
'test/core/end2end/tests/filter_latency.c',
'test/core/end2end/tests/graceful_server_shutdown.c',
'test/core/end2end/tests/high_initial_seqno.c',
'test/core/end2end/tests/hpack_size.c',
'test/core/end2end/tests/idempotent_request.c',
'test/core/end2end/tests/invoke_large_request.c',
'test/core/end2end/tests/keepalive_timeout.c',
'test/core/end2end/tests/large_metadata.c',
'test/core/end2end/tests/load_reporting_hook.c',
'test/core/end2end/tests/max_concurrent_streams.c',
'test/core/end2end/tests/max_connection_age.c',
'test/core/end2end/tests/max_connection_idle.c',
'test/core/end2end/tests/max_message_length.c',
'test/core/end2end/tests/negative_deadline.c',
'test/core/end2end/tests/network_status_change.c',
'test/core/end2end/tests/no_logging.c',
'test/core/end2end/tests/no_op.c',
'test/core/end2end/tests/payload.c',
'test/core/end2end/tests/ping.c',
'test/core/end2end/tests/ping_pong_streaming.c',
'test/core/end2end/tests/proxy_auth.c',
'test/core/end2end/tests/registered_call.c',
'test/core/end2end/tests/request_with_flags.c',
'test/core/end2end/tests/request_with_payload.c',
'test/core/end2end/tests/resource_quota_server.c',
'test/core/end2end/tests/server_finishes_request.c',
'test/core/end2end/tests/shutdown_finishes_calls.c',
'test/core/end2end/tests/shutdown_finishes_tags.c',
'test/core/end2end/tests/simple_cacheable_request.c',
'test/core/end2end/tests/simple_delayed_request.c',
'test/core/end2end/tests/simple_metadata.c',
'test/core/end2end/tests/simple_request.c',
'test/core/end2end/tests/stream_compression_compressed_payload.c',
'test/core/end2end/tests/stream_compression_payload.c',
'test/core/end2end/tests/stream_compression_ping_pong_streaming.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',
'test/core/end2end/end2end_tests.cc',
'test/core/end2end/end2end_test_utils.cc',
'test/core/end2end/tests/authority_not_supported.cc',
'test/core/end2end/tests/bad_hostname.cc',
'test/core/end2end/tests/bad_ping.cc',
'test/core/end2end/tests/binary_metadata.cc',
'test/core/end2end/tests/call_creds.cc',
'test/core/end2end/tests/cancel_after_accept.cc',
'test/core/end2end/tests/cancel_after_client_done.cc',
'test/core/end2end/tests/cancel_after_invoke.cc',
'test/core/end2end/tests/cancel_after_round_trip.cc',
'test/core/end2end/tests/cancel_before_invoke.cc',
'test/core/end2end/tests/cancel_in_a_vacuum.cc',
'test/core/end2end/tests/cancel_with_status.cc',
'test/core/end2end/tests/compressed_payload.cc',
'test/core/end2end/tests/connectivity.cc',
'test/core/end2end/tests/default_host.cc',
'test/core/end2end/tests/disappearing_server.cc',
'test/core/end2end/tests/empty_batch.cc',
'test/core/end2end/tests/filter_call_init_fails.cc',
'test/core/end2end/tests/filter_causes_close.cc',
'test/core/end2end/tests/filter_latency.cc',
'test/core/end2end/tests/graceful_server_shutdown.cc',
'test/core/end2end/tests/high_initial_seqno.cc',
'test/core/end2end/tests/hpack_size.cc',
'test/core/end2end/tests/idempotent_request.cc',
'test/core/end2end/tests/invoke_large_request.cc',
'test/core/end2end/tests/keepalive_timeout.cc',
'test/core/end2end/tests/large_metadata.cc',
'test/core/end2end/tests/load_reporting_hook.cc',
'test/core/end2end/tests/max_concurrent_streams.cc',
'test/core/end2end/tests/max_connection_age.cc',
'test/core/end2end/tests/max_connection_idle.cc',
'test/core/end2end/tests/max_message_length.cc',
'test/core/end2end/tests/negative_deadline.cc',
'test/core/end2end/tests/network_status_change.cc',
'test/core/end2end/tests/no_logging.cc',
'test/core/end2end/tests/no_op.cc',
'test/core/end2end/tests/payload.cc',
'test/core/end2end/tests/ping.cc',
'test/core/end2end/tests/ping_pong_streaming.cc',
'test/core/end2end/tests/proxy_auth.cc',
'test/core/end2end/tests/registered_call.cc',
'test/core/end2end/tests/request_with_flags.cc',
'test/core/end2end/tests/request_with_payload.cc',
'test/core/end2end/tests/resource_quota_server.cc',
'test/core/end2end/tests/server_finishes_request.cc',
'test/core/end2end/tests/shutdown_finishes_calls.cc',
'test/core/end2end/tests/shutdown_finishes_tags.cc',
'test/core/end2end/tests/simple_cacheable_request.cc',
'test/core/end2end/tests/simple_delayed_request.cc',
'test/core/end2end/tests/simple_metadata.cc',
'test/core/end2end/tests/simple_request.cc',
'test/core/end2end/tests/stream_compression_compressed_payload.cc',
'test/core/end2end/tests/stream_compression_payload.cc',
'test/core/end2end/tests/stream_compression_ping_pong_streaming.cc',
'test/core/end2end/tests/streaming_error_response.cc',
'test/core/end2end/tests/trailing_metadata.cc',
'test/core/end2end/tests/workaround_cronet_compression.cc',
'test/core/end2end/tests/write_buffering.cc',
'test/core/end2end/tests/write_buffering_at_end.cc',
],
},
{
@ -2444,66 +2444,66 @@
'gpr',
],
'sources': [
'test/core/end2end/end2end_nosec_tests.c',
'test/core/end2end/end2end_test_utils.c',
'test/core/end2end/tests/authority_not_supported.c',
'test/core/end2end/tests/bad_hostname.c',
'test/core/end2end/tests/bad_ping.c',
'test/core/end2end/tests/binary_metadata.c',
'test/core/end2end/tests/cancel_after_accept.c',
'test/core/end2end/tests/cancel_after_client_done.c',
'test/core/end2end/tests/cancel_after_invoke.c',
'test/core/end2end/tests/cancel_after_round_trip.c',
'test/core/end2end/tests/cancel_before_invoke.c',
'test/core/end2end/tests/cancel_in_a_vacuum.c',
'test/core/end2end/tests/cancel_with_status.c',
'test/core/end2end/tests/compressed_payload.c',
'test/core/end2end/tests/connectivity.c',
'test/core/end2end/tests/default_host.c',
'test/core/end2end/tests/disappearing_server.c',
'test/core/end2end/tests/empty_batch.c',
'test/core/end2end/tests/filter_call_init_fails.c',
'test/core/end2end/tests/filter_causes_close.c',
'test/core/end2end/tests/filter_latency.c',
'test/core/end2end/tests/graceful_server_shutdown.c',
'test/core/end2end/tests/high_initial_seqno.c',
'test/core/end2end/tests/hpack_size.c',
'test/core/end2end/tests/idempotent_request.c',
'test/core/end2end/tests/invoke_large_request.c',
'test/core/end2end/tests/keepalive_timeout.c',
'test/core/end2end/tests/large_metadata.c',
'test/core/end2end/tests/load_reporting_hook.c',
'test/core/end2end/tests/max_concurrent_streams.c',
'test/core/end2end/tests/max_connection_age.c',
'test/core/end2end/tests/max_connection_idle.c',
'test/core/end2end/tests/max_message_length.c',
'test/core/end2end/tests/negative_deadline.c',
'test/core/end2end/tests/network_status_change.c',
'test/core/end2end/tests/no_logging.c',
'test/core/end2end/tests/no_op.c',
'test/core/end2end/tests/payload.c',
'test/core/end2end/tests/ping.c',
'test/core/end2end/tests/ping_pong_streaming.c',
'test/core/end2end/tests/proxy_auth.c',
'test/core/end2end/tests/registered_call.c',
'test/core/end2end/tests/request_with_flags.c',
'test/core/end2end/tests/request_with_payload.c',
'test/core/end2end/tests/resource_quota_server.c',
'test/core/end2end/tests/server_finishes_request.c',
'test/core/end2end/tests/shutdown_finishes_calls.c',
'test/core/end2end/tests/shutdown_finishes_tags.c',
'test/core/end2end/tests/simple_cacheable_request.c',
'test/core/end2end/tests/simple_delayed_request.c',
'test/core/end2end/tests/simple_metadata.c',
'test/core/end2end/tests/simple_request.c',
'test/core/end2end/tests/stream_compression_compressed_payload.c',
'test/core/end2end/tests/stream_compression_payload.c',
'test/core/end2end/tests/stream_compression_ping_pong_streaming.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',
'test/core/end2end/end2end_nosec_tests.cc',
'test/core/end2end/end2end_test_utils.cc',
'test/core/end2end/tests/authority_not_supported.cc',
'test/core/end2end/tests/bad_hostname.cc',
'test/core/end2end/tests/bad_ping.cc',
'test/core/end2end/tests/binary_metadata.cc',
'test/core/end2end/tests/cancel_after_accept.cc',
'test/core/end2end/tests/cancel_after_client_done.cc',
'test/core/end2end/tests/cancel_after_invoke.cc',
'test/core/end2end/tests/cancel_after_round_trip.cc',
'test/core/end2end/tests/cancel_before_invoke.cc',
'test/core/end2end/tests/cancel_in_a_vacuum.cc',
'test/core/end2end/tests/cancel_with_status.cc',
'test/core/end2end/tests/compressed_payload.cc',
'test/core/end2end/tests/connectivity.cc',
'test/core/end2end/tests/default_host.cc',
'test/core/end2end/tests/disappearing_server.cc',
'test/core/end2end/tests/empty_batch.cc',
'test/core/end2end/tests/filter_call_init_fails.cc',
'test/core/end2end/tests/filter_causes_close.cc',
'test/core/end2end/tests/filter_latency.cc',
'test/core/end2end/tests/graceful_server_shutdown.cc',
'test/core/end2end/tests/high_initial_seqno.cc',
'test/core/end2end/tests/hpack_size.cc',
'test/core/end2end/tests/idempotent_request.cc',
'test/core/end2end/tests/invoke_large_request.cc',
'test/core/end2end/tests/keepalive_timeout.cc',
'test/core/end2end/tests/large_metadata.cc',
'test/core/end2end/tests/load_reporting_hook.cc',
'test/core/end2end/tests/max_concurrent_streams.cc',
'test/core/end2end/tests/max_connection_age.cc',
'test/core/end2end/tests/max_connection_idle.cc',
'test/core/end2end/tests/max_message_length.cc',
'test/core/end2end/tests/negative_deadline.cc',
'test/core/end2end/tests/network_status_change.cc',
'test/core/end2end/tests/no_logging.cc',
'test/core/end2end/tests/no_op.cc',
'test/core/end2end/tests/payload.cc',
'test/core/end2end/tests/ping.cc',
'test/core/end2end/tests/ping_pong_streaming.cc',
'test/core/end2end/tests/proxy_auth.cc',
'test/core/end2end/tests/registered_call.cc',
'test/core/end2end/tests/request_with_flags.cc',
'test/core/end2end/tests/request_with_payload.cc',
'test/core/end2end/tests/resource_quota_server.cc',
'test/core/end2end/tests/server_finishes_request.cc',
'test/core/end2end/tests/shutdown_finishes_calls.cc',
'test/core/end2end/tests/shutdown_finishes_tags.cc',
'test/core/end2end/tests/simple_cacheable_request.cc',
'test/core/end2end/tests/simple_delayed_request.cc',
'test/core/end2end/tests/simple_metadata.cc',
'test/core/end2end/tests/simple_request.cc',
'test/core/end2end/tests/stream_compression_compressed_payload.cc',
'test/core/end2end/tests/stream_compression_payload.cc',
'test/core/end2end/tests/stream_compression_ping_pong_streaming.cc',
'test/core/end2end/tests/streaming_error_response.cc',
'test/core/end2end/tests/trailing_metadata.cc',
'test/core/end2end/tests/workaround_cronet_compression.cc',
'test/core/end2end/tests/write_buffering.cc',
'test/core/end2end/tests/write_buffering_at_end.cc',
],
},
]

@ -65,7 +65,7 @@ GPRAPI void gpr_cmdline_add_flag(gpr_cmdline *cl, const char *name,
const char *help, int *value);
/** And for a string */
GPRAPI void gpr_cmdline_add_string(gpr_cmdline *cl, const char *name,
const char *help, char **value);
const char *help, const char **value);
/** Set a callback for non-named arguments */
GPRAPI void gpr_cmdline_on_extra_arg(
gpr_cmdline *cl, const char *name, const char *help,

@ -20,10 +20,6 @@
#define GRPC_CORE_LIB_IOMGR_NETWORK_STATUS_TRACKER_H
#include "src/core/lib/iomgr/endpoint.h"
#ifdef __cplusplus
extern "C" {
#endif
void grpc_network_status_init(void);
void grpc_network_status_shutdown(void);
@ -31,8 +27,4 @@ void grpc_network_status_register_endpoint(grpc_endpoint *ep);
void grpc_network_status_unregister_endpoint(grpc_endpoint *ep);
void grpc_network_status_shutdown_all_endpoints();
#ifdef __cplusplus
}
#endif
#endif /* GRPC_CORE_LIB_IOMGR_NETWORK_STATUS_TRACKER_H */

@ -105,7 +105,7 @@ void gpr_cmdline_add_flag(gpr_cmdline *cl, const char *name, const char *help,
}
void gpr_cmdline_add_string(gpr_cmdline *cl, const char *name, const char *help,
char **value) {
const char **value) {
add_arg(cl, name, help, ARGTYPE_STRING, value);
}

@ -689,7 +689,7 @@ extern gpr_cmdline_add_int_type gpr_cmdline_add_int_import;
typedef void(*gpr_cmdline_add_flag_type)(gpr_cmdline *cl, const char *name, const char *help, int *value);
extern gpr_cmdline_add_flag_type gpr_cmdline_add_flag_import;
#define gpr_cmdline_add_flag gpr_cmdline_add_flag_import
typedef void(*gpr_cmdline_add_string_type)(gpr_cmdline *cl, const char *name, const char *help, char **value);
typedef void(*gpr_cmdline_add_string_type)(gpr_cmdline *cl, const char *name, const char *help, const char **value);
extern gpr_cmdline_add_string_type gpr_cmdline_add_string_import;
#define gpr_cmdline_add_string gpr_cmdline_add_string_import
typedef void(*gpr_cmdline_on_extra_arg_type)(gpr_cmdline *cl, const char *name, const char *help, void (*on_extra_arg)(void *user_data, const char *arg), void *user_data);

@ -168,17 +168,17 @@
ss.dependency "#{s.name}/Interface", version
ss.dependency "#{s.name}/Implementation", version
ss.source_files = 'test/core/end2end/cq_verifier.{c,h}',
'test/core/end2end/end2end_tests.{c,h}',
'test/core/end2end/end2end_test_utils.c',
'test/core/end2end/tests/*.{c,h}',
ss.source_files = 'test/core/end2end/cq_verifier.{cc,h}',
'test/core/end2end/end2end_tests.{cc,h}',
'test/core/end2end/end2end_test_utils.cc',
'test/core/end2end/tests/*.{cc,h}',
'test/core/end2end/fixtures/*.h',
'test/core/end2end/data/*.{c,h}',
'test/core/util/debugger_macros.{c,h}',
'test/core/util/test_config.{c,h}',
'test/core/end2end/data/*.{cc,h}',
'test/core/util/debugger_macros.{cc,h}',
'test/core/util/test_config.{cc,h}',
'test/core/util/port.h',
'test/core/util/port.c',
'test/core/util/port_server_client.{c,h}'
'test/core/util/port.cc',
'test/core/util/port_server_client.{cc,h}'
end
# TODO (mxyan): Instead of this hack, add include path "third_party" to C core's include path?

@ -46,7 +46,7 @@ def main():
'build': 'private',
'language': 'c',
'src': [
'test/core/bad_client/bad_client.c'
'test/core/bad_client/bad_client.cc'
],
'headers': [
'test/core/bad_client/bad_client.h'
@ -66,7 +66,7 @@ def main():
'build': 'test',
'language': 'c',
'secure': 'no',
'src': ['test/core/bad_client/tests/%s.c' % t],
'src': ['test/core/bad_client/tests/%s.cc' % t],
'vs_proj_dir': 'test',
'exclude_iomgrs': ['uv'],
'deps': [

@ -38,7 +38,7 @@ BAD_CLIENT_TESTS = {
def grpc_bad_client_tests():
native.cc_library(
name = 'bad_client_test',
srcs = ['bad_client.c'],
srcs = ['bad_client.cc'],
hdrs = ['bad_client.h'],
copts = ['-std=c99'],
deps = ['//test/core/util:grpc_test_util', '//:grpc', '//:gpr', '//test/core/end2end:cq_verifier']
@ -46,7 +46,7 @@ def grpc_bad_client_tests():
for t, topt in BAD_CLIENT_TESTS.items():
native.cc_test(
name = '%s_bad_client_test' % t,
srcs = ['tests/%s.c' % t],
srcs = ['tests/%s.cc' % t],
deps = [':bad_client_test'],
copts = ['-std=c99'],
)

@ -100,7 +100,7 @@ size_t g_count = 0;
static void addbuf(const void *data, size_t len) {
if (g_count + len > g_cap) {
g_cap = GPR_MAX(g_count + len, g_cap * 2);
g_buffer = gpr_realloc(g_buffer, g_cap);
g_buffer = static_cast<char *>(gpr_realloc(g_buffer, g_cap));
}
memcpy(g_buffer + g_count, data, len);
g_count += len;

@ -58,7 +58,7 @@ size_t g_count = 0;
static void addbuf(const void *data, size_t len) {
if (g_count + len > g_cap) {
g_cap = GPR_MAX(g_count + len, g_cap * 2);
g_buffer = gpr_realloc(g_buffer, g_cap);
g_buffer = static_cast<char *>(gpr_realloc(g_buffer, g_cap));
}
memcpy(g_buffer + g_count, data, len);
g_count += len;

@ -52,9 +52,10 @@ static void run_test(const char *target, size_t nops) {
grpc_op ops[6];
grpc_op *op;
grpc_arg ssl_name_override = {GRPC_ARG_STRING,
GRPC_SSL_TARGET_NAME_OVERRIDE_ARG,
{"foo.test.google.fr"}};
grpc_arg ssl_name_override = {
GRPC_ARG_STRING,
const_cast<char *>(GRPC_SSL_TARGET_NAME_OVERRIDE_ARG),
{const_cast<char *>("foo.test.google.fr")}};
grpc_channel_args args;
args.num_args = 1;
@ -141,7 +142,7 @@ int main(int argc, char **argv) {
/* start the server */
gpr_asprintf(&args[0], "%s/bad_ssl_%s_server%s", root, test,
gpr_subprocess_binary_extension());
args[1] = "--bind";
args[1] = const_cast<char *>("--bind");
gpr_join_host_port(&args[2], "::", port);
svr = gpr_subprocess_create(4, (const char **)args);
gpr_free(args[0]);

@ -38,7 +38,7 @@ def main():
'name': 'bad_ssl_test_server',
'build': 'private',
'language': 'c',
'src': ['test/core/bad_ssl/server_common.c'],
'src': ['test/core/bad_ssl/server_common.cc'],
'headers': ['test/core/bad_ssl/server_common.h'],
'vs_proj_dir': 'test',
'platforms': ['linux', 'posix', 'mac'],
@ -56,7 +56,7 @@ def main():
'build': 'test',
'language': 'c',
'run': False,
'src': ['test/core/bad_ssl/servers/%s.c' % t],
'src': ['test/core/bad_ssl/servers/%s.cc' % t],
'vs_proj_dir': 'test/bad_ssl',
'platforms': ['linux', 'posix', 'mac'],
'deps': [
@ -73,7 +73,7 @@ def main():
'cpu_cost': BAD_CLIENT_TESTS[t].cpu_cost,
'build': 'test',
'language': 'c',
'src': ['test/core/bad_ssl/bad_ssl_test.c'],
'src': ['test/core/bad_ssl/bad_ssl_test.cc'],
'vs_proj_dir': 'test',
'platforms': ['linux', 'posix', 'mac'],
'deps': [

@ -24,14 +24,14 @@ BAD_SSL_TESTS = ['cert', 'alpn']
def grpc_bad_ssl_tests():
native.cc_library(
name = 'bad_ssl_test_server',
srcs = ['server_common.c'],
srcs = ['server_common.cc'],
hdrs = ['server_common.h'],
deps = ['//test/core/util:grpc_test_util', '//:grpc', '//test/core/end2end:ssl_test_data']
)
for t in BAD_SSL_TESTS:
native.cc_test(
name = 'bad_ssl_%s_server' % t,
srcs = ['servers/%s.c' % t],
srcs = ['servers/%s.cc' % t],
deps = [':bad_ssl_test_server'],
)

@ -34,7 +34,7 @@ static void sigint_handler(int x) { got_sigint = 1; }
const char *bad_ssl_addr(int argc, char **argv) {
gpr_cmdline *cl;
char *addr = NULL;
const char *addr = NULL;
cl = gpr_cmdline_create("test server");
gpr_cmdline_add_string(cl, "bind", "Bind host:port", &addr);
gpr_cmdline_parse(cl, argc, argv);

@ -33,13 +33,13 @@ static void test_create(void) {
grpc_arg to_add[2];
grpc_channel_args *ch_args;
arg_int.key = "int_arg";
arg_int.key = const_cast<char *>("int_arg");
arg_int.type = GRPC_ARG_INTEGER;
arg_int.value.integer = 123;
arg_string.key = "str key";
arg_string.key = const_cast<char *>("str key");
arg_string.type = GRPC_ARG_STRING;
arg_string.value.string = "str value";
arg_string.value.string = const_cast<char *>("str value");
to_add[0] = arg_int;
to_add[1] = arg_string;

@ -63,7 +63,7 @@ bool g_replacement_fn_called = false;
bool g_original_fn_called = false;
void set_arg_once_fn(grpc_channel_stack *channel_stack,
grpc_channel_element *elem, void *arg) {
bool *called = arg;
bool *called = static_cast<bool *>(arg);
// Make sure this function is only called once per arg.
GPR_ASSERT(*called == false);
*called = true;
@ -109,7 +109,8 @@ const grpc_channel_filter original_filter = {
static bool add_replacement_filter(grpc_exec_ctx *exec_ctx,
grpc_channel_stack_builder *builder,
void *arg) {
const grpc_channel_filter *filter = arg;
const grpc_channel_filter *filter =
static_cast<const grpc_channel_filter *>(arg);
// Get rid of any other version of the filter, as determined by having the
// same name.
GPR_ASSERT(grpc_channel_stack_builder_remove_filter(builder, filter->name));

@ -69,12 +69,13 @@ static void channel_func(grpc_exec_ctx *exec_ctx, grpc_channel_element *elem,
static void free_channel(grpc_exec_ctx *exec_ctx, void *arg,
grpc_error *error) {
grpc_channel_stack_destroy(exec_ctx, arg);
grpc_channel_stack_destroy(exec_ctx, static_cast<grpc_channel_stack *>(arg));
gpr_free(arg);
}
static void free_call(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) {
grpc_call_stack_destroy(exec_ctx, arg, NULL, NULL);
grpc_call_stack_destroy(exec_ctx, static_cast<grpc_call_stack *>(arg), NULL,
NULL);
gpr_free(arg);
}
@ -104,13 +105,14 @@ static void test_create_channel_stack(void) {
grpc_slice path = grpc_slice_from_static_string("/service/method");
arg.type = GRPC_ARG_INTEGER;
arg.key = "test_key";
arg.key = const_cast<char *>("test_key");
arg.value.integer = 42;
chan_args.num_args = 1;
chan_args.args = &arg;
channel_stack = gpr_malloc(grpc_channel_stack_size(&filters, 1));
channel_stack = static_cast<grpc_channel_stack *>(
gpr_malloc(grpc_channel_stack_size(&filters, 1)));
grpc_channel_stack_init(&exec_ctx, 1, free_channel, channel_stack, &filters,
1, &chan_args, NULL, "test", channel_stack);
GPR_ASSERT(channel_stack->count == 1);
@ -118,15 +120,18 @@ static void test_create_channel_stack(void) {
channel_data = (int *)channel_elem->channel_data;
GPR_ASSERT(*channel_data == 0);
call_stack = gpr_malloc(channel_stack->call_stack_size);
call_stack = static_cast<grpc_call_stack *>(
gpr_malloc(channel_stack->call_stack_size));
const grpc_call_element_args args = {
.call_stack = call_stack,
.server_transport_data = NULL,
.context = NULL,
.path = path,
.start_time = gpr_now(GPR_CLOCK_MONOTONIC),
.deadline = GRPC_MILLIS_INF_FUTURE,
.arena = NULL};
call_stack, /* call_stack */
nullptr, /* server_transport_data */
nullptr, /* context */
path, /* path */
gpr_now(GPR_CLOCK_MONOTONIC), /* start_time */
GRPC_MILLIS_INF_FUTURE, /* deadline */
nullptr, /* arena */
nullptr /* call_combiner */
};
grpc_error *error = grpc_call_stack_init(&exec_ctx, channel_stack, 1,
free_call, call_stack, &args);
GPR_ASSERT(error == GRPC_ERROR_NONE);

@ -61,11 +61,11 @@ int main(int argc, char **argv) {
int errors = 0;
// tests with a minimal stack
grpc_arg minimal_stack_arg = {.type = GRPC_ARG_INTEGER,
.key = GRPC_ARG_MINIMAL_STACK,
.value.integer = 1};
grpc_channel_args minimal_stack_args = {.num_args = 1,
.args = &minimal_stack_arg};
grpc_arg minimal_stack_arg;
minimal_stack_arg.type = GRPC_ARG_INTEGER;
minimal_stack_arg.key = const_cast<char *>(GRPC_ARG_MINIMAL_STACK);
minimal_stack_arg.value.integer = 1;
grpc_channel_args minimal_stack_args = {1, &minimal_stack_arg};
errors += CHECK_STACK("unknown", &minimal_stack_args,
GRPC_CLIENT_DIRECT_CHANNEL, "connected", NULL);
errors += CHECK_STACK("unknown", &minimal_stack_args, GRPC_CLIENT_SUBCHANNEL,
@ -114,7 +114,9 @@ static int check_stack(const char *file, int line, const char *transport_name,
unsigned channel_stack_type, ...) {
// create dummy channel stack
grpc_channel_stack_builder *builder = grpc_channel_stack_builder_create();
grpc_transport_vtable fake_transport_vtable = {.name = transport_name};
grpc_transport_vtable fake_transport_vtable;
memset(&fake_transport_vtable, 0, sizeof(grpc_transport_vtable));
fake_transport_vtable.name = transport_name;
grpc_transport fake_transport = {.vtable = &fake_transport_vtable};
grpc_channel_stack_builder_set_target(builder, "foo.test.google.fr");
grpc_channel_args *channel_args = grpc_channel_args_copy(init_args);
@ -194,7 +196,9 @@ static int check_stack(const char *file, int line, const char *transport_name,
"**************************************************");
gpr_log(file, line, GPR_LOG_SEVERITY_ERROR,
"FAILED transport=%s; stack_type=%s; channel_args=%s:",
transport_name, grpc_channel_stack_type_string(channel_stack_type),
transport_name,
grpc_channel_stack_type_string(
static_cast<grpc_channel_stack_type>(channel_stack_type)),
args_str);
gpr_log(file, line, GPR_LOG_SEVERITY_ERROR, "EXPECTED: %s", expect);
gpr_log(file, line, GPR_LOG_SEVERITY_ERROR, "GOT: %s", got);

@ -88,14 +88,16 @@ static test_spec *test_spec_create(size_t num_iters, size_t num_servers) {
test_spec *spec;
size_t i;
spec = gpr_malloc(sizeof(test_spec));
spec = static_cast<test_spec *>(gpr_malloc(sizeof(test_spec)));
spec->num_iters = num_iters;
spec->num_servers = num_servers;
spec->kill_at = gpr_malloc(sizeof(int *) * num_iters);
spec->revive_at = gpr_malloc(sizeof(int *) * num_iters);
spec->kill_at = static_cast<int **>(gpr_malloc(sizeof(int *) * num_iters));
spec->revive_at = static_cast<int **>(gpr_malloc(sizeof(int *) * num_iters));
for (i = 0; i < num_iters; i++) {
spec->kill_at[i] = gpr_malloc(sizeof(int) * num_servers);
spec->revive_at[i] = gpr_malloc(sizeof(int) * num_servers);
spec->kill_at[i] =
static_cast<int *>(gpr_malloc(sizeof(int) * num_servers));
spec->revive_at[i] =
static_cast<int *>(gpr_malloc(sizeof(int) * num_servers));
}
test_spec_reset(spec);
@ -172,16 +174,20 @@ static void revive_server(const servers_fixture *f, request_data *rdata,
static servers_fixture *setup_servers(const char *server_host,
request_data *rdata,
const size_t num_servers) {
servers_fixture *f = gpr_malloc(sizeof(servers_fixture));
servers_fixture *f =
static_cast<servers_fixture *>(gpr_malloc(sizeof(servers_fixture)));
size_t i;
f->num_servers = num_servers;
f->server_calls = gpr_malloc(sizeof(grpc_call *) * num_servers);
f->request_metadata_recv =
gpr_malloc(sizeof(grpc_metadata_array) * num_servers);
f->server_calls =
static_cast<grpc_call **>(gpr_malloc(sizeof(grpc_call *) * num_servers));
f->request_metadata_recv = static_cast<grpc_metadata_array *>(
gpr_malloc(sizeof(grpc_metadata_array) * num_servers));
/* Create servers. */
f->servers = gpr_malloc(sizeof(grpc_server *) * num_servers);
f->servers_hostports = gpr_malloc(sizeof(char *) * num_servers);
f->servers = static_cast<grpc_server **>(
gpr_malloc(sizeof(grpc_server *) * num_servers));
f->servers_hostports =
static_cast<char **>(gpr_malloc(sizeof(char *) * num_servers));
f->cq = grpc_completion_queue_create_for_next(NULL);
f->shutdown_cq = grpc_completion_queue_create_for_pluck(NULL);
for (i = 0; i < num_servers; i++) {
@ -226,8 +232,10 @@ static void teardown_servers(servers_fixture *f) {
static request_sequences request_sequences_create(size_t n) {
request_sequences res;
res.n = n;
res.connections = gpr_malloc(sizeof(*res.connections) * n);
res.connectivity_states = gpr_malloc(sizeof(*res.connectivity_states) * n);
res.connections =
static_cast<int *>(gpr_malloc(sizeof(*res.connections) * n));
res.connectivity_states =
static_cast<int *>(gpr_malloc(sizeof(*res.connectivity_states) * n));
memset(res.connections, 0, sizeof(*res.connections) * n);
memset(res.connectivity_states, 0, sizeof(*res.connectivity_states) * n);
return res;
@ -255,7 +263,7 @@ static request_sequences perform_request(servers_fixture *f,
int completed_client;
const request_sequences sequences = request_sequences_create(spec->num_iters);
s_valid = gpr_malloc(sizeof(int) * f->num_servers);
s_valid = static_cast<int *>(gpr_malloc(sizeof(int) * f->num_servers));
for (iter_num = 0; iter_num < spec->num_iters; iter_num++) {
cq_verifier *cqv = cq_verifier_create(f->cq);
@ -426,7 +434,8 @@ static grpc_call **perform_multirequest(servers_fixture *f,
grpc_op *op;
size_t i;
calls = gpr_malloc(sizeof(grpc_call *) * concurrent_calls);
calls = static_cast<grpc_call **>(
gpr_malloc(sizeof(grpc_call *) * concurrent_calls));
for (i = 0; i < f->num_servers; i++) {
kill_server(f, i);
}
@ -465,8 +474,8 @@ void run_spec(const test_spec *spec) {
servers_fixture *f;
grpc_channel_args args;
grpc_arg arg_array[2];
rdata.call_details =
gpr_malloc(sizeof(grpc_call_details) * spec->num_servers);
rdata.call_details = static_cast<grpc_call_details *>(
gpr_malloc(sizeof(grpc_call_details) * spec->num_servers));
f = setup_servers("127.0.0.1", &rdata, spec->num_servers);
/* Create client. */
@ -475,11 +484,12 @@ void run_spec(const test_spec *spec) {
gpr_asprintf(&client_hostport, "ipv4:%s", servers_hostports_str);
arg_array[0].type = GRPC_ARG_INTEGER;
arg_array[0].key = "grpc.testing.fixed_reconnect_backoff_ms";
arg_array[0].key =
const_cast<char *>("grpc.testing.fixed_reconnect_backoff_ms");
arg_array[0].value.integer = RETRY_TIMEOUT;
arg_array[1].type = GRPC_ARG_STRING;
arg_array[1].key = GRPC_ARG_LB_POLICY_NAME;
arg_array[1].value.string = "round_robin";
arg_array[1].key = const_cast<char *>(GRPC_ARG_LB_POLICY_NAME);
arg_array[1].value.string = const_cast<char *>("round_robin");
args.num_args = 2;
args.args = arg_array;
@ -513,13 +523,15 @@ static grpc_channel *create_client(const servers_fixture *f) {
gpr_asprintf(&client_hostport, "ipv4:%s", servers_hostports_str);
arg_array[0].type = GRPC_ARG_INTEGER;
arg_array[0].key = "grpc.testing.fixed_reconnect_backoff_ms";
arg_array[0].key =
const_cast<char *>("grpc.testing.fixed_reconnect_backoff_ms");
arg_array[0].value.integer = RETRY_TIMEOUT;
arg_array[1].type = GRPC_ARG_STRING;
arg_array[1].key = GRPC_ARG_LB_POLICY_NAME;
arg_array[1].value.string = "ROUND_ROBIN";
arg_array[1].key = const_cast<char *>(GRPC_ARG_LB_POLICY_NAME);
arg_array[1].value.string = const_cast<char *>("ROUND_ROBIN");
arg_array[2].type = GRPC_ARG_INTEGER;
arg_array[2].key = GRPC_ARG_HTTP2_MIN_SENT_PING_INTERVAL_WITHOUT_DATA_MS;
arg_array[2].key =
const_cast<char *>(GRPC_ARG_HTTP2_MIN_SENT_PING_INTERVAL_WITHOUT_DATA_MS);
arg_array[2].value.integer = 0;
args.num_args = GPR_ARRAY_SIZE(arg_array);
args.args = arg_array;
@ -540,7 +552,8 @@ static void test_ping() {
const size_t num_servers = 1;
int i;
rdata.call_details = gpr_malloc(sizeof(grpc_call_details) * num_servers);
rdata.call_details = static_cast<grpc_call_details *>(
gpr_malloc(sizeof(grpc_call_details) * num_servers));
f = setup_servers("127.0.0.1", &rdata, num_servers);
cqv = cq_verifier_create(f->cq);
@ -585,8 +598,8 @@ static void test_pending_calls(size_t concurrent_calls) {
request_data rdata;
servers_fixture *f;
test_spec *spec = test_spec_create(0, 4);
rdata.call_details =
gpr_malloc(sizeof(grpc_call_details) * spec->num_servers);
rdata.call_details = static_cast<grpc_call_details *>(
gpr_malloc(sizeof(grpc_call_details) * spec->num_servers));
f = setup_servers("127.0.0.1", &rdata, spec->num_servers);
client = create_client(f);
@ -626,7 +639,7 @@ static void test_get_channel_info() {
gpr_free(lb_policy_name);
// Request service config, which does not exist, so we'll get nothing back.
memset(&channel_info, 0, sizeof(channel_info));
char *service_config_json = "dummy_string";
char *service_config_json = const_cast<char *>("dummy_string");
channel_info.service_config_json = &service_config_json;
grpc_channel_get_info(channel, &channel_info);
GPR_ASSERT(service_config_json == NULL);
@ -634,8 +647,9 @@ static void test_get_channel_info() {
grpc_channel_destroy(channel);
grpc_arg arg;
arg.type = GRPC_ARG_STRING;
arg.key = GRPC_ARG_SERVICE_CONFIG;
arg.value.string = "{\"loadBalancingPolicy\": \"ROUND_ROBIN\"}";
arg.key = const_cast<char *>(GRPC_ARG_SERVICE_CONFIG);
arg.value.string =
const_cast<char *>("{\"loadBalancingPolicy\": \"ROUND_ROBIN\"}");
grpc_channel_args *args = grpc_channel_args_copy_and_add(NULL, &arg, 1);
channel = grpc_insecure_channel_create("ipv4:127.0.0.1:1234", args, NULL);
{
@ -676,7 +690,7 @@ static void verify_vanilla_round_robin(const servers_fixture *f,
/* verify conn. seq. expectation */
/* get the first sequence of "num_servers" elements */
int *expected_connection_sequence =
gpr_malloc(sizeof(int) * expected_seq_length);
static_cast<int *>(gpr_malloc(sizeof(int) * expected_seq_length));
memcpy(expected_connection_sequence, sequences->connections,
sizeof(int) * expected_seq_length);
@ -695,7 +709,8 @@ static void verify_vanilla_round_robin(const servers_fixture *f,
/* All servers are available, therefore all client subchannels are READY, even
* when we only need one for the client channel state to be READY */
for (size_t i = 0; i < sequences->n; i++) {
const grpc_connectivity_state actual = sequences->connectivity_states[i];
const grpc_connectivity_state actual =
static_cast<grpc_connectivity_state>(sequences->connectivity_states[i]);
const grpc_connectivity_state expected = GRPC_CHANNEL_READY;
if (actual != expected) {
gpr_log(GPR_ERROR,
@ -721,7 +736,8 @@ static void verify_vanishing_floor_round_robin(
/* verify conn. seq. expectation */
/* copy the first full sequence (without -1s) */
expected_connection_sequence = gpr_malloc(sizeof(int) * expected_seq_length);
expected_connection_sequence =
static_cast<int *>(gpr_malloc(sizeof(int) * expected_seq_length));
memcpy(expected_connection_sequence, sequences->connections + 2,
expected_seq_length * sizeof(int));
@ -750,7 +766,8 @@ static void verify_vanishing_floor_round_robin(
/* There's always at least one subchannel READY (connected), therefore the
* overall state of the client channel is READY at all times. */
for (i = 0; i < sequences->n; i++) {
const grpc_connectivity_state actual = sequences->connectivity_states[i];
const grpc_connectivity_state actual =
static_cast<grpc_connectivity_state>(sequences->connectivity_states[i]);
const grpc_connectivity_state expected = GRPC_CHANNEL_READY;
if (actual != expected) {
gpr_log(GPR_ERROR,
@ -785,7 +802,8 @@ static void verify_total_carnage_round_robin(const servers_fixture *f,
* Note that all other states (IDLE, CONNECTING, TRANSIENT_FAILURE) are still
* possible, as the policy transitions while attempting to reconnect. */
for (size_t i = 0; i < sequences->n; i++) {
const grpc_connectivity_state actual = sequences->connectivity_states[i];
const grpc_connectivity_state actual =
static_cast<grpc_connectivity_state>(sequences->connectivity_states[i]);
if (actual == GRPC_CHANNEL_READY || actual == GRPC_CHANNEL_SHUTDOWN) {
gpr_log(GPR_ERROR,
"CONNECTIVITY STATUS SEQUENCE FAILURE: got unexpected state "
@ -805,7 +823,8 @@ static void verify_partial_carnage_round_robin(
/* verify conn. seq. expectation */
/* get the first sequence of "num_servers" elements */
expected_connection_sequence = gpr_malloc(sizeof(int) * expected_seq_length);
expected_connection_sequence =
static_cast<int *>(gpr_malloc(sizeof(int) * expected_seq_length));
memcpy(expected_connection_sequence, sequences->connections,
sizeof(int) * expected_seq_length);
@ -827,7 +846,8 @@ static void verify_partial_carnage_round_robin(
/* We can assert that the first client channel state should be READY, when all
* servers were available */
grpc_connectivity_state actual = sequences->connectivity_states[0];
grpc_connectivity_state actual =
static_cast<grpc_connectivity_state>(sequences->connectivity_states[0]);
grpc_connectivity_state expected = GRPC_CHANNEL_READY;
if (actual != expected) {
gpr_log(GPR_ERROR,
@ -841,7 +861,8 @@ static void verify_partial_carnage_round_robin(
/* ... and that the last one shouldn't be READY (or SHUTDOWN): all servers are
* gone. It may be all other states (IDLE, CONNECTING, TRANSIENT_FAILURE), as
* the policy transitions while attempting to reconnect. */
actual = sequences->connectivity_states[num_iters - 1];
actual = static_cast<grpc_connectivity_state>(
sequences->connectivity_states[num_iters - 1]);
for (i = 0; i < sequences->n; i++) {
if (actual == GRPC_CHANNEL_READY || actual == GRPC_CHANNEL_SHUTDOWN) {
gpr_log(GPR_ERROR,
@ -894,7 +915,8 @@ static void verify_rebirth_round_robin(const servers_fixture *f,
/* We can assert that the first client channel state should be READY, when all
* servers were available; same thing for the last one. In the middle
* somewhere there must exist at least one TRANSIENT_FAILURE */
grpc_connectivity_state actual = sequences->connectivity_states[0];
grpc_connectivity_state actual =
static_cast<grpc_connectivity_state>(sequences->connectivity_states[0]);
grpc_connectivity_state expected = GRPC_CHANNEL_READY;
if (actual != expected) {
gpr_log(GPR_ERROR,
@ -905,7 +927,8 @@ static void verify_rebirth_round_robin(const servers_fixture *f,
abort();
}
actual = sequences->connectivity_states[num_iters - 1];
actual = static_cast<grpc_connectivity_state>(
sequences->connectivity_states[num_iters - 1]);
expected = GRPC_CHANNEL_READY;
if (actual != expected) {
gpr_log(GPR_ERROR,
@ -931,7 +954,8 @@ static void verify_rebirth_round_robin(const servers_fixture *f,
"instead:");
for (size_t i = 0; i < num_iters; i++) {
gpr_log(GPR_ERROR, "[%d]: %s", (int)i,
grpc_connectivity_state_name(sequences->connectivity_states[i]));
grpc_connectivity_state_name(static_cast<grpc_connectivity_state>(
sequences->connectivity_states[i])));
}
}
}

@ -49,9 +49,11 @@ static void my_resolve_address(grpc_exec_ctx *exec_ctx, const char *addr,
error = GRPC_ERROR_CREATE_FROM_STATIC_STRING("Forced Failure");
} else {
gpr_mu_unlock(&g_mu);
*addrs = gpr_malloc(sizeof(**addrs));
*addrs =
static_cast<grpc_resolved_addresses *>(gpr_malloc(sizeof(**addrs)));
(*addrs)->naddrs = 1;
(*addrs)->addrs = gpr_malloc(sizeof(*(*addrs)->addrs));
(*addrs)->addrs = static_cast<grpc_resolved_address *>(
gpr_malloc(sizeof(*(*addrs)->addrs)));
(*addrs)->addrs[0].len = 123;
}
GRPC_CLOSURE_SCHED(exec_ctx, on_done, error);
@ -95,7 +97,7 @@ static grpc_resolver *create_resolver(grpc_exec_ctx *exec_ctx,
}
static void on_done(grpc_exec_ctx *exec_ctx, void *ev, grpc_error *error) {
gpr_event_set(ev, (void *)1);
gpr_event_set((gpr_event *)ev, (void *)1);
}
// interleave waiting for an event with a timer check
@ -121,7 +123,7 @@ typedef struct next_args {
static void call_resolver_next_now_lock_taken(grpc_exec_ctx *exec_ctx,
void *arg,
grpc_error *error_unused) {
next_args *a = arg;
next_args *a = static_cast<next_args *>(arg);
grpc_resolver_next_locked(exec_ctx, a->resolver, a->result, a->on_complete);
gpr_free(a);
}
@ -130,7 +132,7 @@ static void call_resolver_next_after_locking(grpc_exec_ctx *exec_ctx,
grpc_resolver *resolver,
grpc_channel_args **result,
grpc_closure *on_complete) {
next_args *a = gpr_malloc(sizeof(*a));
next_args *a = static_cast<next_args *>(gpr_malloc(sizeof(*a)));
a->resolver = resolver;
a->result = result;
a->on_complete = on_complete;

@ -56,7 +56,7 @@ typedef struct on_resolution_arg {
} on_resolution_arg;
void on_resolution_cb(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) {
on_resolution_arg *res = arg;
on_resolution_arg *res = static_cast<on_resolution_arg *>(arg);
// We only check the addresses channel arg because that's the only one
// explicitly set by the test via
// grpc_fake_resolver_response_generator_set_response.
@ -84,7 +84,7 @@ static void test_fake_resolver() {
// Setup expectations.
grpc_uri *uris[] = {grpc_uri_parse(&exec_ctx, "ipv4:10.2.1.1:1234", true),
grpc_uri_parse(&exec_ctx, "ipv4:127.0.0.1:4321", true)};
char *balancer_names[] = {"name1", "name2"};
const char *balancer_names[] = {"name1", "name2"};
const bool is_balancer[] = {true, false};
grpc_lb_addresses *addresses = grpc_lb_addresses_create(3, NULL);
for (size_t i = 0; i < GPR_ARRAY_SIZE(uris); ++i) {
@ -117,7 +117,7 @@ static void test_fake_resolver() {
// Setup update.
grpc_uri *uris_update[] = {
grpc_uri_parse(&exec_ctx, "ipv4:192.168.1.0:31416", true)};
char *balancer_names_update[] = {"name3"};
const char *balancer_names_update[] = {"name3"};
const bool is_balancer_update[] = {false};
grpc_lb_addresses *addresses_update = grpc_lb_addresses_create(1, NULL);
for (size_t i = 0; i < GPR_ARRAY_SIZE(uris_update); ++i) {

@ -36,7 +36,7 @@ typedef struct on_resolution_arg {
} on_resolution_arg;
void on_resolution_cb(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) {
on_resolution_arg *res = arg;
on_resolution_arg *res = static_cast<on_resolution_arg *>(arg);
grpc_channel_args_destroy(exec_ctx, res->resolver_result);
}

@ -29,7 +29,7 @@ bool squelch = true;
bool leak_check = true;
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
char *s = gpr_malloc(size + 1);
char *s = static_cast<char *>(gpr_malloc(size + 1));
memcpy(s, data, size);
s[size] = 0;

@ -69,8 +69,10 @@ static void test_algorithm_failure(void) {
GPR_ASSERT(grpc_compression_algorithm_name(GRPC_COMPRESS_ALGORITHMS_COUNT,
NULL) == 0);
GPR_ASSERT(grpc_compression_algorithm_name(GRPC_COMPRESS_ALGORITHMS_COUNT + 1,
NULL) == 0);
GPR_ASSERT(
grpc_compression_algorithm_name(static_cast<grpc_compression_algorithm>(
GRPC_COMPRESS_ALGORITHMS_COUNT + 1),
NULL) == 0);
mdstr = grpc_slice_from_static_string("this-is-an-invalid-algorithm");
GPR_ASSERT(grpc_compression_algorithm_from_slice(mdstr) ==
GRPC_COMPRESS_ALGORITHMS_COUNT);
@ -78,7 +80,8 @@ static void test_algorithm_failure(void) {
grpc_compression_algorithm_slice(GRPC_COMPRESS_ALGORITHMS_COUNT),
grpc_empty_slice()));
GPR_ASSERT(grpc_slice_eq(
grpc_compression_algorithm_slice(GRPC_COMPRESS_ALGORITHMS_COUNT + 1),
grpc_compression_algorithm_slice(static_cast<grpc_compression_algorithm>(
static_cast<int>(GRPC_COMPRESS_ALGORITHMS_COUNT) + 1)),
grpc_empty_slice()));
grpc_slice_unref_internal(&exec_ctx, mdstr);
grpc_exec_ctx_finish(&exec_ctx);

@ -181,21 +181,27 @@ static void test_compression_enable_disable_algorithm(void) {
grpc_compression_options_init(&options);
for (algorithm = GRPC_COMPRESS_NONE;
algorithm < GRPC_COMPRESS_ALGORITHMS_COUNT; algorithm++) {
algorithm < GRPC_COMPRESS_ALGORITHMS_COUNT;
algorithm = static_cast<grpc_compression_algorithm>(
static_cast<int>(algorithm) + 1)) {
/* all algorithms are enabled by default */
GPR_ASSERT(grpc_compression_options_is_algorithm_enabled(&options,
algorithm) != 0);
}
/* disable one by one */
for (algorithm = GRPC_COMPRESS_NONE;
algorithm < GRPC_COMPRESS_ALGORITHMS_COUNT; algorithm++) {
algorithm < GRPC_COMPRESS_ALGORITHMS_COUNT;
algorithm = static_cast<grpc_compression_algorithm>(
static_cast<int>(algorithm) + 1)) {
grpc_compression_options_disable_algorithm(&options, algorithm);
GPR_ASSERT(grpc_compression_options_is_algorithm_enabled(&options,
algorithm) == 0);
}
/* re-enable one by one */
for (algorithm = GRPC_COMPRESS_NONE;
algorithm < GRPC_COMPRESS_ALGORITHMS_COUNT; algorithm++) {
algorithm < GRPC_COMPRESS_ALGORITHMS_COUNT;
algorithm = static_cast<grpc_compression_algorithm>(
static_cast<int>(algorithm) + 1)) {
grpc_compression_options_enable_algorithm(&options, algorithm);
GPR_ASSERT(grpc_compression_options_is_algorithm_enabled(&options,
algorithm) != 0);

@ -148,16 +148,17 @@ static grpc_slice create_test_value(test_value id) {
static void test_tiny_data_compress(void) {
grpc_slice_buffer input;
grpc_slice_buffer output;
grpc_compression_algorithm i;
grpc_slice_buffer_init(&input);
grpc_slice_buffer_init(&output);
grpc_slice_buffer_add(&input, create_test_value(ONE_A));
for (i = 0; i < GRPC_COMPRESS_ALGORITHMS_COUNT; i++) {
for (int i = 0; i < GRPC_COMPRESS_ALGORITHMS_COUNT; i++) {
if (i == GRPC_COMPRESS_NONE) continue;
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
GPR_ASSERT(0 == grpc_msg_compress(&exec_ctx, i, &input, &output));
GPR_ASSERT(0 == grpc_msg_compress(
&exec_ctx, static_cast<grpc_compression_algorithm>(i),
&input, &output));
grpc_exec_ctx_finish(&exec_ctx);
GPR_ASSERT(1 == output.count);
}
@ -252,8 +253,10 @@ static void test_bad_compression_algorithm(void) {
&input, &output);
GPR_ASSERT(0 == was_compressed);
was_compressed = grpc_msg_compress(
&exec_ctx, GRPC_COMPRESS_ALGORITHMS_COUNT + 123, &input, &output);
was_compressed =
grpc_msg_compress(&exec_ctx, static_cast<grpc_compression_algorithm>(
GRPC_COMPRESS_ALGORITHMS_COUNT + 123),
&input, &output);
GPR_ASSERT(0 == was_compressed);
grpc_exec_ctx_finish(&exec_ctx);
@ -276,8 +279,10 @@ static void test_bad_decompression_algorithm(void) {
&exec_ctx, GRPC_COMPRESS_ALGORITHMS_COUNT, &input, &output);
GPR_ASSERT(0 == was_decompressed);
was_decompressed = grpc_msg_decompress(
&exec_ctx, GRPC_COMPRESS_ALGORITHMS_COUNT + 123, &input, &output);
was_decompressed =
grpc_msg_decompress(&exec_ctx, static_cast<grpc_compression_algorithm>(
GRPC_COMPRESS_ALGORITHMS_COUNT + 123),
&input, &output);
GPR_ASSERT(0 == was_decompressed);
grpc_exec_ctx_finish(&exec_ctx);
@ -300,8 +305,13 @@ int main(int argc, char **argv) {
for (j = 0; j < GPR_ARRAY_SIZE(uncompressed_split_modes); j++) {
for (k = 0; k < GPR_ARRAY_SIZE(compressed_split_modes); k++) {
for (m = 0; m < TEST_VALUE_COUNT; m++) {
grpc_slice slice = create_test_value(m);
assert_passthrough(slice, i, j, k, get_compressability(m, i));
grpc_slice slice = create_test_value(static_cast<test_value>(m));
assert_passthrough(
slice, static_cast<grpc_compression_algorithm>(i),
static_cast<grpc_slice_split_mode>(j),
static_cast<grpc_slice_split_mode>(k),
get_compressability(static_cast<test_value>(m),
static_cast<grpc_compression_algorithm>(i)));
grpc_slice_unref(slice);
}
}

@ -134,7 +134,8 @@ test_stream_compression_simple_compress_decompress_with_output_size_constraint()
#define LARGE_DATA_SIZE (1024 * 1024)
static void
test_stream_compression_simple_compress_decompress_with_large_data() {
char *test_str = gpr_malloc(LARGE_DATA_SIZE * sizeof(char));
char *test_str =
static_cast<char *>(gpr_malloc(LARGE_DATA_SIZE * sizeof(char)));
generate_random_payload(test_str, LARGE_DATA_SIZE);
grpc_slice_buffer source, relay, sink;
grpc_slice_buffer_init(&source);

@ -22,7 +22,7 @@ load(":generate_tests.bzl", "grpc_end2end_tests")
grpc_cc_library(
name = "cq_verifier",
srcs = ["cq_verifier.c"],
srcs = ["cq_verifier.cc"],
hdrs = ["cq_verifier.h"],
language = "C",
visibility = ["//test:__subpackages__"],
@ -36,9 +36,9 @@ grpc_cc_library(
grpc_cc_library(
name = "ssl_test_data",
srcs = [
"data/client_certs.c",
"data/server1_cert.c",
"data/server1_key.c",
"data/client_certs.cc",
"data/server1_cert.cc",
"data/server1_key.cc",
"data/test_root_cert.c",
],
hdrs = ["data/ssl_test_data.h"],
@ -49,7 +49,7 @@ grpc_cc_library(
grpc_cc_library(
name = "http_proxy",
srcs = ["fixtures/http_proxy_fixture.c"],
srcs = ["fixtures/http_proxy_fixture.cc"],
hdrs = ["fixtures/http_proxy_fixture.h"],
language = "C",
deps = [
@ -61,7 +61,7 @@ grpc_cc_library(
grpc_cc_library(
name = "proxy",
srcs = ["fixtures/proxy.c"],
srcs = ["fixtures/proxy.cc"],
hdrs = ["fixtures/proxy.h"],
language = "C",
deps = [

@ -62,8 +62,8 @@ static void run_test(bool wait_for_ready, bool use_service_config) {
GPR_ASSERT(wait_for_ready);
grpc_arg arg;
arg.type = GRPC_ARG_STRING;
arg.key = GRPC_ARG_SERVICE_CONFIG;
arg.value.string =
arg.key = const_cast<char *>(GRPC_ARG_SERVICE_CONFIG);
arg.value.string = const_cast<char *>(
"{\n"
" \"methodConfig\": [ {\n"
" \"name\": [\n"
@ -71,7 +71,7 @@ static void run_test(bool wait_for_ready, bool use_service_config) {
" ],\n"
" \"waitForReady\": true\n"
" } ]\n"
"}";
"}");
args = grpc_channel_args_copy_and_add(args, &arg, 1);
}

@ -16,6 +16,8 @@
*
*/
#include "test/core/end2end/data/ssl_test_data.h"
const char test_self_signed_client_cert[] = {
0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x42, 0x45, 0x47, 0x49, 0x4e, 0x20, 0x43,
0x45, 0x52, 0x54, 0x49, 0x46, 0x49, 0x43, 0x41, 0x54, 0x45, 0x2d, 0x2d,

@ -16,6 +16,8 @@
*
*/
#include "test/core/end2end/data/ssl_test_data.h"
const char test_server1_cert[] = {
0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x42, 0x45, 0x47, 0x49, 0x4e, 0x20, 0x43,
0x45, 0x52, 0x54, 0x49, 0x46, 0x49, 0x43, 0x41, 0x54, 0x45, 0x2d, 0x2d,

@ -16,6 +16,8 @@
*
*/
#include "test/core/end2end/data/ssl_test_data.h"
const char test_server1_key[] = {
0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x42, 0x45, 0x47, 0x49, 0x4e, 0x20, 0x52,
0x53, 0x41, 0x20, 0x50, 0x52, 0x49, 0x56, 0x41, 0x54, 0x45, 0x20, 0x4b,

@ -19,10 +19,6 @@
#ifndef GRPC_TEST_CORE_END2END_DATA_SSL_TEST_DATA_H
#define GRPC_TEST_CORE_END2END_DATA_SSL_TEST_DATA_H
#ifdef __cplusplus
extern "C" {
#endif
extern const char test_root_cert[];
extern const char test_server1_cert[];
extern const char test_server1_key[];
@ -31,8 +27,4 @@ extern const char test_self_signed_client_key[];
extern const char test_signed_client_cert[];
extern const char test_signed_client_key[];
#ifdef __cplusplus
}
#endif
#endif /* GRPC_TEST_CORE_END2END_DATA_SSL_TEST_DATA_H */

@ -16,6 +16,8 @@
*
*/
#include "test/core/end2end/data/ssl_test_data.h"
const char test_root_cert[] = {
0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x42, 0x45, 0x47, 0x49, 0x4e, 0x20, 0x43,
0x45, 0x52, 0x54, 0x49, 0x46, 0x49, 0x43, 0x41, 0x54, 0x45, 0x2d, 0x2d,

@ -118,7 +118,8 @@ void test_connect(const char *server_host, const char *client_host, int port,
grpc_slice_new((char *)client_host, strlen(client_host), do_nothing);
grpc_slice_buffer_init(&uri_parts);
grpc_slice_split(uri_slice, ",", &uri_parts);
hosts_with_port = gpr_malloc(sizeof(char *) * uri_parts.count);
hosts_with_port =
static_cast<char **>(gpr_malloc(sizeof(char *) * uri_parts.count));
for (i = 0; i < uri_parts.count; i++) {
char *uri_part_str = grpc_slice_to_c_string(uri_parts.slices[i]);
gpr_asprintf(&hosts_with_port[i], "%s:%d", uri_part_str, port);

@ -44,7 +44,8 @@ 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));
fullstack_fixture_data *ffd = static_cast<fullstack_fixture_data *>(
gpr_malloc(sizeof(fullstack_fixture_data)));
memset(&f, 0, sizeof(f));
gpr_join_host_port(&ffd->localaddr, "localhost", port);
@ -59,14 +60,15 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack(
static grpc_arg make_census_enable_arg(void) {
grpc_arg arg;
arg.type = GRPC_ARG_INTEGER;
arg.key = GRPC_ARG_ENABLE_CENSUS;
arg.key = const_cast<char *>(GRPC_ARG_ENABLE_CENSUS);
arg.value.integer = 1;
return arg;
}
void chttp2_init_client_fullstack(grpc_end2end_test_fixture *f,
grpc_channel_args *client_args) {
fullstack_fixture_data *ffd = f->fixture_data;
fullstack_fixture_data *ffd =
static_cast<fullstack_fixture_data *>(f->fixture_data);
grpc_arg arg = make_census_enable_arg();
client_args = grpc_channel_args_copy_and_add(client_args, &arg, 1);
f->client = grpc_insecure_channel_create(ffd->localaddr, client_args, NULL);
@ -80,7 +82,8 @@ void chttp2_init_client_fullstack(grpc_end2end_test_fixture *f,
void chttp2_init_server_fullstack(grpc_end2end_test_fixture *f,
grpc_channel_args *server_args) {
fullstack_fixture_data *ffd = f->fixture_data;
fullstack_fixture_data *ffd =
static_cast<fullstack_fixture_data *>(f->fixture_data);
grpc_arg arg = make_census_enable_arg();
if (f->server) {
grpc_server_destroy(f->server);
@ -98,7 +101,8 @@ void chttp2_init_server_fullstack(grpc_end2end_test_fixture *f,
}
void chttp2_tear_down_fullstack(grpc_end2end_test_fixture *f) {
fullstack_fixture_data *ffd = f->fixture_data;
fullstack_fixture_data *ffd =
static_cast<fullstack_fixture_data *>(f->fixture_data);
gpr_free(ffd->localaddr);
gpr_free(ffd);
}

@ -47,7 +47,8 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack_compression(
grpc_end2end_test_fixture f;
int port = grpc_pick_unused_port_or_die();
fullstack_compression_fixture_data *ffd =
gpr_malloc(sizeof(fullstack_compression_fixture_data));
static_cast<fullstack_compression_fixture_data *>(
gpr_malloc(sizeof(fullstack_compression_fixture_data)));
memset(ffd, 0, sizeof(fullstack_compression_fixture_data));
gpr_join_host_port(&ffd->localaddr, "localhost", port);
@ -62,7 +63,8 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack_compression(
void chttp2_init_client_fullstack_compression(grpc_end2end_test_fixture *f,
grpc_channel_args *client_args) {
fullstack_compression_fixture_data *ffd = f->fixture_data;
fullstack_compression_fixture_data *ffd =
static_cast<fullstack_compression_fixture_data *>(f->fixture_data);
if (ffd->client_args_compression != NULL) {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_channel_args_destroy(&exec_ctx, ffd->client_args_compression);
@ -76,7 +78,8 @@ void chttp2_init_client_fullstack_compression(grpc_end2end_test_fixture *f,
void chttp2_init_server_fullstack_compression(grpc_end2end_test_fixture *f,
grpc_channel_args *server_args) {
fullstack_compression_fixture_data *ffd = f->fixture_data;
fullstack_compression_fixture_data *ffd =
static_cast<fullstack_compression_fixture_data *>(f->fixture_data);
if (ffd->server_args_compression != NULL) {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_channel_args_destroy(&exec_ctx, ffd->server_args_compression);
@ -95,7 +98,8 @@ void chttp2_init_server_fullstack_compression(grpc_end2end_test_fixture *f,
void chttp2_tear_down_fullstack_compression(grpc_end2end_test_fixture *f) {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
fullstack_compression_fixture_data *ffd = f->fixture_data;
fullstack_compression_fixture_data *ffd =
static_cast<fullstack_compression_fixture_data *>(f->fixture_data);
grpc_channel_args_destroy(&exec_ctx, ffd->client_args_compression);
grpc_channel_args_destroy(&exec_ctx, ffd->server_args_compression);
gpr_free(ffd->localaddr);

@ -39,7 +39,8 @@ static grpc_end2end_test_fixture chttp2_create_fixture_secure_fullstack(
grpc_end2end_test_fixture f;
int port = grpc_pick_unused_port_or_die();
fullstack_secure_fixture_data *ffd =
gpr_malloc(sizeof(fullstack_secure_fixture_data));
static_cast<fullstack_secure_fixture_data *>(
gpr_malloc(sizeof(fullstack_secure_fixture_data)));
memset(&f, 0, sizeof(f));
gpr_join_host_port(&ffd->localaddr, "localhost", port);
@ -62,7 +63,8 @@ static void process_auth_failure(void *state, grpc_auth_context *ctx,
static void chttp2_init_client_secure_fullstack(
grpc_end2end_test_fixture *f, grpc_channel_args *client_args,
grpc_channel_credentials *creds) {
fullstack_secure_fixture_data *ffd = f->fixture_data;
fullstack_secure_fixture_data *ffd =
static_cast<fullstack_secure_fixture_data *>(f->fixture_data);
f->client =
grpc_secure_channel_create(creds, ffd->localaddr, client_args, NULL);
GPR_ASSERT(f->client != NULL);
@ -72,7 +74,8 @@ static void chttp2_init_client_secure_fullstack(
static void chttp2_init_server_secure_fullstack(
grpc_end2end_test_fixture *f, grpc_channel_args *server_args,
grpc_server_credentials *server_creds) {
fullstack_secure_fixture_data *ffd = f->fixture_data;
fullstack_secure_fixture_data *ffd =
static_cast<fullstack_secure_fixture_data *>(f->fixture_data);
if (f->server) {
grpc_server_destroy(f->server);
}
@ -85,7 +88,8 @@ static void chttp2_init_server_secure_fullstack(
}
void chttp2_tear_down_secure_fullstack(grpc_end2end_test_fixture *f) {
fullstack_secure_fixture_data *ffd = f->fixture_data;
fullstack_secure_fixture_data *ffd =
static_cast<fullstack_secure_fixture_data *>(f->fixture_data);
gpr_free(ffd->localaddr);
gpr_free(ffd);
}

@ -50,7 +50,8 @@ static void create_sockets(int sv[2]) {
static grpc_end2end_test_fixture chttp2_create_fixture_socketpair(
grpc_channel_args *client_args, grpc_channel_args *server_args) {
sp_fixture_data *fixture_data = gpr_malloc(sizeof(*fixture_data));
sp_fixture_data *fixture_data =
static_cast<sp_fixture_data *>(gpr_malloc(sizeof(*fixture_data)));
grpc_end2end_test_fixture f;
memset(&f, 0, sizeof(f));
@ -66,7 +67,7 @@ static grpc_end2end_test_fixture chttp2_create_fixture_socketpair(
static void chttp2_init_client_socketpair(grpc_end2end_test_fixture *f,
grpc_channel_args *client_args) {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
sp_fixture_data *sfd = f->fixture_data;
sp_fixture_data *sfd = static_cast<sp_fixture_data *>(f->fixture_data);
GPR_ASSERT(!f->client);
f->client = grpc_insecure_channel_create_from_fd(
@ -79,7 +80,7 @@ static void chttp2_init_client_socketpair(grpc_end2end_test_fixture *f,
static void chttp2_init_server_socketpair(grpc_end2end_test_fixture *f,
grpc_channel_args *server_args) {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
sp_fixture_data *sfd = f->fixture_data;
sp_fixture_data *sfd = static_cast<sp_fixture_data *>(f->fixture_data);
GPR_ASSERT(!f->server);
f->server = grpc_server_create(server_args, NULL);
GPR_ASSERT(f->server);

@ -49,7 +49,8 @@ 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));
fullstack_fixture_data *ffd = static_cast<fullstack_fixture_data *>(
gpr_malloc(sizeof(fullstack_fixture_data)));
memset(&f, 0, sizeof(f));
gpr_join_host_port(&ffd->localaddr, "localhost", port);
@ -63,14 +64,16 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack(
void chttp2_init_client_fullstack(grpc_end2end_test_fixture *f,
grpc_channel_args *client_args) {
fullstack_fixture_data *ffd = f->fixture_data;
fullstack_fixture_data *ffd =
static_cast<fullstack_fixture_data *>(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) {
fullstack_fixture_data *ffd = f->fixture_data;
fullstack_fixture_data *ffd =
static_cast<fullstack_fixture_data *>(f->fixture_data);
if (f->server) {
grpc_server_destroy(f->server);
}
@ -81,7 +84,8 @@ void chttp2_init_server_fullstack(grpc_end2end_test_fixture *f,
}
void chttp2_tear_down_fullstack(grpc_end2end_test_fixture *f) {
fullstack_fixture_data *ffd = f->fixture_data;
fullstack_fixture_data *ffd =
static_cast<fullstack_fixture_data *>(f->fixture_data);
gpr_free(ffd->localaddr);
gpr_free(ffd);
}

@ -49,7 +49,8 @@ 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));
fullstack_fixture_data *ffd = static_cast<fullstack_fixture_data *>(
gpr_malloc(sizeof(fullstack_fixture_data)));
memset(&f, 0, sizeof(f));
gpr_join_host_port(&ffd->localaddr, "localhost", port);
@ -63,14 +64,16 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack(
void chttp2_init_client_fullstack(grpc_end2end_test_fixture *f,
grpc_channel_args *client_args) {
fullstack_fixture_data *ffd = f->fixture_data;
fullstack_fixture_data *ffd =
static_cast<fullstack_fixture_data *>(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) {
fullstack_fixture_data *ffd = f->fixture_data;
fullstack_fixture_data *ffd =
static_cast<fullstack_fixture_data *>(f->fixture_data);
if (f->server) {
grpc_server_destroy(f->server);
}
@ -81,7 +84,8 @@ void chttp2_init_server_fullstack(grpc_end2end_test_fixture *f,
}
void chttp2_tear_down_fullstack(grpc_end2end_test_fixture *f) {
fullstack_fixture_data *ffd = f->fixture_data;
fullstack_fixture_data *ffd =
static_cast<fullstack_fixture_data *>(f->fixture_data);
gpr_free(ffd->localaddr);
gpr_free(ffd);
}

@ -37,7 +37,7 @@
#include "test/core/util/test_config.h"
static char *workarounds_arg[GRPC_MAX_WORKAROUND_ID] = {
GRPC_ARG_WORKAROUND_CRONET_COMPRESSION};
const_cast<char *>(GRPC_ARG_WORKAROUND_CRONET_COMPRESSION)};
typedef struct fullstack_fixture_data {
char *localaddr;
@ -47,7 +47,8 @@ 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));
fullstack_fixture_data *ffd = static_cast<fullstack_fixture_data *>(
gpr_malloc(sizeof(fullstack_fixture_data)));
memset(&f, 0, sizeof(f));
gpr_join_host_port(&ffd->localaddr, "localhost", port);
@ -61,7 +62,8 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack(
void chttp2_init_client_fullstack(grpc_end2end_test_fixture *f,
grpc_channel_args *client_args) {
fullstack_fixture_data *ffd = f->fixture_data;
fullstack_fixture_data *ffd =
static_cast<fullstack_fixture_data *>(f->fixture_data);
f->client = grpc_insecure_channel_create(ffd->localaddr, client_args, NULL);
GPR_ASSERT(f->client);
}
@ -70,7 +72,8 @@ void chttp2_init_server_fullstack(grpc_end2end_test_fixture *f,
grpc_channel_args *server_args) {
int i;
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
fullstack_fixture_data *ffd = f->fixture_data;
fullstack_fixture_data *ffd =
static_cast<fullstack_fixture_data *>(f->fixture_data);
grpc_arg args[GRPC_MAX_WORKAROUND_ID];
for (i = 0; i < GRPC_MAX_WORKAROUND_ID; i++) {
args[i].key = workarounds_arg[i];
@ -91,7 +94,8 @@ void chttp2_init_server_fullstack(grpc_end2end_test_fixture *f,
}
void chttp2_tear_down_fullstack(grpc_end2end_test_fixture *f) {
fullstack_fixture_data *ffd = f->fixture_data;
fullstack_fixture_data *ffd =
static_cast<fullstack_fixture_data *>(f->fixture_data);
gpr_free(ffd->localaddr);
gpr_free(ffd);
}

@ -43,7 +43,8 @@ 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));
fullstack_fixture_data *ffd = static_cast<fullstack_fixture_data *>(
gpr_malloc(sizeof(fullstack_fixture_data)));
memset(&f, 0, sizeof(f));
gpr_join_host_port(&ffd->localaddr, "localhost", port);
@ -57,14 +58,16 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack(
void chttp2_init_client_fullstack(grpc_end2end_test_fixture *f,
grpc_channel_args *client_args) {
fullstack_fixture_data *ffd = f->fixture_data;
fullstack_fixture_data *ffd =
static_cast<fullstack_fixture_data *>(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) {
fullstack_fixture_data *ffd = f->fixture_data;
fullstack_fixture_data *ffd =
static_cast<fullstack_fixture_data *>(f->fixture_data);
if (f->server) {
grpc_server_destroy(f->server);
}
@ -75,7 +78,8 @@ void chttp2_init_server_fullstack(grpc_end2end_test_fixture *f,
}
void chttp2_tear_down_fullstack(grpc_end2end_test_fixture *f) {
fullstack_fixture_data *ffd = f->fixture_data;
fullstack_fixture_data *ffd =
static_cast<fullstack_fixture_data *>(f->fixture_data);
gpr_free(ffd->localaddr);
gpr_free(ffd);
}

@ -47,7 +47,8 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack(
grpc_channel_args *client_args, grpc_channel_args *server_args) {
grpc_end2end_test_fixture f;
memset(&f, 0, sizeof(f));
fullstack_fixture_data *ffd = gpr_malloc(sizeof(fullstack_fixture_data));
fullstack_fixture_data *ffd = static_cast<fullstack_fixture_data *>(
gpr_malloc(sizeof(fullstack_fixture_data)));
const int server_port = grpc_pick_unused_port_or_die();
gpr_join_host_port(&ffd->server_addr, "localhost", server_port);
@ -64,7 +65,8 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack(
void chttp2_init_client_fullstack(grpc_end2end_test_fixture *f,
grpc_channel_args *client_args) {
fullstack_fixture_data *ffd = f->fixture_data;
fullstack_fixture_data *ffd =
static_cast<fullstack_fixture_data *>(f->fixture_data);
char *proxy_uri;
/* If testing for proxy auth, add credentials to proxy uri */
@ -85,7 +87,8 @@ void chttp2_init_client_fullstack(grpc_end2end_test_fixture *f,
void chttp2_init_server_fullstack(grpc_end2end_test_fixture *f,
grpc_channel_args *server_args) {
fullstack_fixture_data *ffd = f->fixture_data;
fullstack_fixture_data *ffd =
static_cast<fullstack_fixture_data *>(f->fixture_data);
if (f->server) {
grpc_server_destroy(f->server);
}
@ -96,7 +99,8 @@ void chttp2_init_server_fullstack(grpc_end2end_test_fixture *f,
}
void chttp2_tear_down_fullstack(grpc_end2end_test_fixture *f) {
fullstack_fixture_data *ffd = f->fixture_data;
fullstack_fixture_data *ffd =
static_cast<fullstack_fixture_data *>(f->fixture_data);
gpr_free(ffd->server_addr);
grpc_end2end_http_proxy_destroy(ffd->proxy);
gpr_free(ffd);

@ -45,8 +45,8 @@ static grpc_end2end_test_fixture chttp2_create_fixture_load_reporting(
grpc_channel_args *client_args, grpc_channel_args *server_args) {
grpc_end2end_test_fixture f;
int port = grpc_pick_unused_port_or_die();
load_reporting_fixture_data *ffd =
gpr_malloc(sizeof(load_reporting_fixture_data));
load_reporting_fixture_data *ffd = static_cast<load_reporting_fixture_data *>(
gpr_malloc(sizeof(load_reporting_fixture_data)));
memset(&f, 0, sizeof(f));
gpr_join_host_port(&ffd->localaddr, "localhost", port);
@ -60,14 +60,16 @@ static grpc_end2end_test_fixture chttp2_create_fixture_load_reporting(
void chttp2_init_client_load_reporting(grpc_end2end_test_fixture *f,
grpc_channel_args *client_args) {
load_reporting_fixture_data *ffd = f->fixture_data;
load_reporting_fixture_data *ffd =
static_cast<load_reporting_fixture_data *>(f->fixture_data);
f->client = grpc_insecure_channel_create(ffd->localaddr, client_args, NULL);
GPR_ASSERT(f->client);
}
void chttp2_init_server_load_reporting(grpc_end2end_test_fixture *f,
grpc_channel_args *server_args) {
load_reporting_fixture_data *ffd = f->fixture_data;
load_reporting_fixture_data *ffd =
static_cast<load_reporting_fixture_data *>(f->fixture_data);
grpc_arg arg = grpc_load_reporting_enable_arg();
if (f->server) {
grpc_server_destroy(f->server);
@ -85,7 +87,8 @@ void chttp2_init_server_load_reporting(grpc_end2end_test_fixture *f,
}
void chttp2_tear_down_load_reporting(grpc_end2end_test_fixture *f) {
load_reporting_fixture_data *ffd = f->fixture_data;
load_reporting_fixture_data *ffd =
static_cast<load_reporting_fixture_data *>(f->fixture_data);
gpr_free(ffd->localaddr);
gpr_free(ffd);
}

@ -92,7 +92,8 @@ static grpc_end2end_test_fixture chttp2_create_fixture_secure_fullstack(
grpc_end2end_test_fixture f;
int port = grpc_pick_unused_port_or_die();
fullstack_secure_fixture_data *ffd =
gpr_malloc(sizeof(fullstack_secure_fixture_data));
static_cast<fullstack_secure_fixture_data *>(
gpr_malloc(sizeof(fullstack_secure_fixture_data)));
memset(&f, 0, sizeof(f));
gpr_join_host_port(&ffd->localaddr, "localhost", port);
@ -107,7 +108,8 @@ static grpc_end2end_test_fixture chttp2_create_fixture_secure_fullstack(
static void chttp2_init_client_secure_fullstack(
grpc_end2end_test_fixture *f, grpc_channel_args *client_args,
grpc_channel_credentials *creds) {
fullstack_secure_fixture_data *ffd = f->fixture_data;
fullstack_secure_fixture_data *ffd =
static_cast<fullstack_secure_fixture_data *>(f->fixture_data);
f->client =
grpc_secure_channel_create(creds, ffd->localaddr, client_args, NULL);
GPR_ASSERT(f->client != NULL);
@ -117,7 +119,8 @@ static void chttp2_init_client_secure_fullstack(
static void chttp2_init_server_secure_fullstack(
grpc_end2end_test_fixture *f, grpc_channel_args *server_args,
grpc_server_credentials *server_creds) {
fullstack_secure_fixture_data *ffd = f->fixture_data;
fullstack_secure_fixture_data *ffd =
static_cast<fullstack_secure_fixture_data *>(f->fixture_data);
if (f->server) {
grpc_server_destroy(f->server);
}
@ -130,7 +133,8 @@ static void chttp2_init_server_secure_fullstack(
}
void chttp2_tear_down_secure_fullstack(grpc_end2end_test_fixture *f) {
fullstack_secure_fixture_data *ffd = f->fixture_data;
fullstack_secure_fixture_data *ffd =
static_cast<fullstack_secure_fixture_data *>(f->fixture_data);
gpr_free(ffd->localaddr);
gpr_free(ffd);
}
@ -144,9 +148,10 @@ static void chttp2_init_client_simple_ssl_with_oauth2_secure_fullstack(
&exec_ctx, "authorization", oauth2_md, true /* is_async */);
grpc_channel_credentials *ssl_oauth2_creds =
grpc_composite_channel_credentials_create(ssl_creds, oauth2_creds, NULL);
grpc_arg ssl_name_override = {GRPC_ARG_STRING,
GRPC_SSL_TARGET_NAME_OVERRIDE_ARG,
{"foo.test.google.fr"}};
grpc_arg ssl_name_override = {
GRPC_ARG_STRING,
const_cast<char *>(GRPC_SSL_TARGET_NAME_OVERRIDE_ARG),
{const_cast<char *>("foo.test.google.fr")}};
grpc_channel_args *new_client_args =
grpc_channel_args_copy_and_add(client_args, &ssl_name_override, 1);
chttp2_init_client_secure_fullstack(f, new_client_args, ssl_oauth2_creds);
@ -175,7 +180,8 @@ static void processor_destroy(void *state) {
}
static grpc_auth_metadata_processor test_processor_create(int failing) {
test_processor_state *s = gpr_malloc(sizeof(*s));
test_processor_state *s =
static_cast<test_processor_state *>(gpr_malloc(sizeof(*s)));
grpc_auth_metadata_processor result;
s->pseudo_refcount = 1;
result.state = s;

@ -58,7 +58,8 @@ static const grpc_end2end_proxy_def proxy_def = {create_proxy_server,
static grpc_end2end_test_fixture chttp2_create_fixture_fullstack(
grpc_channel_args *client_args, grpc_channel_args *server_args) {
grpc_end2end_test_fixture f;
fullstack_fixture_data *ffd = gpr_malloc(sizeof(fullstack_fixture_data));
fullstack_fixture_data *ffd = static_cast<fullstack_fixture_data *>(
gpr_malloc(sizeof(fullstack_fixture_data)));
memset(&f, 0, sizeof(f));
ffd->proxy = grpc_end2end_proxy_create(&proxy_def, client_args, server_args);
@ -72,7 +73,8 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack(
void chttp2_init_client_fullstack(grpc_end2end_test_fixture *f,
grpc_channel_args *client_args) {
fullstack_fixture_data *ffd = f->fixture_data;
fullstack_fixture_data *ffd =
static_cast<fullstack_fixture_data *>(f->fixture_data);
f->client = grpc_insecure_channel_create(
grpc_end2end_proxy_get_client_target(ffd->proxy), client_args, NULL);
GPR_ASSERT(f->client);
@ -80,7 +82,8 @@ void chttp2_init_client_fullstack(grpc_end2end_test_fixture *f,
void chttp2_init_server_fullstack(grpc_end2end_test_fixture *f,
grpc_channel_args *server_args) {
fullstack_fixture_data *ffd = f->fixture_data;
fullstack_fixture_data *ffd =
static_cast<fullstack_fixture_data *>(f->fixture_data);
if (f->server) {
grpc_server_destroy(f->server);
}
@ -92,7 +95,8 @@ void chttp2_init_server_fullstack(grpc_end2end_test_fixture *f,
}
void chttp2_tear_down_fullstack(grpc_end2end_test_fixture *f) {
fullstack_fixture_data *ffd = f->fixture_data;
fullstack_fixture_data *ffd =
static_cast<fullstack_fixture_data *>(f->fixture_data);
grpc_end2end_proxy_destroy(ffd->proxy);
gpr_free(ffd);
}

@ -49,9 +49,9 @@
connected_channel without a client_channel */
static void server_setup_transport(void *ts, grpc_transport *transport) {
grpc_end2end_test_fixture *f = ts;
grpc_end2end_test_fixture *f = static_cast<grpc_end2end_test_fixture *>(ts);
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_endpoint_pair *sfd = f->fixture_data;
grpc_endpoint_pair *sfd = static_cast<grpc_endpoint_pair *>(f->fixture_data);
grpc_endpoint_add_to_pollset(&exec_ctx, sfd->server, grpc_cq_pollset(f->cq));
grpc_server_setup_transport(&exec_ctx, f->server, transport, NULL,
grpc_server_get_channel_args(f->server));
@ -65,7 +65,7 @@ typedef struct {
static void client_setup_transport(grpc_exec_ctx *exec_ctx, void *ts,
grpc_transport *transport) {
sp_client_setup *cs = ts;
sp_client_setup *cs = static_cast<sp_client_setup *>(ts);
cs->f->client =
grpc_channel_create(exec_ctx, "socketpair-target", cs->client_args,
@ -74,7 +74,8 @@ static void client_setup_transport(grpc_exec_ctx *exec_ctx, void *ts,
static grpc_end2end_test_fixture chttp2_create_fixture_socketpair(
grpc_channel_args *client_args, grpc_channel_args *server_args) {
grpc_endpoint_pair *sfd = gpr_malloc(sizeof(grpc_endpoint_pair));
grpc_endpoint_pair *sfd =
static_cast<grpc_endpoint_pair *>(gpr_malloc(sizeof(grpc_endpoint_pair)));
grpc_end2end_test_fixture f;
memset(&f, 0, sizeof(f));
@ -90,7 +91,7 @@ static grpc_end2end_test_fixture chttp2_create_fixture_socketpair(
static void chttp2_init_client_socketpair(grpc_end2end_test_fixture *f,
grpc_channel_args *client_args) {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_endpoint_pair *sfd = f->fixture_data;
grpc_endpoint_pair *sfd = static_cast<grpc_endpoint_pair *>(f->fixture_data);
grpc_transport *transport;
sp_client_setup cs;
cs.client_args = client_args;
@ -106,7 +107,7 @@ static void chttp2_init_client_socketpair(grpc_end2end_test_fixture *f,
static void chttp2_init_server_socketpair(grpc_end2end_test_fixture *f,
grpc_channel_args *server_args) {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_endpoint_pair *sfd = f->fixture_data;
grpc_endpoint_pair *sfd = static_cast<grpc_endpoint_pair *>(f->fixture_data);
grpc_transport *transport;
GPR_ASSERT(!f->server);
f->server = grpc_server_create(server_args, NULL);

@ -43,9 +43,9 @@
connected_channel without a client_channel */
static void server_setup_transport(void *ts, grpc_transport *transport) {
grpc_end2end_test_fixture *f = ts;
grpc_end2end_test_fixture *f = static_cast<grpc_end2end_test_fixture *>(ts);
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_endpoint_pair *sfd = f->fixture_data;
grpc_endpoint_pair *sfd = static_cast<grpc_endpoint_pair *>(f->fixture_data);
grpc_endpoint_add_to_pollset(&exec_ctx, sfd->server, grpc_cq_pollset(f->cq));
grpc_server_setup_transport(&exec_ctx, f->server, transport, NULL,
grpc_server_get_channel_args(f->server));
@ -59,7 +59,7 @@ typedef struct {
static void client_setup_transport(grpc_exec_ctx *exec_ctx, void *ts,
grpc_transport *transport) {
sp_client_setup *cs = ts;
sp_client_setup *cs = static_cast<sp_client_setup *>(ts);
cs->f->client =
grpc_channel_create(exec_ctx, "socketpair-target", cs->client_args,
@ -68,7 +68,8 @@ static void client_setup_transport(grpc_exec_ctx *exec_ctx, void *ts,
static grpc_end2end_test_fixture chttp2_create_fixture_socketpair(
grpc_channel_args *client_args, grpc_channel_args *server_args) {
grpc_endpoint_pair *sfd = gpr_malloc(sizeof(grpc_endpoint_pair));
grpc_endpoint_pair *sfd =
static_cast<grpc_endpoint_pair *>(gpr_malloc(sizeof(grpc_endpoint_pair)));
grpc_end2end_test_fixture f;
memset(&f, 0, sizeof(f));
@ -84,7 +85,7 @@ static grpc_end2end_test_fixture chttp2_create_fixture_socketpair(
static void chttp2_init_client_socketpair(grpc_end2end_test_fixture *f,
grpc_channel_args *client_args) {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_endpoint_pair *sfd = f->fixture_data;
grpc_endpoint_pair *sfd = static_cast<grpc_endpoint_pair *>(f->fixture_data);
grpc_transport *transport;
sp_client_setup cs;
cs.client_args = client_args;
@ -100,7 +101,7 @@ static void chttp2_init_client_socketpair(grpc_end2end_test_fixture *f,
static void chttp2_init_server_socketpair(grpc_end2end_test_fixture *f,
grpc_channel_args *server_args) {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_endpoint_pair *sfd = f->fixture_data;
grpc_endpoint_pair *sfd = static_cast<grpc_endpoint_pair *>(f->fixture_data);
grpc_transport *transport;
GPR_ASSERT(!f->server);
f->server = grpc_server_create(server_args, NULL);

@ -43,9 +43,9 @@
connected_channel without a client_channel */
static void server_setup_transport(void *ts, grpc_transport *transport) {
grpc_end2end_test_fixture *f = ts;
grpc_end2end_test_fixture *f = static_cast<grpc_end2end_test_fixture *>(ts);
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_endpoint_pair *sfd = f->fixture_data;
grpc_endpoint_pair *sfd = static_cast<grpc_endpoint_pair *>(f->fixture_data);
grpc_endpoint_add_to_pollset(&exec_ctx, sfd->server, grpc_cq_pollset(f->cq));
grpc_server_setup_transport(&exec_ctx, f->server, transport, NULL,
grpc_server_get_channel_args(f->server));
@ -59,7 +59,7 @@ typedef struct {
static void client_setup_transport(grpc_exec_ctx *exec_ctx, void *ts,
grpc_transport *transport) {
sp_client_setup *cs = ts;
sp_client_setup *cs = static_cast<sp_client_setup *>(ts);
cs->f->client =
grpc_channel_create(exec_ctx, "socketpair-target", cs->client_args,
@ -68,7 +68,8 @@ static void client_setup_transport(grpc_exec_ctx *exec_ctx, void *ts,
static grpc_end2end_test_fixture chttp2_create_fixture_socketpair(
grpc_channel_args *client_args, grpc_channel_args *server_args) {
grpc_endpoint_pair *sfd = gpr_malloc(sizeof(grpc_endpoint_pair));
grpc_endpoint_pair *sfd =
static_cast<grpc_endpoint_pair *>(gpr_malloc(sizeof(grpc_endpoint_pair)));
grpc_end2end_test_fixture f;
memset(&f, 0, sizeof(f));
@ -76,16 +77,17 @@ static grpc_end2end_test_fixture chttp2_create_fixture_socketpair(
f.cq = grpc_completion_queue_create_for_next(NULL);
f.shutdown_cq = grpc_completion_queue_create_for_pluck(NULL);
grpc_arg a[] = {{.key = GRPC_ARG_TCP_READ_CHUNK_SIZE,
.type = GRPC_ARG_INTEGER,
.value.integer = 1},
{.key = GRPC_ARG_TCP_MIN_READ_CHUNK_SIZE,
.type = GRPC_ARG_INTEGER,
.value.integer = 1},
{.key = GRPC_ARG_TCP_MAX_READ_CHUNK_SIZE,
.type = GRPC_ARG_INTEGER,
.value.integer = 1}};
grpc_channel_args args = {.num_args = GPR_ARRAY_SIZE(a), .args = a};
grpc_arg a[3];
a[0].key = const_cast<char *>(GRPC_ARG_TCP_READ_CHUNK_SIZE);
a[0].type = GRPC_ARG_INTEGER;
a[0].value.integer = 1;
a[1].key = const_cast<char *>(GRPC_ARG_TCP_MIN_READ_CHUNK_SIZE);
a[1].type = GRPC_ARG_INTEGER;
a[1].value.integer = 1;
a[2].key = const_cast<char *>(GRPC_ARG_TCP_MAX_READ_CHUNK_SIZE);
a[2].type = GRPC_ARG_INTEGER;
a[2].value.integer = 1;
grpc_channel_args args = {GPR_ARRAY_SIZE(a), a};
*sfd = grpc_iomgr_create_endpoint_pair("fixture", &args);
return f;
@ -94,7 +96,7 @@ static grpc_end2end_test_fixture chttp2_create_fixture_socketpair(
static void chttp2_init_client_socketpair(grpc_end2end_test_fixture *f,
grpc_channel_args *client_args) {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_endpoint_pair *sfd = f->fixture_data;
grpc_endpoint_pair *sfd = static_cast<grpc_endpoint_pair *>(f->fixture_data);
grpc_transport *transport;
sp_client_setup cs;
cs.client_args = client_args;
@ -110,7 +112,7 @@ static void chttp2_init_client_socketpair(grpc_end2end_test_fixture *f,
static void chttp2_init_server_socketpair(grpc_end2end_test_fixture *f,
grpc_channel_args *server_args) {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_endpoint_pair *sfd = f->fixture_data;
grpc_endpoint_pair *sfd = static_cast<grpc_endpoint_pair *>(f->fixture_data);
grpc_transport *transport;
GPR_ASSERT(!f->server);
f->server = grpc_server_create(server_args, NULL);

@ -43,7 +43,8 @@ static grpc_end2end_test_fixture chttp2_create_fixture_secure_fullstack(
grpc_end2end_test_fixture f;
int port = grpc_pick_unused_port_or_die();
fullstack_secure_fixture_data *ffd =
gpr_malloc(sizeof(fullstack_secure_fixture_data));
static_cast<fullstack_secure_fixture_data *>(
gpr_malloc(sizeof(fullstack_secure_fixture_data)));
memset(&f, 0, sizeof(f));
gpr_join_host_port(&ffd->localaddr, "localhost", port);
@ -66,7 +67,8 @@ static void process_auth_failure(void *state, grpc_auth_context *ctx,
static void chttp2_init_client_secure_fullstack(
grpc_end2end_test_fixture *f, grpc_channel_args *client_args,
grpc_channel_credentials *creds) {
fullstack_secure_fixture_data *ffd = f->fixture_data;
fullstack_secure_fixture_data *ffd =
static_cast<fullstack_secure_fixture_data *>(f->fixture_data);
f->client =
grpc_secure_channel_create(creds, ffd->localaddr, client_args, NULL);
GPR_ASSERT(f->client != NULL);
@ -76,7 +78,8 @@ static void chttp2_init_client_secure_fullstack(
static void chttp2_init_server_secure_fullstack(
grpc_end2end_test_fixture *f, grpc_channel_args *server_args,
grpc_server_credentials *server_creds) {
fullstack_secure_fixture_data *ffd = f->fixture_data;
fullstack_secure_fixture_data *ffd =
static_cast<fullstack_secure_fixture_data *>(f->fixture_data);
if (f->server) {
grpc_server_destroy(f->server);
}
@ -89,7 +92,8 @@ static void chttp2_init_server_secure_fullstack(
}
void chttp2_tear_down_secure_fullstack(grpc_end2end_test_fixture *f) {
fullstack_secure_fixture_data *ffd = f->fixture_data;
fullstack_secure_fixture_data *ffd =
static_cast<fullstack_secure_fixture_data *>(f->fixture_data);
gpr_free(ffd->localaddr);
gpr_free(ffd);
}
@ -98,9 +102,10 @@ static void chttp2_init_client_simple_ssl_secure_fullstack(
grpc_end2end_test_fixture *f, grpc_channel_args *client_args) {
grpc_channel_credentials *ssl_creds =
grpc_ssl_credentials_create(NULL, NULL, NULL);
grpc_arg ssl_name_override = {GRPC_ARG_STRING,
GRPC_SSL_TARGET_NAME_OVERRIDE_ARG,
{"foo.test.google.fr"}};
grpc_arg ssl_name_override = {
GRPC_ARG_STRING,
const_cast<char *>(GRPC_SSL_TARGET_NAME_OVERRIDE_ARG),
{const_cast<char *>("foo.test.google.fr")}};
grpc_channel_args *new_client_args =
grpc_channel_args_copy_and_add(client_args, &ssl_name_override, 1);
chttp2_init_client_secure_fullstack(f, new_client_args, ssl_creds);

@ -56,9 +56,10 @@ static grpc_channel *create_proxy_client(const char *target,
grpc_channel *channel;
grpc_channel_credentials *ssl_creds =
grpc_ssl_credentials_create(NULL, NULL, NULL);
grpc_arg ssl_name_override = {GRPC_ARG_STRING,
GRPC_SSL_TARGET_NAME_OVERRIDE_ARG,
{"foo.test.google.fr"}};
grpc_arg ssl_name_override = {
GRPC_ARG_STRING,
const_cast<char *>(GRPC_SSL_TARGET_NAME_OVERRIDE_ARG),
{const_cast<char *>("foo.test.google.fr")}};
grpc_channel_args *new_client_args =
grpc_channel_args_copy_and_add(client_args, &ssl_name_override, 1);
channel =
@ -79,7 +80,8 @@ static grpc_end2end_test_fixture chttp2_create_fixture_secure_fullstack(
grpc_channel_args *client_args, grpc_channel_args *server_args) {
grpc_end2end_test_fixture f;
fullstack_secure_fixture_data *ffd =
gpr_malloc(sizeof(fullstack_secure_fixture_data));
static_cast<fullstack_secure_fixture_data *>(
gpr_malloc(sizeof(fullstack_secure_fixture_data)));
memset(&f, 0, sizeof(f));
ffd->proxy = grpc_end2end_proxy_create(&proxy_def, client_args, server_args);
@ -102,7 +104,8 @@ static void process_auth_failure(void *state, grpc_auth_context *ctx,
static void chttp2_init_client_secure_fullstack(
grpc_end2end_test_fixture *f, grpc_channel_args *client_args,
grpc_channel_credentials *creds) {
fullstack_secure_fixture_data *ffd = f->fixture_data;
fullstack_secure_fixture_data *ffd =
static_cast<fullstack_secure_fixture_data *>(f->fixture_data);
f->client = grpc_secure_channel_create(
creds, grpc_end2end_proxy_get_client_target(ffd->proxy), client_args,
NULL);
@ -113,7 +116,8 @@ static void chttp2_init_client_secure_fullstack(
static void chttp2_init_server_secure_fullstack(
grpc_end2end_test_fixture *f, grpc_channel_args *server_args,
grpc_server_credentials *server_creds) {
fullstack_secure_fixture_data *ffd = f->fixture_data;
fullstack_secure_fixture_data *ffd =
static_cast<fullstack_secure_fixture_data *>(f->fixture_data);
if (f->server) {
grpc_server_destroy(f->server);
}
@ -126,7 +130,8 @@ static void chttp2_init_server_secure_fullstack(
}
void chttp2_tear_down_secure_fullstack(grpc_end2end_test_fixture *f) {
fullstack_secure_fixture_data *ffd = f->fixture_data;
fullstack_secure_fixture_data *ffd =
static_cast<fullstack_secure_fixture_data *>(f->fixture_data);
grpc_end2end_proxy_destroy(ffd->proxy);
gpr_free(ffd);
}
@ -135,9 +140,10 @@ static void chttp2_init_client_simple_ssl_secure_fullstack(
grpc_end2end_test_fixture *f, grpc_channel_args *client_args) {
grpc_channel_credentials *ssl_creds =
grpc_ssl_credentials_create(NULL, NULL, NULL);
grpc_arg ssl_name_override = {GRPC_ARG_STRING,
GRPC_SSL_TARGET_NAME_OVERRIDE_ARG,
{"foo.test.google.fr"}};
grpc_arg ssl_name_override = {
GRPC_ARG_STRING,
const_cast<char *>(GRPC_SSL_TARGET_NAME_OVERRIDE_ARG),
{const_cast<char *>("foo.test.google.fr")}};
grpc_channel_args *new_client_args =
grpc_channel_args_copy_and_add(client_args, &ssl_name_override, 1);
chttp2_init_client_secure_fullstack(f, new_client_args, ssl_creds);

@ -48,7 +48,8 @@ static int unique = 1;
static grpc_end2end_test_fixture chttp2_create_fixture_fullstack(
grpc_channel_args *client_args, grpc_channel_args *server_args) {
grpc_end2end_test_fixture f;
fullstack_fixture_data *ffd = gpr_malloc(sizeof(fullstack_fixture_data));
fullstack_fixture_data *ffd = static_cast<fullstack_fixture_data *>(
gpr_malloc(sizeof(fullstack_fixture_data)));
memset(&f, 0, sizeof(f));
gpr_asprintf(&ffd->localaddr, "unix:/tmp/grpc_fullstack_test.%d.%d", getpid(),
@ -63,13 +64,15 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack(
void chttp2_init_client_fullstack(grpc_end2end_test_fixture *f,
grpc_channel_args *client_args) {
fullstack_fixture_data *ffd = f->fixture_data;
fullstack_fixture_data *ffd =
static_cast<fullstack_fixture_data *>(f->fixture_data);
f->client = grpc_insecure_channel_create(ffd->localaddr, client_args, NULL);
}
void chttp2_init_server_fullstack(grpc_end2end_test_fixture *f,
grpc_channel_args *server_args) {
fullstack_fixture_data *ffd = f->fixture_data;
fullstack_fixture_data *ffd =
static_cast<fullstack_fixture_data *>(f->fixture_data);
if (f->server) {
grpc_server_destroy(f->server);
}
@ -80,7 +83,8 @@ void chttp2_init_server_fullstack(grpc_end2end_test_fixture *f,
}
void chttp2_tear_down_fullstack(grpc_end2end_test_fixture *f) {
fullstack_fixture_data *ffd = f->fixture_data;
fullstack_fixture_data *ffd =
static_cast<fullstack_fixture_data *>(f->fixture_data);
gpr_free(ffd->localaddr);
gpr_free(ffd);
}

@ -42,7 +42,8 @@ typedef struct inproc_fixture_data {
static grpc_end2end_test_fixture inproc_create_fixture(
grpc_channel_args *client_args, grpc_channel_args *server_args) {
grpc_end2end_test_fixture f;
inproc_fixture_data *ffd = gpr_malloc(sizeof(inproc_fixture_data));
inproc_fixture_data *ffd = static_cast<inproc_fixture_data *>(
gpr_malloc(sizeof(inproc_fixture_data)));
memset(&f, 0, sizeof(f));
f.fixture_data = ffd;
@ -69,7 +70,8 @@ void inproc_init_server(grpc_end2end_test_fixture *f,
}
void inproc_tear_down(grpc_end2end_test_fixture *f) {
inproc_fixture_data *ffd = f->fixture_data;
inproc_fixture_data *ffd =
static_cast<inproc_fixture_data *>(f->fixture_data);
gpr_free(ffd);
}

@ -91,7 +91,7 @@ static char *read_string(input_stream *inp, bool *special) {
do {
if (cap == sz) {
cap = GPR_MAX(3 * cap / 2, cap + 8);
str = gpr_realloc(str, cap);
str = static_cast<char *>(gpr_realloc(str, cap));
}
c = (char)next_byte(inp);
str[sz++] = c;
@ -114,7 +114,7 @@ static void read_buffer(input_stream *inp, char **buffer, size_t *length,
} else {
if (special != NULL) *special = false;
}
*buffer = gpr_malloc(*length);
*buffer = static_cast<char *>(gpr_malloc(*length));
for (size_t i = 0; i < *length; i++) {
(*buffer)[i] = (char)next_byte(inp);
}
@ -196,7 +196,7 @@ static int read_int(input_stream *inp) { return (int)read_uint32(inp); }
static grpc_channel_args *read_args(input_stream *inp) {
size_t n = next_byte(inp);
grpc_arg *args = gpr_malloc(sizeof(*args) * n);
grpc_arg *args = static_cast<grpc_arg *>(gpr_malloc(sizeof(*args) * n));
for (size_t i = 0; i < n; i++) {
switch (next_byte(inp)) {
case 1:
@ -222,7 +222,8 @@ static grpc_channel_args *read_args(input_stream *inp) {
break;
}
}
grpc_channel_args *a = gpr_malloc(sizeof(*a));
grpc_channel_args *a =
static_cast<grpc_channel_args *>(gpr_malloc(sizeof(*a)));
a->args = args;
a->num_args = n;
return a;
@ -373,13 +374,15 @@ typedef struct addr_req {
static void finish_resolve(grpc_exec_ctx *exec_ctx, void *arg,
grpc_error *error) {
addr_req *r = arg;
addr_req *r = static_cast<addr_req *>(arg);
if (error == GRPC_ERROR_NONE && 0 == strcmp(r->addr, "server")) {
if (r->addrs != NULL) {
grpc_resolved_addresses *addrs = gpr_malloc(sizeof(*addrs));
grpc_resolved_addresses *addrs =
static_cast<grpc_resolved_addresses *>(gpr_malloc(sizeof(*addrs)));
addrs->naddrs = 1;
addrs->addrs = gpr_malloc(sizeof(*addrs->addrs));
addrs->addrs = static_cast<grpc_resolved_address *>(
gpr_malloc(sizeof(*addrs->addrs)));
addrs->addrs[0].len = 0;
*r->addrs = addrs;
} else if (r->lb_addrs != NULL) {
@ -403,7 +406,7 @@ void my_resolve_address(grpc_exec_ctx *exec_ctx, const char *addr,
grpc_pollset_set *interested_parties,
grpc_closure *on_done,
grpc_resolved_addresses **addresses) {
addr_req *r = gpr_malloc(sizeof(*r));
addr_req *r = static_cast<addr_req *>(gpr_malloc(sizeof(*r)));
r->addr = gpr_strdup(addr);
r->on_done = on_done;
r->addrs = addresses;
@ -418,7 +421,7 @@ grpc_ares_request *my_dns_lookup_ares(
const char *default_port, grpc_pollset_set *interested_parties,
grpc_closure *on_done, grpc_lb_addresses **lb_addrs, bool check_grpclb,
char **service_config_json) {
addr_req *r = gpr_malloc(sizeof(*r));
addr_req *r = static_cast<addr_req *>(gpr_malloc(sizeof(*r)));
r->addr = gpr_strdup(addr);
r->on_done = on_done;
r->addrs = NULL;
@ -449,7 +452,7 @@ typedef struct {
} future_connect;
static void do_connect(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) {
future_connect *fc = arg;
future_connect *fc = static_cast<future_connect *>(arg);
if (error != GRPC_ERROR_NONE) {
*fc->ep = NULL;
GRPC_CLOSURE_SCHED(exec_ctx, fc->closure, GRPC_ERROR_REF(error));
@ -480,7 +483,7 @@ static void sched_connect(grpc_exec_ctx *exec_ctx, grpc_closure *closure,
return;
}
future_connect *fc = gpr_malloc(sizeof(*fc));
future_connect *fc = static_cast<future_connect *>(gpr_malloc(sizeof(*fc)));
fc->closure = closure;
fc->ep = ep;
fc->deadline = deadline;
@ -508,7 +511,7 @@ typedef struct validator {
static validator *create_validator(void (*validate)(void *arg, bool success),
void *arg) {
validator *v = gpr_malloc(sizeof(*v));
validator *v = static_cast<validator *>(gpr_malloc(sizeof(*v)));
v->validate = validate;
v->arg = arg;
return v;
@ -528,14 +531,15 @@ typedef struct connectivity_watch {
static connectivity_watch *make_connectivity_watch(gpr_timespec s,
int *counter) {
connectivity_watch *o = gpr_malloc(sizeof(*o));
connectivity_watch *o =
static_cast<connectivity_watch *>(gpr_malloc(sizeof(*o)));
o->deadline = s;
o->counter = counter;
return o;
}
static void validate_connectivity_watch(void *p, bool success) {
connectivity_watch *w = p;
connectivity_watch *w = static_cast<connectivity_watch *>(p);
if (!success) {
GPR_ASSERT(gpr_time_cmp(gpr_now(w->deadline.clock_type), w->deadline) >= 0);
}
@ -585,7 +589,7 @@ typedef struct call_state {
static call_state *g_active_call;
static call_state *new_call(call_state *sibling, call_state_type type) {
call_state *c = gpr_malloc(sizeof(*c));
call_state *c = static_cast<call_state *>(gpr_malloc(sizeof(*c)));
memset(c, 0, sizeof(*c));
if (sibling != NULL) {
c->next = sibling;
@ -634,8 +638,8 @@ static call_state *maybe_delete_call_state(call_state *call) {
static void add_to_free(call_state *call, void *p) {
if (call->num_to_free == call->cap_to_free) {
call->cap_to_free = GPR_MAX(8, 2 * call->cap_to_free);
call->to_free =
gpr_realloc(call->to_free, sizeof(*call->to_free) * call->cap_to_free);
call->to_free = static_cast<void **>(
gpr_realloc(call->to_free, sizeof(*call->to_free) * call->cap_to_free));
}
call->to_free[call->num_to_free++] = p;
}
@ -643,12 +647,12 @@ static void add_to_free(call_state *call, void *p) {
static grpc_slice *add_slice_to_unref(call_state *call, grpc_slice s) {
if (call->num_slices_to_unref == call->cap_slices_to_unref) {
call->cap_slices_to_unref = GPR_MAX(8, 2 * call->cap_slices_to_unref);
call->slices_to_unref =
gpr_realloc(call->slices_to_unref,
sizeof(*call->slices_to_unref) * call->cap_slices_to_unref);
call->slices_to_unref = static_cast<grpc_slice **>(gpr_realloc(
call->slices_to_unref,
sizeof(*call->slices_to_unref) * call->cap_slices_to_unref));
}
call->slices_to_unref[call->num_slices_to_unref] =
gpr_malloc(sizeof(grpc_slice));
static_cast<grpc_slice *>(gpr_malloc(sizeof(grpc_slice)));
*call->slices_to_unref[call->num_slices_to_unref++] = s;
return call->slices_to_unref[call->num_slices_to_unref - 1];
}
@ -657,7 +661,8 @@ static void read_metadata(input_stream *inp, size_t *count,
grpc_metadata **metadata, call_state *cs) {
*count = next_byte(inp);
if (*count) {
*metadata = gpr_malloc(*count * sizeof(**metadata));
*metadata =
static_cast<grpc_metadata *>(gpr_malloc(*count * sizeof(**metadata)));
memset(*metadata, 0, *count * sizeof(**metadata));
for (size_t i = 0; i < *count; i++) {
(*metadata)[i].key = read_string_like_slice(inp);
@ -667,7 +672,7 @@ static void read_metadata(input_stream *inp, size_t *count,
add_slice_to_unref(cs, (*metadata)[i].value);
}
} else {
*metadata = gpr_malloc(1);
*metadata = static_cast<grpc_metadata *>(gpr_malloc(1));
}
add_to_free(cs, *metadata);
}
@ -679,7 +684,7 @@ static call_state *destroy_call(call_state *call) {
}
static void finished_request_call(void *csp, bool success) {
call_state *cs = csp;
call_state *cs = static_cast<call_state *>(csp);
GPR_ASSERT(cs->pending_ops > 0);
--cs->pending_ops;
if (success) {
@ -696,7 +701,7 @@ typedef struct {
} batch_info;
static void finished_batch(void *p, bool success) {
batch_info *bi = p;
batch_info *bi = static_cast<batch_info *>(p);
--bi->cs->pending_ops;
if ((bi->has_ops & (1u << GRPC_OP_RECV_MESSAGE)) &&
(bi->cs->done_flags & DONE_FLAG_CALL_CLOSED)) {
@ -721,7 +726,7 @@ static void finished_batch(void *p, bool success) {
static validator *make_finished_batch_validator(call_state *cs,
uint8_t has_ops) {
batch_info *bi = gpr_malloc(sizeof(*bi));
batch_info *bi = static_cast<batch_info *>(gpr_malloc(sizeof(*bi)));
bi->cs = cs;
bi->has_ops = has_ops;
return create_validator(finished_batch, bi);
@ -803,7 +808,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
cq, gpr_inf_past(GPR_CLOCK_REALTIME), NULL);
switch (ev.type) {
case GRPC_OP_COMPLETE: {
validator *v = ev.tag;
validator *v = static_cast<validator *>(ev.tag);
v->validate(v->arg, ev.success);
gpr_free(v);
break;
@ -992,7 +997,8 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
end(&inp);
break;
}
grpc_op *ops = gpr_malloc(sizeof(grpc_op) * num_ops);
grpc_op *ops =
static_cast<grpc_op *>(gpr_malloc(sizeof(grpc_op) * num_ops));
if (num_ops > 0) memset(ops, 0, sizeof(grpc_op) * num_ops);
bool ok = true;
size_t i;
@ -1035,7 +1041,8 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
&op->data.send_status_from_server.trailing_metadata_count,
&op->data.send_status_from_server.trailing_metadata,
g_active_call);
op->data.send_status_from_server.status = next_byte(&inp);
op->data.send_status_from_server.status =
static_cast<grpc_status_code>(next_byte(&inp));
op->data.send_status_from_server.status_details =
add_slice_to_unref(g_active_call,
read_buffer_like_slice(&inp));

@ -220,9 +220,9 @@ def main():
'build': 'private',
'language': 'c',
'secure': True,
'src': ['test/core/end2end/end2end_tests.c',
'test/core/end2end/end2end_test_utils.c'] + [
'test/core/end2end/tests/%s.c' % t
'src': ['test/core/end2end/end2end_tests.cc',
'test/core/end2end/end2end_test_utils.cc'] + [
'test/core/end2end/tests/%s.cc' % t
for t in sorted(END2END_TESTS.keys())],
'headers': ['test/core/end2end/tests/cancel_test_helpers.h',
'test/core/end2end/end2end_tests.h'],
@ -235,9 +235,9 @@ def main():
'build': 'private',
'language': 'c',
'secure': False,
'src': ['test/core/end2end/end2end_nosec_tests.c',
'test/core/end2end/end2end_test_utils.c'] + [
'test/core/end2end/tests/%s.c' % t
'src': ['test/core/end2end/end2end_nosec_tests.cc',
'test/core/end2end/end2end_test_utils.cc'] + [
'test/core/end2end/tests/%s.cc' % t
for t in sorted(END2END_TESTS.keys())
if not END2END_TESTS[t].secure],
'headers': ['test/core/end2end/tests/cancel_test_helpers.h',
@ -252,7 +252,7 @@ def main():
'build': 'test',
'language': 'c',
'run': False,
'src': ['test/core/end2end/fixtures/%s.c' % f],
'src': ['test/core/end2end/fixtures/%s.cc' % f],
'platforms': END2END_FIXTURES[f].platforms,
'ci_platforms': (END2END_FIXTURES[f].platforms
if END2END_FIXTURES[f].ci_mac else without(
@ -269,7 +269,7 @@ def main():
'build': 'test',
'language': 'c',
'secure': False,
'src': ['test/core/end2end/fixtures/%s.c' % f],
'src': ['test/core/end2end/fixtures/%s.cc' % f],
'run': False,
'platforms': END2END_FIXTURES[f].platforms,
'ci_platforms': (END2END_FIXTURES[f].platforms

@ -186,8 +186,8 @@ def compatible(fopt, topt):
def grpc_end2end_tests():
grpc_cc_library(
name = 'end2end_tests',
srcs = ['end2end_tests.c', 'end2end_test_utils.c'] + [
'tests/%s.c' % t
srcs = ['end2end_tests.cc', 'end2end_test_utils.cc'] + [
'tests/%s.cc' % t
for t in sorted(END2END_TESTS.keys())],
hdrs = [
'tests/cancel_test_helpers.h',
@ -205,7 +205,7 @@ def grpc_end2end_tests():
for f, fopt in END2END_FIXTURES.items():
grpc_cc_binary(
name = '%s_test' % f,
srcs = ['fixtures/%s.c' % f],
srcs = ['fixtures/%s.cc' % f],
language = "C",
deps = [
':end2end_tests',

@ -74,9 +74,11 @@ static void my_resolve_address(grpc_exec_ctx *exec_ctx, const char *addr,
gpr_mu_unlock(&g_mu);
error = GRPC_ERROR_CREATE_FROM_STATIC_STRING("Forced Failure");
} else {
*addrs = gpr_malloc(sizeof(**addrs));
*addrs =
static_cast<grpc_resolved_addresses *>(gpr_malloc(sizeof(**addrs)));
(*addrs)->naddrs = 1;
(*addrs)->addrs = gpr_malloc(sizeof(*(*addrs)->addrs));
(*addrs)->addrs = static_cast<grpc_resolved_address *>(
gpr_malloc(sizeof(*(*addrs)->addrs)));
memset((*addrs)->addrs, 0, sizeof(*(*addrs)->addrs));
struct sockaddr_in *sa = (struct sockaddr_in *)(*addrs)->addrs[0].addr;
sa->sin_family = AF_INET;
@ -106,7 +108,8 @@ static grpc_ares_request *my_dns_lookup_ares(
error = GRPC_ERROR_CREATE_FROM_STATIC_STRING("Forced Failure");
} else {
*lb_addrs = grpc_lb_addresses_create(1, NULL);
struct sockaddr_in *sa = gpr_zalloc(sizeof(struct sockaddr_in));
struct sockaddr_in *sa = static_cast<struct sockaddr_in *>(
gpr_zalloc(sizeof(struct sockaddr_in)));
sa->sin_family = AF_INET;
sa->sin_addr.s_addr = htonl(0x7f000001);
sa->sin_port = htons((uint16_t)g_resolve_port);
@ -167,7 +170,8 @@ int main(int argc, char **argv) {
grpc_channel_args client_args;
grpc_arg arg_array[1];
arg_array[0].type = GRPC_ARG_INTEGER;
arg_array[0].key = "grpc.testing.fixed_reconnect_backoff_ms";
arg_array[0].key =
const_cast<char *>("grpc.testing.fixed_reconnect_backoff_ms");
arg_array[0].value.integer = 1000;
client_args.args = arg_array;
client_args.num_args = 1;

@ -258,7 +258,7 @@ static void test_send_messages_at_the_same_time() {
op->reserved = NULL;
op++;
op->op = GRPC_OP_SEND_MESSAGE;
op->data.send_message.send_message = tag(2);
op->data.send_message.send_message = static_cast<grpc_byte_buffer *>(tag(2));
op->flags = 0;
op->reserved = NULL;
op++;

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

Loading…
Cancel
Save