aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/core
diff options
context:
space:
mode:
Diffstat (limited to 'test/core')
-rw-r--r--test/core/backoff/BUILD4
-rw-r--r--test/core/backoff/backoff_test.cc (renamed from test/core/backoff/backoff_test.c)0
-rw-r--r--test/core/bad_client/bad_client.cc (renamed from test/core/bad_client/bad_client.c)0
-rwxr-xr-xtest/core/bad_client/gen_build_yaml.py4
-rwxr-xr-xtest/core/bad_client/generate_tests.bzl6
-rw-r--r--test/core/bad_client/tests/badreq.cc (renamed from test/core/bad_client/tests/badreq.c)0
-rw-r--r--test/core/bad_client/tests/connection_prefix.cc (renamed from test/core/bad_client/tests/connection_prefix.c)0
-rw-r--r--test/core/bad_client/tests/head_of_line_blocking.cc (renamed from test/core/bad_client/tests/head_of_line_blocking.c)2
-rw-r--r--test/core/bad_client/tests/headers.cc (renamed from test/core/bad_client/tests/headers.c)0
-rw-r--r--test/core/bad_client/tests/initial_settings_frame.cc (renamed from test/core/bad_client/tests/initial_settings_frame.c)0
-rw-r--r--test/core/bad_client/tests/large_metadata.cc (renamed from test/core/bad_client/tests/large_metadata.c)0
-rw-r--r--test/core/bad_client/tests/server_registered_method.cc (renamed from test/core/bad_client/tests/server_registered_method.c)0
-rw-r--r--test/core/bad_client/tests/simple_request.cc (renamed from test/core/bad_client/tests/simple_request.c)0
-rw-r--r--test/core/bad_client/tests/unknown_frame.cc (renamed from test/core/bad_client/tests/unknown_frame.c)0
-rw-r--r--test/core/bad_client/tests/window_overflow.cc (renamed from test/core/bad_client/tests/window_overflow.c)2
-rw-r--r--test/core/bad_ssl/bad_ssl_test.cc (renamed from test/core/bad_ssl/bad_ssl_test.c)9
-rwxr-xr-xtest/core/bad_ssl/gen_build_yaml.py6
-rwxr-xr-xtest/core/bad_ssl/generate_tests.bzl4
-rw-r--r--test/core/bad_ssl/server_common.cc (renamed from test/core/bad_ssl/server_common.c)2
-rw-r--r--test/core/bad_ssl/servers/alpn.cc (renamed from test/core/bad_ssl/servers/alpn.c)0
-rw-r--r--test/core/bad_ssl/servers/cert.cc (renamed from test/core/bad_ssl/servers/cert.c)0
-rw-r--r--test/core/channel/BUILD12
-rw-r--r--test/core/channel/channel_args_test.cc (renamed from test/core/channel/channel_args_test.c)6
-rw-r--r--test/core/channel/channel_stack_builder_test.cc (renamed from test/core/channel/channel_stack_builder_test.c)5
-rw-r--r--test/core/channel/channel_stack_test.cc (renamed from test/core/channel/channel_stack_test.c)29
-rw-r--r--test/core/channel/minimal_stack_is_minimal_test.cc (renamed from test/core/channel/minimal_stack_is_minimal_test.c)20
-rw-r--r--test/core/client_channel/BUILD8
-rw-r--r--test/core/client_channel/lb_policies_test.cc (renamed from test/core/client_channel/lb_policies_test.c)104
-rw-r--r--test/core/client_channel/parse_address_test.cc (renamed from test/core/client_channel/parse_address_test.c)0
-rw-r--r--test/core/client_channel/resolvers/BUILD16
-rw-r--r--test/core/client_channel/resolvers/dns_resolver_connectivity_test.cc (renamed from test/core/client_channel/resolvers/dns_resolver_connectivity_test.c)11
-rw-r--r--test/core/client_channel/resolvers/dns_resolver_test.cc (renamed from test/core/client_channel/resolvers/dns_resolver_test.c)0
-rw-r--r--test/core/client_channel/resolvers/fake_resolver_test.cc (renamed from test/core/client_channel/resolvers/fake_resolver_test.c)6
-rw-r--r--test/core/client_channel/resolvers/sockaddr_resolver_test.cc (renamed from test/core/client_channel/resolvers/sockaddr_resolver_test.c)2
-rw-r--r--test/core/client_channel/uri_fuzzer_test.cc (renamed from test/core/client_channel/uri_fuzzer_test.c)4
-rw-r--r--test/core/client_channel/uri_parser_test.cc (renamed from test/core/client_channel/uri_parser_test.c)0
-rw-r--r--test/core/compression/BUILD12
-rw-r--r--test/core/compression/algorithm_test.cc (renamed from test/core/compression/algorithm_test.c)9
-rw-r--r--test/core/compression/compression_test.cc (renamed from test/core/compression/compression_test.c)12
-rw-r--r--test/core/compression/message_compress_test.cc (renamed from test/core/compression/message_compress_test.c)29
-rw-r--r--test/core/compression/stream_compression_test.cc (renamed from test/core/compression/stream_compression_test.c)3
-rw-r--r--test/core/debug/stats_test.cc2
-rw-r--r--test/core/end2end/BUILD22
-rw-r--r--test/core/end2end/bad_server_response_test.cc (renamed from test/core/end2end/bad_server_response_test.c)0
-rw-r--r--test/core/end2end/connection_refused_test.cc (renamed from test/core/end2end/connection_refused_test.c)6
-rw-r--r--test/core/end2end/cq_verifier.cc (renamed from test/core/end2end/cq_verifier.c)0
-rw-r--r--test/core/end2end/cq_verifier.h8
-rw-r--r--test/core/end2end/cq_verifier_native.cc (renamed from test/core/end2end/cq_verifier_native.c)2
-rw-r--r--test/core/end2end/cq_verifier_uv.cc (renamed from test/core/end2end/cq_verifier_uv.c)6
-rw-r--r--test/core/end2end/data/client_certs.cc (renamed from test/core/end2end/data/client_certs.c)2
-rw-r--r--test/core/end2end/data/server1_cert.cc (renamed from test/core/end2end/data/server1_cert.c)2
-rw-r--r--test/core/end2end/data/server1_key.cc (renamed from test/core/end2end/data/server1_key.c)2
-rw-r--r--test/core/end2end/data/test_root_cert.cc (renamed from test/core/end2end/data/test_root_cert.c)2
-rw-r--r--test/core/end2end/dualstack_socket_test.cc (renamed from test/core/end2end/dualstack_socket_test.c)3
-rw-r--r--test/core/end2end/end2end_nosec_tests.cc (renamed from test/core/end2end/end2end_nosec_tests.c)0
-rw-r--r--test/core/end2end/end2end_test_utils.cc (renamed from test/core/end2end/end2end_test_utils.c)0
-rw-r--r--test/core/end2end/end2end_tests.cc (renamed from test/core/end2end/end2end_tests.c)0
-rw-r--r--test/core/end2end/end2end_tests.h8
-rw-r--r--test/core/end2end/fixtures/h2_census.cc (renamed from test/core/end2end/fixtures/h2_census.c)14
-rw-r--r--test/core/end2end/fixtures/h2_compress.cc (renamed from test/core/end2end/fixtures/h2_compress.c)12
-rw-r--r--test/core/end2end/fixtures/h2_fakesec.cc (renamed from test/core/end2end/fixtures/h2_fakesec.c)12
-rw-r--r--test/core/end2end/fixtures/h2_fd.cc (renamed from test/core/end2end/fixtures/h2_fd.c)7
-rw-r--r--test/core/end2end/fixtures/h2_full+pipe.cc (renamed from test/core/end2end/fixtures/h2_full+pipe.c)12
-rw-r--r--test/core/end2end/fixtures/h2_full+trace.cc (renamed from test/core/end2end/fixtures/h2_full+trace.c)12
-rw-r--r--test/core/end2end/fixtures/h2_full+workarounds.cc (renamed from test/core/end2end/fixtures/h2_full+workarounds.c)14
-rw-r--r--test/core/end2end/fixtures/h2_full.cc (renamed from test/core/end2end/fixtures/h2_full.c)12
-rw-r--r--test/core/end2end/fixtures/h2_http_proxy.cc (renamed from test/core/end2end/fixtures/h2_http_proxy.c)12
-rw-r--r--test/core/end2end/fixtures/h2_load_reporting.cc (renamed from test/core/end2end/fixtures/h2_load_reporting.c)13
-rw-r--r--test/core/end2end/fixtures/h2_oauth2.cc (renamed from test/core/end2end/fixtures/h2_oauth2.c)22
-rw-r--r--test/core/end2end/fixtures/h2_proxy.cc (renamed from test/core/end2end/fixtures/h2_proxy.c)12
-rw-r--r--test/core/end2end/fixtures/h2_sockpair+trace.cc (renamed from test/core/end2end/fixtures/h2_sockpair+trace.c)13
-rw-r--r--test/core/end2end/fixtures/h2_sockpair.cc (renamed from test/core/end2end/fixtures/h2_sockpair.c)13
-rw-r--r--test/core/end2end/fixtures/h2_sockpair_1byte.cc (renamed from test/core/end2end/fixtures/h2_sockpair_1byte.c)34
-rw-r--r--test/core/end2end/fixtures/h2_ssl.cc (renamed from test/core/end2end/fixtures/h2_ssl.c)19
-rw-r--r--test/core/end2end/fixtures/h2_ssl_proxy.cc (renamed from test/core/end2end/fixtures/h2_ssl_proxy.c)26
-rw-r--r--test/core/end2end/fixtures/h2_uds.cc (renamed from test/core/end2end/fixtures/h2_uds.c)12
-rw-r--r--test/core/end2end/fixtures/http_proxy_fixture.cc (renamed from test/core/end2end/fixtures/http_proxy_fixture.c)0
-rw-r--r--test/core/end2end/fixtures/inproc.cc (renamed from test/core/end2end/fixtures/inproc.c)5
-rw-r--r--test/core/end2end/fixtures/proxy.cc (renamed from test/core/end2end/fixtures/proxy.c)0
-rw-r--r--test/core/end2end/fuzzers/BUILD12
-rw-r--r--test/core/end2end/fuzzers/api_fuzzer.cc (renamed from test/core/end2end/fuzzers/api_fuzzer.c)80
-rw-r--r--test/core/end2end/fuzzers/client_fuzzer.cc (renamed from test/core/end2end/fuzzers/client_fuzzer.c)2
-rw-r--r--test/core/end2end/fuzzers/server_fuzzer.cc (renamed from test/core/end2end/fuzzers/server_fuzzer.c)2
-rwxr-xr-xtest/core/end2end/gen_build_yaml.py16
-rwxr-xr-xtest/core/end2end/generate_tests.bzl10
-rw-r--r--test/core/end2end/goaway_server_test.cc (renamed from test/core/end2end/goaway_server_test.c)11
-rw-r--r--test/core/end2end/h2_ssl_cert_test.cc4
-rw-r--r--test/core/end2end/invalid_call_argument_test.cc (renamed from test/core/end2end/invalid_call_argument_test.c)2
-rw-r--r--test/core/end2end/multiple_server_queues_test.cc (renamed from test/core/end2end/multiple_server_queues_test.c)0
-rw-r--r--test/core/end2end/no_server_test.cc (renamed from test/core/end2end/no_server_test.c)0
-rw-r--r--test/core/end2end/tests/authority_not_supported.cc (renamed from test/core/end2end/tests/authority_not_supported.c)0
-rw-r--r--test/core/end2end/tests/bad_hostname.cc (renamed from test/core/end2end/tests/bad_hostname.c)0
-rw-r--r--test/core/end2end/tests/bad_ping.cc (renamed from test/core/end2end/tests/bad_ping.c)48
-rw-r--r--test/core/end2end/tests/binary_metadata.cc (renamed from test/core/end2end/tests/binary_metadata.c)0
-rw-r--r--test/core/end2end/tests/call_creds.cc (renamed from test/core/end2end/tests/call_creds.c)4
-rw-r--r--test/core/end2end/tests/cancel_after_accept.cc (renamed from test/core/end2end/tests/cancel_after_accept.c)6
-rw-r--r--test/core/end2end/tests/cancel_after_client_done.cc (renamed from test/core/end2end/tests/cancel_after_client_done.c)0
-rw-r--r--test/core/end2end/tests/cancel_after_invoke.cc (renamed from test/core/end2end/tests/cancel_after_invoke.c)0
-rw-r--r--test/core/end2end/tests/cancel_after_round_trip.cc (renamed from test/core/end2end/tests/cancel_after_round_trip.c)6
-rw-r--r--test/core/end2end/tests/cancel_before_invoke.cc (renamed from test/core/end2end/tests/cancel_before_invoke.c)0
-rw-r--r--test/core/end2end/tests/cancel_in_a_vacuum.cc (renamed from test/core/end2end/tests/cancel_in_a_vacuum.c)0
-rw-r--r--test/core/end2end/tests/cancel_with_status.cc (renamed from test/core/end2end/tests/cancel_with_status.c)0
-rw-r--r--test/core/end2end/tests/compressed_payload.cc (renamed from test/core/end2end/tests/compressed_payload.c)0
-rw-r--r--test/core/end2end/tests/connectivity.cc (renamed from test/core/end2end/tests/connectivity.c)3
-rw-r--r--test/core/end2end/tests/default_host.cc (renamed from test/core/end2end/tests/default_host.c)0
-rw-r--r--test/core/end2end/tests/disappearing_server.cc (renamed from test/core/end2end/tests/disappearing_server.c)0
-rw-r--r--test/core/end2end/tests/empty_batch.cc (renamed from test/core/end2end/tests/empty_batch.c)0
-rw-r--r--test/core/end2end/tests/filter_call_init_fails.cc (renamed from test/core/end2end/tests/filter_call_init_fails.c)0
-rw-r--r--test/core/end2end/tests/filter_causes_close.cc (renamed from test/core/end2end/tests/filter_causes_close.c)0
-rw-r--r--test/core/end2end/tests/filter_latency.cc (renamed from test/core/end2end/tests/filter_latency.c)0
-rw-r--r--test/core/end2end/tests/graceful_server_shutdown.cc (renamed from test/core/end2end/tests/graceful_server_shutdown.c)0
-rw-r--r--test/core/end2end/tests/high_initial_seqno.cc (renamed from test/core/end2end/tests/high_initial_seqno.c)2
-rw-r--r--test/core/end2end/tests/hpack_size.cc (renamed from test/core/end2end/tests/hpack_size.c)4
-rw-r--r--test/core/end2end/tests/idempotent_request.cc (renamed from test/core/end2end/tests/idempotent_request.c)0
-rw-r--r--test/core/end2end/tests/invoke_large_request.cc (renamed from test/core/end2end/tests/invoke_large_request.c)4
-rw-r--r--test/core/end2end/tests/keepalive_timeout.cc (renamed from test/core/end2end/tests/keepalive_timeout.c)24
-rw-r--r--test/core/end2end/tests/large_metadata.cc (renamed from test/core/end2end/tests/large_metadata.c)7
-rw-r--r--test/core/end2end/tests/load_reporting_hook.cc (renamed from test/core/end2end/tests/load_reporting_hook.c)0
-rw-r--r--test/core/end2end/tests/max_concurrent_streams.cc (renamed from test/core/end2end/tests/max_concurrent_streams.c)6
-rw-r--r--test/core/end2end/tests/max_connection_age.cc (renamed from test/core/end2end/tests/max_connection_age.c)44
-rw-r--r--test/core/end2end/tests/max_connection_idle.cc (renamed from test/core/end2end/tests/max_connection_idle.c)27
-rw-r--r--test/core/end2end/tests/max_message_length.cc (renamed from test/core/end2end/tests/max_message_length.c)53
-rw-r--r--test/core/end2end/tests/negative_deadline.cc (renamed from test/core/end2end/tests/negative_deadline.c)0
-rw-r--r--test/core/end2end/tests/network_status_change.cc (renamed from test/core/end2end/tests/network_status_change.c)0
-rw-r--r--test/core/end2end/tests/no_logging.cc (renamed from test/core/end2end/tests/no_logging.c)2
-rw-r--r--test/core/end2end/tests/no_op.cc (renamed from test/core/end2end/tests/no_op.c)0
-rw-r--r--test/core/end2end/tests/payload.cc (renamed from test/core/end2end/tests/payload.c)0
-rw-r--r--test/core/end2end/tests/ping.cc (renamed from test/core/end2end/tests/ping.c)42
-rw-r--r--test/core/end2end/tests/ping_pong_streaming.cc (renamed from test/core/end2end/tests/ping_pong_streaming.c)0
-rw-r--r--test/core/end2end/tests/proxy_auth.cc (renamed from test/core/end2end/tests/proxy_auth.c)9
-rw-r--r--test/core/end2end/tests/registered_call.cc (renamed from test/core/end2end/tests/registered_call.c)0
-rw-r--r--test/core/end2end/tests/request_with_flags.cc (renamed from test/core/end2end/tests/request_with_flags.c)0
-rw-r--r--test/core/end2end/tests/request_with_payload.cc (renamed from test/core/end2end/tests/request_with_payload.c)0
-rw-r--r--test/core/end2end/tests/resource_quota_server.cc (renamed from test/core/end2end/tests/resource_quota_server.c)2
-rw-r--r--test/core/end2end/tests/server_finishes_request.cc (renamed from test/core/end2end/tests/server_finishes_request.c)0
-rw-r--r--test/core/end2end/tests/shutdown_finishes_calls.cc (renamed from test/core/end2end/tests/shutdown_finishes_calls.c)0
-rw-r--r--test/core/end2end/tests/shutdown_finishes_tags.cc (renamed from test/core/end2end/tests/shutdown_finishes_tags.c)0
-rw-r--r--test/core/end2end/tests/simple_cacheable_request.cc (renamed from test/core/end2end/tests/simple_cacheable_request.c)0
-rw-r--r--test/core/end2end/tests/simple_delayed_request.cc (renamed from test/core/end2end/tests/simple_delayed_request.c)6
-rw-r--r--test/core/end2end/tests/simple_metadata.cc (renamed from test/core/end2end/tests/simple_metadata.c)0
-rw-r--r--test/core/end2end/tests/simple_request.cc (renamed from test/core/end2end/tests/simple_request.c)6
-rw-r--r--test/core/end2end/tests/stream_compression_compressed_payload.cc (renamed from test/core/end2end/tests/stream_compression_compressed_payload.c)0
-rw-r--r--test/core/end2end/tests/stream_compression_payload.cc (renamed from test/core/end2end/tests/stream_compression_payload.c)0
-rw-r--r--test/core/end2end/tests/stream_compression_ping_pong_streaming.cc (renamed from test/core/end2end/tests/stream_compression_ping_pong_streaming.c)0
-rw-r--r--test/core/end2end/tests/streaming_error_response.cc (renamed from test/core/end2end/tests/streaming_error_response.c)0
-rw-r--r--test/core/end2end/tests/trailing_metadata.cc (renamed from test/core/end2end/tests/trailing_metadata.c)0
-rw-r--r--test/core/end2end/tests/workaround_cronet_compression.cc (renamed from test/core/end2end/tests/workaround_cronet_compression.c)11
-rw-r--r--test/core/end2end/tests/write_buffering.cc (renamed from test/core/end2end/tests/write_buffering.c)0
-rw-r--r--test/core/end2end/tests/write_buffering_at_end.cc (renamed from test/core/end2end/tests/write_buffering_at_end.c)0
-rw-r--r--test/core/fling/BUILD12
-rw-r--r--test/core/fling/client.cc (renamed from test/core/fling/client.c)4
-rw-r--r--test/core/fling/fling_stream_test.cc (renamed from test/core/fling/fling_stream_test.c)10
-rw-r--r--test/core/fling/fling_test.cc (renamed from test/core/fling/fling_test.c)16
-rw-r--r--test/core/fling/server.cc (renamed from test/core/fling/server.c)4
-rw-r--r--test/core/handshake/BUILD8
-rw-r--r--test/core/handshake/client_ssl.cc (renamed from test/core/handshake/client_ssl.c)16
-rw-r--r--test/core/handshake/server_ssl.cc (renamed from test/core/handshake/server_ssl.c)3
-rw-r--r--test/core/http/BUILD20
-rw-r--r--test/core/http/format_request_test.cc (renamed from test/core/http/format_request_test.c)30
-rw-r--r--test/core/http/httpcli_test.cc (renamed from test/core/http/httpcli_test.c)16
-rw-r--r--test/core/http/httpscli_test.cc (renamed from test/core/http/httpscli_test.c)22
-rw-r--r--test/core/http/parser_test.cc (renamed from test/core/http/parser_test.c)19
-rw-r--r--test/core/http/request_fuzzer.cc (renamed from test/core/http/request_fuzzer.c)2
-rw-r--r--test/core/http/response_fuzzer.cc (renamed from test/core/http/response_fuzzer.c)2
-rw-r--r--test/core/iomgr/BUILD84
-rw-r--r--test/core/iomgr/combiner_test.cc (renamed from test/core/iomgr/combiner_test.c)11
-rw-r--r--test/core/iomgr/endpoint_pair_test.cc (renamed from test/core/iomgr/endpoint_pair_test.c)13
-rw-r--r--test/core/iomgr/endpoint_tests.cc (renamed from test/core/iomgr/endpoint_tests.c)0
-rw-r--r--test/core/iomgr/error_test.cc (renamed from test/core/iomgr/error_test.c)0
-rw-r--r--test/core/iomgr/ev_epollsig_linux_test.cc (renamed from test/core/iomgr/ev_epollsig_linux_test.c)11
-rw-r--r--test/core/iomgr/fd_conservation_posix_test.cc (renamed from test/core/iomgr/fd_conservation_posix_test.c)0
-rw-r--r--test/core/iomgr/fd_posix_test.cc (renamed from test/core/iomgr/fd_posix_test.c)22
-rw-r--r--test/core/iomgr/load_file_test.cc (renamed from test/core/iomgr/load_file_test.c)2
-rw-r--r--test/core/iomgr/pollset_set_test.cc (renamed from test/core/iomgr/pollset_set_test.c)5
-rw-r--r--test/core/iomgr/resolve_address_posix_test.cc (renamed from test/core/iomgr/resolve_address_posix_test.c)11
-rw-r--r--test/core/iomgr/resolve_address_test.cc (renamed from test/core/iomgr/resolve_address_test.c)6
-rw-r--r--test/core/iomgr/resource_quota_test.cc (renamed from test/core/iomgr/resource_quota_test.c)8
-rw-r--r--test/core/iomgr/sockaddr_utils_test.cc (renamed from test/core/iomgr/sockaddr_utils_test.c)0
-rw-r--r--test/core/iomgr/socket_utils_test.cc (renamed from test/core/iomgr/socket_utils_test.c)0
-rw-r--r--test/core/iomgr/tcp_client_posix_test.cc (renamed from test/core/iomgr/tcp_client_posix_test.c)4
-rw-r--r--test/core/iomgr/tcp_client_uv_test.cc (renamed from test/core/iomgr/tcp_client_uv_test.c)9
-rw-r--r--test/core/iomgr/tcp_posix_test.cc (renamed from test/core/iomgr/tcp_posix_test.c)43
-rw-r--r--test/core/iomgr/tcp_server_posix_test.cc (renamed from test/core/iomgr/tcp_server_posix_test.c)15
-rw-r--r--test/core/iomgr/tcp_server_uv_test.cc (renamed from test/core/iomgr/tcp_server_uv_test.c)12
-rw-r--r--test/core/iomgr/time_averaged_stats_test.cc (renamed from test/core/iomgr/time_averaged_stats_test.c)0
-rw-r--r--test/core/iomgr/timer_heap_test.cc (renamed from test/core/iomgr/timer_heap_test.c)11
-rw-r--r--test/core/iomgr/timer_list_test.cc (renamed from test/core/iomgr/timer_list_test.c)4
-rw-r--r--test/core/iomgr/udp_server_test.cc (renamed from test/core/iomgr/udp_server_test.c)7
-rw-r--r--test/core/iomgr/wakeup_fd_cv_test.cc (renamed from test/core/iomgr/wakeup_fd_cv_test.c)0
-rw-r--r--test/core/json/BUILD20
-rw-r--r--test/core/json/fuzzer.cc (renamed from test/core/json/fuzzer.c)4
-rw-r--r--test/core/json/json_rewrite.cc (renamed from test/core/json/json_rewrite.c)34
-rw-r--r--test/core/json/json_rewrite_test.cc (renamed from test/core/json/json_rewrite_test.c)30
-rw-r--r--test/core/json/json_stream_error_test.cc (renamed from test/core/json/json_stream_error_test.c)0
-rw-r--r--test/core/json/json_test.cc (renamed from test/core/json/json_test.c)0
-rw-r--r--test/core/memory_usage/client.cc (renamed from test/core/memory_usage/client.c)2
-rw-r--r--test/core/memory_usage/memory_usage_test.cc (renamed from test/core/memory_usage/memory_usage_test.c)10
-rw-r--r--test/core/memory_usage/server.cc (renamed from test/core/memory_usage/server.c)4
-rw-r--r--test/core/nanopb/BUILD8
-rw-r--r--test/core/nanopb/fuzzer_response.cc (renamed from test/core/nanopb/fuzzer_response.c)2
-rw-r--r--test/core/nanopb/fuzzer_serverlist.cc (renamed from test/core/nanopb/fuzzer_serverlist.c)2
-rw-r--r--test/core/network_benchmarks/BUILD4
-rw-r--r--test/core/network_benchmarks/low_level_ping_pong.cc (renamed from test/core/network_benchmarks/low_level_ping_pong.c)35
-rw-r--r--test/core/security/BUILD40
-rw-r--r--test/core/security/auth_context_test.cc (renamed from test/core/security/auth_context_test.c)0
-rw-r--r--test/core/security/create_jwt.cc (renamed from test/core/security/create_jwt.c)6
-rw-r--r--test/core/security/credentials_test.cc (renamed from test/core/security/credentials_test.c)11
-rw-r--r--test/core/security/fetch_oauth2.cc (renamed from test/core/security/fetch_oauth2.c)2
-rw-r--r--test/core/security/json_token_test.cc (renamed from test/core/security/json_token_test.c)6
-rw-r--r--test/core/security/jwt_verifier_test.cc (renamed from test/core/security/jwt_verifier_test.c)4
-rw-r--r--test/core/security/oauth2_utils.cc (renamed from test/core/security/oauth2_utils.c)0
-rw-r--r--test/core/security/oauth2_utils.h8
-rw-r--r--test/core/security/print_google_default_creds_token.cc (renamed from test/core/security/print_google_default_creds_token.c)10
-rw-r--r--test/core/security/secure_endpoint_test.cc (renamed from test/core/security/secure_endpoint_test.c)9
-rw-r--r--test/core/security/security_connector_test.cc (renamed from test/core/security/security_connector_test.c)0
-rw-r--r--test/core/security/ssl_credentials_test.cc (renamed from test/core/security/ssl_credentials_test.c)0
-rw-r--r--test/core/security/ssl_server_fuzzer.cc (renamed from test/core/security/ssl_server_fuzzer.c)7
-rw-r--r--test/core/security/verify_jwt.cc (renamed from test/core/security/verify_jwt.c)8
-rw-r--r--test/core/slice/BUILD32
-rw-r--r--test/core/slice/b64_test.cc (renamed from test/core/slice/b64_test.c)0
-rw-r--r--test/core/slice/percent_decode_fuzzer.cc (renamed from test/core/slice/percent_decode_fuzzer.c)2
-rw-r--r--test/core/slice/percent_encode_fuzzer.cc (renamed from test/core/slice/percent_encode_fuzzer.c)2
-rw-r--r--test/core/slice/percent_encoding_test.cc (renamed from test/core/slice/percent_encoding_test.c)0
-rw-r--r--test/core/slice/slice_buffer_test.cc (renamed from test/core/slice/slice_buffer_test.c)0
-rw-r--r--test/core/slice/slice_hash_table_test.cc (renamed from test/core/slice/slice_hash_table_test.c)14
-rw-r--r--test/core/slice/slice_string_helpers_test.cc (renamed from test/core/slice/slice_string_helpers_test.c)3
-rw-r--r--test/core/slice/slice_test.cc (renamed from test/core/slice/slice_test.c)4
-rw-r--r--test/core/statistics/census_log_tests.cc (renamed from test/core/statistics/census_log_tests.c)0
-rw-r--r--test/core/statistics/census_stub_test.cc (renamed from test/core/statistics/census_stub_test.c)0
-rw-r--r--test/core/statistics/hash_table_test.cc (renamed from test/core/statistics/hash_table_test.c)18
-rw-r--r--test/core/statistics/multiple_writers_circular_buffer_test.cc (renamed from test/core/statistics/multiple_writers_circular_buffer_test.c)0
-rw-r--r--test/core/statistics/multiple_writers_test.cc (renamed from test/core/statistics/multiple_writers_test.c)0
-rw-r--r--test/core/statistics/performance_test.cc (renamed from test/core/statistics/performance_test.c)0
-rw-r--r--test/core/statistics/quick_test.cc (renamed from test/core/statistics/quick_test.c)0
-rw-r--r--test/core/statistics/rpc_stats_test.cc (renamed from test/core/statistics/rpc_stats_test.c)0
-rw-r--r--test/core/statistics/small_log_test.cc (renamed from test/core/statistics/small_log_test.c)0
-rw-r--r--test/core/statistics/trace_test.cc (renamed from test/core/statistics/trace_test.c)0
-rw-r--r--test/core/statistics/window_stats_test.cc (renamed from test/core/statistics/window_stats_test.c)25
-rw-r--r--test/core/support/BUILD72
-rw-r--r--test/core/support/alloc_test.cc (renamed from test/core/support/alloc_test.c)5
-rw-r--r--test/core/support/arena_test.cc (renamed from test/core/support/arena_test.c)4
-rw-r--r--test/core/support/avl_test.cc (renamed from test/core/support/avl_test.c)2
-rw-r--r--test/core/support/cmdline_test.cc (renamed from test/core/support/cmdline_test.c)78
-rw-r--r--test/core/support/cpu_test.cc (renamed from test/core/support/cpu_test.c)2
-rw-r--r--test/core/support/env_test.cc (renamed from test/core/support/env_test.c)0
-rw-r--r--test/core/support/histogram_test.cc (renamed from test/core/support/histogram_test.c)0
-rw-r--r--test/core/support/host_port_test.cc (renamed from test/core/support/host_port_test.c)0
-rw-r--r--test/core/support/log_test.cc (renamed from test/core/support/log_test.c)0
-rw-r--r--test/core/support/mpscq_test.cc (renamed from test/core/support/mpscq_test.c)6
-rw-r--r--test/core/support/murmur_hash_test.cc (renamed from test/core/support/murmur_hash_test.c)0
-rw-r--r--test/core/support/spinlock_test.cc (renamed from test/core/support/spinlock_test.c)9
-rw-r--r--test/core/support/stack_lockfree_test.cc (renamed from test/core/support/stack_lockfree_test.c)0
-rw-r--r--test/core/support/string_test.cc (renamed from test/core/support/string_test.c)0
-rw-r--r--test/core/support/sync_test.cc (renamed from test/core/support/sync_test.c)22
-rw-r--r--test/core/support/thd_test.cc (renamed from test/core/support/thd_test.c)2
-rw-r--r--test/core/support/time_test.cc (renamed from test/core/support/time_test.c)0
-rw-r--r--test/core/support/tls_test.cc (renamed from test/core/support/tls_test.c)0
-rw-r--r--test/core/support/useful_test.cc (renamed from test/core/support/useful_test.c)0
-rw-r--r--test/core/surface/BUILD48
-rw-r--r--test/core/surface/alarm_test.cc (renamed from test/core/surface/alarm_test.c)0
-rw-r--r--test/core/surface/byte_buffer_reader_test.cc (renamed from test/core/surface/byte_buffer_reader_test.c)0
-rw-r--r--test/core/surface/channel_create_test.cc (renamed from test/core/surface/channel_create_test.c)0
-rw-r--r--test/core/surface/completion_queue_test.cc (renamed from test/core/surface/completion_queue_test.c)0
-rw-r--r--test/core/surface/completion_queue_threading_test.cc (renamed from test/core/surface/completion_queue_threading_test.c)13
-rw-r--r--test/core/surface/concurrent_connectivity_test.cc (renamed from test/core/surface/concurrent_connectivity_test.c)4
-rw-r--r--test/core/surface/init_test.cc (renamed from test/core/surface/init_test.c)0
-rw-r--r--test/core/surface/invalid_channel_args_test.cc (renamed from test/core/surface/invalid_channel_args_test.c)12
-rw-r--r--test/core/surface/lame_client_test.cc (renamed from test/core/surface/lame_client_test.c)2
-rw-r--r--test/core/surface/num_external_connectivity_watchers_test.cc (renamed from test/core/surface/num_external_connectivity_watchers_test.c)7
-rw-r--r--test/core/surface/secure_channel_create_test.cc (renamed from test/core/surface/secure_channel_create_test.c)2
-rw-r--r--test/core/surface/sequential_connectivity_test.cc (renamed from test/core/surface/sequential_connectivity_test.c)9
-rw-r--r--test/core/surface/server_chttp2_test.cc (renamed from test/core/surface/server_chttp2_test.c)2
-rw-r--r--test/core/surface/server_test.cc (renamed from test/core/surface/server_test.c)2
-rw-r--r--test/core/transport/BUILD24
-rw-r--r--test/core/transport/byte_stream_test.cc (renamed from test/core/transport/byte_stream_test.c)0
-rw-r--r--test/core/transport/chttp2/BUILD34
-rw-r--r--test/core/transport/chttp2/alpn_test.cc (renamed from test/core/transport/chttp2/alpn_test.c)0
-rw-r--r--test/core/transport/chttp2/bin_decoder_test.cc (renamed from test/core/transport/chttp2/bin_decoder_test.c)2
-rw-r--r--test/core/transport/chttp2/bin_encoder_test.cc (renamed from test/core/transport/chttp2/bin_encoder_test.c)4
-rw-r--r--test/core/transport/chttp2/hpack_encoder_test.cc (renamed from test/core/transport/chttp2/hpack_encoder_test.c)47
-rw-r--r--test/core/transport/chttp2/hpack_parser_fuzzer_test.cc (renamed from test/core/transport/chttp2/hpack_parser_fuzzer_test.c)2
-rw-r--r--test/core/transport/chttp2/hpack_parser_test.cc (renamed from test/core/transport/chttp2/hpack_parser_test.c)2
-rw-r--r--test/core/transport/chttp2/hpack_table_test.cc (renamed from test/core/transport/chttp2/hpack_table_test.c)0
-rw-r--r--test/core/transport/chttp2/stream_map_test.cc (renamed from test/core/transport/chttp2/stream_map_test.c)2
-rw-r--r--test/core/transport/chttp2/varint_test.cc (renamed from test/core/transport/chttp2/varint_test.c)0
-rw-r--r--test/core/transport/connectivity_state_test.cc (renamed from test/core/transport/connectivity_state_test.c)0
-rw-r--r--test/core/transport/metadata_test.cc (renamed from test/core/transport/metadata_test.c)12
-rw-r--r--test/core/transport/status_conversion_test.cc (renamed from test/core/transport/status_conversion_test.c)0
-rw-r--r--test/core/transport/stream_owned_slice_test.cc (renamed from test/core/transport/stream_owned_slice_test.c)0
-rw-r--r--test/core/transport/timeout_encoding_test.cc (renamed from test/core/transport/timeout_encoding_test.c)0
-rw-r--r--test/core/tsi/BUILD14
-rw-r--r--test/core/tsi/fake_transport_security_test.cc (renamed from test/core/tsi/fake_transport_security_test.c)7
-rw-r--r--test/core/tsi/ssl_transport_security_test.cc (renamed from test/core/tsi/ssl_transport_security_test.c)37
-rw-r--r--test/core/tsi/transport_security_test.cc (renamed from test/core/tsi/transport_security_test.c)2
-rw-r--r--test/core/tsi/transport_security_test_lib.cc (renamed from test/core/tsi/transport_security_test_lib.c)33
-rw-r--r--test/core/tsi/transport_security_test_lib.h8
-rw-r--r--test/core/util/BUILD30
-rw-r--r--test/core/util/debugger_macros.cc2
-rw-r--r--test/core/util/debugger_macros.h8
-rw-r--r--test/core/util/grpc_profiler.cc (renamed from test/core/util/grpc_profiler.c)0
-rw-r--r--test/core/util/grpc_profiler.h8
-rw-r--r--test/core/util/memory_counters.cc (renamed from test/core/util/memory_counters.c)0
-rw-r--r--test/core/util/mock_endpoint.cc (renamed from test/core/util/mock_endpoint.c)0
-rw-r--r--test/core/util/one_corpus_entry_fuzzer.cc (renamed from test/core/util/one_corpus_entry_fuzzer.c)2
-rw-r--r--test/core/util/parse_hexstring.cc (renamed from test/core/util/parse_hexstring.c)0
-rw-r--r--test/core/util/passthru_endpoint.cc (renamed from test/core/util/passthru_endpoint.c)0
-rw-r--r--test/core/util/port.cc (renamed from test/core/util/port.c)0
-rw-r--r--test/core/util/port_server_client.cc (renamed from test/core/util/port_server_client.c)10
-rw-r--r--test/core/util/reconnect_server.cc (renamed from test/core/util/reconnect_server.c)2
-rw-r--r--test/core/util/reconnect_server.h8
-rw-r--r--test/core/util/slice_splitter.cc (renamed from test/core/util/slice_splitter.c)0
-rw-r--r--test/core/util/test_config.cc (renamed from test/core/util/test_config.c)2
-rw-r--r--test/core/util/test_config.h4
-rw-r--r--test/core/util/test_tcp_server.cc (renamed from test/core/util/test_tcp_server.c)6
-rw-r--r--test/core/util/trickle_endpoint.cc (renamed from test/core/util/trickle_endpoint.c)0
-rw-r--r--test/core/util/trickle_endpoint.h8
316 files changed, 1387 insertions, 1187 deletions
diff --git a/test/core/backoff/BUILD b/test/core/backoff/BUILD
index 4ae762007c..4cd7acf066 100644
--- a/test/core/backoff/BUILD
+++ b/test/core/backoff/BUILD
@@ -25,8 +25,8 @@ package(
grpc_cc_test(
name = "backoff_test",
- srcs = ["backoff_test.c"],
- language = "C",
+ srcs = ["backoff_test.cc"],
+ language = "C++",
deps = [
"//:grpc",
"//test/core/util:grpc_test_util",
diff --git a/test/core/backoff/backoff_test.c b/test/core/backoff/backoff_test.cc
index ef2de8d638..ef2de8d638 100644
--- a/test/core/backoff/backoff_test.c
+++ b/test/core/backoff/backoff_test.cc
diff --git a/test/core/bad_client/bad_client.c b/test/core/bad_client/bad_client.cc
index b1944425ba..b1944425ba 100644
--- a/test/core/bad_client/bad_client.c
+++ b/test/core/bad_client/bad_client.cc
diff --git a/test/core/bad_client/gen_build_yaml.py b/test/core/bad_client/gen_build_yaml.py
index 61cf1f7cd7..14c8a27334 100755
--- a/test/core/bad_client/gen_build_yaml.py
+++ b/test/core/bad_client/gen_build_yaml.py
@@ -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': [
diff --git a/test/core/bad_client/generate_tests.bzl b/test/core/bad_client/generate_tests.bzl
index 58b48d688f..022edf3ff3 100755
--- a/test/core/bad_client/generate_tests.bzl
+++ b/test/core/bad_client/generate_tests.bzl
@@ -38,16 +38,14 @@ 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']
)
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'],
)
diff --git a/test/core/bad_client/tests/badreq.c b/test/core/bad_client/tests/badreq.cc
index 5273c831e5..5273c831e5 100644
--- a/test/core/bad_client/tests/badreq.c
+++ b/test/core/bad_client/tests/badreq.cc
diff --git a/test/core/bad_client/tests/connection_prefix.c b/test/core/bad_client/tests/connection_prefix.cc
index a4fd734e04..a4fd734e04 100644
--- a/test/core/bad_client/tests/connection_prefix.c
+++ b/test/core/bad_client/tests/connection_prefix.cc
diff --git a/test/core/bad_client/tests/head_of_line_blocking.c b/test/core/bad_client/tests/head_of_line_blocking.cc
index 8b51d0e6fa..aad335cf5b 100644
--- a/test/core/bad_client/tests/head_of_line_blocking.c
+++ b/test/core/bad_client/tests/head_of_line_blocking.cc
@@ -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;
diff --git a/test/core/bad_client/tests/headers.c b/test/core/bad_client/tests/headers.cc
index f96c6f0028..f96c6f0028 100644
--- a/test/core/bad_client/tests/headers.c
+++ b/test/core/bad_client/tests/headers.cc
diff --git a/test/core/bad_client/tests/initial_settings_frame.c b/test/core/bad_client/tests/initial_settings_frame.cc
index dde9d4b5d3..dde9d4b5d3 100644
--- a/test/core/bad_client/tests/initial_settings_frame.c
+++ b/test/core/bad_client/tests/initial_settings_frame.cc
diff --git a/test/core/bad_client/tests/large_metadata.c b/test/core/bad_client/tests/large_metadata.cc
index df7dd8f4b3..df7dd8f4b3 100644
--- a/test/core/bad_client/tests/large_metadata.c
+++ b/test/core/bad_client/tests/large_metadata.cc
diff --git a/test/core/bad_client/tests/server_registered_method.c b/test/core/bad_client/tests/server_registered_method.cc
index b1b11235de..b1b11235de 100644
--- a/test/core/bad_client/tests/server_registered_method.c
+++ b/test/core/bad_client/tests/server_registered_method.cc
diff --git a/test/core/bad_client/tests/simple_request.c b/test/core/bad_client/tests/simple_request.cc
index b9cc1e3259..b9cc1e3259 100644
--- a/test/core/bad_client/tests/simple_request.c
+++ b/test/core/bad_client/tests/simple_request.cc
diff --git a/test/core/bad_client/tests/unknown_frame.c b/test/core/bad_client/tests/unknown_frame.cc
index b8367a2b65..b8367a2b65 100644
--- a/test/core/bad_client/tests/unknown_frame.c
+++ b/test/core/bad_client/tests/unknown_frame.cc
diff --git a/test/core/bad_client/tests/window_overflow.c b/test/core/bad_client/tests/window_overflow.cc
index 6f5c013005..cb4b790de2 100644
--- a/test/core/bad_client/tests/window_overflow.c
+++ b/test/core/bad_client/tests/window_overflow.cc
@@ -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;
diff --git a/test/core/bad_ssl/bad_ssl_test.c b/test/core/bad_ssl/bad_ssl_test.cc
index 547cadc6c3..3cfa2a4a2b 100644
--- a/test/core/bad_ssl/bad_ssl_test.c
+++ b/test/core/bad_ssl/bad_ssl_test.cc
@@ -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]);
diff --git a/test/core/bad_ssl/gen_build_yaml.py b/test/core/bad_ssl/gen_build_yaml.py
index 30fdb5ea02..6b78e9c7aa 100755
--- a/test/core/bad_ssl/gen_build_yaml.py
+++ b/test/core/bad_ssl/gen_build_yaml.py
@@ -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': [
diff --git a/test/core/bad_ssl/generate_tests.bzl b/test/core/bad_ssl/generate_tests.bzl
index b61fabc051..b7cb8f86e6 100755
--- a/test/core/bad_ssl/generate_tests.bzl
+++ b/test/core/bad_ssl/generate_tests.bzl
@@ -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'],
)
diff --git a/test/core/bad_ssl/server_common.c b/test/core/bad_ssl/server_common.cc
index 2aa547dd4e..0110ed5ad2 100644
--- a/test/core/bad_ssl/server_common.c
+++ b/test/core/bad_ssl/server_common.cc
@@ -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);
diff --git a/test/core/bad_ssl/servers/alpn.c b/test/core/bad_ssl/servers/alpn.cc
index a207516a72..a207516a72 100644
--- a/test/core/bad_ssl/servers/alpn.c
+++ b/test/core/bad_ssl/servers/alpn.cc
diff --git a/test/core/bad_ssl/servers/cert.c b/test/core/bad_ssl/servers/cert.cc
index 4a8ac93452..4a8ac93452 100644
--- a/test/core/bad_ssl/servers/cert.c
+++ b/test/core/bad_ssl/servers/cert.cc
diff --git a/test/core/channel/BUILD b/test/core/channel/BUILD
index 5ac77c449b..92f5907aac 100644
--- a/test/core/channel/BUILD
+++ b/test/core/channel/BUILD
@@ -20,8 +20,8 @@ licenses(["notice"]) # Apache v2
grpc_cc_test(
name = "channel_args_test",
- srcs = ["channel_args_test.c"],
- language = "C",
+ srcs = ["channel_args_test.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//:grpc",
@@ -32,8 +32,8 @@ grpc_cc_test(
grpc_cc_test(
name = "channel_stack_test",
- srcs = ["channel_stack_test.c"],
- language = "C",
+ srcs = ["channel_stack_test.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//:grpc",
@@ -44,8 +44,8 @@ grpc_cc_test(
grpc_cc_test(
name = "channel_stack_builder_test",
- srcs = ["channel_stack_builder_test.c"],
- language = "C",
+ srcs = ["channel_stack_builder_test.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//:grpc",
diff --git a/test/core/channel/channel_args_test.c b/test/core/channel/channel_args_test.cc
index 85baa990cd..4b4bd3e718 100644
--- a/test/core/channel/channel_args_test.c
+++ b/test/core/channel/channel_args_test.cc
@@ -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;
diff --git a/test/core/channel/channel_stack_builder_test.c b/test/core/channel/channel_stack_builder_test.cc
index 2a5920c673..1571f6ec09 100644
--- a/test/core/channel/channel_stack_builder_test.c
+++ b/test/core/channel/channel_stack_builder_test.cc
@@ -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));
diff --git a/test/core/channel/channel_stack_test.c b/test/core/channel/channel_stack_test.cc
index aff3fb24b7..1b661ac2f4 100644
--- a/test/core/channel/channel_stack_test.c
+++ b/test/core/channel/channel_stack_test.cc
@@ -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);
diff --git a/test/core/channel/minimal_stack_is_minimal_test.c b/test/core/channel/minimal_stack_is_minimal_test.cc
index a43305aa37..c54ff2e01b 100644
--- a/test/core/channel/minimal_stack_is_minimal_test.c
+++ b/test/core/channel/minimal_stack_is_minimal_test.cc
@@ -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,8 +114,10 @@ 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 fake_transport = {.vtable = &fake_transport_vtable};
+ 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 = {&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);
if (transport_name != NULL) {
@@ -195,7 +197,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), args_str);
+ 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);
result = 1;
diff --git a/test/core/client_channel/BUILD b/test/core/client_channel/BUILD
index c4a93238f2..ec72e0ea72 100644
--- a/test/core/client_channel/BUILD
+++ b/test/core/client_channel/BUILD
@@ -22,8 +22,8 @@ load("//test/core/util:grpc_fuzzer.bzl", "grpc_fuzzer")
grpc_fuzzer(
name = "uri_fuzzer_test",
- srcs = ["uri_fuzzer_test.c"],
- language = "C",
+ srcs = ["uri_fuzzer_test.cc"],
+ language = "C++",
corpus = "uri_corpus",
deps = [
"//:gpr",
@@ -34,8 +34,8 @@ grpc_fuzzer(
grpc_cc_test(
name = "lb_policies_test",
- srcs = ["lb_policies_test.c"],
- language = "C",
+ srcs = ["lb_policies_test.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//:grpc",
diff --git a/test/core/client_channel/lb_policies_test.c b/test/core/client_channel/lb_policies_test.cc
index b557e26361..3b907487b7 100644
--- a/test/core/client_channel/lb_policies_test.c
+++ b/test/core/client_channel/lb_policies_test.cc
@@ -88,14 +88,15 @@ 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 +173,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 +231,9 @@ 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<grpc_connectivity_state*>(
+ 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 +261,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 +432,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 +472,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 +482,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 +521,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 +550,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 +596,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 +637,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 +645,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 +688,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 +707,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 +734,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 +764,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 +800,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 +821,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 +844,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 +859,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 +913,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 +925,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 +952,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])));
}
}
}
diff --git a/test/core/client_channel/parse_address_test.c b/test/core/client_channel/parse_address_test.cc
index 5ad6c6d015..5ad6c6d015 100644
--- a/test/core/client_channel/parse_address_test.c
+++ b/test/core/client_channel/parse_address_test.cc
diff --git a/test/core/client_channel/resolvers/BUILD b/test/core/client_channel/resolvers/BUILD
index 0907e06623..b5269c7ef0 100644
--- a/test/core/client_channel/resolvers/BUILD
+++ b/test/core/client_channel/resolvers/BUILD
@@ -20,8 +20,8 @@ licenses(["notice"]) # Apache v2
grpc_cc_test(
name = "dns_resolver_connectivity_test",
- srcs = ["dns_resolver_connectivity_test.c"],
- language = "C",
+ srcs = ["dns_resolver_connectivity_test.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//:grpc",
@@ -32,8 +32,8 @@ grpc_cc_test(
grpc_cc_test(
name = "dns_resolver_test",
- srcs = ["dns_resolver_test.c"],
- language = "C",
+ srcs = ["dns_resolver_test.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//:grpc",
@@ -44,8 +44,8 @@ grpc_cc_test(
grpc_cc_test(
name = "sockaddr_resolver_test",
- srcs = ["sockaddr_resolver_test.c"],
- language = "C",
+ srcs = ["sockaddr_resolver_test.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//:grpc",
@@ -56,8 +56,8 @@ grpc_cc_test(
grpc_cc_test(
name = "fake_resolver_test",
- srcs = ["fake_resolver_test.c"],
- language = "C",
+ srcs = ["fake_resolver_test.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//:grpc",
diff --git a/test/core/client_channel/resolvers/dns_resolver_connectivity_test.c b/test/core/client_channel/resolvers/dns_resolver_connectivity_test.cc
index cefbaa81dc..a388b826cf 100644
--- a/test/core/client_channel/resolvers/dns_resolver_connectivity_test.c
+++ b/test/core/client_channel/resolvers/dns_resolver_connectivity_test.cc
@@ -49,9 +49,10 @@ 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 +96,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 +122,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 +131,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;
diff --git a/test/core/client_channel/resolvers/dns_resolver_test.c b/test/core/client_channel/resolvers/dns_resolver_test.cc
index ef3c1b8216..ef3c1b8216 100644
--- a/test/core/client_channel/resolvers/dns_resolver_test.c
+++ b/test/core/client_channel/resolvers/dns_resolver_test.cc
diff --git a/test/core/client_channel/resolvers/fake_resolver_test.c b/test/core/client_channel/resolvers/fake_resolver_test.cc
index 094cd7259d..06e8ebdc88 100644
--- a/test/core/client_channel/resolvers/fake_resolver_test.c
+++ b/test/core/client_channel/resolvers/fake_resolver_test.cc
@@ -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) {
diff --git a/test/core/client_channel/resolvers/sockaddr_resolver_test.c b/test/core/client_channel/resolvers/sockaddr_resolver_test.cc
index 99ba84c1ea..028a786059 100644
--- a/test/core/client_channel/resolvers/sockaddr_resolver_test.c
+++ b/test/core/client_channel/resolvers/sockaddr_resolver_test.cc
@@ -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);
}
diff --git a/test/core/client_channel/uri_fuzzer_test.c b/test/core/client_channel/uri_fuzzer_test.cc
index b4de092438..ba31793ff3 100644
--- a/test/core/client_channel/uri_fuzzer_test.c
+++ b/test/core/client_channel/uri_fuzzer_test.cc
@@ -28,8 +28,8 @@
bool squelch = true;
bool leak_check = true;
-int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
- char* s = gpr_malloc(size + 1);
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
+ char* s = static_cast<char*>(gpr_malloc(size + 1));
memcpy(s, data, size);
s[size] = 0;
diff --git a/test/core/client_channel/uri_parser_test.c b/test/core/client_channel/uri_parser_test.cc
index 0bdf57ce4b..0bdf57ce4b 100644
--- a/test/core/client_channel/uri_parser_test.c
+++ b/test/core/client_channel/uri_parser_test.cc
diff --git a/test/core/compression/BUILD b/test/core/compression/BUILD
index 1ab6e35f0d..ee71eecfeb 100644
--- a/test/core/compression/BUILD
+++ b/test/core/compression/BUILD
@@ -20,8 +20,8 @@ licenses(["notice"]) # Apache v2
grpc_cc_test(
name = "algorithm_test",
- srcs = ["algorithm_test.c"],
- language = "C",
+ srcs = ["algorithm_test.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//:grpc",
@@ -32,8 +32,8 @@ grpc_cc_test(
grpc_cc_test(
name = "compression_test",
- srcs = ["compression_test.c"],
- language = "C",
+ srcs = ["compression_test.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//:grpc",
@@ -44,8 +44,8 @@ grpc_cc_test(
grpc_cc_test(
name = "message_compress_test",
- srcs = ["message_compress_test.c"],
- language = "C",
+ srcs = ["message_compress_test.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//:grpc",
diff --git a/test/core/compression/algorithm_test.c b/test/core/compression/algorithm_test.cc
index e711101b3f..bc3af410c5 100644
--- a/test/core/compression/algorithm_test.c
+++ b/test/core/compression/algorithm_test.cc
@@ -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);
diff --git a/test/core/compression/compression_test.c b/test/core/compression/compression_test.cc
index b6ab0bb844..a1a9441c8d 100644
--- a/test/core/compression/compression_test.c
+++ b/test/core/compression/compression_test.cc
@@ -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);
diff --git a/test/core/compression/message_compress_test.c b/test/core/compression/message_compress_test.cc
index 5afa8af6f8..676415ba9d 100644
--- a/test/core/compression/message_compress_test.c
+++ b/test/core/compression/message_compress_test.cc
@@ -149,16 +149,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);
}
@@ -253,8 +254,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);
@@ -277,8 +280,11 @@ 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);
@@ -301,8 +307,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);
}
}
diff --git a/test/core/compression/stream_compression_test.c b/test/core/compression/stream_compression_test.cc
index 568f9f5f6a..7cb583b88d 100644
--- a/test/core/compression/stream_compression_test.c
+++ b/test/core/compression/stream_compression_test.cc
@@ -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);
diff --git a/test/core/debug/stats_test.cc b/test/core/debug/stats_test.cc
index c1011de105..c4b0d502e3 100644
--- a/test/core/debug/stats_test.cc
+++ b/test/core/debug/stats_test.cc
@@ -16,9 +16,7 @@
*
*/
-extern "C" {
#include "src/core/lib/debug/stats.h"
-}
#include <mutex>
#include <thread>
diff --git a/test/core/end2end/BUILD b/test/core/end2end/BUILD
index 49bfc43646..f8281bfe6f 100644
--- a/test/core/end2end/BUILD
+++ b/test/core/end2end/BUILD
@@ -22,9 +22,9 @@ 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",
+ language = "C++",
visibility = ["//test:__subpackages__"],
deps = [
"//:gpr",
@@ -36,22 +36,22 @@ grpc_cc_library(
grpc_cc_library(
name = "ssl_test_data",
srcs = [
- "data/client_certs.c",
- "data/server1_cert.c",
- "data/server1_key.c",
- "data/test_root_cert.c",
+ "data/client_certs.cc",
+ "data/server1_cert.cc",
+ "data/server1_key.cc",
+ "data/test_root_cert.cc",
],
hdrs = ["data/ssl_test_data.h"],
- language = "C",
+ language = "C++",
visibility = ["//test:__subpackages__"],
)
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",
+ language = "C++",
deps = [
"//:gpr",
"//:grpc",
@@ -61,9 +61,9 @@ grpc_cc_library(
grpc_cc_library(
name = "proxy",
- srcs = ["fixtures/proxy.c"],
+ srcs = ["fixtures/proxy.cc"],
hdrs = ["fixtures/proxy.h"],
- language = "C",
+ language = "C++",
deps = [
"//:gpr",
"//:grpc",
diff --git a/test/core/end2end/bad_server_response_test.c b/test/core/end2end/bad_server_response_test.cc
index ea7857d8d7..ea7857d8d7 100644
--- a/test/core/end2end/bad_server_response_test.c
+++ b/test/core/end2end/bad_server_response_test.cc
diff --git a/test/core/end2end/connection_refused_test.c b/test/core/end2end/connection_refused_test.cc
index bc7cd2ecaf..cea06ae282 100644
--- a/test/core/end2end/connection_refused_test.c
+++ b/test/core/end2end/connection_refused_test.cc
@@ -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);
}
diff --git a/test/core/end2end/cq_verifier.c b/test/core/end2end/cq_verifier.cc
index fd5193f42c..fd5193f42c 100644
--- a/test/core/end2end/cq_verifier.c
+++ b/test/core/end2end/cq_verifier.cc
diff --git a/test/core/end2end/cq_verifier.h b/test/core/end2end/cq_verifier.h
index 959f849cb1..0b3b3fb349 100644
--- a/test/core/end2end/cq_verifier.h
+++ b/test/core/end2end/cq_verifier.h
@@ -24,6 +24,10 @@
#include <grpc/grpc.h>
#include "test/core/util/test_config.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/* A cq_verifier can verify that expected events arrive in a timely fashion
on a single completion queue */
@@ -59,4 +63,8 @@ int contains_metadata(grpc_metadata_array* array, const char* key,
int contains_metadata_slices(grpc_metadata_array* array, grpc_slice key,
grpc_slice value);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* GRPC_TEST_CORE_END2END_CQ_VERIFIER_H */
diff --git a/test/core/end2end/cq_verifier_native.c b/test/core/end2end/cq_verifier_native.cc
index f5fe3494b0..a0a7c832e5 100644
--- a/test/core/end2end/cq_verifier_native.c
+++ b/test/core/end2end/cq_verifier_native.cc
@@ -31,7 +31,7 @@ struct cq_verifier {
};
cq_verifier* cq_verifier_create(grpc_completion_queue* cq) {
- cq_verifier* v = gpr_malloc(sizeof(cq_verifier));
+ cq_verifier* v = static_cast<cq_verifier*>(gpr_malloc(sizeof(cq_verifier)));
v->cq = cq;
cq_verifier_set_first_expectation(v, NULL);
return v;
diff --git a/test/core/end2end/cq_verifier_uv.c b/test/core/end2end/cq_verifier_uv.cc
index 9f479273b0..e23b3ae2a0 100644
--- a/test/core/end2end/cq_verifier_uv.c
+++ b/test/core/end2end/cq_verifier_uv.cc
@@ -43,7 +43,7 @@ struct cq_verifier {
};
cq_verifier* cq_verifier_create(grpc_completion_queue* cq) {
- cq_verifier* v = gpr_malloc(sizeof(cq_verifier));
+ cq_verifier* v = static_cast<cq_verifier*>(gpr_malloc(sizeof(cq_verifier)));
v->cq = cq;
v->first_expectation = NULL;
uv_timer_init(uv_default_loop(), &v->timer);
@@ -58,7 +58,7 @@ static void timer_close_cb(uv_handle_t* handle) {
void cq_verifier_destroy(cq_verifier* v) {
cq_verify(v);
uv_close((uv_handle_t*)&v->timer, timer_close_cb);
- while ((timer_state)v->timer.data != TIMER_CLOSED) {
+ while (reinterpret_cast<timer_state>(v->timer.data) != TIMER_CLOSED) {
uv_run(uv_default_loop(), UV_RUN_NOWAIT);
}
gpr_free(v);
@@ -85,7 +85,7 @@ grpc_event cq_verifier_next_event(cq_verifier* v, int timeout_seconds) {
ev = grpc_completion_queue_next(v->cq, gpr_inf_past(GPR_CLOCK_MONOTONIC),
NULL);
// Stop the loop if the timer goes off or we get a non-timeout event
- while (((timer_state)v->timer.data != TIMER_TRIGGERED) &&
+ while ((reinterpret_cast<timer_state>(v->timer.data) != TIMER_TRIGGERED) &&
ev.type == GRPC_QUEUE_TIMEOUT) {
uv_run(uv_default_loop(), UV_RUN_ONCE);
ev = grpc_completion_queue_next(v->cq, gpr_inf_past(GPR_CLOCK_MONOTONIC),
diff --git a/test/core/end2end/data/client_certs.c b/test/core/end2end/data/client_certs.cc
index 78770674c4..6e61501234 100644
--- a/test/core/end2end/data/client_certs.c
+++ b/test/core/end2end/data/client_certs.cc
@@ -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,
diff --git a/test/core/end2end/data/server1_cert.c b/test/core/end2end/data/server1_cert.cc
index 8d149607b6..5e017c4da7 100644
--- a/test/core/end2end/data/server1_cert.c
+++ b/test/core/end2end/data/server1_cert.cc
@@ -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,
diff --git a/test/core/end2end/data/server1_key.c b/test/core/end2end/data/server1_key.cc
index eee5cc6d82..92a77aa21f 100644
--- a/test/core/end2end/data/server1_key.c
+++ b/test/core/end2end/data/server1_key.cc
@@ -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,
diff --git a/test/core/end2end/data/test_root_cert.c b/test/core/end2end/data/test_root_cert.cc
index ef39ca56ab..81ca410e14 100644
--- a/test/core/end2end/data/test_root_cert.c
+++ b/test/core/end2end/data/test_root_cert.cc
@@ -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,
diff --git a/test/core/end2end/dualstack_socket_test.c b/test/core/end2end/dualstack_socket_test.cc
index 59bb0540bc..1e02116e4c 100644
--- a/test/core/end2end/dualstack_socket_test.c
+++ b/test/core/end2end/dualstack_socket_test.cc
@@ -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);
diff --git a/test/core/end2end/end2end_nosec_tests.c b/test/core/end2end/end2end_nosec_tests.cc
index 3236feea56..3236feea56 100644
--- a/test/core/end2end/end2end_nosec_tests.c
+++ b/test/core/end2end/end2end_nosec_tests.cc
diff --git a/test/core/end2end/end2end_test_utils.c b/test/core/end2end/end2end_test_utils.cc
index 35f086a7f6..35f086a7f6 100644
--- a/test/core/end2end/end2end_test_utils.c
+++ b/test/core/end2end/end2end_test_utils.cc
diff --git a/test/core/end2end/end2end_tests.c b/test/core/end2end/end2end_tests.cc
index ca9443b642..ca9443b642 100644
--- a/test/core/end2end/end2end_tests.c
+++ b/test/core/end2end/end2end_tests.cc
diff --git a/test/core/end2end/end2end_tests.h b/test/core/end2end/end2end_tests.h
index b42d90b55c..33943a7271 100644
--- a/test/core/end2end/end2end_tests.h
+++ b/test/core/end2end/end2end_tests.h
@@ -21,6 +21,10 @@
#include <grpc/grpc.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
+
typedef struct grpc_end2end_test_fixture grpc_end2end_test_fixture;
typedef struct grpc_end2end_test_config grpc_end2end_test_config;
@@ -74,4 +78,8 @@ const grpc_slice* get_host_override_slice(const char* str,
void validate_host_override_string(const char* pattern, grpc_slice str,
grpc_end2end_test_config config);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* GRPC_TEST_CORE_END2END_END2END_TESTS_H */
diff --git a/test/core/end2end/fixtures/h2_census.c b/test/core/end2end/fixtures/h2_census.cc
index 29e55ef4fd..4213140f4a 100644
--- a/test/core/end2end/fixtures/h2_census.c
+++ b/test/core/end2end/fixtures/h2_census.cc
@@ -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);
}
diff --git a/test/core/end2end/fixtures/h2_compress.c b/test/core/end2end/fixtures/h2_compress.cc
index a2f9a2277c..64e028b950 100644
--- a/test/core/end2end/fixtures/h2_compress.c
+++ b/test/core/end2end/fixtures/h2_compress.cc
@@ -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);
diff --git a/test/core/end2end/fixtures/h2_fakesec.c b/test/core/end2end/fixtures/h2_fakesec.cc
index 74fec936e8..fbf2f49729 100644
--- a/test/core/end2end/fixtures/h2_fakesec.c
+++ b/test/core/end2end/fixtures/h2_fakesec.cc
@@ -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);
}
diff --git a/test/core/end2end/fixtures/h2_fd.c b/test/core/end2end/fixtures/h2_fd.cc
index 337ae8945a..7005b969a0 100644
--- a/test/core/end2end/fixtures/h2_fd.c
+++ b/test/core/end2end/fixtures/h2_fd.cc
@@ -52,7 +52,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));
@@ -68,7 +69,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(
@@ -81,7 +82,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);
diff --git a/test/core/end2end/fixtures/h2_full+pipe.c b/test/core/end2end/fixtures/h2_full+pipe.cc
index d36ba361b6..0dd650b8e0 100644
--- a/test/core/end2end/fixtures/h2_full+pipe.c
+++ b/test/core/end2end/fixtures/h2_full+pipe.cc
@@ -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);
}
diff --git a/test/core/end2end/fixtures/h2_full+trace.c b/test/core/end2end/fixtures/h2_full+trace.cc
index 62195f30d1..21372c6dee 100644
--- a/test/core/end2end/fixtures/h2_full+trace.c
+++ b/test/core/end2end/fixtures/h2_full+trace.cc
@@ -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);
}
diff --git a/test/core/end2end/fixtures/h2_full+workarounds.c b/test/core/end2end/fixtures/h2_full+workarounds.cc
index 0a331b0fc0..ebffe2125c 100644
--- a/test/core/end2end/fixtures/h2_full+workarounds.c
+++ b/test/core/end2end/fixtures/h2_full+workarounds.cc
@@ -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);
}
diff --git a/test/core/end2end/fixtures/h2_full.c b/test/core/end2end/fixtures/h2_full.cc
index 496ca6304e..895af67930 100644
--- a/test/core/end2end/fixtures/h2_full.c
+++ b/test/core/end2end/fixtures/h2_full.cc
@@ -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);
}
diff --git a/test/core/end2end/fixtures/h2_http_proxy.c b/test/core/end2end/fixtures/h2_http_proxy.cc
index dd3ccf3575..a67ce82064 100644
--- a/test/core/end2end/fixtures/h2_http_proxy.c
+++ b/test/core/end2end/fixtures/h2_http_proxy.cc
@@ -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);
diff --git a/test/core/end2end/fixtures/h2_load_reporting.c b/test/core/end2end/fixtures/h2_load_reporting.cc
index 23323962dd..b402fc5620 100644
--- a/test/core/end2end/fixtures/h2_load_reporting.c
+++ b/test/core/end2end/fixtures/h2_load_reporting.cc
@@ -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);
}
diff --git a/test/core/end2end/fixtures/h2_oauth2.c b/test/core/end2end/fixtures/h2_oauth2.cc
index 6a4173bfb7..88e590a15f 100644
--- a/test/core/end2end/fixtures/h2_oauth2.c
+++ b/test/core/end2end/fixtures/h2_oauth2.cc
@@ -94,7 +94,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);
@@ -109,7 +110,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);
@@ -119,7 +121,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);
}
@@ -132,7 +135,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);
}
@@ -146,9 +150,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);
@@ -177,7 +182,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;
diff --git a/test/core/end2end/fixtures/h2_proxy.c b/test/core/end2end/fixtures/h2_proxy.cc
index 96c9b6e96c..03ffa02e17 100644
--- a/test/core/end2end/fixtures/h2_proxy.c
+++ b/test/core/end2end/fixtures/h2_proxy.cc
@@ -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);
}
diff --git a/test/core/end2end/fixtures/h2_sockpair+trace.c b/test/core/end2end/fixtures/h2_sockpair+trace.cc
index fa2e6c6b11..c5dfe40391 100644
--- a/test/core/end2end/fixtures/h2_sockpair+trace.c
+++ b/test/core/end2end/fixtures/h2_sockpair+trace.cc
@@ -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);
diff --git a/test/core/end2end/fixtures/h2_sockpair.c b/test/core/end2end/fixtures/h2_sockpair.cc
index 024b45767b..f07722e52d 100644
--- a/test/core/end2end/fixtures/h2_sockpair.c
+++ b/test/core/end2end/fixtures/h2_sockpair.cc
@@ -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);
diff --git a/test/core/end2end/fixtures/h2_sockpair_1byte.c b/test/core/end2end/fixtures/h2_sockpair_1byte.cc
index f8ab7e7f9d..7d00c69a18 100644
--- a/test/core/end2end/fixtures/h2_sockpair_1byte.c
+++ b/test/core/end2end/fixtures/h2_sockpair_1byte.cc
@@ -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);
diff --git a/test/core/end2end/fixtures/h2_ssl.c b/test/core/end2end/fixtures/h2_ssl.cc
index 10e2ce04f5..70daefd333 100644
--- a/test/core/end2end/fixtures/h2_ssl.c
+++ b/test/core/end2end/fixtures/h2_ssl.cc
@@ -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);
diff --git a/test/core/end2end/fixtures/h2_ssl_proxy.c b/test/core/end2end/fixtures/h2_ssl_proxy.cc
index 1530707f56..b3488a29e5 100644
--- a/test/core/end2end/fixtures/h2_ssl_proxy.c
+++ b/test/core/end2end/fixtures/h2_ssl_proxy.cc
@@ -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);
diff --git a/test/core/end2end/fixtures/h2_uds.c b/test/core/end2end/fixtures/h2_uds.cc
index b090f5d590..ba433df57b 100644
--- a/test/core/end2end/fixtures/h2_uds.c
+++ b/test/core/end2end/fixtures/h2_uds.cc
@@ -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);
}
diff --git a/test/core/end2end/fixtures/http_proxy_fixture.c b/test/core/end2end/fixtures/http_proxy_fixture.cc
index d29401fdc3..d29401fdc3 100644
--- a/test/core/end2end/fixtures/http_proxy_fixture.c
+++ b/test/core/end2end/fixtures/http_proxy_fixture.cc
diff --git a/test/core/end2end/fixtures/inproc.c b/test/core/end2end/fixtures/inproc.cc
index 02e8030dd0..5107ed2018 100644
--- a/test/core/end2end/fixtures/inproc.c
+++ b/test/core/end2end/fixtures/inproc.cc
@@ -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,7 @@ 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);
}
diff --git a/test/core/end2end/fixtures/proxy.c b/test/core/end2end/fixtures/proxy.cc
index 01c9e13538..01c9e13538 100644
--- a/test/core/end2end/fixtures/proxy.c
+++ b/test/core/end2end/fixtures/proxy.cc
diff --git a/test/core/end2end/fuzzers/BUILD b/test/core/end2end/fuzzers/BUILD
index 4ed9a70578..d33e2b0ff4 100644
--- a/test/core/end2end/fuzzers/BUILD
+++ b/test/core/end2end/fuzzers/BUILD
@@ -22,8 +22,8 @@ load("//test/core/util:grpc_fuzzer.bzl", "grpc_fuzzer")
grpc_fuzzer(
name = "api_fuzzer",
- srcs = ["api_fuzzer.c"],
- language = "C",
+ srcs = ["api_fuzzer.cc"],
+ language = "C++",
corpus = "api_fuzzer_corpus",
deps = [
"//:gpr",
@@ -35,8 +35,8 @@ grpc_fuzzer(
grpc_fuzzer(
name = "client_fuzzer",
- srcs = ["client_fuzzer.c"],
- language = "C",
+ srcs = ["client_fuzzer.cc"],
+ language = "C++",
corpus = "client_fuzzer_corpus",
deps = [
"//:gpr",
@@ -47,8 +47,8 @@ grpc_fuzzer(
grpc_fuzzer(
name = "server_fuzzer",
- srcs = ["server_fuzzer.c"],
- language = "C",
+ srcs = ["server_fuzzer.cc"],
+ language = "C++",
corpus = "server_fuzzer_corpus",
deps = [
"//:gpr",
diff --git a/test/core/end2end/fuzzers/api_fuzzer.c b/test/core/end2end/fuzzers/api_fuzzer.cc
index c85c9b0301..69a5670d22 100644
--- a/test/core/end2end/fuzzers/api_fuzzer.c
+++ b/test/core/end2end/fuzzers/api_fuzzer.cc
@@ -56,7 +56,7 @@ static grpc_server* g_server;
static grpc_channel* g_channel;
static grpc_resource_quota* g_resource_quota;
-extern gpr_timespec (*gpr_now_impl)(gpr_clock_type clock_type);
+extern "C" gpr_timespec (*gpr_now_impl)(gpr_clock_type clock_type);
static gpr_timespec now_impl(gpr_clock_type clock_type) {
GPR_ASSERT(clock_type != GPR_TIMESPAN);
@@ -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;
@@ -374,18 +375,20 @@ 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) {
grpc_lb_addresses* lb_addrs = grpc_lb_addresses_create(1, NULL);
- grpc_lb_addresses_set_address(lb_addrs, 0, NULL, 0, NULL, NULL, NULL);
+ grpc_lb_addresses_set_address(lb_addrs, 0, NULL, 0, false, NULL, NULL);
*r->lb_addrs = lb_addrs;
}
GRPC_CLOSURE_SCHED(exec_ctx, r->on_done, GRPC_ERROR_NONE);
@@ -404,7 +407,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;
@@ -419,7 +422,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;
@@ -434,10 +437,10 @@ grpc_ares_request* my_dns_lookup_ares(
// client connection
// defined in tcp_client_posix.c
-extern void (*grpc_tcp_client_connect_impl)(
+extern "C" void (*grpc_tcp_client_connect_impl)(
grpc_exec_ctx* exec_ctx, grpc_closure* closure, grpc_endpoint** ep,
grpc_pollset_set* interested_parties, const grpc_channel_args* channel_args,
- const grpc_resolved_address* addr, gpr_timespec deadline);
+ const grpc_resolved_address* addr, grpc_millis deadline);
static void sched_connect(grpc_exec_ctx* exec_ctx, grpc_closure* closure,
grpc_endpoint** ep, gpr_timespec deadline);
@@ -450,7 +453,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));
@@ -482,7 +485,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;
@@ -496,8 +499,9 @@ static void my_tcp_client_connect(grpc_exec_ctx* exec_ctx,
grpc_pollset_set* interested_parties,
const grpc_channel_args* channel_args,
const grpc_resolved_address* addr,
- gpr_timespec deadline) {
- sched_connect(exec_ctx, closure, ep, deadline);
+ grpc_millis deadline) {
+ sched_connect(exec_ctx, closure, ep,
+ grpc_millis_to_timespec(deadline, GPR_CLOCK_MONOTONIC));
}
////////////////////////////////////////////////////////////////////////////////
@@ -510,7 +514,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;
@@ -530,14 +534,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);
}
@@ -587,7 +592,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;
@@ -636,8 +641,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;
}
@@ -645,12 +650,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];
}
@@ -659,7 +664,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);
@@ -669,7 +675,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);
}
@@ -681,7 +687,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) {
@@ -698,7 +704,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)) {
@@ -723,13 +729,13 @@ 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);
}
-int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
grpc_test_only_set_slice_hash_seed(0);
char* grpc_trace_fuzzer = gpr_getenv("GRPC_TRACE_FUZZER");
if (squelch && grpc_trace_fuzzer == NULL) gpr_set_log_function(dont_log);
@@ -806,7 +812,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;
@@ -996,7 +1002,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;
@@ -1039,7 +1046,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));
diff --git a/test/core/end2end/fuzzers/client_fuzzer.c b/test/core/end2end/fuzzers/client_fuzzer.cc
index f171d4b08e..d90ec40a27 100644
--- a/test/core/end2end/fuzzers/client_fuzzer.c
+++ b/test/core/end2end/fuzzers/client_fuzzer.cc
@@ -37,7 +37,7 @@ static void* tag(int n) { return (void*)(uintptr_t)n; }
static void dont_log(gpr_log_func_args* args) {}
-int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
grpc_test_only_set_slice_hash_seed(0);
struct grpc_memory_counters counters;
if (squelch) gpr_set_log_function(dont_log);
diff --git a/test/core/end2end/fuzzers/server_fuzzer.c b/test/core/end2end/fuzzers/server_fuzzer.cc
index 2078a3c32d..87bccc70cd 100644
--- a/test/core/end2end/fuzzers/server_fuzzer.c
+++ b/test/core/end2end/fuzzers/server_fuzzer.cc
@@ -35,7 +35,7 @@ static int detag(void* p) { return (int)(uintptr_t)p; }
static void dont_log(gpr_log_func_args* args) {}
-int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
grpc_test_only_set_slice_hash_seed(0);
struct grpc_memory_counters counters;
if (squelch) gpr_set_log_function(dont_log);
diff --git a/test/core/end2end/gen_build_yaml.py b/test/core/end2end/gen_build_yaml.py
index f7f996d5c1..7c8e7f420a 100755
--- a/test/core/end2end/gen_build_yaml.py
+++ b/test/core/end2end/gen_build_yaml.py
@@ -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
diff --git a/test/core/end2end/generate_tests.bzl b/test/core/end2end/generate_tests.bzl
index 89a95edfd7..b9a42bdb88 100755
--- a/test/core/end2end/generate_tests.bzl
+++ b/test/core/end2end/generate_tests.bzl
@@ -186,14 +186,14 @@ 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',
'end2end_tests.h'
],
- language = "C",
+ language = "C++",
deps = [
':cq_verifier',
':ssl_test_data',
@@ -205,8 +205,8 @@ def grpc_end2end_tests():
for f, fopt in END2END_FIXTURES.items():
grpc_cc_binary(
name = '%s_test' % f,
- srcs = ['fixtures/%s.c' % f],
- language = "C",
+ srcs = ['fixtures/%s.cc' % f],
+ language = "C++",
deps = [
':end2end_tests',
'//test/core/util:grpc_test_util',
diff --git a/test/core/end2end/goaway_server_test.c b/test/core/end2end/goaway_server_test.cc
index ec6a678545..12a966d05a 100644
--- a/test/core/end2end/goaway_server_test.c
+++ b/test/core/end2end/goaway_server_test.cc
@@ -74,9 +74,10 @@ 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 +107,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 +169,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;
diff --git a/test/core/end2end/h2_ssl_cert_test.cc b/test/core/end2end/h2_ssl_cert_test.cc
index fe4fd1029d..8994b63e5f 100644
--- a/test/core/end2end/h2_ssl_cert_test.cc
+++ b/test/core/end2end/h2_ssl_cert_test.cc
@@ -16,9 +16,7 @@
*
*/
-extern "C" {
#include "test/core/end2end/end2end_tests.h"
-}
#include <stdio.h>
#include <string.h>
@@ -27,7 +25,6 @@ extern "C" {
#include <grpc/support/host_port.h>
#include <grpc/support/log.h>
-extern "C" {
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/security/credentials/credentials.h"
#include "src/core/lib/support/env.h"
@@ -37,7 +34,6 @@ extern "C" {
#include "test/core/end2end/data/ssl_test_data.h"
#include "test/core/util/port.h"
#include "test/core/util/test_config.h"
-}
#include <gtest/gtest.h>
diff --git a/test/core/end2end/invalid_call_argument_test.c b/test/core/end2end/invalid_call_argument_test.cc
index 4847787782..c310a0e9ba 100644
--- a/test/core/end2end/invalid_call_argument_test.c
+++ b/test/core/end2end/invalid_call_argument_test.cc
@@ -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++;
diff --git a/test/core/end2end/multiple_server_queues_test.c b/test/core/end2end/multiple_server_queues_test.cc
index 8036ca54b2..8036ca54b2 100644
--- a/test/core/end2end/multiple_server_queues_test.c
+++ b/test/core/end2end/multiple_server_queues_test.cc
diff --git a/test/core/end2end/no_server_test.c b/test/core/end2end/no_server_test.cc
index a69b7bc8d6..a69b7bc8d6 100644
--- a/test/core/end2end/no_server_test.c
+++ b/test/core/end2end/no_server_test.cc
diff --git a/test/core/end2end/tests/authority_not_supported.c b/test/core/end2end/tests/authority_not_supported.cc
index 62fb02ab56..62fb02ab56 100644
--- a/test/core/end2end/tests/authority_not_supported.c
+++ b/test/core/end2end/tests/authority_not_supported.cc
diff --git a/test/core/end2end/tests/bad_hostname.c b/test/core/end2end/tests/bad_hostname.cc
index c54cb8ed34..c54cb8ed34 100644
--- a/test/core/end2end/tests/bad_hostname.c
+++ b/test/core/end2end/tests/bad_hostname.cc
diff --git a/test/core/end2end/tests/bad_ping.c b/test/core/end2end/tests/bad_ping.cc
index feca592a25..648061587c 100644
--- a/test/core/end2end/tests/bad_ping.c
+++ b/test/core/end2end/tests/bad_ping.cc
@@ -66,30 +66,30 @@ static void end_test(grpc_end2end_test_fixture* f) {
static void test_bad_ping(grpc_end2end_test_config config) {
grpc_end2end_test_fixture f = config.create_fixture(NULL, NULL);
cq_verifier* cqv = cq_verifier_create(f.cq);
- grpc_arg client_a[] = {
- {.type = GRPC_ARG_INTEGER,
- .key = GRPC_ARG_HTTP2_MIN_SENT_PING_INTERVAL_WITHOUT_DATA_MS,
- .value.integer = 10},
- {.type = GRPC_ARG_INTEGER,
- .key = GRPC_ARG_HTTP2_MAX_PINGS_WITHOUT_DATA,
- .value.integer = 0},
- {.type = GRPC_ARG_INTEGER,
- .key = GRPC_ARG_HTTP2_BDP_PROBE,
- .value.integer = 0}};
- grpc_arg server_a[] = {
- {.type = GRPC_ARG_INTEGER,
- .key = GRPC_ARG_HTTP2_MIN_RECV_PING_INTERVAL_WITHOUT_DATA_MS,
- .value.integer = 300000 /* 5 minutes */},
- {.type = GRPC_ARG_INTEGER,
- .key = GRPC_ARG_HTTP2_MAX_PING_STRIKES,
- .value.integer = MAX_PING_STRIKES},
- {.type = GRPC_ARG_INTEGER,
- .key = GRPC_ARG_HTTP2_BDP_PROBE,
- .value.integer = 0}};
- grpc_channel_args client_args = {.num_args = GPR_ARRAY_SIZE(client_a),
- .args = client_a};
- grpc_channel_args server_args = {.num_args = GPR_ARRAY_SIZE(server_a),
- .args = server_a};
+ grpc_arg client_a[3];
+ client_a[0].type = GRPC_ARG_INTEGER;
+ client_a[0].key =
+ const_cast<char*>(GRPC_ARG_HTTP2_MIN_SENT_PING_INTERVAL_WITHOUT_DATA_MS);
+ client_a[0].value.integer = 10;
+ client_a[1].type = GRPC_ARG_INTEGER;
+ client_a[1].key = const_cast<char*>(GRPC_ARG_HTTP2_MAX_PINGS_WITHOUT_DATA);
+ client_a[1].value.integer = 0;
+ client_a[2].type = GRPC_ARG_INTEGER;
+ client_a[2].key = const_cast<char*>(GRPC_ARG_HTTP2_BDP_PROBE);
+ client_a[2].value.integer = 0;
+ grpc_arg server_a[3];
+ server_a[0].type = GRPC_ARG_INTEGER;
+ server_a[0].key =
+ const_cast<char*>(GRPC_ARG_HTTP2_MIN_RECV_PING_INTERVAL_WITHOUT_DATA_MS);
+ server_a[0].value.integer = 300000 /* 5 minutes */;
+ server_a[1].type = GRPC_ARG_INTEGER;
+ server_a[1].key = const_cast<char*>(GRPC_ARG_HTTP2_MAX_PING_STRIKES);
+ server_a[1].value.integer = MAX_PING_STRIKES;
+ server_a[2].type = GRPC_ARG_INTEGER;
+ server_a[2].key = const_cast<char*>(GRPC_ARG_HTTP2_BDP_PROBE);
+ server_a[2].value.integer = 0;
+ grpc_channel_args client_args = {GPR_ARRAY_SIZE(client_a), client_a};
+ grpc_channel_args server_args = {GPR_ARRAY_SIZE(server_a), server_a};
config.init_client(&f, &client_args);
config.init_server(&f, &server_args);
diff --git a/test/core/end2end/tests/binary_metadata.c b/test/core/end2end/tests/binary_metadata.cc
index 52f0c70862..52f0c70862 100644
--- a/test/core/end2end/tests/binary_metadata.c
+++ b/test/core/end2end/tests/binary_metadata.cc
diff --git a/test/core/end2end/tests/call_creds.c b/test/core/end2end/tests/call_creds.cc
index a3d1eac90b..fc550b7733 100644
--- a/test/core/end2end/tests/call_creds.c
+++ b/test/core/end2end/tests/call_creds.cc
@@ -49,7 +49,9 @@ static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config,
config.init_client(&f, NULL);
if (fail_server_auth_check) {
grpc_arg fail_auth_arg = {
- GRPC_ARG_STRING, FAIL_AUTH_CHECK_SERVER_ARG_NAME, {NULL}};
+ GRPC_ARG_STRING,
+ const_cast<char*>(FAIL_AUTH_CHECK_SERVER_ARG_NAME),
+ {NULL}};
grpc_channel_args args;
args.num_args = 1;
args.args = &fail_auth_arg;
diff --git a/test/core/end2end/tests/cancel_after_accept.c b/test/core/end2end/tests/cancel_after_accept.cc
index 92c89fb1a8..e2ad5bd721 100644
--- a/test/core/end2end/tests/cancel_after_accept.c
+++ b/test/core/end2end/tests/cancel_after_accept.cc
@@ -125,8 +125,8 @@ static void test_cancel_after_accept(grpc_end2end_test_config config,
if (use_service_config) {
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"
@@ -135,7 +135,7 @@ static void test_cancel_after_accept(grpc_end2end_test_config config,
" ],\n"
" \"timeout\": \"5s\"\n"
" } ]\n"
- "}";
+ "}");
args = grpc_channel_args_copy_and_add(args, &arg, 1);
}
diff --git a/test/core/end2end/tests/cancel_after_client_done.c b/test/core/end2end/tests/cancel_after_client_done.cc
index 90db7f51b2..90db7f51b2 100644
--- a/test/core/end2end/tests/cancel_after_client_done.c
+++ b/test/core/end2end/tests/cancel_after_client_done.cc
diff --git a/test/core/end2end/tests/cancel_after_invoke.c b/test/core/end2end/tests/cancel_after_invoke.cc
index 7f0c4e7af9..7f0c4e7af9 100644
--- a/test/core/end2end/tests/cancel_after_invoke.c
+++ b/test/core/end2end/tests/cancel_after_invoke.cc
diff --git a/test/core/end2end/tests/cancel_after_round_trip.c b/test/core/end2end/tests/cancel_after_round_trip.cc
index 402e0bbd83..35b5214fac 100644
--- a/test/core/end2end/tests/cancel_after_round_trip.c
+++ b/test/core/end2end/tests/cancel_after_round_trip.cc
@@ -127,8 +127,8 @@ static void test_cancel_after_round_trip(grpc_end2end_test_config config,
if (use_service_config) {
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"
@@ -136,7 +136,7 @@ static void test_cancel_after_round_trip(grpc_end2end_test_config config,
" ],\n"
" \"timeout\": \"5s\"\n"
" } ]\n"
- "}";
+ "}");
args = grpc_channel_args_copy_and_add(args, &arg, 1);
}
diff --git a/test/core/end2end/tests/cancel_before_invoke.c b/test/core/end2end/tests/cancel_before_invoke.cc
index 9504aae5e6..9504aae5e6 100644
--- a/test/core/end2end/tests/cancel_before_invoke.c
+++ b/test/core/end2end/tests/cancel_before_invoke.cc
diff --git a/test/core/end2end/tests/cancel_in_a_vacuum.c b/test/core/end2end/tests/cancel_in_a_vacuum.cc
index 090ee2fbb2..090ee2fbb2 100644
--- a/test/core/end2end/tests/cancel_in_a_vacuum.c
+++ b/test/core/end2end/tests/cancel_in_a_vacuum.cc
diff --git a/test/core/end2end/tests/cancel_with_status.c b/test/core/end2end/tests/cancel_with_status.cc
index bc3c4c3ebd..bc3c4c3ebd 100644
--- a/test/core/end2end/tests/cancel_with_status.c
+++ b/test/core/end2end/tests/cancel_with_status.cc
diff --git a/test/core/end2end/tests/compressed_payload.c b/test/core/end2end/tests/compressed_payload.cc
index b5fc1898b5..b5fc1898b5 100644
--- a/test/core/end2end/tests/compressed_payload.c
+++ b/test/core/end2end/tests/compressed_payload.cc
diff --git a/test/core/end2end/tests/connectivity.c b/test/core/end2end/tests/connectivity.cc
index a3f69cd425..4f302d11dc 100644
--- a/test/core/end2end/tests/connectivity.c
+++ b/test/core/end2end/tests/connectivity.cc
@@ -56,7 +56,8 @@ static void test_connectivity(grpc_end2end_test_config config) {
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;
diff --git a/test/core/end2end/tests/default_host.c b/test/core/end2end/tests/default_host.cc
index 166f22aec9..166f22aec9 100644
--- a/test/core/end2end/tests/default_host.c
+++ b/test/core/end2end/tests/default_host.cc
diff --git a/test/core/end2end/tests/disappearing_server.c b/test/core/end2end/tests/disappearing_server.cc
index a0b34dd805..a0b34dd805 100644
--- a/test/core/end2end/tests/disappearing_server.c
+++ b/test/core/end2end/tests/disappearing_server.cc
diff --git a/test/core/end2end/tests/empty_batch.c b/test/core/end2end/tests/empty_batch.cc
index 59d0025239..59d0025239 100644
--- a/test/core/end2end/tests/empty_batch.c
+++ b/test/core/end2end/tests/empty_batch.cc
diff --git a/test/core/end2end/tests/filter_call_init_fails.c b/test/core/end2end/tests/filter_call_init_fails.cc
index ecf0cc3aca..ecf0cc3aca 100644
--- a/test/core/end2end/tests/filter_call_init_fails.c
+++ b/test/core/end2end/tests/filter_call_init_fails.cc
diff --git a/test/core/end2end/tests/filter_causes_close.c b/test/core/end2end/tests/filter_causes_close.cc
index b6cceabdd5..b6cceabdd5 100644
--- a/test/core/end2end/tests/filter_causes_close.c
+++ b/test/core/end2end/tests/filter_causes_close.cc
diff --git a/test/core/end2end/tests/filter_latency.c b/test/core/end2end/tests/filter_latency.cc
index e8ec188ec3..e8ec188ec3 100644
--- a/test/core/end2end/tests/filter_latency.c
+++ b/test/core/end2end/tests/filter_latency.cc
diff --git a/test/core/end2end/tests/graceful_server_shutdown.c b/test/core/end2end/tests/graceful_server_shutdown.cc
index 22bdac4032..22bdac4032 100644
--- a/test/core/end2end/tests/graceful_server_shutdown.c
+++ b/test/core/end2end/tests/graceful_server_shutdown.cc
diff --git a/test/core/end2end/tests/high_initial_seqno.c b/test/core/end2end/tests/high_initial_seqno.cc
index d60dd825ca..72f1d0fd3d 100644
--- a/test/core/end2end/tests/high_initial_seqno.c
+++ b/test/core/end2end/tests/high_initial_seqno.cc
@@ -211,7 +211,7 @@ static void test_invoke_10_simple_requests(grpc_end2end_test_config config,
char* name;
client_arg.type = GRPC_ARG_INTEGER;
- client_arg.key = GRPC_ARG_HTTP2_INITIAL_SEQUENCE_NUMBER;
+ client_arg.key = const_cast<char*>(GRPC_ARG_HTTP2_INITIAL_SEQUENCE_NUMBER);
client_arg.value.integer = initial_sequence_number;
client_args.num_args = 1;
diff --git a/test/core/end2end/tests/hpack_size.c b/test/core/end2end/tests/hpack_size.cc
index 706aa2fe2f..b2c683ec8e 100644
--- a/test/core/end2end/tests/hpack_size.c
+++ b/test/core/end2end/tests/hpack_size.cc
@@ -360,13 +360,13 @@ static void test_size(grpc_end2end_test_config config, int encode_size,
char* name;
server_arg.type = GRPC_ARG_INTEGER;
- server_arg.key = GRPC_ARG_HTTP2_HPACK_TABLE_SIZE_DECODER;
+ server_arg.key = const_cast<char*>(GRPC_ARG_HTTP2_HPACK_TABLE_SIZE_DECODER);
server_arg.value.integer = decode_size;
server_args.num_args = 1;
server_args.args = &server_arg;
client_arg.type = GRPC_ARG_INTEGER;
- client_arg.key = GRPC_ARG_HTTP2_HPACK_TABLE_SIZE_ENCODER;
+ client_arg.key = const_cast<char*>(GRPC_ARG_HTTP2_HPACK_TABLE_SIZE_ENCODER);
client_arg.value.integer = encode_size;
client_args.num_args = 1;
client_args.args = &client_arg;
diff --git a/test/core/end2end/tests/idempotent_request.c b/test/core/end2end/tests/idempotent_request.cc
index 4f61caa6df..4f61caa6df 100644
--- a/test/core/end2end/tests/idempotent_request.c
+++ b/test/core/end2end/tests/idempotent_request.cc
diff --git a/test/core/end2end/tests/invoke_large_request.c b/test/core/end2end/tests/invoke_large_request.cc
index 4b10665c21..ade61ac91d 100644
--- a/test/core/end2end/tests/invoke_large_request.c
+++ b/test/core/end2end/tests/invoke_large_request.cc
@@ -96,10 +96,10 @@ static void test_invoke_large_request(grpc_end2end_test_config config,
grpc_arg args[2];
args[0].type = GRPC_ARG_INTEGER;
- args[0].key = GRPC_ARG_HTTP2_MAX_FRAME_SIZE;
+ args[0].key = const_cast<char*>(GRPC_ARG_HTTP2_MAX_FRAME_SIZE);
args[0].value.integer = max_frame_size;
args[1].type = GRPC_ARG_INTEGER;
- args[1].key = GRPC_ARG_HTTP2_STREAM_LOOKAHEAD_BYTES;
+ args[1].key = const_cast<char*>(GRPC_ARG_HTTP2_STREAM_LOOKAHEAD_BYTES);
args[1].value.integer = lookahead_bytes;
grpc_channel_args channel_args = {GPR_ARRAY_SIZE(args), args};
diff --git a/test/core/end2end/tests/keepalive_timeout.c b/test/core/end2end/tests/keepalive_timeout.cc
index 91c06319b4..d071254a98 100644
--- a/test/core/end2end/tests/keepalive_timeout.c
+++ b/test/core/end2end/tests/keepalive_timeout.cc
@@ -98,18 +98,18 @@ static void test_keepalive_timeout(grpc_end2end_test_config config) {
grpc_byte_buffer* response_payload =
grpc_raw_byte_buffer_create(&response_payload_slice, 1);
- grpc_arg keepalive_arg_elems[] = {{.type = GRPC_ARG_INTEGER,
- .key = GRPC_ARG_KEEPALIVE_TIME_MS,
- .value.integer = 1500},
- {.type = GRPC_ARG_INTEGER,
- .key = GRPC_ARG_KEEPALIVE_TIMEOUT_MS,
- .value.integer = 0},
- {.type = GRPC_ARG_INTEGER,
- .key = GRPC_ARG_HTTP2_BDP_PROBE,
- .value.integer = 0}};
- grpc_channel_args keepalive_args = {
- .num_args = GPR_ARRAY_SIZE(keepalive_arg_elems),
- .args = keepalive_arg_elems};
+ grpc_arg keepalive_arg_elems[3];
+ keepalive_arg_elems[0].type = GRPC_ARG_INTEGER;
+ keepalive_arg_elems[0].key = const_cast<char*>(GRPC_ARG_KEEPALIVE_TIME_MS);
+ keepalive_arg_elems[0].value.integer = 1500;
+ keepalive_arg_elems[1].type = GRPC_ARG_INTEGER;
+ keepalive_arg_elems[1].key = const_cast<char*>(GRPC_ARG_KEEPALIVE_TIMEOUT_MS);
+ keepalive_arg_elems[1].value.integer = 0;
+ keepalive_arg_elems[2].type = GRPC_ARG_INTEGER;
+ keepalive_arg_elems[2].key = const_cast<char*>(GRPC_ARG_HTTP2_BDP_PROBE);
+ keepalive_arg_elems[2].value.integer = 0;
+ grpc_channel_args keepalive_args = {GPR_ARRAY_SIZE(keepalive_arg_elems),
+ keepalive_arg_elems};
grpc_end2end_test_fixture f =
begin_test(config, "keepalive_timeout", &keepalive_args, NULL);
diff --git a/test/core/end2end/tests/large_metadata.c b/test/core/end2end/tests/large_metadata.cc
index 280e411c3d..4afd9f31ba 100644
--- a/test/core/end2end/tests/large_metadata.c
+++ b/test/core/end2end/tests/large_metadata.cc
@@ -94,9 +94,10 @@ static void test_request_with_large_metadata(grpc_end2end_test_config config) {
grpc_raw_byte_buffer_create(&request_payload_slice, 1);
grpc_metadata meta;
const size_t large_size = 64 * 1024;
- grpc_arg arg = {GRPC_ARG_INTEGER,
- GRPC_ARG_MAX_METADATA_SIZE,
- {.integer = (int)large_size + 1024}};
+ grpc_arg arg;
+ arg.type = GRPC_ARG_INTEGER;
+ arg.key = const_cast<char*>(GRPC_ARG_MAX_METADATA_SIZE);
+ arg.value.integer = (int)large_size + 1024;
grpc_channel_args args = {1, &arg};
grpc_end2end_test_fixture f =
begin_test(config, "test_request_with_large_metadata", &args, &args);
diff --git a/test/core/end2end/tests/load_reporting_hook.c b/test/core/end2end/tests/load_reporting_hook.cc
index 5c2c3b497c..5c2c3b497c 100644
--- a/test/core/end2end/tests/load_reporting_hook.c
+++ b/test/core/end2end/tests/load_reporting_hook.cc
diff --git a/test/core/end2end/tests/max_concurrent_streams.c b/test/core/end2end/tests/max_concurrent_streams.cc
index 675b1be3be..b8b49d65fb 100644
--- a/test/core/end2end/tests/max_concurrent_streams.c
+++ b/test/core/end2end/tests/max_concurrent_streams.cc
@@ -221,7 +221,7 @@ static void test_max_concurrent_streams(grpc_end2end_test_config config) {
int got_client_start;
int got_server_start;
- server_arg.key = GRPC_ARG_MAX_CONCURRENT_STREAMS;
+ server_arg.key = const_cast<char*>(GRPC_ARG_MAX_CONCURRENT_STREAMS);
server_arg.type = GRPC_ARG_INTEGER;
server_arg.value.integer = 1;
@@ -461,7 +461,7 @@ static void test_max_concurrent_streams_with_timeout_on_first(
grpc_op* op;
int was_cancelled;
- server_arg.key = GRPC_ARG_MAX_CONCURRENT_STREAMS;
+ server_arg.key = const_cast<char*>(GRPC_ARG_MAX_CONCURRENT_STREAMS);
server_arg.type = GRPC_ARG_INTEGER;
server_arg.value.integer = 1;
@@ -655,7 +655,7 @@ static void test_max_concurrent_streams_with_timeout_on_second(
grpc_op* op;
int was_cancelled;
- server_arg.key = GRPC_ARG_MAX_CONCURRENT_STREAMS;
+ server_arg.key = const_cast<char*>(GRPC_ARG_MAX_CONCURRENT_STREAMS);
server_arg.type = GRPC_ARG_INTEGER;
server_arg.value.integer = 1;
diff --git a/test/core/end2end/tests/max_connection_age.c b/test/core/end2end/tests/max_connection_age.cc
index ed52133471..b5d4dcf963 100644
--- a/test/core/end2end/tests/max_connection_age.c
+++ b/test/core/end2end/tests/max_connection_age.cc
@@ -80,17 +80,17 @@ static void end_test(grpc_end2end_test_fixture* f) {
static void test_max_age_forcibly_close(grpc_end2end_test_config config) {
grpc_end2end_test_fixture f = config.create_fixture(NULL, NULL);
cq_verifier* cqv = cq_verifier_create(f.cq);
- grpc_arg server_a[] = {{.type = GRPC_ARG_INTEGER,
- .key = GRPC_ARG_MAX_CONNECTION_AGE_MS,
- .value.integer = MAX_CONNECTION_AGE_MS},
- {.type = GRPC_ARG_INTEGER,
- .key = GRPC_ARG_MAX_CONNECTION_AGE_GRACE_MS,
- .value.integer = MAX_CONNECTION_AGE_GRACE_MS},
- {.type = GRPC_ARG_INTEGER,
- .key = GRPC_ARG_MAX_CONNECTION_IDLE_MS,
- .value.integer = MAX_CONNECTION_IDLE_MS}};
- grpc_channel_args server_args = {.num_args = GPR_ARRAY_SIZE(server_a),
- .args = server_a};
+ grpc_arg server_a[3];
+ server_a[0].type = GRPC_ARG_INTEGER;
+ server_a[0].key = const_cast<char*>(GRPC_ARG_MAX_CONNECTION_AGE_MS);
+ server_a[0].value.integer = MAX_CONNECTION_AGE_MS;
+ server_a[1].type = GRPC_ARG_INTEGER;
+ server_a[1].key = const_cast<char*>(GRPC_ARG_MAX_CONNECTION_AGE_GRACE_MS);
+ server_a[1].value.integer = MAX_CONNECTION_AGE_GRACE_MS;
+ server_a[2].type = GRPC_ARG_INTEGER;
+ server_a[2].key = const_cast<char*>(GRPC_ARG_MAX_CONNECTION_IDLE_MS);
+ server_a[2].value.integer = MAX_CONNECTION_IDLE_MS;
+ grpc_channel_args server_args = {GPR_ARRAY_SIZE(server_a), server_a};
config.init_client(&f, NULL);
config.init_server(&f, &server_args);
@@ -223,17 +223,17 @@ static void test_max_age_forcibly_close(grpc_end2end_test_config config) {
static void test_max_age_gracefully_close(grpc_end2end_test_config config) {
grpc_end2end_test_fixture f = config.create_fixture(NULL, NULL);
cq_verifier* cqv = cq_verifier_create(f.cq);
- grpc_arg server_a[] = {{.type = GRPC_ARG_INTEGER,
- .key = GRPC_ARG_MAX_CONNECTION_AGE_MS,
- .value.integer = MAX_CONNECTION_AGE_MS},
- {.type = GRPC_ARG_INTEGER,
- .key = GRPC_ARG_MAX_CONNECTION_AGE_GRACE_MS,
- .value.integer = INT_MAX},
- {.type = GRPC_ARG_INTEGER,
- .key = GRPC_ARG_MAX_CONNECTION_IDLE_MS,
- .value.integer = MAX_CONNECTION_IDLE_MS}};
- grpc_channel_args server_args = {.num_args = GPR_ARRAY_SIZE(server_a),
- .args = server_a};
+ grpc_arg server_a[3];
+ server_a[0].type = GRPC_ARG_INTEGER;
+ server_a[0].key = const_cast<char*>(GRPC_ARG_MAX_CONNECTION_AGE_MS);
+ server_a[0].value.integer = MAX_CONNECTION_AGE_MS;
+ server_a[1].type = GRPC_ARG_INTEGER;
+ server_a[1].key = const_cast<char*>(GRPC_ARG_MAX_CONNECTION_AGE_GRACE_MS);
+ server_a[1].value.integer = INT_MAX;
+ server_a[2].type = GRPC_ARG_INTEGER;
+ server_a[2].key = const_cast<char*>(GRPC_ARG_MAX_CONNECTION_IDLE_MS);
+ server_a[2].value.integer = MAX_CONNECTION_IDLE_MS;
+ grpc_channel_args server_args = {GPR_ARRAY_SIZE(server_a), server_a};
config.init_client(&f, NULL);
config.init_server(&f, &server_args);
diff --git a/test/core/end2end/tests/max_connection_idle.c b/test/core/end2end/tests/max_connection_idle.cc
index 8866a3dc0d..d850e4267b 100644
--- a/test/core/end2end/tests/max_connection_idle.c
+++ b/test/core/end2end/tests/max_connection_idle.cc
@@ -171,19 +171,20 @@ static void test_max_connection_idle(grpc_end2end_test_config config) {
grpc_connectivity_state state = GRPC_CHANNEL_IDLE;
cq_verifier* cqv = cq_verifier_create(f.cq);
- grpc_arg client_a[] = {{.type = GRPC_ARG_INTEGER,
- .key = "grpc.testing.fixed_reconnect_backoff_ms",
- .value.integer = 1000}};
- grpc_arg server_a[] = {{.type = GRPC_ARG_INTEGER,
- .key = GRPC_ARG_MAX_CONNECTION_IDLE_MS,
- .value.integer = MAX_CONNECTION_IDLE_MS},
- {.type = GRPC_ARG_INTEGER,
- .key = GRPC_ARG_MAX_CONNECTION_AGE_MS,
- .value.integer = MAX_CONNECTION_AGE_MS}};
- grpc_channel_args client_args = {.num_args = GPR_ARRAY_SIZE(client_a),
- .args = client_a};
- grpc_channel_args server_args = {.num_args = GPR_ARRAY_SIZE(server_a),
- .args = server_a};
+ grpc_arg client_a[1];
+ client_a[0].type = GRPC_ARG_INTEGER;
+ client_a[0].key =
+ const_cast<char*>("grpc.testing.fixed_reconnect_backoff_ms");
+ client_a[0].value.integer = 1000;
+ grpc_arg server_a[2];
+ server_a[0].type = GRPC_ARG_INTEGER;
+ server_a[0].key = const_cast<char*>(GRPC_ARG_MAX_CONNECTION_IDLE_MS);
+ server_a[0].value.integer = MAX_CONNECTION_IDLE_MS;
+ server_a[1].type = GRPC_ARG_INTEGER;
+ server_a[1].key = const_cast<char*>(GRPC_ARG_MAX_CONNECTION_AGE_MS);
+ server_a[1].value.integer = MAX_CONNECTION_AGE_MS;
+ grpc_channel_args client_args = {GPR_ARRAY_SIZE(client_a), client_a};
+ grpc_channel_args server_args = {GPR_ARRAY_SIZE(server_a), server_a};
config.init_client(&f, &client_args);
config.init_server(&f, &server_args);
diff --git a/test/core/end2end/tests/max_message_length.c b/test/core/end2end/tests/max_message_length.cc
index ba730ecaad..3d677f1d8f 100644
--- a/test/core/end2end/tests/max_message_length.c
+++ b/test/core/end2end/tests/max_message_length.cc
@@ -132,32 +132,34 @@ static void test_max_message_length_on_request(grpc_end2end_test_config config,
GPR_ASSERT(send_limit);
grpc_arg arg;
arg.type = GRPC_ARG_STRING;
- arg.key = GRPC_ARG_SERVICE_CONFIG;
+ arg.key = const_cast<char*>(GRPC_ARG_SERVICE_CONFIG);
arg.value.string =
use_string_json_value
- ? "{\n"
- " \"methodConfig\": [ {\n"
- " \"name\": [\n"
- " { \"service\": \"service\", \"method\": \"method\" },\n"
- " { \"service\": \"unused\" }\n"
- " ],\n"
- " \"maxRequestMessageBytes\": \"5\"\n"
- " } ]\n"
- "}"
- : "{\n"
- " \"methodConfig\": [ {\n"
- " \"name\": [\n"
- " { \"service\": \"service\", \"method\": \"method\" }\n"
- " ],\n"
- " \"maxRequestMessageBytes\": 5\n"
- " } ]\n"
- "}";
+ ? const_cast<char*>(
+ "{\n"
+ " \"methodConfig\": [ {\n"
+ " \"name\": [\n"
+ " { \"service\": \"service\", \"method\": \"method\" }\n"
+ " ],\n"
+ " \"maxRequestMessageBytes\": \"5\"\n"
+ " } ]\n"
+ "}")
+ : const_cast<char*>(
+ "{\n"
+ " \"methodConfig\": [ {\n"
+ " \"name\": [\n"
+ " { \"service\": \"service\", \"method\": \"method\" }\n"
+ " ],\n"
+ " \"maxRequestMessageBytes\": 5\n"
+ " } ]\n"
+ "}");
client_args = grpc_channel_args_copy_and_add(NULL, &arg, 1);
} else {
// Set limit via channel args.
grpc_arg arg;
- arg.key = send_limit ? GRPC_ARG_MAX_SEND_MESSAGE_LENGTH
- : GRPC_ARG_MAX_RECEIVE_MESSAGE_LENGTH;
+ arg.key = send_limit
+ ? const_cast<char*>(GRPC_ARG_MAX_SEND_MESSAGE_LENGTH)
+ : const_cast<char*>(GRPC_ARG_MAX_RECEIVE_MESSAGE_LENGTH);
arg.type = GRPC_ARG_INTEGER;
arg.value.integer = 5;
grpc_channel_args* args = grpc_channel_args_copy_and_add(NULL, &arg, 1);
@@ -323,8 +325,8 @@ static void test_max_message_length_on_response(grpc_end2end_test_config config,
GPR_ASSERT(!send_limit);
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*>(
use_string_json_value
? "{\n"
" \"methodConfig\": [ {\n"
@@ -341,13 +343,14 @@ static void test_max_message_length_on_response(grpc_end2end_test_config config,
" ],\n"
" \"maxResponseMessageBytes\": 5\n"
" } ]\n"
- "}";
+ "}");
client_args = grpc_channel_args_copy_and_add(NULL, &arg, 1);
} else {
// Set limit via channel args.
grpc_arg arg;
- arg.key = send_limit ? GRPC_ARG_MAX_SEND_MESSAGE_LENGTH
- : GRPC_ARG_MAX_RECEIVE_MESSAGE_LENGTH;
+ arg.key = send_limit
+ ? const_cast<char*>(GRPC_ARG_MAX_SEND_MESSAGE_LENGTH)
+ : const_cast<char*>(GRPC_ARG_MAX_RECEIVE_MESSAGE_LENGTH);
arg.type = GRPC_ARG_INTEGER;
arg.value.integer = 5;
grpc_channel_args* args = grpc_channel_args_copy_and_add(NULL, &arg, 1);
diff --git a/test/core/end2end/tests/negative_deadline.c b/test/core/end2end/tests/negative_deadline.cc
index 0d56038684..0d56038684 100644
--- a/test/core/end2end/tests/negative_deadline.c
+++ b/test/core/end2end/tests/negative_deadline.cc
diff --git a/test/core/end2end/tests/network_status_change.c b/test/core/end2end/tests/network_status_change.cc
index 088563cb2c..088563cb2c 100644
--- a/test/core/end2end/tests/network_status_change.c
+++ b/test/core/end2end/tests/network_status_change.cc
diff --git a/test/core/end2end/tests/no_logging.c b/test/core/end2end/tests/no_logging.cc
index c75ff8a514..1a7b57cd84 100644
--- a/test/core/end2end/tests/no_logging.c
+++ b/test/core/end2end/tests/no_logging.cc
@@ -36,7 +36,7 @@ enum { TIMEOUT = 200000 };
static void* tag(intptr_t t) { return (void*)t; }
-extern void gpr_default_log(gpr_log_func_args* args);
+extern "C" void gpr_default_log(gpr_log_func_args* args);
static void test_no_log(gpr_log_func_args* args) {
char* message = NULL;
diff --git a/test/core/end2end/tests/no_op.c b/test/core/end2end/tests/no_op.cc
index 98cf5eb9dc..98cf5eb9dc 100644
--- a/test/core/end2end/tests/no_op.c
+++ b/test/core/end2end/tests/no_op.cc
diff --git a/test/core/end2end/tests/payload.c b/test/core/end2end/tests/payload.cc
index 0ff9461a47..0ff9461a47 100644
--- a/test/core/end2end/tests/payload.c
+++ b/test/core/end2end/tests/payload.cc
diff --git a/test/core/end2end/tests/ping.c b/test/core/end2end/tests/ping.cc
index f2bb71b643..88f62c0a2b 100644
--- a/test/core/end2end/tests/ping.c
+++ b/test/core/end2end/tests/ping.cc
@@ -37,27 +37,27 @@ static void test_ping(grpc_end2end_test_config config,
grpc_connectivity_state state = GRPC_CHANNEL_IDLE;
int i;
- grpc_arg client_a[] = {
- {.type = GRPC_ARG_INTEGER,
- .key = GRPC_ARG_HTTP2_MIN_SENT_PING_INTERVAL_WITHOUT_DATA_MS,
- .value.integer = 10},
- {.type = GRPC_ARG_INTEGER,
- .key = GRPC_ARG_HTTP2_MAX_PINGS_WITHOUT_DATA,
- .value.integer = 0},
- {.type = GRPC_ARG_INTEGER,
- .key = GRPC_ARG_KEEPALIVE_PERMIT_WITHOUT_CALLS,
- .value.integer = 1}};
- grpc_arg server_a[] = {
- {.type = GRPC_ARG_INTEGER,
- .key = GRPC_ARG_HTTP2_MIN_RECV_PING_INTERVAL_WITHOUT_DATA_MS,
- .value.integer = 0},
- {.type = GRPC_ARG_INTEGER,
- .key = GRPC_ARG_KEEPALIVE_PERMIT_WITHOUT_CALLS,
- .value.integer = 1}};
- grpc_channel_args client_args = {.num_args = GPR_ARRAY_SIZE(client_a),
- .args = client_a};
- grpc_channel_args server_args = {.num_args = GPR_ARRAY_SIZE(server_a),
- .args = server_a};
+ grpc_arg client_a[3];
+ client_a[0].type = GRPC_ARG_INTEGER;
+ client_a[0].key =
+ const_cast<char*>(GRPC_ARG_HTTP2_MIN_SENT_PING_INTERVAL_WITHOUT_DATA_MS);
+ client_a[0].value.integer = 10;
+ client_a[1].type = GRPC_ARG_INTEGER;
+ client_a[1].key = const_cast<char*>(GRPC_ARG_HTTP2_MAX_PINGS_WITHOUT_DATA);
+ client_a[1].value.integer = 0;
+ client_a[2].type = GRPC_ARG_INTEGER;
+ client_a[2].key = const_cast<char*>(GRPC_ARG_KEEPALIVE_PERMIT_WITHOUT_CALLS);
+ client_a[2].value.integer = 1;
+ grpc_arg server_a[2];
+ server_a[0].type = GRPC_ARG_INTEGER;
+ server_a[0].key =
+ const_cast<char*>(GRPC_ARG_HTTP2_MIN_RECV_PING_INTERVAL_WITHOUT_DATA_MS);
+ server_a[0].value.integer = 0;
+ server_a[1].type = GRPC_ARG_INTEGER;
+ server_a[1].key = const_cast<char*>(GRPC_ARG_KEEPALIVE_PERMIT_WITHOUT_CALLS);
+ server_a[1].value.integer = 1;
+ grpc_channel_args client_args = {GPR_ARRAY_SIZE(client_a), client_a};
+ grpc_channel_args server_args = {GPR_ARRAY_SIZE(server_a), server_a};
config.init_client(&f, &client_args);
config.init_server(&f, &server_args);
diff --git a/test/core/end2end/tests/ping_pong_streaming.c b/test/core/end2end/tests/ping_pong_streaming.cc
index 3c2e76b9f9..3c2e76b9f9 100644
--- a/test/core/end2end/tests/ping_pong_streaming.c
+++ b/test/core/end2end/tests/ping_pong_streaming.cc
diff --git a/test/core/end2end/tests/proxy_auth.c b/test/core/end2end/tests/proxy_auth.cc
index 05cbc12f60..d5dce7c6de 100644
--- a/test/core/end2end/tests/proxy_auth.c
+++ b/test/core/end2end/tests/proxy_auth.cc
@@ -217,10 +217,11 @@ static void simple_request_body(grpc_end2end_test_config config,
static void test_invoke_proxy_auth(grpc_end2end_test_config config) {
/* Indicate that the proxy requires user auth */
- grpc_arg client_arg = {.type = GRPC_ARG_STRING,
- .key = GRPC_ARG_HTTP_PROXY_AUTH_CREDS,
- .value.string = GRPC_TEST_HTTP_PROXY_AUTH_CREDS};
- grpc_channel_args client_args = {.num_args = 1, .args = &client_arg};
+ grpc_arg client_arg;
+ client_arg.type = GRPC_ARG_STRING;
+ client_arg.key = const_cast<char*>(GRPC_ARG_HTTP_PROXY_AUTH_CREDS);
+ client_arg.value.string = const_cast<char*>(GRPC_TEST_HTTP_PROXY_AUTH_CREDS);
+ grpc_channel_args client_args = {1, &client_arg};
grpc_end2end_test_fixture f =
begin_test(config, "test_invoke_proxy_auth", &client_args, NULL);
simple_request_body(config, f);
diff --git a/test/core/end2end/tests/registered_call.c b/test/core/end2end/tests/registered_call.cc
index b43ca04766..b43ca04766 100644
--- a/test/core/end2end/tests/registered_call.c
+++ b/test/core/end2end/tests/registered_call.cc
diff --git a/test/core/end2end/tests/request_with_flags.c b/test/core/end2end/tests/request_with_flags.cc
index 77c931844c..77c931844c 100644
--- a/test/core/end2end/tests/request_with_flags.c
+++ b/test/core/end2end/tests/request_with_flags.cc
diff --git a/test/core/end2end/tests/request_with_payload.c b/test/core/end2end/tests/request_with_payload.cc
index 946144239c..946144239c 100644
--- a/test/core/end2end/tests/request_with_payload.c
+++ b/test/core/end2end/tests/request_with_payload.cc
diff --git a/test/core/end2end/tests/resource_quota_server.c b/test/core/end2end/tests/resource_quota_server.cc
index 445c536f19..dd00c9843f 100644
--- a/test/core/end2end/tests/resource_quota_server.c
+++ b/test/core/end2end/tests/resource_quota_server.cc
@@ -117,7 +117,7 @@ void resource_quota_server(grpc_end2end_test_config config) {
#define SERVER_END_BASE_TAG 0x4000
grpc_arg arg;
- arg.key = GRPC_ARG_RESOURCE_QUOTA;
+ arg.key = const_cast<char*>(GRPC_ARG_RESOURCE_QUOTA);
arg.type = GRPC_ARG_POINTER;
arg.value.pointer.p = resource_quota;
arg.value.pointer.vtable = grpc_resource_quota_arg_vtable();
diff --git a/test/core/end2end/tests/server_finishes_request.c b/test/core/end2end/tests/server_finishes_request.cc
index 50544a6759..50544a6759 100644
--- a/test/core/end2end/tests/server_finishes_request.c
+++ b/test/core/end2end/tests/server_finishes_request.cc
diff --git a/test/core/end2end/tests/shutdown_finishes_calls.c b/test/core/end2end/tests/shutdown_finishes_calls.cc
index 26a53e5161..26a53e5161 100644
--- a/test/core/end2end/tests/shutdown_finishes_calls.c
+++ b/test/core/end2end/tests/shutdown_finishes_calls.cc
diff --git a/test/core/end2end/tests/shutdown_finishes_tags.c b/test/core/end2end/tests/shutdown_finishes_tags.cc
index 0275a1e4ef..0275a1e4ef 100644
--- a/test/core/end2end/tests/shutdown_finishes_tags.c
+++ b/test/core/end2end/tests/shutdown_finishes_tags.cc
diff --git a/test/core/end2end/tests/simple_cacheable_request.c b/test/core/end2end/tests/simple_cacheable_request.cc
index e2ee7bf35a..e2ee7bf35a 100644
--- a/test/core/end2end/tests/simple_cacheable_request.c
+++ b/test/core/end2end/tests/simple_cacheable_request.cc
diff --git a/test/core/end2end/tests/simple_delayed_request.c b/test/core/end2end/tests/simple_delayed_request.cc
index 009eb58833..eef36c9710 100644
--- a/test/core/end2end/tests/simple_delayed_request.c
+++ b/test/core/end2end/tests/simple_delayed_request.cc
@@ -191,7 +191,8 @@ static void test_simple_delayed_request_short(grpc_end2end_test_config config) {
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;
@@ -210,7 +211,8 @@ static void test_simple_delayed_request_long(grpc_end2end_test_config config) {
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;
diff --git a/test/core/end2end/tests/simple_metadata.c b/test/core/end2end/tests/simple_metadata.cc
index 3b3d5ad64c..3b3d5ad64c 100644
--- a/test/core/end2end/tests/simple_metadata.c
+++ b/test/core/end2end/tests/simple_metadata.cc
diff --git a/test/core/end2end/tests/simple_request.c b/test/core/end2end/tests/simple_request.cc
index 8faac97134..d48010ba87 100644
--- a/test/core/end2end/tests/simple_request.c
+++ b/test/core/end2end/tests/simple_request.cc
@@ -103,8 +103,10 @@ static void simple_request_body(grpc_end2end_test_config config,
grpc_slice details;
int was_cancelled = 2;
char* peer;
- grpc_stats_data* before = gpr_malloc(sizeof(grpc_stats_data));
- grpc_stats_data* after = gpr_malloc(sizeof(grpc_stats_data));
+ grpc_stats_data* before =
+ static_cast<grpc_stats_data*>(gpr_malloc(sizeof(grpc_stats_data)));
+ grpc_stats_data* after =
+ static_cast<grpc_stats_data*>(gpr_malloc(sizeof(grpc_stats_data)));
grpc_stats_collect(before);
diff --git a/test/core/end2end/tests/stream_compression_compressed_payload.c b/test/core/end2end/tests/stream_compression_compressed_payload.cc
index 3fe5200045..3fe5200045 100644
--- a/test/core/end2end/tests/stream_compression_compressed_payload.c
+++ b/test/core/end2end/tests/stream_compression_compressed_payload.cc
diff --git a/test/core/end2end/tests/stream_compression_payload.c b/test/core/end2end/tests/stream_compression_payload.cc
index 038f0be738..038f0be738 100644
--- a/test/core/end2end/tests/stream_compression_payload.c
+++ b/test/core/end2end/tests/stream_compression_payload.cc
diff --git a/test/core/end2end/tests/stream_compression_ping_pong_streaming.c b/test/core/end2end/tests/stream_compression_ping_pong_streaming.cc
index a5321bfc61..a5321bfc61 100644
--- a/test/core/end2end/tests/stream_compression_ping_pong_streaming.c
+++ b/test/core/end2end/tests/stream_compression_ping_pong_streaming.cc
diff --git a/test/core/end2end/tests/streaming_error_response.c b/test/core/end2end/tests/streaming_error_response.cc
index f87fd2c4c3..f87fd2c4c3 100644
--- a/test/core/end2end/tests/streaming_error_response.c
+++ b/test/core/end2end/tests/streaming_error_response.cc
diff --git a/test/core/end2end/tests/trailing_metadata.c b/test/core/end2end/tests/trailing_metadata.cc
index 0da02a56db..0da02a56db 100644
--- a/test/core/end2end/tests/trailing_metadata.c
+++ b/test/core/end2end/tests/trailing_metadata.cc
diff --git a/test/core/end2end/tests/workaround_cronet_compression.c b/test/core/end2end/tests/workaround_cronet_compression.cc
index e9a2b8a7ec..8f8ca16a9e 100644
--- a/test/core/end2end/tests/workaround_cronet_compression.c
+++ b/test/core/end2end/tests/workaround_cronet_compression.cc
@@ -145,7 +145,7 @@ static void request_with_payload_template(
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_channel_args* client_args_old = client_args;
grpc_arg arg;
- arg.key = GRPC_ARG_PRIMARY_USER_AGENT_STRING;
+ arg.key = const_cast<char*>(GRPC_ARG_PRIMARY_USER_AGENT_STRING);
arg.type = GRPC_ARG_STRING;
arg.value.string = user_agent_override;
client_args = grpc_channel_args_copy_and_add(client_args_old, &arg, 1);
@@ -366,11 +366,14 @@ typedef struct workaround_cronet_compression_config {
static workaround_cronet_compression_config workaround_configs[] = {
{NULL, GRPC_COMPRESS_GZIP},
- {"grpc-objc/1.3.0-dev grpc-c/3.0.0-dev (ios; cronet_http; gentle)",
+ {const_cast<char*>(
+ "grpc-objc/1.3.0-dev grpc-c/3.0.0-dev (ios; cronet_http; gentle)"),
GRPC_COMPRESS_NONE},
- {"grpc-objc/1.3.0-dev grpc-c/3.0.0-dev (ios; chttp2; gentle)",
+ {const_cast<char*>(
+ "grpc-objc/1.3.0-dev grpc-c/3.0.0-dev (ios; chttp2; gentle)"),
GRPC_COMPRESS_GZIP},
- {"grpc-objc/1.4.0 grpc-c/3.0.0-dev (ios; cronet_http; gentle)",
+ {const_cast<char*>(
+ "grpc-objc/1.4.0 grpc-c/3.0.0-dev (ios; cronet_http; gentle)"),
GRPC_COMPRESS_GZIP}};
static const size_t workaround_configs_num =
sizeof(workaround_configs) / sizeof(*workaround_configs);
diff --git a/test/core/end2end/tests/write_buffering.c b/test/core/end2end/tests/write_buffering.cc
index 5e92e598b3..5e92e598b3 100644
--- a/test/core/end2end/tests/write_buffering.c
+++ b/test/core/end2end/tests/write_buffering.cc
diff --git a/test/core/end2end/tests/write_buffering_at_end.c b/test/core/end2end/tests/write_buffering_at_end.cc
index 01dacdfd12..01dacdfd12 100644
--- a/test/core/end2end/tests/write_buffering_at_end.c
+++ b/test/core/end2end/tests/write_buffering_at_end.cc
diff --git a/test/core/fling/BUILD b/test/core/fling/BUILD
index 27b2b5bec6..268e94aacc 100644
--- a/test/core/fling/BUILD
+++ b/test/core/fling/BUILD
@@ -23,8 +23,8 @@ load("//test/core/util:grpc_fuzzer.bzl", "grpc_fuzzer")
grpc_cc_binary(
name = "client",
testonly = 1,
- srcs = ["client.c"],
- language = "C",
+ srcs = ["client.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//:grpc",
@@ -37,8 +37,8 @@ grpc_cc_binary(
grpc_cc_binary(
name = "server",
testonly = 1,
- srcs = ["server.c"],
- language = "C",
+ srcs = ["server.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//:grpc",
@@ -50,7 +50,7 @@ grpc_cc_binary(
grpc_cc_test(
name = "fling",
- srcs = ["fling_test.c"],
+ srcs = ["fling_test.cc"],
data = [
":client",
":server",
@@ -66,7 +66,7 @@ grpc_cc_test(
grpc_cc_test(
name = "fling_stream",
- srcs = ["fling_stream_test.c"],
+ srcs = ["fling_stream_test.cc"],
data = [
":client",
":server",
diff --git a/test/core/fling/client.c b/test/core/fling/client.cc
index 80d3793c98..64d1dc5089 100644
--- a/test/core/fling/client.c
+++ b/test/core/fling/client.cc
@@ -151,10 +151,10 @@ int main(int argc, char** argv) {
int payload_size = 1;
int secure = 0;
- char* target = "localhost:443";
+ const char* target = "localhost:443";
gpr_cmdline* cl;
grpc_event event;
- char* scenario_name = "ping-pong-request";
+ const char* scenario_name = "ping-pong-request";
scenario sc = {NULL, NULL, NULL};
gpr_timers_set_log_filename("latency_trace.fling_client.txt");
diff --git a/test/core/fling/fling_stream_test.c b/test/core/fling/fling_stream_test.cc
index 1f7d7d7e6b..620427e12a 100644
--- a/test/core/fling/fling_stream_test.c
+++ b/test/core/fling/fling_stream_test.cc
@@ -44,9 +44,9 @@ int main(int argc, char** argv) {
/* start the server */
gpr_asprintf(&args[0], "%s/fling_server%s", root,
gpr_subprocess_binary_extension());
- args[1] = "--bind";
+ args[1] = const_cast<char*>("--bind");
gpr_join_host_port(&args[2], "::", port);
- args[3] = "--no-secure";
+ args[3] = const_cast<char*>("--no-secure");
svr = gpr_subprocess_create(4, (const char**)args);
gpr_free(args[0]);
gpr_free(args[2]);
@@ -54,10 +54,10 @@ int main(int argc, char** argv) {
/* start the client */
gpr_asprintf(&args[0], "%s/fling_client%s", root,
gpr_subprocess_binary_extension());
- args[1] = "--target";
+ args[1] = const_cast<char*>("--target");
gpr_join_host_port(&args[2], "127.0.0.1", port);
- args[3] = "--scenario=ping-pong-stream";
- args[4] = "--no-secure";
+ args[3] = const_cast<char*>("--scenario=ping-pong-stream");
+ args[4] = const_cast<char*>("--no-secure");
args[5] = 0;
cli = gpr_subprocess_create(6, (const char**)args);
gpr_free(args[0]);
diff --git a/test/core/fling/fling_test.c b/test/core/fling/fling_test.cc
index ce5efb0336..1d4263ab01 100644
--- a/test/core/fling/fling_test.c
+++ b/test/core/fling/fling_test.cc
@@ -26,9 +26,9 @@
#include "src/core/lib/support/string.h"
#include "test/core/util/port.h"
-int main(int argc, char** argv) {
- char* me = argv[0];
- char* lslash = strrchr(me, '/');
+int main(int argc, const char** argv) {
+ const char* me = argv[0];
+ const char* lslash = strrchr(me, '/');
char root[1024];
int port = grpc_pick_unused_port_or_die();
char* args[10];
@@ -44,9 +44,9 @@ int main(int argc, char** argv) {
/* start the server */
gpr_asprintf(&args[0], "%s/fling_server%s", root,
gpr_subprocess_binary_extension());
- args[1] = "--bind";
+ args[1] = const_cast<char*>("--bind");
gpr_join_host_port(&args[2], "::", port);
- args[3] = "--no-secure";
+ args[3] = const_cast<char*>("--no-secure");
svr = gpr_subprocess_create(4, (const char**)args);
gpr_free(args[0]);
gpr_free(args[2]);
@@ -54,10 +54,10 @@ int main(int argc, char** argv) {
/* start the client */
gpr_asprintf(&args[0], "%s/fling_client%s", root,
gpr_subprocess_binary_extension());
- args[1] = "--target";
+ args[1] = const_cast<char*>("--target");
gpr_join_host_port(&args[2], "127.0.0.1", port);
- args[3] = "--scenario=ping-pong-request";
- args[4] = "--no-secure";
+ args[3] = const_cast<char*>("--scenario=ping-pong-request");
+ args[4] = const_cast<char*>("--no-secure");
args[5] = 0;
cli = gpr_subprocess_create(6, (const char**)args);
gpr_free(args[0]);
diff --git a/test/core/fling/server.c b/test/core/fling/server.cc
index e284a61bcb..4dfb30f107 100644
--- a/test/core/fling/server.c
+++ b/test/core/fling/server.cc
@@ -177,7 +177,7 @@ int main(int argc, char** argv) {
int shutdown_finished = 0;
int secure = 0;
- char* addr = NULL;
+ const char* addr = NULL;
char* fake_argv[1];
@@ -248,7 +248,7 @@ int main(int argc, char** argv) {
gpr_time_add(gpr_now(GPR_CLOCK_REALTIME),
gpr_time_from_micros(1000000, GPR_TIMESPAN)),
NULL);
- s = ev.tag;
+ s = static_cast<call_state*>(ev.tag);
switch (ev.type) {
case GRPC_OP_COMPLETE:
switch ((intptr_t)s) {
diff --git a/test/core/handshake/BUILD b/test/core/handshake/BUILD
index 8e462cfc5b..aea4a27e99 100644
--- a/test/core/handshake/BUILD
+++ b/test/core/handshake/BUILD
@@ -20,8 +20,8 @@ licenses(["notice"]) # Apache v2
grpc_cc_test(
name = "client_ssl",
- srcs = ["client_ssl.c"],
- language = "C",
+ srcs = ["client_ssl.cc"],
+ language = "C++",
data = [
"//src/core/tsi/test_creds:ca.pem",
"//src/core/tsi/test_creds:server1.key",
@@ -37,8 +37,8 @@ grpc_cc_test(
grpc_cc_test(
name = "server_ssl",
- srcs = ["server_ssl.c"],
- language = "C",
+ srcs = ["server_ssl.cc"],
+ language = "C++",
data = [
"//src/core/tsi/test_creds:ca.pem",
"//src/core/tsi/test_creds:server1.key",
diff --git a/test/core/handshake/client_ssl.c b/test/core/handshake/client_ssl.cc
index 6d4a14c1ea..b8cfd627a9 100644
--- a/test/core/handshake/client_ssl.c
+++ b/test/core/handshake/client_ssl.cc
@@ -230,8 +230,7 @@ static bool client_ssl_test(char* server_alpn_preferred) {
gpr_thd_options thdopt = gpr_thd_options_default();
gpr_thd_id thdid;
gpr_thd_options_set_joinable(&thdopt);
- server_args args = {.socket = server_socket,
- .alpn_preferred = server_alpn_preferred};
+ server_args args = {server_socket, server_alpn_preferred};
GPR_ASSERT(gpr_thd_new(&thdid, server_thread, &args, &thdopt));
// Load key pair and establish client SSL credentials.
@@ -253,9 +252,10 @@ static bool client_ssl_test(char* server_alpn_preferred) {
// lazy, this won't necessarily establish a connection yet.
char* target;
gpr_asprintf(&target, "127.0.0.1:%d", port);
- 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 grpc_args;
grpc_args.num_args = 1;
grpc_args.args = &ssl_name_override;
@@ -305,14 +305,14 @@ static bool client_ssl_test(char* server_alpn_preferred) {
int main(int argc, char* argv[]) {
// Handshake succeeeds when the server has grpc-exp as the ALPN preference.
- GPR_ASSERT(client_ssl_test("grpc-exp"));
+ GPR_ASSERT(client_ssl_test(const_cast<char*>("grpc-exp")));
// Handshake succeeeds when the server has h2 as the ALPN preference. This
// covers legacy gRPC servers which don't support grpc-exp.
- GPR_ASSERT(client_ssl_test("h2"));
+ GPR_ASSERT(client_ssl_test(const_cast<char*>("h2")));
// Handshake fails when the server uses a fake protocol as its ALPN
// preference. This validates the client is correctly validating ALPN returns
// and sanity checks the client_ssl_test.
- GPR_ASSERT(!client_ssl_test("foo"));
+ GPR_ASSERT(!client_ssl_test(const_cast<char*>("foo")));
return 0;
}
diff --git a/test/core/handshake/server_ssl.c b/test/core/handshake/server_ssl.cc
index 84a1cf15aa..bb92c8435a 100644
--- a/test/core/handshake/server_ssl.c
+++ b/test/core/handshake/server_ssl.cc
@@ -175,7 +175,8 @@ static bool server_ssl_test(const char* alpn_list[], unsigned int alpn_list_len,
for (unsigned int i = 0; i < alpn_list_len; ++i) {
alpn_protos_len += (unsigned int)strlen(alpn_list[i]);
}
- unsigned char* alpn_protos = gpr_malloc(alpn_protos_len);
+ unsigned char* alpn_protos =
+ static_cast<unsigned char*>(gpr_malloc(alpn_protos_len));
unsigned char* p = alpn_protos;
for (unsigned int i = 0; i < alpn_list_len; ++i) {
const uint8_t len = (uint8_t)strlen(alpn_list[i]);
diff --git a/test/core/http/BUILD b/test/core/http/BUILD
index fffdac5e08..a5ae6272db 100644
--- a/test/core/http/BUILD
+++ b/test/core/http/BUILD
@@ -22,8 +22,8 @@ load("//test/core/util:grpc_fuzzer.bzl", "grpc_fuzzer")
grpc_fuzzer(
name = "response_fuzzer",
- srcs = ["response_fuzzer.c"],
- language = "C",
+ srcs = ["response_fuzzer.cc"],
+ language = "C++",
corpus = "response_corpus",
deps = [
"//:gpr",
@@ -34,8 +34,8 @@ grpc_fuzzer(
grpc_fuzzer(
name = "request_fuzzer",
- srcs = ["request_fuzzer.c"],
- language = "C",
+ srcs = ["request_fuzzer.cc"],
+ language = "C++",
corpus = "request_corpus",
deps = [
"//:gpr",
@@ -64,8 +64,8 @@ load("//test/core/util:grpc_fuzzer.bzl", "grpc_fuzzer")
grpc_cc_test(
name = "httpcli_test",
- srcs = ["httpcli_test.c"],
- language = "C",
+ srcs = ["httpcli_test.cc"],
+ language = "C++",
data = ["test_server.py"],
deps = [
"//:gpr",
@@ -78,8 +78,8 @@ grpc_cc_test(
grpc_cc_test(
name = "httpscli_test",
- srcs = ["httpscli_test.c"],
- language = "C",
+ srcs = ["httpscli_test.cc"],
+ language = "C++",
data = ["test_server.py"],
deps = [
"//:gpr",
@@ -92,8 +92,8 @@ grpc_cc_test(
grpc_cc_test(
name = "parser_test",
- srcs = ["parser_test.c"],
- language = "C",
+ srcs = ["parser_test.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//:grpc",
diff --git a/test/core/http/format_request_test.c b/test/core/http/format_request_test.cc
index a1476e1b39..253e59135d 100644
--- a/test/core/http/format_request_test.c
+++ b/test/core/http/format_request_test.cc
@@ -24,13 +24,13 @@
#include "test/core/util/test_config.h"
static void test_format_get_request(void) {
- grpc_http_header hdr = {"x-yz", "abc"};
+ grpc_http_header hdr = {const_cast<char*>("x-yz"), const_cast<char*>("abc")};
grpc_httpcli_request req;
grpc_slice slice;
memset(&req, 0, sizeof(req));
- req.host = "example.com";
- req.http.path = "/index.html";
+ req.host = const_cast<char*>("example.com");
+ req.http.path = const_cast<char*>("/index.html");
req.http.hdr_count = 1;
req.http.hdrs = &hdr;
@@ -49,15 +49,15 @@ static void test_format_get_request(void) {
}
static void test_format_post_request(void) {
- grpc_http_header hdr = {"x-yz", "abc"};
+ grpc_http_header hdr = {const_cast<char*>("x-yz"), const_cast<char*>("abc")};
grpc_httpcli_request req;
grpc_slice slice;
char body_bytes[] = "fake body";
size_t body_len = 9;
memset(&req, 0, sizeof(req));
- req.host = "example.com";
- req.http.path = "/index.html";
+ req.host = const_cast<char*>("example.com");
+ req.http.path = const_cast<char*>("/index.html");
req.http.hdr_count = 1;
req.http.hdrs = &hdr;
@@ -79,13 +79,13 @@ static void test_format_post_request(void) {
}
static void test_format_post_request_no_body(void) {
- grpc_http_header hdr = {"x-yz", "abc"};
+ grpc_http_header hdr = {const_cast<char*>("x-yz"), const_cast<char*>("abc")};
grpc_httpcli_request req;
grpc_slice slice;
memset(&req, 0, sizeof(req));
- req.host = "example.com";
- req.http.path = "/index.html";
+ req.host = const_cast<char*>("example.com");
+ req.http.path = const_cast<char*>("/index.html");
req.http.hdr_count = 1;
req.http.hdrs = &hdr;
@@ -110,13 +110,13 @@ static void test_format_post_request_content_type_override(void) {
char body_bytes[] = "fake%20body";
size_t body_len = 11;
- hdrs[0].key = "x-yz";
- hdrs[0].value = "abc";
- hdrs[1].key = "Content-Type";
- hdrs[1].value = "application/x-www-form-urlencoded";
+ hdrs[0].key = const_cast<char*>("x-yz");
+ hdrs[0].value = const_cast<char*>("abc");
+ hdrs[1].key = const_cast<char*>("Content-Type");
+ hdrs[1].value = const_cast<char*>("application/x-www-form-urlencoded");
memset(&req, 0, sizeof(req));
- req.host = "example.com";
- req.http.path = "/index.html";
+ req.host = const_cast<char*>("example.com");
+ req.http.path = const_cast<char*>("/index.html");
req.http.hdr_count = 2;
req.http.hdrs = hdrs;
diff --git a/test/core/http/httpcli_test.c b/test/core/http/httpcli_test.cc
index 8c22b644e7..ac3c6a2ce5 100644
--- a/test/core/http/httpcli_test.c
+++ b/test/core/http/httpcli_test.cc
@@ -44,7 +44,7 @@ static void on_finish(grpc_exec_ctx* exec_ctx, void* arg, grpc_error* error) {
const char* expect =
"<html><head><title>Hello world!</title></head>"
"<body><p>This is a test</p></body></html>";
- grpc_http_response* response = arg;
+ grpc_http_response* response = static_cast<grpc_http_response*>(arg);
GPR_ASSERT(response);
GPR_ASSERT(response->status == 200);
GPR_ASSERT(response->body_length == strlen(expect));
@@ -70,7 +70,7 @@ static void test_get(int port) {
memset(&req, 0, sizeof(req));
req.host = host;
- req.http.path = "/get";
+ req.http.path = const_cast<char*>("/get");
req.handshaker = &grpc_httpcli_plaintext;
grpc_http_response response;
@@ -110,7 +110,7 @@ static void test_post(int port) {
memset(&req, 0, sizeof(req));
req.host = host;
- req.http.path = "/post";
+ req.http.path = const_cast<char*>("/post");
req.handshaker = &grpc_httpcli_plaintext;
grpc_http_response response;
@@ -139,7 +139,8 @@ static void test_post(int port) {
}
static void destroy_pops(grpc_exec_ctx* exec_ctx, void* p, grpc_error* error) {
- grpc_pollset_destroy(exec_ctx, grpc_polling_entity_pollset(p));
+ grpc_pollset_destroy(exec_ctx, grpc_polling_entity_pollset(
+ static_cast<grpc_polling_entity*>(p)));
}
int main(int argc, char** argv) {
@@ -154,7 +155,7 @@ int main(int argc, char** argv) {
/* figure out where we are */
char* root;
if (lslash) {
- root = gpr_malloc((size_t)(lslash - me + 1));
+ root = static_cast<char*>(gpr_malloc((size_t)(lslash - me + 1)));
memcpy(root, me, (size_t)(lslash - me));
root[lslash - me] = 0;
} else {
@@ -171,7 +172,7 @@ int main(int argc, char** argv) {
}
/* start the server */
- args[1 + arg_shift] = "--port";
+ args[1 + arg_shift] = const_cast<char*>("--port");
gpr_asprintf(&args[2 + arg_shift], "%d", port);
server = gpr_subprocess_create(3 + arg_shift, (const char**)args);
GPR_ASSERT(server);
@@ -186,7 +187,8 @@ int main(int argc, char** argv) {
grpc_test_init(argc, argv);
grpc_init();
grpc_httpcli_context_init(&g_context);
- grpc_pollset* pollset = gpr_zalloc(grpc_pollset_size());
+ grpc_pollset* pollset =
+ static_cast<grpc_pollset*>(gpr_zalloc(grpc_pollset_size()));
grpc_pollset_init(pollset, &g_mu);
g_pops = grpc_polling_entity_create_from_pollset(pollset);
diff --git a/test/core/http/httpscli_test.c b/test/core/http/httpscli_test.cc
index b375d46b9f..bf851b1175 100644
--- a/test/core/http/httpscli_test.c
+++ b/test/core/http/httpscli_test.cc
@@ -44,7 +44,7 @@ static void on_finish(grpc_exec_ctx* exec_ctx, void* arg, grpc_error* error) {
const char* expect =
"<html><head><title>Hello world!</title></head>"
"<body><p>This is a test</p></body></html>";
- grpc_http_response* response = arg;
+ grpc_http_response* response = static_cast<grpc_http_response*>(arg);
GPR_ASSERT(response);
GPR_ASSERT(response->status == 200);
GPR_ASSERT(response->body_length == strlen(expect));
@@ -70,8 +70,8 @@ static void test_get(int port) {
memset(&req, 0, sizeof(req));
req.host = host;
- req.ssl_host_override = "foo.test.google.fr";
- req.http.path = "/get";
+ req.ssl_host_override = const_cast<char*>("foo.test.google.fr");
+ req.http.path = const_cast<char*>("/get");
req.handshaker = &grpc_httpcli_ssl;
grpc_http_response response;
@@ -111,8 +111,8 @@ static void test_post(int port) {
memset(&req, 0, sizeof(req));
req.host = host;
- req.ssl_host_override = "foo.test.google.fr";
- req.http.path = "/post";
+ req.ssl_host_override = const_cast<char*>("foo.test.google.fr");
+ req.http.path = const_cast<char*>("/post");
req.handshaker = &grpc_httpcli_ssl;
grpc_http_response response;
@@ -141,7 +141,8 @@ static void test_post(int port) {
}
static void destroy_pops(grpc_exec_ctx* exec_ctx, void* p, grpc_error* error) {
- grpc_pollset_destroy(exec_ctx, grpc_polling_entity_pollset(p));
+ grpc_pollset_destroy(exec_ctx, grpc_polling_entity_pollset(
+ static_cast<grpc_polling_entity*>(p)));
}
int main(int argc, char** argv) {
@@ -156,7 +157,7 @@ int main(int argc, char** argv) {
/* figure out where we are */
char* root;
if (lslash) {
- root = gpr_malloc((size_t)(lslash - me + 1));
+ root = static_cast<char*>(gpr_malloc((size_t)(lslash - me + 1)));
memcpy(root, me, (size_t)(lslash - me));
root[lslash - me] = 0;
} else {
@@ -173,9 +174,9 @@ int main(int argc, char** argv) {
}
/* start the server */
- args[1 + arg_shift] = "--port";
+ args[1 + arg_shift] = const_cast<char*>("--port");
gpr_asprintf(&args[2 + arg_shift], "%d", port);
- args[3 + arg_shift] = "--ssl";
+ args[3 + arg_shift] = const_cast<char*>("--ssl");
server = gpr_subprocess_create(4 + arg_shift, (const char**)args);
GPR_ASSERT(server);
gpr_free(args[0]);
@@ -189,7 +190,8 @@ int main(int argc, char** argv) {
grpc_test_init(argc, argv);
grpc_init();
grpc_httpcli_context_init(&g_context);
- grpc_pollset* pollset = gpr_zalloc(grpc_pollset_size());
+ grpc_pollset* pollset =
+ static_cast<grpc_pollset*>(gpr_zalloc(grpc_pollset_size()));
grpc_pollset_init(pollset, &g_mu);
g_pops = grpc_polling_entity_create_from_pollset(pollset);
diff --git a/test/core/http/parser_test.c b/test/core/http/parser_test.cc
index 9a8528ddc8..d0d2559cdf 100644
--- a/test/core/http/parser_test.c
+++ b/test/core/http/parser_test.cc
@@ -29,9 +29,11 @@
#include "test/core/util/test_config.h"
static void test_request_succeeds(grpc_slice_split_mode split_mode,
- char* request_text, char* expect_method,
+ const char* request_text,
+ const char* expect_method,
grpc_http_version expect_version,
- char* expect_path, char* expect_body, ...) {
+ const char* expect_path,
+ const char* expect_body, ...) {
grpc_http_parser parser;
grpc_slice input_slice = grpc_slice_from_copied_string(request_text);
size_t num_slices;
@@ -87,8 +89,9 @@ static void test_request_succeeds(grpc_slice_split_mode split_mode,
gpr_free(slices);
}
-static void test_succeeds(grpc_slice_split_mode split_mode, char* response_text,
- int expect_status, char* expect_body, ...) {
+static void test_succeeds(grpc_slice_split_mode split_mode,
+ const char* response_text, int expect_status,
+ const char* expect_body, ...) {
grpc_http_parser parser;
grpc_slice input_slice = grpc_slice_from_copied_string(response_text);
size_t num_slices;
@@ -141,7 +144,8 @@ static void test_succeeds(grpc_slice_split_mode split_mode, char* response_text,
gpr_free(slices);
}
-static void test_fails(grpc_slice_split_mode split_mode, char* response_text) {
+static void test_fails(grpc_slice_split_mode split_mode,
+ const char* response_text) {
grpc_http_parser parser;
grpc_slice input_slice = grpc_slice_from_copied_string(response_text);
size_t num_slices;
@@ -174,7 +178,7 @@ static void test_fails(grpc_slice_split_mode split_mode, char* response_text) {
}
static void test_request_fails(grpc_slice_split_mode split_mode,
- char* request_text) {
+ const char* request_text) {
grpc_http_parser parser;
grpc_slice input_slice = grpc_slice_from_copied_string(request_text);
size_t num_slices;
@@ -286,7 +290,8 @@ int main(int argc, char** argv) {
test_request_fails(split_modes[i], "GET / HTTP/1.2\r\n");
test_request_fails(split_modes[i], "GET / HTTP/1.0\n");
- tmp1 = gpr_malloc(2 * GRPC_HTTP_PARSER_MAX_HEADER_LENGTH);
+ tmp1 =
+ static_cast<char*>(gpr_malloc(2 * GRPC_HTTP_PARSER_MAX_HEADER_LENGTH));
memset(tmp1, 'a', 2 * GRPC_HTTP_PARSER_MAX_HEADER_LENGTH - 1);
tmp1[2 * GRPC_HTTP_PARSER_MAX_HEADER_LENGTH - 1] = 0;
gpr_asprintf(&tmp2, "HTTP/1.0 200 OK\r\nxyz: %s\r\n\r\n", tmp1);
diff --git a/test/core/http/request_fuzzer.c b/test/core/http/request_fuzzer.cc
index 3f685711ff..dfdb5792ac 100644
--- a/test/core/http/request_fuzzer.c
+++ b/test/core/http/request_fuzzer.cc
@@ -27,7 +27,7 @@
bool squelch = true;
bool leak_check = true;
-int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
grpc_http_parser parser;
grpc_http_request request;
memset(&request, 0, sizeof(request));
diff --git a/test/core/http/response_fuzzer.c b/test/core/http/response_fuzzer.cc
index b41a340f18..89ee676b49 100644
--- a/test/core/http/response_fuzzer.c
+++ b/test/core/http/response_fuzzer.cc
@@ -26,7 +26,7 @@
bool squelch = true;
bool leak_check = true;
-int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
grpc_http_parser parser;
grpc_http_response response;
memset(&response, 0, sizeof(response));
diff --git a/test/core/iomgr/BUILD b/test/core/iomgr/BUILD
index 7620d1de21..41e2607646 100644
--- a/test/core/iomgr/BUILD
+++ b/test/core/iomgr/BUILD
@@ -22,9 +22,9 @@ grpc_package(name = "test/core/iomgr", visibility = "public") # Useful for third
grpc_cc_library(
name = "endpoint_tests",
- srcs = ["endpoint_tests.c"],
+ srcs = ["endpoint_tests.cc"],
hdrs = ["endpoint_tests.h"],
- language = "C",
+ language = "C++",
visibility = ["//test:__subpackages__"],
deps = [
"//:gpr",
@@ -36,8 +36,8 @@ grpc_cc_library(
grpc_cc_test(
name = "combiner_test",
- srcs = ["combiner_test.c"],
- language = "C",
+ srcs = ["combiner_test.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//:grpc",
@@ -48,8 +48,8 @@ grpc_cc_test(
grpc_cc_test(
name = "endpoint_pair_test",
- srcs = ["endpoint_pair_test.c"],
- language = "C",
+ srcs = ["endpoint_pair_test.cc"],
+ language = "C++",
deps = [
":endpoint_tests",
"//:gpr",
@@ -61,20 +61,20 @@ grpc_cc_test(
grpc_cc_test(
name = "ev_epollsig_linux_test",
- srcs = ["ev_epollsig_linux_test.c"],
+ srcs = ["ev_epollsig_linux_test.cc"],
deps = [
"//:gpr",
"//:grpc",
"//test/core/util:gpr_test_util",
"//test/core/util:grpc_test_util",
],
- language = "C",
+ language = "C++",
)
grpc_cc_test(
name = "fd_conservation_posix_test",
- srcs = ["fd_conservation_posix_test.c"],
- language = "C",
+ srcs = ["fd_conservation_posix_test.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//:grpc",
@@ -85,8 +85,8 @@ grpc_cc_test(
grpc_cc_test(
name = "fd_posix_test",
- srcs = ["fd_posix_test.c"],
- language = "C",
+ srcs = ["fd_posix_test.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//:grpc",
@@ -97,8 +97,8 @@ grpc_cc_test(
grpc_cc_test(
name = "load_file_test",
- srcs = ["load_file_test.c"],
- language = "C",
+ srcs = ["load_file_test.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//:grpc",
@@ -109,8 +109,8 @@ grpc_cc_test(
grpc_cc_test(
name = "pollset_set_test",
- srcs = ["pollset_set_test.c"],
- language = "C",
+ srcs = ["pollset_set_test.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//:grpc",
@@ -121,8 +121,8 @@ grpc_cc_test(
grpc_cc_test(
name = "resolve_address_posix_test",
- srcs = ["resolve_address_posix_test.c"],
- language = "C",
+ srcs = ["resolve_address_posix_test.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//:grpc",
@@ -133,8 +133,8 @@ grpc_cc_test(
grpc_cc_test(
name = "resolve_address_test",
- srcs = ["resolve_address_test.c"],
- language = "C",
+ srcs = ["resolve_address_test.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//:grpc",
@@ -145,8 +145,8 @@ grpc_cc_test(
grpc_cc_test(
name = "resource_quota_test",
- srcs = ["resource_quota_test.c"],
- language = "C",
+ srcs = ["resource_quota_test.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//:grpc",
@@ -157,8 +157,8 @@ grpc_cc_test(
grpc_cc_test(
name = "sockaddr_utils_test",
- srcs = ["sockaddr_utils_test.c"],
- language = "C",
+ srcs = ["sockaddr_utils_test.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//:grpc",
@@ -169,8 +169,8 @@ grpc_cc_test(
grpc_cc_test(
name = "socket_utils_test",
- srcs = ["socket_utils_test.c"],
- language = "C",
+ srcs = ["socket_utils_test.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//:grpc",
@@ -181,8 +181,8 @@ grpc_cc_test(
grpc_cc_test(
name = "tcp_client_posix_test",
- srcs = ["tcp_client_posix_test.c"],
- language = "C",
+ srcs = ["tcp_client_posix_test.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//:grpc",
@@ -193,8 +193,8 @@ grpc_cc_test(
grpc_cc_test(
name = "tcp_posix_test",
- srcs = ["tcp_posix_test.c"],
- language = "C",
+ srcs = ["tcp_posix_test.cc"],
+ language = "C++",
deps = [
":endpoint_tests",
"//:gpr",
@@ -206,8 +206,8 @@ grpc_cc_test(
grpc_cc_test(
name = "tcp_server_posix_test",
- srcs = ["tcp_server_posix_test.c"],
- language = "C",
+ srcs = ["tcp_server_posix_test.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//:grpc",
@@ -218,8 +218,8 @@ grpc_cc_test(
grpc_cc_test(
name = "time_averaged_stats_test",
- srcs = ["time_averaged_stats_test.c"],
- language = "C",
+ srcs = ["time_averaged_stats_test.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//:grpc",
@@ -230,8 +230,8 @@ grpc_cc_test(
grpc_cc_test(
name = "timer_heap_test",
- srcs = ["timer_heap_test.c"],
- language = "C",
+ srcs = ["timer_heap_test.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//:grpc",
@@ -242,8 +242,8 @@ grpc_cc_test(
grpc_cc_test(
name = "timer_list_test",
- srcs = ["timer_list_test.c"],
- language = "C",
+ srcs = ["timer_list_test.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//:grpc",
@@ -254,8 +254,8 @@ grpc_cc_test(
grpc_cc_test(
name = "udp_server_test",
- srcs = ["udp_server_test.c"],
- language = "C",
+ srcs = ["udp_server_test.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//:grpc",
@@ -266,8 +266,8 @@ grpc_cc_test(
grpc_cc_test(
name = "wakeup_fd_cv_test",
- srcs = ["wakeup_fd_cv_test.c"],
- language = "C",
+ srcs = ["wakeup_fd_cv_test.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//:grpc",
diff --git a/test/core/iomgr/combiner_test.c b/test/core/iomgr/combiner_test.cc
index 063bcb6433..5a825368f7 100644
--- a/test/core/iomgr/combiner_test.c
+++ b/test/core/iomgr/combiner_test.cc
@@ -35,7 +35,7 @@ static void test_no_op(void) {
static void set_event_to_true(grpc_exec_ctx* exec_ctx, void* value,
grpc_error* error) {
- gpr_event_set(value, (void*)1);
+ gpr_event_set(static_cast<gpr_event*>(value), (void*)1);
}
static void test_execute_one(void) {
@@ -68,19 +68,19 @@ typedef struct {
} ex_args;
static void check_one(grpc_exec_ctx* exec_ctx, void* a, grpc_error* error) {
- ex_args* args = a;
+ ex_args* args = static_cast<ex_args*>(a);
GPR_ASSERT(*args->ctr == args->value - 1);
*args->ctr = args->value;
gpr_free(a);
}
static void execute_many_loop(void* a) {
- thd_args* args = a;
+ thd_args* args = static_cast<thd_args*>(a);
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
size_t n = 1;
for (size_t i = 0; i < 10; i++) {
for (size_t j = 0; j < 10000; j++) {
- ex_args* c = gpr_malloc(sizeof(*c));
+ ex_args* c = static_cast<ex_args*>(gpr_malloc(sizeof(*c)));
c->ctr = &args->ctr;
c->value = n++;
GRPC_CLOSURE_SCHED(&exec_ctx,
@@ -133,7 +133,8 @@ static void in_finally(grpc_exec_ctx* exec_ctx, void* arg, grpc_error* error) {
static void add_finally(grpc_exec_ctx* exec_ctx, void* arg, grpc_error* error) {
GRPC_CLOSURE_SCHED(exec_ctx,
GRPC_CLOSURE_CREATE(in_finally, arg,
- grpc_combiner_finally_scheduler(arg)),
+ grpc_combiner_finally_scheduler(
+ static_cast<grpc_combiner*>(arg))),
GRPC_ERROR_NONE);
}
diff --git a/test/core/iomgr/endpoint_pair_test.c b/test/core/iomgr/endpoint_pair_test.cc
index 795061f2c3..30a0cb5924 100644
--- a/test/core/iomgr/endpoint_pair_test.c
+++ b/test/core/iomgr/endpoint_pair_test.cc
@@ -34,10 +34,11 @@ static grpc_endpoint_test_fixture create_fixture_endpoint_pair(
size_t slice_size) {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_endpoint_test_fixture f;
- grpc_arg a[] = {{.key = GRPC_ARG_TCP_READ_CHUNK_SIZE,
- .type = GRPC_ARG_INTEGER,
- .value.integer = (int)slice_size}};
- grpc_channel_args args = {.num_args = GPR_ARRAY_SIZE(a), .args = a};
+ grpc_arg a[1];
+ a[0].key = const_cast<char*>(GRPC_ARG_TCP_READ_CHUNK_SIZE);
+ a[0].type = GRPC_ARG_INTEGER;
+ a[0].value.integer = (int)slice_size;
+ grpc_channel_args args = {GPR_ARRAY_SIZE(a), a};
grpc_endpoint_pair p = grpc_iomgr_create_endpoint_pair("test", &args);
f.client_ep = p.client;
@@ -55,7 +56,7 @@ static grpc_endpoint_test_config configs[] = {
static void destroy_pollset(grpc_exec_ctx* exec_ctx, void* p,
grpc_error* error) {
- grpc_pollset_destroy(exec_ctx, p);
+ grpc_pollset_destroy(exec_ctx, static_cast<grpc_pollset*>(p));
}
int main(int argc, char** argv) {
@@ -63,7 +64,7 @@ int main(int argc, char** argv) {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_test_init(argc, argv);
grpc_init();
- g_pollset = gpr_zalloc(grpc_pollset_size());
+ g_pollset = static_cast<grpc_pollset*>(gpr_zalloc(grpc_pollset_size()));
grpc_pollset_init(g_pollset, &g_mu);
grpc_endpoint_tests(configs[0], g_pollset, g_mu);
GRPC_CLOSURE_INIT(&destroyed, destroy_pollset, g_pollset,
diff --git a/test/core/iomgr/endpoint_tests.c b/test/core/iomgr/endpoint_tests.cc
index 8e859ba909..8e859ba909 100644
--- a/test/core/iomgr/endpoint_tests.c
+++ b/test/core/iomgr/endpoint_tests.cc
diff --git a/test/core/iomgr/error_test.c b/test/core/iomgr/error_test.cc
index 51f8af1957..51f8af1957 100644
--- a/test/core/iomgr/error_test.c
+++ b/test/core/iomgr/error_test.cc
diff --git a/test/core/iomgr/ev_epollsig_linux_test.c b/test/core/iomgr/ev_epollsig_linux_test.cc
index 2170f5c573..3ee607d97e 100644
--- a/test/core/iomgr/ev_epollsig_linux_test.c
+++ b/test/core/iomgr/ev_epollsig_linux_test.cc
@@ -92,14 +92,15 @@ static void test_fd_cleanup(grpc_exec_ctx* exec_ctx, test_fd* tfds,
static void test_pollset_init(test_pollset* pollsets, int num_pollsets) {
int i;
for (i = 0; i < num_pollsets; i++) {
- pollsets[i].pollset = gpr_zalloc(grpc_pollset_size());
+ pollsets[i].pollset =
+ static_cast<grpc_pollset*>(gpr_zalloc(grpc_pollset_size()));
grpc_pollset_init(pollsets[i].pollset, &pollsets[i].mu);
}
}
static void destroy_pollset(grpc_exec_ctx* exec_ctx, void* p,
grpc_error* error) {
- grpc_pollset_destroy(exec_ctx, p);
+ grpc_pollset_destroy(exec_ctx, (grpc_pollset*)p);
}
static void test_pollset_cleanup(grpc_exec_ctx* exec_ctx,
@@ -232,7 +233,7 @@ typedef struct threading_shared {
static __thread int thread_wakeups = 0;
static void test_threading_loop(void* arg) {
- threading_shared* shared = arg;
+ threading_shared* shared = static_cast<threading_shared*>(arg);
while (thread_wakeups < 1000000) {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_pollset_worker* worker;
@@ -247,7 +248,7 @@ static void test_threading_loop(void* arg) {
static void test_threading_wakeup(grpc_exec_ctx* exec_ctx, void* arg,
grpc_error* error) {
- threading_shared* shared = arg;
+ threading_shared* shared = static_cast<threading_shared*>(arg);
++shared->wakeups;
++thread_wakeups;
if (error == GRPC_ERROR_NONE) {
@@ -261,7 +262,7 @@ static void test_threading_wakeup(grpc_exec_ctx* exec_ctx, void* arg,
static void test_threading(void) {
threading_shared shared;
- shared.pollset = gpr_zalloc(grpc_pollset_size());
+ shared.pollset = static_cast<grpc_pollset*>(gpr_zalloc(grpc_pollset_size()));
grpc_pollset_init(shared.pollset, &shared.mu);
gpr_thd_id thds[10];
diff --git a/test/core/iomgr/fd_conservation_posix_test.c b/test/core/iomgr/fd_conservation_posix_test.cc
index b76c247fb8..b76c247fb8 100644
--- a/test/core/iomgr/fd_conservation_posix_test.c
+++ b/test/core/iomgr/fd_conservation_posix_test.cc
diff --git a/test/core/iomgr/fd_posix_test.c b/test/core/iomgr/fd_posix_test.cc
index d19ce18081..c70187ce91 100644
--- a/test/core/iomgr/fd_posix_test.c
+++ b/test/core/iomgr/fd_posix_test.cc
@@ -113,7 +113,7 @@ typedef struct {
Close session FD and start to shutdown listen FD. */
static void session_shutdown_cb(grpc_exec_ctx* exec_ctx, void* arg, /*session */
bool success) {
- session* se = arg;
+ session* se = static_cast<session*>(arg);
server* sv = se->sv;
grpc_fd_orphan(exec_ctx, se->em_fd, NULL, NULL, false /* already_closed */,
"a");
@@ -126,7 +126,7 @@ static void session_shutdown_cb(grpc_exec_ctx* exec_ctx, void* arg, /*session */
/* Called when data become readable in a session. */
static void session_read_cb(grpc_exec_ctx* exec_ctx, void* arg, /*session */
grpc_error* error) {
- session* se = arg;
+ session* se = static_cast<session*>(arg);
int fd = grpc_fd_wrapped_fd(se->em_fd);
ssize_t read_once = 0;
@@ -171,7 +171,7 @@ static void session_read_cb(grpc_exec_ctx* exec_ctx, void* arg, /*session */
Close listen FD and signal that server can be shutdown. */
static void listen_shutdown_cb(grpc_exec_ctx* exec_ctx, void* arg /*server */,
int success) {
- server* sv = arg;
+ server* sv = static_cast<server*>(arg);
grpc_fd_orphan(exec_ctx, sv->em_fd, NULL, NULL, false /* already_closed */,
"b");
@@ -186,7 +186,7 @@ static void listen_shutdown_cb(grpc_exec_ctx* exec_ctx, void* arg /*server */,
/* Called when a new TCP connection request arrives in the listening port. */
static void listen_cb(grpc_exec_ctx* exec_ctx, void* arg, /*=sv_arg*/
grpc_error* error) {
- server* sv = arg;
+ server* sv = static_cast<server*>(arg);
int fd;
int flags;
session* se;
@@ -204,7 +204,7 @@ static void listen_cb(grpc_exec_ctx* exec_ctx, void* arg, /*=sv_arg*/
GPR_ASSERT(fd < FD_SETSIZE);
flags = fcntl(fd, F_GETFL, 0);
fcntl(fd, F_SETFL, flags | O_NONBLOCK);
- se = gpr_malloc(sizeof(*se));
+ se = static_cast<session*>(gpr_malloc(sizeof(*se)));
se->sv = sv;
se->em_fd = grpc_fd_create(fd, "listener");
grpc_pollset_add_fd(exec_ctx, g_pollset, se->em_fd);
@@ -291,7 +291,7 @@ static void client_init(client* cl) {
/* Called when a client upload session is ready to shutdown. */
static void client_session_shutdown_cb(grpc_exec_ctx* exec_ctx,
void* arg /*client */, int success) {
- client* cl = arg;
+ client* cl = static_cast<client*>(arg);
grpc_fd_orphan(exec_ctx, cl->em_fd, NULL, NULL, false /* already_closed */,
"c");
cl->done = 1;
@@ -302,7 +302,7 @@ static void client_session_shutdown_cb(grpc_exec_ctx* exec_ctx,
/* Write as much as possible, then register notify_on_write. */
static void client_session_write(grpc_exec_ctx* exec_ctx, void* arg, /*client */
grpc_error* error) {
- client* cl = arg;
+ client* cl = static_cast<client*>(arg);
int fd = grpc_fd_wrapped_fd(cl->em_fd);
ssize_t write_once = 0;
@@ -409,7 +409,7 @@ void destroy_change_data(fd_change_data* fdc) {}
static void first_read_callback(grpc_exec_ctx* exec_ctx,
void* arg /* fd_change_data */,
grpc_error* error) {
- fd_change_data* fdc = arg;
+ fd_change_data* fdc = static_cast<fd_change_data*>(arg);
gpr_mu_lock(g_mu);
fdc->cb_that_ran = first_read_callback;
@@ -421,7 +421,7 @@ static void first_read_callback(grpc_exec_ctx* exec_ctx,
static void second_read_callback(grpc_exec_ctx* exec_ctx,
void* arg /* fd_change_data */,
grpc_error* error) {
- fd_change_data* fdc = arg;
+ fd_change_data* fdc = static_cast<fd_change_data*>(arg);
gpr_mu_lock(g_mu);
fdc->cb_that_ran = second_read_callback;
@@ -516,7 +516,7 @@ static void test_grpc_fd_change(void) {
static void destroy_pollset(grpc_exec_ctx* exec_ctx, void* p,
grpc_error* error) {
- grpc_pollset_destroy(exec_ctx, p);
+ grpc_pollset_destroy(exec_ctx, static_cast<grpc_pollset*>(p));
}
int main(int argc, char** argv) {
@@ -524,7 +524,7 @@ int main(int argc, char** argv) {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_test_init(argc, argv);
grpc_init();
- g_pollset = gpr_zalloc(grpc_pollset_size());
+ g_pollset = static_cast<grpc_pollset*>(gpr_zalloc(grpc_pollset_size()));
grpc_pollset_init(g_pollset, &g_mu);
test_grpc_fd();
test_grpc_fd_change();
diff --git a/test/core/iomgr/load_file_test.c b/test/core/iomgr/load_file_test.cc
index f07900373e..2c9e7c33f4 100644
--- a/test/core/iomgr/load_file_test.c
+++ b/test/core/iomgr/load_file_test.cc
@@ -122,7 +122,7 @@ static void test_load_big_file(void) {
grpc_error* error;
char* tmp_name;
static const size_t buffer_size = 124631;
- unsigned char* buffer = gpr_malloc(buffer_size);
+ unsigned char* buffer = static_cast<unsigned char*>(gpr_malloc(buffer_size));
unsigned char* current;
size_t i;
diff --git a/test/core/iomgr/pollset_set_test.c b/test/core/iomgr/pollset_set_test.cc
index d8a812341a..8d0198cace 100644
--- a/test/core/iomgr/pollset_set_test.c
+++ b/test/core/iomgr/pollset_set_test.cc
@@ -67,14 +67,15 @@ typedef struct test_pollset {
static void init_test_pollsets(test_pollset* pollsets, const int num_pollsets) {
for (int i = 0; i < num_pollsets; i++) {
- pollsets[i].ps = gpr_zalloc(grpc_pollset_size());
+ pollsets[i].ps =
+ static_cast<grpc_pollset*>(gpr_zalloc(grpc_pollset_size()));
grpc_pollset_init(pollsets[i].ps, &pollsets[i].mu);
}
}
static void destroy_pollset(grpc_exec_ctx* exec_ctx, void* p,
grpc_error* error) {
- grpc_pollset_destroy(exec_ctx, p);
+ grpc_pollset_destroy(exec_ctx, static_cast<grpc_pollset*>(p));
}
static void cleanup_test_pollsets(grpc_exec_ctx* exec_ctx,
diff --git a/test/core/iomgr/resolve_address_posix_test.c b/test/core/iomgr/resolve_address_posix_test.cc
index c5eb2c8cb0..ba89fc8ad5 100644
--- a/test/core/iomgr/resolve_address_posix_test.c
+++ b/test/core/iomgr/resolve_address_posix_test.cc
@@ -50,7 +50,7 @@ static void do_nothing(grpc_exec_ctx* exec_ctx, void* arg, grpc_error* error) {}
void args_init(grpc_exec_ctx* exec_ctx, args_struct* args) {
gpr_event_init(&args->ev);
- args->pollset = gpr_zalloc(grpc_pollset_size());
+ args->pollset = static_cast<grpc_pollset*>(gpr_zalloc(grpc_pollset_size()));
grpc_pollset_init(args->pollset, &args->mu);
args->pollset_set = grpc_pollset_set_create();
grpc_pollset_set_add_pollset(exec_ctx, args->pollset_set, args->pollset);
@@ -78,7 +78,7 @@ static grpc_millis n_sec_deadline(int seconds) {
}
static void actually_poll(void* argsp) {
- args_struct* args = argsp;
+ args_struct* args = static_cast<args_struct*>(argsp);
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_millis deadline = n_sec_deadline(10);
while (true) {
@@ -109,7 +109,7 @@ static void poll_pollset_until_request_done(args_struct* args) {
static void must_succeed(grpc_exec_ctx* exec_ctx, void* argsp,
grpc_error* err) {
- args_struct* args = argsp;
+ args_struct* args = static_cast<args_struct*>(argsp);
GPR_ASSERT(err == GRPC_ERROR_NONE);
GPR_ASSERT(args->addrs != NULL);
GPR_ASSERT(args->addrs->naddrs > 0);
@@ -117,7 +117,7 @@ static void must_succeed(grpc_exec_ctx* exec_ctx, void* argsp,
}
static void must_fail(grpc_exec_ctx* exec_ctx, void* argsp, grpc_error* err) {
- args_struct* args = argsp;
+ args_struct* args = static_cast<args_struct*>(argsp);
GPR_ASSERT(err != GRPC_ERROR_NONE);
gpr_atm_rel_store(&args->done_atm, 1);
}
@@ -142,7 +142,8 @@ static void test_unix_socket_path_name_too_long(void) {
const char prefix[] = "unix:/path/name";
size_t path_name_length =
GPR_ARRAY_SIZE(((struct sockaddr_un*)0)->sun_path) + 6;
- char* path_name = gpr_malloc(sizeof(char) * path_name_length);
+ char* path_name =
+ static_cast<char*>(gpr_malloc(sizeof(char) * path_name_length));
memset(path_name, 'a', path_name_length);
memcpy(path_name, prefix, strlen(prefix) - 1);
path_name[path_name_length - 1] = '\0';
diff --git a/test/core/iomgr/resolve_address_test.c b/test/core/iomgr/resolve_address_test.cc
index 64a353973d..0aa3e5f0f0 100644
--- a/test/core/iomgr/resolve_address_test.c
+++ b/test/core/iomgr/resolve_address_test.cc
@@ -43,7 +43,7 @@ static void do_nothing(grpc_exec_ctx* exec_ctx, void* arg, grpc_error* error) {}
void args_init(grpc_exec_ctx* exec_ctx, args_struct* args) {
gpr_event_init(&args->ev);
- args->pollset = gpr_zalloc(grpc_pollset_size());
+ args->pollset = static_cast<grpc_pollset*>(gpr_zalloc(grpc_pollset_size()));
grpc_pollset_init(args->pollset, &args->mu);
args->pollset_set = grpc_pollset_set_create();
grpc_pollset_set_add_pollset(exec_ctx, args->pollset_set, args->pollset);
@@ -98,7 +98,7 @@ static void poll_pollset_until_request_done(args_struct* args) {
static void must_succeed(grpc_exec_ctx* exec_ctx, void* argsp,
grpc_error* err) {
- args_struct* args = argsp;
+ args_struct* args = static_cast<args_struct*>(argsp);
GPR_ASSERT(err == GRPC_ERROR_NONE);
GPR_ASSERT(args->addrs != NULL);
GPR_ASSERT(args->addrs->naddrs > 0);
@@ -110,7 +110,7 @@ static void must_succeed(grpc_exec_ctx* exec_ctx, void* argsp,
}
static void must_fail(grpc_exec_ctx* exec_ctx, void* argsp, grpc_error* err) {
- args_struct* args = argsp;
+ args_struct* args = static_cast<args_struct*>(argsp);
GPR_ASSERT(err != GRPC_ERROR_NONE);
gpr_atm_rel_store(&args->done_atm, 1);
gpr_mu_lock(args->mu);
diff --git a/test/core/iomgr/resource_quota_test.c b/test/core/iomgr/resource_quota_test.cc
index 837fd01d0b..8a2faaed02 100644
--- a/test/core/iomgr/resource_quota_test.c
+++ b/test/core/iomgr/resource_quota_test.cc
@@ -55,18 +55,20 @@ typedef struct {
grpc_resource_user* resource_user;
grpc_closure* then;
} reclaimer_args;
+
static void reclaimer_cb(grpc_exec_ctx* exec_ctx, void* args,
grpc_error* error) {
GPR_ASSERT(error == GRPC_ERROR_NONE);
- reclaimer_args* a = args;
+ reclaimer_args* a = static_cast<reclaimer_args*>(args);
grpc_resource_user_free(exec_ctx, a->resource_user, a->size);
grpc_resource_user_finish_reclamation(exec_ctx, a->resource_user);
GRPC_CLOSURE_RUN(exec_ctx, a->then, GRPC_ERROR_NONE);
gpr_free(a);
}
+
grpc_closure* make_reclaimer(grpc_resource_user* resource_user, size_t size,
grpc_closure* then) {
- reclaimer_args* a = gpr_malloc(sizeof(*a));
+ reclaimer_args* a = static_cast<reclaimer_args*>(gpr_malloc(sizeof(*a)));
a->size = size;
a->resource_user = resource_user;
a->then = then;
@@ -76,7 +78,7 @@ grpc_closure* make_reclaimer(grpc_resource_user* resource_user, size_t size,
static void unused_reclaimer_cb(grpc_exec_ctx* exec_ctx, void* arg,
grpc_error* error) {
GPR_ASSERT(error == GRPC_ERROR_CANCELLED);
- GRPC_CLOSURE_RUN(exec_ctx, arg, GRPC_ERROR_NONE);
+ GRPC_CLOSURE_RUN(exec_ctx, static_cast<grpc_closure*>(arg), GRPC_ERROR_NONE);
}
grpc_closure* make_unused_reclaimer(grpc_closure* then) {
return GRPC_CLOSURE_CREATE(unused_reclaimer_cb, then,
diff --git a/test/core/iomgr/sockaddr_utils_test.c b/test/core/iomgr/sockaddr_utils_test.cc
index 40f2157ba3..40f2157ba3 100644
--- a/test/core/iomgr/sockaddr_utils_test.c
+++ b/test/core/iomgr/sockaddr_utils_test.cc
diff --git a/test/core/iomgr/socket_utils_test.c b/test/core/iomgr/socket_utils_test.cc
index 49c6f799e7..49c6f799e7 100644
--- a/test/core/iomgr/socket_utils_test.c
+++ b/test/core/iomgr/socket_utils_test.cc
diff --git a/test/core/iomgr/tcp_client_posix_test.c b/test/core/iomgr/tcp_client_posix_test.cc
index 84b404156d..206fa5de01 100644
--- a/test/core/iomgr/tcp_client_posix_test.c
+++ b/test/core/iomgr/tcp_client_posix_test.cc
@@ -189,7 +189,7 @@ void test_fails(void) {
static void destroy_pollset(grpc_exec_ctx* exec_ctx, void* p,
grpc_error* error) {
- grpc_pollset_destroy(exec_ctx, p);
+ grpc_pollset_destroy(exec_ctx, static_cast<grpc_pollset*>(p));
}
int main(int argc, char** argv) {
@@ -198,7 +198,7 @@ int main(int argc, char** argv) {
grpc_test_init(argc, argv);
grpc_init();
g_pollset_set = grpc_pollset_set_create();
- g_pollset = gpr_zalloc(grpc_pollset_size());
+ g_pollset = static_cast<grpc_pollset*>(gpr_zalloc(grpc_pollset_size()));
grpc_pollset_init(g_pollset, &g_mu);
grpc_pollset_set_add_pollset(&exec_ctx, g_pollset_set, g_pollset);
grpc_exec_ctx_finish(&exec_ctx);
diff --git a/test/core/iomgr/tcp_client_uv_test.c b/test/core/iomgr/tcp_client_uv_test.cc
index 978e3fa186..101d7bf6b5 100644
--- a/test/core/iomgr/tcp_client_uv_test.c
+++ b/test/core/iomgr/tcp_client_uv_test.cc
@@ -75,7 +75,8 @@ static void must_fail(grpc_exec_ctx* exec_ctx, void* arg, grpc_error* error) {
static void close_cb(uv_handle_t* handle) { gpr_free(handle); }
static void connection_cb(uv_stream_t* server, int status) {
- uv_tcp_t* client_handle = gpr_malloc(sizeof(uv_tcp_t));
+ uv_tcp_t* client_handle =
+ static_cast<uv_tcp_t*>(gpr_malloc(sizeof(uv_tcp_t)));
GPR_ASSERT(0 == status);
GPR_ASSERT(0 == uv_tcp_init(uv_default_loop(), client_handle));
GPR_ASSERT(0 == uv_accept(server, (uv_stream_t*)client_handle));
@@ -85,7 +86,7 @@ static void connection_cb(uv_stream_t* server, int status) {
void test_succeeds(void) {
grpc_resolved_address resolved_addr;
struct sockaddr_in* addr = (struct sockaddr_in*)resolved_addr.addr;
- uv_tcp_t* svr_handle = gpr_malloc(sizeof(uv_tcp_t));
+ uv_tcp_t* svr_handle = static_cast<uv_tcp_t*>(gpr_malloc(sizeof(uv_tcp_t)));
int connections_complete_before;
grpc_closure done;
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
@@ -186,7 +187,7 @@ void test_fails(void) {
static void destroy_pollset(grpc_exec_ctx* exec_ctx, void* p,
grpc_error* error) {
- grpc_pollset_destroy(exec_ctx, p);
+ grpc_pollset_destroy(exec_ctx, static_cast<grpc_pollset*>(p));
}
int main(int argc, char** argv) {
@@ -194,7 +195,7 @@ int main(int argc, char** argv) {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_test_init(argc, argv);
grpc_init();
- g_pollset = gpr_malloc(grpc_pollset_size());
+ g_pollset = static_cast<grpc_pollset*>(gpr_malloc(grpc_pollset_size()));
grpc_pollset_init(g_pollset, &g_mu);
grpc_exec_ctx_finish(&exec_ctx);
test_succeeds();
diff --git a/test/core/iomgr/tcp_posix_test.c b/test/core/iomgr/tcp_posix_test.cc
index 916bb9fde8..51ab0bfc6a 100644
--- a/test/core/iomgr/tcp_posix_test.c
+++ b/test/core/iomgr/tcp_posix_test.cc
@@ -171,10 +171,10 @@ static void read_test(size_t num_bytes, size_t slice_size) {
create_sockets(sv);
- grpc_arg a[] = {{.key = GRPC_ARG_TCP_READ_CHUNK_SIZE,
- .type = GRPC_ARG_INTEGER,
- .value.integer = (int)slice_size}};
- grpc_channel_args args = {.num_args = GPR_ARRAY_SIZE(a), .args = a};
+ grpc_arg a[1];
+ a[0].key = const_cast<char*>(GRPC_ARG_TCP_READ_CHUNK_SIZE);
+ a[0].type = GRPC_ARG_INTEGER, a[0].value.integer = (int)slice_size;
+ grpc_channel_args args = {GPR_ARRAY_SIZE(a), a};
ep = grpc_tcp_create(&exec_ctx, grpc_fd_create(sv[1], "read_test"), &args,
"test");
grpc_endpoint_add_to_pollset(&exec_ctx, ep, g_pollset);
@@ -223,10 +223,11 @@ static void large_read_test(size_t slice_size) {
create_sockets(sv);
- grpc_arg a[] = {{.key = GRPC_ARG_TCP_READ_CHUNK_SIZE,
- .type = GRPC_ARG_INTEGER,
- .value.integer = (int)slice_size}};
- grpc_channel_args args = {.num_args = GPR_ARRAY_SIZE(a), .args = a};
+ grpc_arg a[1];
+ a[0].key = const_cast<char*>(GRPC_ARG_TCP_READ_CHUNK_SIZE);
+ a[0].type = GRPC_ARG_INTEGER;
+ a[0].value.integer = (int)slice_size;
+ grpc_channel_args args = {GPR_ARRAY_SIZE(a), a};
ep = grpc_tcp_create(&exec_ctx, grpc_fd_create(sv[1], "large_read_test"),
&args, "test");
grpc_endpoint_add_to_pollset(&exec_ctx, ep, g_pollset);
@@ -363,10 +364,10 @@ static void write_test(size_t num_bytes, size_t slice_size) {
create_sockets(sv);
- grpc_arg a[] = {{.key = GRPC_ARG_TCP_READ_CHUNK_SIZE,
- .type = GRPC_ARG_INTEGER,
- .value.integer = (int)slice_size}};
- grpc_channel_args args = {.num_args = GPR_ARRAY_SIZE(a), .args = a};
+ grpc_arg a[1];
+ a[0].key = const_cast<char*>(GRPC_ARG_TCP_READ_CHUNK_SIZE);
+ a[0].type = GRPC_ARG_INTEGER, a[0].value.integer = (int)slice_size;
+ grpc_channel_args args = {GPR_ARRAY_SIZE(a), a};
ep = grpc_tcp_create(&exec_ctx, grpc_fd_create(sv[1], "write_test"), &args,
"test");
grpc_endpoint_add_to_pollset(&exec_ctx, ep, g_pollset);
@@ -433,10 +434,11 @@ static void release_fd_test(size_t num_bytes, size_t slice_size) {
create_sockets(sv);
- grpc_arg a[] = {{.key = GRPC_ARG_TCP_READ_CHUNK_SIZE,
- .type = GRPC_ARG_INTEGER,
- .value.integer = (int)slice_size}};
- grpc_channel_args args = {.num_args = GPR_ARRAY_SIZE(a), .args = a};
+ grpc_arg a[1];
+ a[0].key = const_cast<char*>(GRPC_ARG_TCP_READ_CHUNK_SIZE);
+ a[0].type = GRPC_ARG_INTEGER;
+ a[0].value.integer = (int)slice_size;
+ grpc_channel_args args = {GPR_ARRAY_SIZE(a), a};
ep = grpc_tcp_create(&exec_ctx, grpc_fd_create(sv[1], "read_test"), &args,
"test");
GPR_ASSERT(grpc_tcp_fd(ep) == sv[1] && sv[1] >= 0);
@@ -525,10 +527,11 @@ static grpc_endpoint_test_fixture create_fixture_tcp_socketpair(
create_sockets(sv);
grpc_resource_quota* resource_quota =
grpc_resource_quota_create("tcp_posix_test_socketpair");
- grpc_arg a[] = {{.key = GRPC_ARG_TCP_READ_CHUNK_SIZE,
- .type = GRPC_ARG_INTEGER,
- .value.integer = (int)slice_size}};
- grpc_channel_args args = {.num_args = GPR_ARRAY_SIZE(a), .args = a};
+ grpc_arg a[1];
+ a[0].key = const_cast<char*>(GRPC_ARG_TCP_READ_CHUNK_SIZE);
+ a[0].type = GRPC_ARG_INTEGER;
+ a[0].value.integer = (int)slice_size;
+ grpc_channel_args args = {GPR_ARRAY_SIZE(a), a};
f.client_ep = grpc_tcp_create(
&exec_ctx, grpc_fd_create(sv[0], "fixture:client"), &args, "test");
f.server_ep = grpc_tcp_create(
diff --git a/test/core/iomgr/tcp_server_posix_test.c b/test/core/iomgr/tcp_server_posix_test.cc
index 4f91669315..6efa74c706 100644
--- a/test/core/iomgr/tcp_server_posix_test.c
+++ b/test/core/iomgr/tcp_server_posix_test.cc
@@ -112,7 +112,7 @@ static void on_connect_result_set(on_connect_result* result,
static void server_weak_ref_shutdown(grpc_exec_ctx* exec_ctx, void* arg,
grpc_error* error) {
- server_weak_ref* weak_ref = arg;
+ server_weak_ref* weak_ref = static_cast<server_weak_ref*>(arg);
weak_ref->server = NULL;
}
@@ -429,22 +429,25 @@ static void test_connect(size_t num_connects,
static void destroy_pollset(grpc_exec_ctx* exec_ctx, void* p,
grpc_error* error) {
- grpc_pollset_destroy(exec_ctx, p);
+ grpc_pollset_destroy(exec_ctx, static_cast<grpc_pollset*>(p));
}
int main(int argc, char** argv) {
grpc_closure destroyed;
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_arg chan_args[] = {
- {GRPC_ARG_INTEGER, GRPC_ARG_EXPAND_WILDCARD_ADDRS, {.integer = 1}}};
+ grpc_arg chan_args[1];
+ chan_args[0].type = GRPC_ARG_INTEGER;
+ chan_args[0].key = const_cast<char*>(GRPC_ARG_EXPAND_WILDCARD_ADDRS);
+ chan_args[0].value.integer = 1;
const grpc_channel_args channel_args = {1, chan_args};
struct ifaddrs* ifa = NULL;
struct ifaddrs* ifa_it;
// Zalloc dst_addrs to avoid oversized frames.
- test_addrs* dst_addrs = gpr_zalloc(sizeof(*dst_addrs));
+ test_addrs* dst_addrs =
+ static_cast<test_addrs*>(gpr_zalloc(sizeof(*dst_addrs)));
grpc_test_init(argc, argv);
grpc_init();
- g_pollset = gpr_zalloc(grpc_pollset_size());
+ g_pollset = static_cast<grpc_pollset*>(gpr_zalloc(grpc_pollset_size()));
grpc_pollset_init(g_pollset, &g_mu);
test_no_op();
diff --git a/test/core/iomgr/tcp_server_uv_test.c b/test/core/iomgr/tcp_server_uv_test.cc
index f2047c943f..dd047a0498 100644
--- a/test/core/iomgr/tcp_server_uv_test.c
+++ b/test/core/iomgr/tcp_server_uv_test.cc
@@ -76,7 +76,7 @@ static void on_connect_result_set(on_connect_result* result,
static void server_weak_ref_shutdown(grpc_exec_ctx* exec_ctx, void* arg,
grpc_error* error) {
- server_weak_ref* weak_ref = arg;
+ server_weak_ref* weak_ref = static_cast<server_weak_ref*>(arg);
weak_ref->server = NULL;
}
@@ -190,8 +190,10 @@ static void close_cb(uv_handle_t* handle) { gpr_free(handle); }
static void tcp_connect(grpc_exec_ctx* exec_ctx, const struct sockaddr* remote,
socklen_t remote_len, on_connect_result* result) {
gpr_timespec deadline = grpc_timeout_seconds_to_deadline(10);
- uv_tcp_t* client_handle = gpr_malloc(sizeof(uv_tcp_t));
- uv_connect_t* req = gpr_malloc(sizeof(uv_connect_t));
+ uv_tcp_t* client_handle =
+ static_cast<uv_tcp_t*>(gpr_malloc(sizeof(uv_tcp_t)));
+ uv_connect_t* req =
+ static_cast<uv_connect_t*>(gpr_malloc(sizeof(uv_connect_t)));
int nconnects_before;
gpr_mu_lock(g_mu);
@@ -291,7 +293,7 @@ static void test_connect(unsigned n) {
static void destroy_pollset(grpc_exec_ctx* exec_ctx, void* p,
grpc_error* error) {
- grpc_pollset_destroy(exec_ctx, p);
+ grpc_pollset_destroy(exec_ctx, static_cast<grpc_pollset*>(p));
}
int main(int argc, char** argv) {
@@ -299,7 +301,7 @@ int main(int argc, char** argv) {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_test_init(argc, argv);
grpc_init();
- g_pollset = gpr_malloc(grpc_pollset_size());
+ g_pollset = static_cast<grpc_pollset*>(gpr_malloc(grpc_pollset_size()));
grpc_pollset_init(g_pollset, &g_mu);
test_no_op();
diff --git a/test/core/iomgr/time_averaged_stats_test.c b/test/core/iomgr/time_averaged_stats_test.cc
index b932e62d1f..b932e62d1f 100644
--- a/test/core/iomgr/time_averaged_stats_test.c
+++ b/test/core/iomgr/time_averaged_stats_test.cc
diff --git a/test/core/iomgr/timer_heap_test.c b/test/core/iomgr/timer_heap_test.cc
index e0ab7b506b..20a383371d 100644
--- a/test/core/iomgr/timer_heap_test.c
+++ b/test/core/iomgr/timer_heap_test.cc
@@ -35,7 +35,8 @@
static gpr_atm random_deadline(void) { return rand(); }
static grpc_timer* create_test_elements(size_t num_elements) {
- grpc_timer* elems = gpr_malloc(num_elements * sizeof(grpc_timer));
+ grpc_timer* elems =
+ static_cast<grpc_timer*>(gpr_malloc(num_elements * sizeof(grpc_timer)));
size_t i;
for (i = 0; i < num_elements; i++) {
elems[i].deadline = random_deadline();
@@ -75,7 +76,7 @@ static void test1(void) {
const size_t num_test_operations = 10000;
size_t i;
grpc_timer* test_elements = create_test_elements(num_test_elements);
- uint8_t* inpq = gpr_malloc(num_test_elements);
+ uint8_t* inpq = static_cast<uint8_t*>(gpr_malloc(num_test_elements));
gpr_log(GPR_INFO, "test1");
@@ -135,7 +136,8 @@ typedef struct {
static elem_struct* search_elems(elem_struct* elems, size_t count,
bool inserted) {
- size_t* search_order = gpr_malloc(count * sizeof(*search_order));
+ size_t* search_order =
+ static_cast<size_t*>(gpr_malloc(count * sizeof(*search_order)));
for (size_t i = 0; i < count; i++) {
search_order[i] = i;
}
@@ -160,7 +162,8 @@ static void test2(void) {
grpc_timer_heap pq;
static const size_t elems_size = 1000;
- elem_struct* elems = gpr_malloc(elems_size * sizeof(elem_struct));
+ elem_struct* elems =
+ static_cast<elem_struct*>(gpr_malloc(elems_size * sizeof(elem_struct)));
size_t num_inserted = 0;
grpc_timer_heap_init(&pq);
diff --git a/test/core/iomgr/timer_list_test.c b/test/core/iomgr/timer_list_test.cc
index d530dfb985..8783c5c6d7 100644
--- a/test/core/iomgr/timer_list_test.c
+++ b/test/core/iomgr/timer_list_test.cc
@@ -31,8 +31,8 @@
#define MAX_CB 30
-extern grpc_tracer_flag grpc_timer_trace;
-extern grpc_tracer_flag grpc_timer_check_trace;
+extern "C" grpc_tracer_flag grpc_timer_trace;
+extern "C" grpc_tracer_flag grpc_timer_check_trace;
static int cb_called[MAX_CB][2];
diff --git a/test/core/iomgr/udp_server_test.c b/test/core/iomgr/udp_server_test.cc
index 4eb5ce1a05..4e8f234a8b 100644
--- a/test/core/iomgr/udp_server_test.c
+++ b/test/core/iomgr/udp_server_test.cc
@@ -118,7 +118,8 @@ static const grpc_socket_factory_vtable test_socket_factory_vtable = {
test_socket_factory_compare, test_socket_factory_destroy};
static test_socket_factory* test_socket_factory_create(void) {
- test_socket_factory* factory = gpr_malloc(sizeof(test_socket_factory));
+ test_socket_factory* factory = static_cast<test_socket_factory*>(
+ gpr_malloc(sizeof(test_socket_factory)));
grpc_socket_factory_init(&factory->base, &test_socket_factory_vtable);
factory->number_of_socket_calls = 0;
factory->number_of_bind_calls = 0;
@@ -292,7 +293,7 @@ static void test_receive(int number_of_clients) {
static void destroy_pollset(grpc_exec_ctx* exec_ctx, void* p,
grpc_error* error) {
- grpc_pollset_destroy(exec_ctx, p);
+ grpc_pollset_destroy(exec_ctx, static_cast<grpc_pollset*>(p));
}
int main(int argc, char** argv) {
@@ -300,7 +301,7 @@ int main(int argc, char** argv) {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_test_init(argc, argv);
grpc_init();
- g_pollset = gpr_zalloc(grpc_pollset_size());
+ g_pollset = static_cast<grpc_pollset*>(gpr_zalloc(grpc_pollset_size()));
grpc_pollset_init(g_pollset, &g_mu);
test_no_op();
diff --git a/test/core/iomgr/wakeup_fd_cv_test.c b/test/core/iomgr/wakeup_fd_cv_test.cc
index dc1d77a0ab..dc1d77a0ab 100644
--- a/test/core/iomgr/wakeup_fd_cv_test.c
+++ b/test/core/iomgr/wakeup_fd_cv_test.cc
diff --git a/test/core/json/BUILD b/test/core/json/BUILD
index 3ff7918677..b8b36c0652 100644
--- a/test/core/json/BUILD
+++ b/test/core/json/BUILD
@@ -22,8 +22,8 @@ load("//test/core/util:grpc_fuzzer.bzl", "grpc_fuzzer")
grpc_fuzzer(
name = "json_fuzzer",
- srcs = ["fuzzer.c"],
- language = "C",
+ srcs = ["fuzzer.cc"],
+ language = "C++",
corpus = "corpus",
deps = [
"//:gpr",
@@ -35,8 +35,8 @@ grpc_fuzzer(
grpc_cc_binary(
name = "json_rewrite",
testonly = 1,
- srcs = ["json_rewrite.c"],
- language = "C",
+ srcs = ["json_rewrite.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//:grpc",
@@ -47,8 +47,8 @@ grpc_cc_binary(
grpc_cc_test(
name = "json_rewrite_test",
- srcs = ["json_rewrite_test.c"],
- language = "C",
+ srcs = ["json_rewrite_test.cc"],
+ language = "C++",
data = [
"rewrite_test_input.json",
"rewrite_test_output_condensed.json",
@@ -65,8 +65,8 @@ grpc_cc_test(
grpc_cc_test(
name = "json_stream_error_test",
- srcs = ["json_stream_error_test.c"],
- language = "C",
+ srcs = ["json_stream_error_test.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//:grpc",
@@ -77,8 +77,8 @@ grpc_cc_test(
grpc_cc_test(
name = "json_test",
- srcs = ["json_test.c"],
- language = "C",
+ srcs = ["json_test.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//:grpc",
diff --git a/test/core/json/fuzzer.c b/test/core/json/fuzzer.cc
index 273886873c..6dafabb95b 100644
--- a/test/core/json/fuzzer.c
+++ b/test/core/json/fuzzer.cc
@@ -29,11 +29,11 @@
bool squelch = true;
bool leak_check = true;
-int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
char* s;
struct grpc_memory_counters counters;
grpc_memory_counters_init();
- s = gpr_malloc(size);
+ s = static_cast<char*>(gpr_malloc(size));
memcpy(s, data, size);
grpc_json* x;
if ((x = grpc_json_parse_string_with_len(s, size))) {
diff --git a/test/core/json/json_rewrite.c b/test/core/json/json_rewrite.cc
index 3bd50e67b3..98e76e9772 100644
--- a/test/core/json/json_rewrite.c
+++ b/test/core/json/json_rewrite.cc
@@ -47,18 +47,18 @@ typedef struct json_reader_userdata {
} json_reader_userdata;
static void json_writer_output_char(void* userdata, char c) {
- json_writer_userdata* state = userdata;
+ json_writer_userdata* state = static_cast<json_writer_userdata*>(userdata);
fputc(c, state->out);
}
static void json_writer_output_string(void* userdata, const char* str) {
- json_writer_userdata* state = userdata;
+ json_writer_userdata* state = static_cast<json_writer_userdata*>(userdata);
fputs(str, state->out);
}
static void json_writer_output_string_with_len(void* userdata, const char* str,
size_t len) {
- json_writer_userdata* state = userdata;
+ json_writer_userdata* state = static_cast<json_writer_userdata*>(userdata);
fwrite(str, len, 1, state->out);
}
@@ -70,19 +70,20 @@ static void check_string(json_reader_userdata* state, size_t needed) {
if (state->free_space >= needed) return;
needed -= state->free_space;
needed = (needed + 0xffu) & ~0xffu;
- state->scratchpad = gpr_realloc(state->scratchpad, state->allocated + needed);
+ state->scratchpad = static_cast<char*>(
+ gpr_realloc(state->scratchpad, state->allocated + needed));
state->free_space += needed;
state->allocated += needed;
}
static void json_reader_string_clear(void* userdata) {
- json_reader_userdata* state = userdata;
+ json_reader_userdata* state = static_cast<json_reader_userdata*>(userdata);
state->free_space = state->allocated;
state->string_len = 0;
}
static void json_reader_string_add_char(void* userdata, uint32_t c) {
- json_reader_userdata* state = userdata;
+ json_reader_userdata* state = static_cast<json_reader_userdata*>(userdata);
check_string(state, 1);
GPR_ASSERT(c < 256);
state->scratchpad[state->string_len++] = (char)c;
@@ -117,7 +118,7 @@ static void json_reader_string_add_utf32(void* userdata, uint32_t c) {
static uint32_t json_reader_read_char(void* userdata) {
int r;
- json_reader_userdata* state = userdata;
+ json_reader_userdata* state = static_cast<json_reader_userdata*>(userdata);
r = fgetc(state->in);
if (r == EOF) r = GRPC_JSON_READ_CHAR_EOF;
@@ -125,8 +126,9 @@ static uint32_t json_reader_read_char(void* userdata) {
}
static void json_reader_container_begins(void* userdata, grpc_json_type type) {
- json_reader_userdata* state = userdata;
- stacked_container* container = gpr_malloc(sizeof(stacked_container));
+ json_reader_userdata* state = static_cast<json_reader_userdata*>(userdata);
+ stacked_container* container =
+ static_cast<stacked_container*>(gpr_malloc(sizeof(stacked_container)));
container->type = type;
container->next = state->top;
@@ -136,7 +138,7 @@ static void json_reader_container_begins(void* userdata, grpc_json_type type) {
}
static grpc_json_type json_reader_container_ends(void* userdata) {
- json_reader_userdata* state = userdata;
+ json_reader_userdata* state = static_cast<json_reader_userdata*>(userdata);
stacked_container* container = state->top;
grpc_json_writer_container_ends(state->writer, container->type);
@@ -146,21 +148,21 @@ static grpc_json_type json_reader_container_ends(void* userdata) {
}
static void json_reader_set_key(void* userdata) {
- json_reader_userdata* state = userdata;
+ json_reader_userdata* state = static_cast<json_reader_userdata*>(userdata);
json_reader_string_add_char(userdata, 0);
grpc_json_writer_object_key(state->writer, state->scratchpad);
}
static void json_reader_set_string(void* userdata) {
- json_reader_userdata* state = userdata;
+ json_reader_userdata* state = static_cast<json_reader_userdata*>(userdata);
json_reader_string_add_char(userdata, 0);
grpc_json_writer_value_string(state->writer, state->scratchpad);
}
static int json_reader_set_number(void* userdata) {
- json_reader_userdata* state = userdata;
+ json_reader_userdata* state = static_cast<json_reader_userdata*>(userdata);
grpc_json_writer_value_raw_with_len(state->writer, state->scratchpad,
state->string_len);
@@ -169,19 +171,19 @@ static int json_reader_set_number(void* userdata) {
}
static void json_reader_set_true(void* userdata) {
- json_reader_userdata* state = userdata;
+ json_reader_userdata* state = static_cast<json_reader_userdata*>(userdata);
grpc_json_writer_value_raw_with_len(state->writer, "true", 4);
}
static void json_reader_set_false(void* userdata) {
- json_reader_userdata* state = userdata;
+ json_reader_userdata* state = static_cast<json_reader_userdata*>(userdata);
grpc_json_writer_value_raw_with_len(state->writer, "false", 5);
}
static void json_reader_set_null(void* userdata) {
- json_reader_userdata* state = userdata;
+ json_reader_userdata* state = static_cast<json_reader_userdata*>(userdata);
grpc_json_writer_value_raw_with_len(state->writer, "null", 4);
}
diff --git a/test/core/json/json_rewrite_test.c b/test/core/json/json_rewrite_test.cc
index a83989f402..47b4f01e8b 100644
--- a/test/core/json/json_rewrite_test.c
+++ b/test/core/json/json_rewrite_test.cc
@@ -49,7 +49,7 @@ typedef struct json_reader_userdata {
} json_reader_userdata;
static void json_writer_output_char(void* userdata, char c) {
- json_writer_userdata* state = userdata;
+ json_writer_userdata* state = static_cast<json_writer_userdata*>(userdata);
int cmp = fgetc(state->cmp);
/* treat CRLF as LF */
@@ -81,19 +81,20 @@ static void check_string(json_reader_userdata* state, size_t needed) {
if (state->free_space >= needed) return;
needed -= state->free_space;
needed = (needed + 0xffu) & ~0xffu;
- state->scratchpad = gpr_realloc(state->scratchpad, state->allocated + needed);
+ state->scratchpad = static_cast<char*>(
+ gpr_realloc(state->scratchpad, state->allocated + needed));
state->free_space += needed;
state->allocated += needed;
}
static void json_reader_string_clear(void* userdata) {
- json_reader_userdata* state = userdata;
+ json_reader_userdata* state = static_cast<json_reader_userdata*>(userdata);
state->free_space = state->allocated;
state->string_len = 0;
}
static void json_reader_string_add_char(void* userdata, uint32_t c) {
- json_reader_userdata* state = userdata;
+ json_reader_userdata* state = static_cast<json_reader_userdata*>(userdata);
check_string(state, 1);
GPR_ASSERT(c <= 256);
state->scratchpad[state->string_len++] = (char)c;
@@ -128,7 +129,7 @@ static void json_reader_string_add_utf32(void* userdata, uint32_t c) {
static uint32_t json_reader_read_char(void* userdata) {
int r;
- json_reader_userdata* state = userdata;
+ json_reader_userdata* state = static_cast<json_reader_userdata*>(userdata);
if (!state->did_eagain) {
state->did_eagain = 1;
@@ -143,8 +144,9 @@ static uint32_t json_reader_read_char(void* userdata) {
}
static void json_reader_container_begins(void* userdata, grpc_json_type type) {
- json_reader_userdata* state = userdata;
- stacked_container* container = gpr_malloc(sizeof(stacked_container));
+ json_reader_userdata* state = static_cast<json_reader_userdata*>(userdata);
+ stacked_container* container =
+ static_cast<stacked_container*>(gpr_malloc(sizeof(stacked_container)));
container->type = type;
container->next = state->top;
@@ -154,7 +156,7 @@ static void json_reader_container_begins(void* userdata, grpc_json_type type) {
}
static grpc_json_type json_reader_container_ends(void* userdata) {
- json_reader_userdata* state = userdata;
+ json_reader_userdata* state = static_cast<json_reader_userdata*>(userdata);
stacked_container* container = state->top;
grpc_json_writer_container_ends(state->writer, container->type);
@@ -164,21 +166,21 @@ static grpc_json_type json_reader_container_ends(void* userdata) {
}
static void json_reader_set_key(void* userdata) {
- json_reader_userdata* state = userdata;
+ json_reader_userdata* state = static_cast<json_reader_userdata*>(userdata);
json_reader_string_add_char(userdata, 0);
grpc_json_writer_object_key(state->writer, state->scratchpad);
}
static void json_reader_set_string(void* userdata) {
- json_reader_userdata* state = userdata;
+ json_reader_userdata* state = static_cast<json_reader_userdata*>(userdata);
json_reader_string_add_char(userdata, 0);
grpc_json_writer_value_string(state->writer, state->scratchpad);
}
static int json_reader_set_number(void* userdata) {
- json_reader_userdata* state = userdata;
+ json_reader_userdata* state = static_cast<json_reader_userdata*>(userdata);
grpc_json_writer_value_raw_with_len(state->writer, state->scratchpad,
state->string_len);
@@ -187,19 +189,19 @@ static int json_reader_set_number(void* userdata) {
}
static void json_reader_set_true(void* userdata) {
- json_reader_userdata* state = userdata;
+ json_reader_userdata* state = static_cast<json_reader_userdata*>(userdata);
grpc_json_writer_value_raw_with_len(state->writer, "true", 4);
}
static void json_reader_set_false(void* userdata) {
- json_reader_userdata* state = userdata;
+ json_reader_userdata* state = static_cast<json_reader_userdata*>(userdata);
grpc_json_writer_value_raw_with_len(state->writer, "false", 5);
}
static void json_reader_set_null(void* userdata) {
- json_reader_userdata* state = userdata;
+ json_reader_userdata* state = static_cast<json_reader_userdata*>(userdata);
grpc_json_writer_value_raw_with_len(state->writer, "null", 4);
}
diff --git a/test/core/json/json_stream_error_test.c b/test/core/json/json_stream_error_test.cc
index 975ccd2b42..975ccd2b42 100644
--- a/test/core/json/json_stream_error_test.c
+++ b/test/core/json/json_stream_error_test.cc
diff --git a/test/core/json/json_test.c b/test/core/json/json_test.cc
index 9e4d351dd7..9e4d351dd7 100644
--- a/test/core/json/json_test.c
+++ b/test/core/json/json_test.cc
diff --git a/test/core/memory_usage/client.c b/test/core/memory_usage/client.cc
index cd84c4e63a..74ec4b0738 100644
--- a/test/core/memory_usage/client.c
+++ b/test/core/memory_usage/client.cc
@@ -183,7 +183,7 @@ int main(int argc, char** argv) {
grpc_slice slice = grpc_slice_from_copied_string("x");
char* fake_argv[1];
- char* target = "localhost:443";
+ const char* target = "localhost:443";
gpr_cmdline* cl;
grpc_event event;
diff --git a/test/core/memory_usage/memory_usage_test.c b/test/core/memory_usage/memory_usage_test.cc
index 258bf7511c..58e31c9531 100644
--- a/test/core/memory_usage/memory_usage_test.c
+++ b/test/core/memory_usage/memory_usage_test.cc
@@ -44,9 +44,9 @@ int main(int argc, char** argv) {
/* start the server */
gpr_asprintf(&args[0], "%s/memory_profile_server%s", root,
gpr_subprocess_binary_extension());
- args[1] = "--bind";
+ args[1] = const_cast<char*>("--bind");
gpr_join_host_port(&args[2], "::", port);
- args[3] = "--no-secure";
+ args[3] = const_cast<char*>("--no-secure");
svr = gpr_subprocess_create(4, (const char**)args);
gpr_free(args[0]);
gpr_free(args[2]);
@@ -54,10 +54,10 @@ int main(int argc, char** argv) {
/* start the client */
gpr_asprintf(&args[0], "%s/memory_profile_client%s", root,
gpr_subprocess_binary_extension());
- args[1] = "--target";
+ args[1] = const_cast<char*>("--target");
gpr_join_host_port(&args[2], "127.0.0.1", port);
- args[3] = "--warmup=1000";
- args[4] = "--benchmark=9000";
+ args[3] = const_cast<char*>("--warmup=1000");
+ args[4] = const_cast<char*>("--benchmark=9000");
cli = gpr_subprocess_create(5, (const char**)args);
gpr_free(args[0]);
gpr_free(args[2]);
diff --git a/test/core/memory_usage/server.c b/test/core/memory_usage/server.cc
index cc2cf75faf..04e55db30d 100644
--- a/test/core/memory_usage/server.c
+++ b/test/core/memory_usage/server.cc
@@ -151,7 +151,7 @@ int main(int argc, char** argv) {
int shutdown_finished = 0;
int secure = 0;
- char* addr = NULL;
+ const char* addr = NULL;
char* fake_argv[1];
@@ -232,7 +232,7 @@ int main(int argc, char** argv) {
gpr_time_add(gpr_now(GPR_CLOCK_REALTIME),
gpr_time_from_micros(1000000, GPR_TIMESPAN)),
NULL);
- fling_call* s = ev.tag;
+ fling_call* s = static_cast<fling_call*>(ev.tag);
switch (ev.type) {
case GRPC_OP_COMPLETE:
switch (s->state) {
diff --git a/test/core/nanopb/BUILD b/test/core/nanopb/BUILD
index f332207e2d..1497f829ab 100644
--- a/test/core/nanopb/BUILD
+++ b/test/core/nanopb/BUILD
@@ -22,8 +22,8 @@ load("//test/core/util:grpc_fuzzer.bzl", "grpc_fuzzer")
grpc_fuzzer(
name = "fuzzer_response",
- srcs = ["fuzzer_response.c"],
- language = "C",
+ srcs = ["fuzzer_response.cc"],
+ language = "C++",
corpus = "corpus_response",
deps = [
"//:gpr",
@@ -34,8 +34,8 @@ grpc_fuzzer(
grpc_fuzzer(
name = "fuzzer_serverlist",
- srcs = ["fuzzer_serverlist.c"],
- language = "C",
+ srcs = ["fuzzer_serverlist.cc"],
+ language = "C++",
corpus = "corpus_serverlist",
deps = [
"//:gpr",
diff --git a/test/core/nanopb/fuzzer_response.c b/test/core/nanopb/fuzzer_response.cc
index 42826c18f3..7039c801cb 100644
--- a/test/core/nanopb/fuzzer_response.c
+++ b/test/core/nanopb/fuzzer_response.cc
@@ -28,7 +28,7 @@ bool leak_check = true;
static void dont_log(gpr_log_func_args* args) {}
-int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
if (squelch) gpr_set_log_function(dont_log);
grpc_slice slice = grpc_slice_from_copied_buffer((const char*)data, size);
grpc_grpclb_initial_response* response;
diff --git a/test/core/nanopb/fuzzer_serverlist.c b/test/core/nanopb/fuzzer_serverlist.cc
index 059e33d584..0a6b1767a1 100644
--- a/test/core/nanopb/fuzzer_serverlist.c
+++ b/test/core/nanopb/fuzzer_serverlist.cc
@@ -28,7 +28,7 @@ bool leak_check = true;
static void dont_log(gpr_log_func_args* args) {}
-int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
if (squelch) gpr_set_log_function(dont_log);
grpc_slice slice = grpc_slice_from_copied_buffer((const char*)data, size);
grpc_grpclb_serverlist* serverlist;
diff --git a/test/core/network_benchmarks/BUILD b/test/core/network_benchmarks/BUILD
index 0e15393030..e1b4953608 100644
--- a/test/core/network_benchmarks/BUILD
+++ b/test/core/network_benchmarks/BUILD
@@ -22,8 +22,8 @@ licenses(["notice"]) # Apache v2
grpc_cc_binary(
name = "low_level_ping_pong",
- srcs = ["low_level_ping_pong.c"],
- language = "C",
+ srcs = ["low_level_ping_pong.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//:grpc",
diff --git a/test/core/network_benchmarks/low_level_ping_pong.c b/test/core/network_benchmarks/low_level_ping_pong.cc
index 868011739c..722652148c 100644
--- a/test/core/network_benchmarks/low_level_ping_pong.c
+++ b/test/core/network_benchmarks/low_level_ping_pong.cc
@@ -56,7 +56,7 @@ typedef struct thread_args {
int (*write_bytes)(struct thread_args* args, char* buf);
int (*setup)(struct thread_args* args);
int epoll_fd;
- char* strategy_name;
+ const char* strategy_name;
} thread_args;
/*
@@ -252,7 +252,7 @@ static int epoll_setup(thread_args* args) {
#endif
static void server_thread(thread_args* args) {
- char* buf = gpr_malloc(args->msg_size);
+ char* buf = static_cast<char*>(gpr_malloc(args->msg_size));
if (args->setup(args) < 0) {
gpr_log(GPR_ERROR, "Setup failed");
}
@@ -271,7 +271,7 @@ static void server_thread(thread_args* args) {
}
static void server_thread_wrap(void* arg) {
- thread_args* args = arg;
+ thread_args* args = static_cast<thread_args*>(arg);
server_thread(args);
}
@@ -291,7 +291,7 @@ static double now(void) {
}
static void client_thread(thread_args* args) {
- char* buf = gpr_malloc(args->msg_size * sizeof(char));
+ char* buf = static_cast<char*>(gpr_malloc(args->msg_size * sizeof(char)));
memset(buf, 0, args->msg_size * sizeof(char));
gpr_histogram* histogram = gpr_histogram_create(0.01, 60e9);
double start_time;
@@ -538,7 +538,7 @@ void print_usage(char* argv0) {
}
typedef struct test_strategy {
- char* name;
+ const char* name;
int (*read_strategy)(struct thread_args* args, char* buf);
int (*setup)(struct thread_args* args);
} test_strategy;
@@ -553,9 +553,10 @@ static test_strategy test_strategies[] = {
{"spin_read", spin_read_bytes, set_socket_nonblocking},
{"spin_poll", poll_read_bytes_spin, set_socket_nonblocking}};
-static char* socket_types[] = {"tcp", "socketpair", "pipe"};
+static const char* socket_types[] = {"tcp", "socketpair", "pipe"};
-int create_socket(char* socket_type, fd_pair* client_fds, fd_pair* server_fds) {
+int create_socket(const char* socket_type, fd_pair* client_fds,
+ fd_pair* server_fds) {
if (strcmp(socket_type, "tcp") == 0) {
create_sockets_tcp(client_fds, server_fds);
} else if (strcmp(socket_type, "socketpair") == 0) {
@@ -569,7 +570,7 @@ int create_socket(char* socket_type, fd_pair* client_fds, fd_pair* server_fds) {
return 0;
}
-static int run_benchmark(char* socket_type, thread_args* client_args,
+static int run_benchmark(const char* socket_type, thread_args* client_args,
thread_args* server_args) {
gpr_thd_id tid;
int rv = 0;
@@ -594,9 +595,11 @@ static int run_all_benchmarks(size_t msg_size) {
test_strategy* strategy = &test_strategies[i];
size_t j;
for (j = 0; j < GPR_ARRAY_SIZE(socket_types); ++j) {
- thread_args* client_args = gpr_malloc(sizeof(thread_args));
- thread_args* server_args = gpr_malloc(sizeof(thread_args));
- char* socket_type = socket_types[j];
+ thread_args* client_args =
+ static_cast<thread_args*>(gpr_malloc(sizeof(thread_args)));
+ thread_args* server_args =
+ static_cast<thread_args*>(gpr_malloc(sizeof(thread_args)));
+ const char* socket_type = socket_types[j];
client_args->read_bytes = strategy->read_strategy;
client_args->write_bytes = blocking_write_bytes;
@@ -618,11 +621,13 @@ static int run_all_benchmarks(size_t msg_size) {
}
int main(int argc, char** argv) {
- thread_args* client_args = gpr_malloc(sizeof(thread_args));
- thread_args* server_args = gpr_malloc(sizeof(thread_args));
+ thread_args* client_args =
+ static_cast<thread_args*>(gpr_malloc(sizeof(thread_args)));
+ thread_args* server_args =
+ static_cast<thread_args*>(gpr_malloc(sizeof(thread_args)));
int msg_size = -1;
- char* read_strategy = NULL;
- char* socket_type = NULL;
+ const char* read_strategy = NULL;
+ const char* socket_type = NULL;
size_t i;
const test_strategy* strategy = NULL;
int error = 0;
diff --git a/test/core/security/BUILD b/test/core/security/BUILD
index 83b1747648..7cd3ae58da 100644
--- a/test/core/security/BUILD
+++ b/test/core/security/BUILD
@@ -22,8 +22,8 @@ load("//test/core/util:grpc_fuzzer.bzl", "grpc_fuzzer")
grpc_fuzzer(
name = "ssl_server_fuzzer",
- srcs = ["ssl_server_fuzzer.c"],
- language = "C",
+ srcs = ["ssl_server_fuzzer.cc"],
+ language = "C++",
corpus = "corpus",
deps = [
"//:gpr",
@@ -35,17 +35,17 @@ grpc_fuzzer(
grpc_cc_library(
name = "oauth2_utils",
- srcs = ["oauth2_utils.c"],
+ srcs = ["oauth2_utils.cc"],
hdrs = ["oauth2_utils.h"],
- language = "C",
+ language = "C++",
deps = ["//:grpc"],
visibility = ["//test/cpp:__subpackages__"],
)
grpc_cc_test(
name = "auth_context_test",
- srcs = ["auth_context_test.c"],
- language = "C",
+ srcs = ["auth_context_test.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//:grpc",
@@ -56,8 +56,8 @@ grpc_cc_test(
grpc_cc_test(
name = "credentials_test",
- srcs = ["credentials_test.c"],
- language = "C",
+ srcs = ["credentials_test.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//:grpc",
@@ -68,8 +68,8 @@ grpc_cc_test(
grpc_cc_test(
name = "secure_endpoint_test",
- srcs = ["secure_endpoint_test.c"],
- language = "C",
+ srcs = ["secure_endpoint_test.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//:grpc",
@@ -81,8 +81,8 @@ grpc_cc_test(
grpc_cc_test(
name = "security_connector_test",
- srcs = ["security_connector_test.c"],
- language = "C",
+ srcs = ["security_connector_test.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//:grpc",
@@ -93,8 +93,8 @@ grpc_cc_test(
grpc_cc_test(
name = "ssl_credentials_test",
- srcs = ["ssl_credentials_test.c"],
- language = "C",
+ srcs = ["ssl_credentials_test.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//:grpc",
@@ -105,8 +105,8 @@ grpc_cc_test(
grpc_cc_binary(
name = "create_jwt",
- srcs = ["create_jwt.c"],
- language = "C",
+ srcs = ["create_jwt.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//:grpc",
@@ -115,8 +115,8 @@ grpc_cc_binary(
grpc_cc_binary(
name = "fetch_oauth2",
- srcs = ["fetch_oauth2.c"],
- language = "C",
+ srcs = ["fetch_oauth2.cc"],
+ language = "C++",
deps = [
":oauth2_utils",
"//:gpr",
@@ -126,8 +126,8 @@ grpc_cc_binary(
grpc_cc_binary(
name = "verify_jwt",
- srcs = ["verify_jwt.c"],
- language = "C",
+ srcs = ["verify_jwt.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//:grpc",
diff --git a/test/core/security/auth_context_test.c b/test/core/security/auth_context_test.cc
index 3ab9190689..3ab9190689 100644
--- a/test/core/security/auth_context_test.c
+++ b/test/core/security/auth_context_test.cc
diff --git a/test/core/security/create_jwt.c b/test/core/security/create_jwt.cc
index 327179c9de..95f3615074 100644
--- a/test/core/security/create_jwt.c
+++ b/test/core/security/create_jwt.cc
@@ -54,9 +54,9 @@ void create_jwt(const char* json_key_file_path, const char* service_url,
}
int main(int argc, char** argv) {
- char* scope = NULL;
- char* json_key_file_path = NULL;
- char* service_url = NULL;
+ const char* scope = NULL;
+ const char* json_key_file_path = NULL;
+ const char* service_url = NULL;
grpc_init();
gpr_cmdline* cl = gpr_cmdline_create("create_jwt");
gpr_cmdline_add_string(cl, "json_key", "File path of the json key.",
diff --git a/test/core/security/credentials_test.c b/test/core/security/credentials_test.cc
index 3962d35d3a..9b575c4bc5 100644
--- a/test/core/security/credentials_test.c
+++ b/test/core/security/credentials_test.cc
@@ -47,7 +47,8 @@
static grpc_channel_credentials* grpc_mock_channel_credentials_create(
const grpc_channel_credentials_vtable* vtable) {
- grpc_channel_credentials* c = gpr_malloc(sizeof(*c));
+ grpc_channel_credentials* c =
+ static_cast<grpc_channel_credentials*>(gpr_malloc(sizeof(*c)));
memset(c, 0, sizeof(*c));
c->type = "mock";
c->vtable = vtable;
@@ -125,7 +126,7 @@ static char* test_json_key_str(void) {
size_t result_len = strlen(test_json_key_str_part1) +
strlen(test_json_key_str_part2) +
strlen(test_json_key_str_part3);
- char* result = gpr_malloc(result_len + 1);
+ char* result = static_cast<char*>(gpr_malloc(result_len + 1));
char* current = result;
strcpy(result, test_json_key_str_part1);
current += strlen(test_json_key_str_part1);
@@ -366,7 +367,8 @@ static void check_request_metadata(grpc_exec_ctx* exec_ctx, void* arg,
static request_metadata_state* make_request_metadata_state(
grpc_error* expected_error, const expected_md* expected,
size_t expected_size) {
- request_metadata_state* state = gpr_zalloc(sizeof(*state));
+ request_metadata_state* state =
+ static_cast<request_metadata_state*>(gpr_zalloc(sizeof(*state)));
state->expected_error = expected_error;
state->expected = expected;
state->expected_size = expected_size;
@@ -937,7 +939,8 @@ static int default_creds_gce_detection_httpcli_get_success_override(
grpc_millis deadline, grpc_closure* on_done,
grpc_httpcli_response* response) {
*response = http_response(200, "");
- grpc_http_header* headers = gpr_malloc(sizeof(*headers) * 1);
+ grpc_http_header* headers =
+ static_cast<grpc_http_header*>(gpr_malloc(sizeof(*headers) * 1));
headers[0].key = gpr_strdup("Metadata-Flavor");
headers[0].value = gpr_strdup("Google");
response->hdr_count = 1;
diff --git a/test/core/security/fetch_oauth2.c b/test/core/security/fetch_oauth2.cc
index 42f68fc7d1..fa8036e581 100644
--- a/test/core/security/fetch_oauth2.c
+++ b/test/core/security/fetch_oauth2.cc
@@ -44,7 +44,7 @@ static grpc_call_credentials* create_refresh_token_creds(
int main(int argc, char** argv) {
grpc_call_credentials* creds = NULL;
char* json_key_file_path = NULL;
- char* json_refresh_token_file_path = NULL;
+ const char* json_refresh_token_file_path = NULL;
char* token = NULL;
int use_gce = 0;
char* scope = NULL;
diff --git a/test/core/security/json_token_test.c b/test/core/security/json_token_test.cc
index 4159367abe..a06e1d05ce 100644
--- a/test/core/security/json_token_test.c
+++ b/test/core/security/json_token_test.cc
@@ -81,7 +81,7 @@ static char* test_json_key_str(const char* bad_part3) {
const char* part3 = bad_part3 != NULL ? bad_part3 : test_json_key_str_part3;
size_t result_len = strlen(test_json_key_str_part1) +
strlen(test_json_key_str_part2) + strlen(part3);
- char* result = gpr_malloc(result_len + 1);
+ char* result = static_cast<char*>(gpr_malloc(result_len + 1));
char* current = result;
strcpy(result, test_json_key_str_part1);
current += strlen(test_json_key_str_part1);
@@ -211,12 +211,12 @@ static grpc_json* parse_json_part_from_jwt(const char* str, size_t len,
char* decoded;
grpc_json* json;
grpc_slice slice;
- b64 = gpr_malloc(len + 1);
+ b64 = static_cast<char*>(gpr_malloc(len + 1));
strncpy(b64, str, len);
b64[len] = '\0';
slice = grpc_base64_decode(&exec_ctx, b64, 1);
GPR_ASSERT(!GRPC_SLICE_IS_EMPTY(slice));
- decoded = gpr_malloc(GRPC_SLICE_LENGTH(slice) + 1);
+ decoded = static_cast<char*>(gpr_malloc(GRPC_SLICE_LENGTH(slice) + 1));
strncpy(decoded, (const char*)GRPC_SLICE_START_PTR(slice),
GRPC_SLICE_LENGTH(slice));
decoded[GRPC_SLICE_LENGTH(slice)] = '\0';
diff --git a/test/core/security/jwt_verifier_test.c b/test/core/security/jwt_verifier_test.cc
index 0e16dc958e..6858b36141 100644
--- a/test/core/security/jwt_verifier_test.c
+++ b/test/core/security/jwt_verifier_test.cc
@@ -292,7 +292,7 @@ static void test_bad_subject_claims_failure(void) {
static char* json_key_str(const char* last_part) {
size_t result_len = strlen(json_key_str_part1) + strlen(json_key_str_part2) +
strlen(last_part);
- char* result = gpr_malloc(result_len + 1);
+ char* result = static_cast<char*>(gpr_malloc(result_len + 1));
char* current = result;
strcpy(result, json_key_str_part1);
current += strlen(json_key_str_part1);
@@ -305,7 +305,7 @@ static char* json_key_str(const char* last_part) {
static char* good_google_email_keys(void) {
size_t result_len = strlen(good_google_email_keys_part1) +
strlen(good_google_email_keys_part2);
- char* result = gpr_malloc(result_len + 1);
+ char* result = static_cast<char*>(gpr_malloc(result_len + 1));
char* current = result;
strcpy(result, good_google_email_keys_part1);
current += strlen(good_google_email_keys_part1);
diff --git a/test/core/security/oauth2_utils.c b/test/core/security/oauth2_utils.cc
index fda3d96e18..fda3d96e18 100644
--- a/test/core/security/oauth2_utils.c
+++ b/test/core/security/oauth2_utils.cc
diff --git a/test/core/security/oauth2_utils.h b/test/core/security/oauth2_utils.h
index 5e33ef4f43..5ad2e398e1 100644
--- a/test/core/security/oauth2_utils.h
+++ b/test/core/security/oauth2_utils.h
@@ -21,17 +21,9 @@
#include "src/core/lib/security/credentials/credentials.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
-
/* Fetch oauth2 access token with a credentials object. Does not take ownership.
Returns NULL on a failure. The caller should call gpr_free on the token. */
char* grpc_test_fetch_oauth2_token_with_credentials(
grpc_call_credentials* creds);
-#ifdef __cplusplus
-}
-#endif
-
#endif /* GRPC_TEST_CORE_SECURITY_OAUTH2_UTILS_H */
diff --git a/test/core/security/print_google_default_creds_token.c b/test/core/security/print_google_default_creds_token.cc
index c5d4e9c3ea..a57180b57d 100644
--- a/test/core/security/print_google_default_creds_token.c
+++ b/test/core/security/print_google_default_creds_token.cc
@@ -43,7 +43,7 @@ typedef struct {
static void on_metadata_response(grpc_exec_ctx* exec_ctx, void* arg,
grpc_error* error) {
- synchronizer* sync = arg;
+ synchronizer* sync = static_cast<synchronizer*>(arg);
if (error != GRPC_ERROR_NONE) {
fprintf(stderr, "Fetching token failed: %s\n", grpc_error_string(error));
} else {
@@ -67,9 +67,11 @@ int main(int argc, char** argv) {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
synchronizer sync;
grpc_channel_credentials* creds = NULL;
- char* service_url = "https://test.foo.google.com/Foo";
+ const char* service_url = "https://test.foo.google.com/Foo";
grpc_auth_metadata_context context;
gpr_cmdline* cl = gpr_cmdline_create("print_google_default_creds_token");
+ grpc_pollset* pollset = nullptr;
+ grpc_error* error = nullptr;
gpr_cmdline_add_string(cl, "service_url",
"Service URL for the token request.", &service_url);
gpr_cmdline_parse(cl, argc, argv);
@@ -86,14 +88,14 @@ int main(int argc, char** argv) {
}
memset(&sync, 0, sizeof(sync));
- grpc_pollset* pollset = gpr_zalloc(grpc_pollset_size());
+ pollset = (grpc_pollset*)gpr_zalloc(grpc_pollset_size());
grpc_pollset_init(pollset, &sync.mu);
sync.pops = grpc_polling_entity_create_from_pollset(pollset);
sync.is_done = false;
GRPC_CLOSURE_INIT(&sync.on_request_metadata, on_metadata_response, &sync,
grpc_schedule_on_exec_ctx);
- grpc_error* error = GRPC_ERROR_NONE;
+ error = GRPC_ERROR_NONE;
if (grpc_call_credentials_get_request_metadata(
&exec_ctx, ((grpc_composite_channel_credentials*)creds)->call_creds,
&sync.pops, context, &sync.md_array, &sync.on_request_metadata,
diff --git a/test/core/security/secure_endpoint_test.c b/test/core/security/secure_endpoint_test.cc
index b772c30956..11d1e5fcf4 100644
--- a/test/core/security/secure_endpoint_test.c
+++ b/test/core/security/secure_endpoint_test.cc
@@ -52,10 +52,11 @@ static grpc_endpoint_test_fixture secure_endpoint_create_fixture_tcp_socketpair(
grpc_endpoint_test_fixture f;
grpc_endpoint_pair tcp;
- grpc_arg a[] = {{.key = GRPC_ARG_TCP_READ_CHUNK_SIZE,
- .type = GRPC_ARG_INTEGER,
- .value.integer = (int)slice_size}};
- grpc_channel_args args = {.num_args = GPR_ARRAY_SIZE(a), .args = a};
+ grpc_arg a[1];
+ a[0].key = const_cast<char*>(GRPC_ARG_TCP_READ_CHUNK_SIZE);
+ a[0].type = GRPC_ARG_INTEGER;
+ a[0].value.integer = (int)slice_size;
+ grpc_channel_args args = {GPR_ARRAY_SIZE(a), a};
tcp = grpc_iomgr_create_endpoint_pair("fixture", &args);
grpc_endpoint_add_to_pollset(&exec_ctx, tcp.client, g_pollset);
grpc_endpoint_add_to_pollset(&exec_ctx, tcp.server, g_pollset);
diff --git a/test/core/security/security_connector_test.c b/test/core/security/security_connector_test.cc
index a0c1e93532..a0c1e93532 100644
--- a/test/core/security/security_connector_test.c
+++ b/test/core/security/security_connector_test.cc
diff --git a/test/core/security/ssl_credentials_test.c b/test/core/security/ssl_credentials_test.cc
index 76ee32b001..76ee32b001 100644
--- a/test/core/security/ssl_credentials_test.c
+++ b/test/core/security/ssl_credentials_test.cc
diff --git a/test/core/security/ssl_server_fuzzer.c b/test/core/security/ssl_server_fuzzer.cc
index 7d6b3409b3..5c5153b505 100644
--- a/test/core/security/ssl_server_fuzzer.c
+++ b/test/core/security/ssl_server_fuzzer.cc
@@ -42,15 +42,16 @@ struct handshake_state {
static void on_handshake_done(grpc_exec_ctx* exec_ctx, void* arg,
grpc_error* error) {
- grpc_handshaker_args* args = arg;
- struct handshake_state* state = args->user_data;
+ grpc_handshaker_args* args = static_cast<grpc_handshaker_args*>(arg);
+ struct handshake_state* state =
+ static_cast<struct handshake_state*>(args->user_data);
GPR_ASSERT(state->done_callback_called == false);
state->done_callback_called = true;
// The fuzzer should not pass the handshake.
GPR_ASSERT(error != GRPC_ERROR_NONE);
}
-int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
struct grpc_memory_counters counters;
if (squelch) gpr_set_log_function(dont_log);
if (leak_check) grpc_memory_counters_init();
diff --git a/test/core/security/verify_jwt.c b/test/core/security/verify_jwt.cc
index 08adb6e463..e0e22d16f9 100644
--- a/test/core/security/verify_jwt.c
+++ b/test/core/security/verify_jwt.cc
@@ -47,7 +47,7 @@ static void print_usage_and_exit(gpr_cmdline* cl, const char* argv0) {
static void on_jwt_verification_done(grpc_exec_ctx* exec_ctx, void* user_data,
grpc_jwt_verifier_status status,
grpc_jwt_claims* claims) {
- synchronizer* sync = user_data;
+ synchronizer* sync = static_cast<synchronizer*>(user_data);
sync->success = (status == GRPC_JWT_VERIFIER_OK);
if (sync->success) {
@@ -75,8 +75,8 @@ int main(int argc, char** argv) {
synchronizer sync;
grpc_jwt_verifier* verifier;
gpr_cmdline* cl;
- char* jwt = NULL;
- char* aud = NULL;
+ const char* jwt = NULL;
+ const char* aud = NULL;
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_init();
@@ -92,7 +92,7 @@ int main(int argc, char** argv) {
grpc_init();
- sync.pollset = gpr_zalloc(grpc_pollset_size());
+ sync.pollset = static_cast<grpc_pollset*>(gpr_zalloc(grpc_pollset_size()));
grpc_pollset_init(sync.pollset, &sync.mu);
sync.is_done = 0;
diff --git a/test/core/slice/BUILD b/test/core/slice/BUILD
index ad2308a4d6..ba2b553e0b 100644
--- a/test/core/slice/BUILD
+++ b/test/core/slice/BUILD
@@ -22,8 +22,8 @@ load("//test/core/util:grpc_fuzzer.bzl", "grpc_fuzzer")
grpc_fuzzer(
name = "percent_encode_fuzzer",
- srcs = ["percent_encode_fuzzer.c"],
- language = "C",
+ srcs = ["percent_encode_fuzzer.cc"],
+ language = "C++",
corpus = "percent_encode_corpus",
deps = [
"//:gpr",
@@ -34,8 +34,8 @@ grpc_fuzzer(
grpc_fuzzer(
name = "percent_decode_fuzzer",
- srcs = ["percent_decode_fuzzer.c"],
- language = "C",
+ srcs = ["percent_decode_fuzzer.cc"],
+ language = "C++",
corpus = "percent_decode_corpus",
deps = [
"//:gpr",
@@ -46,8 +46,8 @@ grpc_fuzzer(
grpc_cc_test(
name = "percent_encoding_test",
- srcs = ["percent_encoding_test.c"],
- language = "C",
+ srcs = ["percent_encoding_test.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//:grpc",
@@ -58,15 +58,15 @@ grpc_cc_test(
grpc_cc_test(
name = "slice_test",
- srcs = ["slice_test.c"],
+ srcs = ["slice_test.cc"],
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"],
- language = "C",
+ language = "C++",
)
grpc_cc_test(
name = "slice_string_helpers_test",
- srcs = ["slice_string_helpers_test.c"],
- language = "C",
+ srcs = ["slice_string_helpers_test.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//:grpc",
@@ -77,22 +77,22 @@ grpc_cc_test(
grpc_cc_test(
name = "slice_buffer_test",
- srcs = ["slice_buffer_test.c"],
+ srcs = ["slice_buffer_test.cc"],
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"],
- language = "C",
+ language = "C++",
)
grpc_cc_test(
name = "slice_hash_table_test",
- srcs = ["slice_hash_table_test.c"],
+ srcs = ["slice_hash_table_test.cc"],
deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"],
- language = "C",
+ language = "C++",
)
grpc_cc_test(
name = "b64_test",
- srcs = ["b64_test.c"],
- language = "C",
+ srcs = ["b64_test.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//:grpc",
diff --git a/test/core/slice/b64_test.c b/test/core/slice/b64_test.cc
index 479198f9f9..479198f9f9 100644
--- a/test/core/slice/b64_test.c
+++ b/test/core/slice/b64_test.cc
diff --git a/test/core/slice/percent_decode_fuzzer.c b/test/core/slice/percent_decode_fuzzer.cc
index e6458736d3..3603177c47 100644
--- a/test/core/slice/percent_decode_fuzzer.c
+++ b/test/core/slice/percent_decode_fuzzer.cc
@@ -29,7 +29,7 @@
bool squelch = true;
bool leak_check = true;
-int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
struct grpc_memory_counters counters;
grpc_memory_counters_init();
grpc_slice input = grpc_slice_from_copied_buffer((const char*)data, size);
diff --git a/test/core/slice/percent_encode_fuzzer.c b/test/core/slice/percent_encode_fuzzer.cc
index 776a998e51..c8e3849fc8 100644
--- a/test/core/slice/percent_encode_fuzzer.c
+++ b/test/core/slice/percent_encode_fuzzer.cc
@@ -51,7 +51,7 @@ static void test(const uint8_t* data, size_t size, const uint8_t* dict) {
GPR_ASSERT(counters.total_size_relative == 0);
}
-int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
test(data, size, grpc_url_percent_encoding_unreserved_bytes);
test(data, size, grpc_compatible_percent_encoding_unreserved_bytes);
return 0;
diff --git a/test/core/slice/percent_encoding_test.c b/test/core/slice/percent_encoding_test.cc
index 253240faad..253240faad 100644
--- a/test/core/slice/percent_encoding_test.c
+++ b/test/core/slice/percent_encoding_test.cc
diff --git a/test/core/slice/slice_buffer_test.c b/test/core/slice/slice_buffer_test.cc
index 338e8079dc..338e8079dc 100644
--- a/test/core/slice/slice_buffer_test.c
+++ b/test/core/slice/slice_buffer_test.cc
diff --git a/test/core/slice/slice_hash_table_test.c b/test/core/slice/slice_hash_table_test.cc
index f3689aac64..a2006b3c10 100644
--- a/test/core/slice/slice_hash_table_test.c
+++ b/test/core/slice/slice_hash_table_test.cc
@@ -28,8 +28,8 @@
#include "test/core/util/test_config.h"
typedef struct {
- char* key;
- char* value;
+ const char* key;
+ const char* value;
} test_entry;
static void populate_entries(const test_entry* input, size_t num_entries,
@@ -44,7 +44,8 @@ static void check_values(const test_entry* input, size_t num_entries,
grpc_slice_hash_table* table) {
for (size_t i = 0; i < num_entries; ++i) {
grpc_slice key = grpc_slice_from_static_string(input[i].key);
- char* actual = grpc_slice_hash_table_get(table, key);
+ const char* actual =
+ static_cast<const char*>(grpc_slice_hash_table_get(table, key));
GPR_ASSERT(actual != NULL);
GPR_ASSERT(strcmp(actual, input[i].value) == 0);
grpc_slice_unref(key);
@@ -67,7 +68,8 @@ static grpc_slice_hash_table* create_table_from_entries(
int (*value_cmp_fn)(void*, void*)) {
// Construct table.
grpc_slice_hash_table_entry* entries =
- gpr_zalloc(sizeof(*entries) * num_test_entries);
+ static_cast<grpc_slice_hash_table_entry*>(
+ gpr_zalloc(sizeof(*entries) * num_test_entries));
populate_entries(test_entries, num_test_entries, entries);
grpc_slice_hash_table* table = grpc_slice_hash_table_create(
num_test_entries, entries, destroy_string, value_cmp_fn);
@@ -125,8 +127,8 @@ static void test_slice_hash_table() {
}
static int value_cmp_fn(void* a, void* b) {
- const char* a_str = a;
- const char* b_str = b;
+ const char* a_str = static_cast<const char*>(a);
+ const char* b_str = static_cast<const char*>(b);
return strcmp(a_str, b_str);
}
diff --git a/test/core/slice/slice_string_helpers_test.c b/test/core/slice/slice_string_helpers_test.cc
index 7378735326..260f8c80d5 100644
--- a/test/core/slice/slice_string_helpers_test.c
+++ b/test/core/slice/slice_string_helpers_test.cc
@@ -67,7 +67,8 @@ static void test_strsplit(void) {
LOG_TEST_NAME("test_strsplit");
- parts = gpr_malloc(sizeof(grpc_slice_buffer));
+ parts =
+ static_cast<grpc_slice_buffer*>(gpr_malloc(sizeof(grpc_slice_buffer)));
grpc_slice_buffer_init(parts);
str = grpc_slice_from_copied_string("one, two, three, four");
diff --git a/test/core/slice/slice_test.c b/test/core/slice/slice_test.cc
index 0a069c9ef9..aec5636376 100644
--- a/test/core/slice/slice_test.c
+++ b/test/core/slice/slice_test.cc
@@ -43,8 +43,8 @@ static void test_slice_malloc_returns_something_sensible(void) {
slice = grpc_slice_malloc(length);
/* If there is a length, slice.data must be non-NULL. If length is zero
we don't care. */
- if (length) {
- GPR_ASSERT(GRPC_SLICE_START_PTR(slice));
+ if (length > GRPC_SLICE_INLINED_SIZE) {
+ GPR_ASSERT(slice.data.refcounted.bytes);
}
/* Returned slice length must be what was requested. */
GPR_ASSERT(GRPC_SLICE_LENGTH(slice) == length);
diff --git a/test/core/statistics/census_log_tests.c b/test/core/statistics/census_log_tests.cc
index e6eda5486c..e6eda5486c 100644
--- a/test/core/statistics/census_log_tests.c
+++ b/test/core/statistics/census_log_tests.cc
diff --git a/test/core/statistics/census_stub_test.c b/test/core/statistics/census_stub_test.cc
index 507ae0a9fa..507ae0a9fa 100644
--- a/test/core/statistics/census_stub_test.c
+++ b/test/core/statistics/census_stub_test.cc
diff --git a/test/core/statistics/hash_table_test.c b/test/core/statistics/hash_table_test.cc
index 0f6147a095..b660006b8a 100644
--- a/test/core/statistics/hash_table_test.c
+++ b/test/core/statistics/hash_table_test.cc
@@ -89,7 +89,7 @@ static void test_table_with_int_key(void) {
uint64_t* val = NULL;
census_ht_key key;
key.val = i;
- val = census_ht_find(ht, key);
+ val = static_cast<uint64_t*>(census_ht_find(ht, key));
GPR_ASSERT(val == (void*)(intptr_t)i);
}
elements = census_ht_get_all_elements(ht, &num_elements);
@@ -112,22 +112,22 @@ static void test_value_and_key_deleter(void) {
char* val = NULL;
char* val2 = NULL;
key.ptr = gpr_malloc(100);
- val = gpr_malloc(10);
+ val = static_cast<char*>(gpr_malloc(10));
strcpy(val, "value");
strcpy(key.ptr, "some string as a key");
GPR_ASSERT(ht != NULL);
GPR_ASSERT(census_ht_get_size(ht) == 0);
census_ht_insert(ht, key, val);
GPR_ASSERT(census_ht_get_size(ht) == 1);
- val = census_ht_find(ht, key);
+ val = static_cast<char*>(census_ht_find(ht, key));
GPR_ASSERT(val != NULL);
GPR_ASSERT(strcmp(val, "value") == 0);
/* Insert same key different value, old value is overwritten. */
- val2 = gpr_malloc(10);
+ val2 = static_cast<char*>(gpr_malloc(10));
strcpy(val2, "v2");
census_ht_insert(ht, key, val2);
GPR_ASSERT(census_ht_get_size(ht) == 1);
- val2 = census_ht_find(ht, key);
+ val2 = static_cast<char*>(census_ht_find(ht, key));
GPR_ASSERT(val2 != NULL);
GPR_ASSERT(strcmp(val2, "v2") == 0);
census_ht_destroy(ht);
@@ -214,7 +214,7 @@ static void test_table_with_string_key(void) {
census_ht_key key;
int* val_ptr;
key.ptr = (void*)(keys[i]);
- val_ptr = census_ht_find(ht, key);
+ val_ptr = static_cast<int*>(census_ht_find(ht, key));
GPR_ASSERT(*val_ptr == vals[i]);
}
{
@@ -225,7 +225,7 @@ static void test_table_with_string_key(void) {
census_ht_insert(ht, key, (void*)(vals + 8));
/* expect value to be over written by new insertion */
GPR_ASSERT(census_ht_get_size(ht) == 9);
- val_ptr = census_ht_find(ht, key);
+ val_ptr = static_cast<int*>(census_ht_find(ht, key));
GPR_ASSERT(*val_ptr == vals[8]);
}
for (i = 0; i < 9; i++) {
@@ -234,11 +234,11 @@ static void test_table_with_string_key(void) {
uint32_t expected_tbl_sz = 9 - i;
GPR_ASSERT(census_ht_get_size(ht) == expected_tbl_sz);
key.ptr = (void*)(keys[i]);
- val_ptr = census_ht_find(ht, key);
+ val_ptr = static_cast<int*>(census_ht_find(ht, key));
GPR_ASSERT(val_ptr != NULL);
census_ht_erase(ht, key);
GPR_ASSERT(census_ht_get_size(ht) == expected_tbl_sz - 1);
- val_ptr = census_ht_find(ht, key);
+ val_ptr = static_cast<int*>(census_ht_find(ht, key));
GPR_ASSERT(val_ptr == NULL);
}
census_ht_destroy(ht);
diff --git a/test/core/statistics/multiple_writers_circular_buffer_test.c b/test/core/statistics/multiple_writers_circular_buffer_test.cc
index 6d3411289e..6d3411289e 100644
--- a/test/core/statistics/multiple_writers_circular_buffer_test.c
+++ b/test/core/statistics/multiple_writers_circular_buffer_test.cc
diff --git a/test/core/statistics/multiple_writers_test.c b/test/core/statistics/multiple_writers_test.cc
index 47410ab105..47410ab105 100644
--- a/test/core/statistics/multiple_writers_test.c
+++ b/test/core/statistics/multiple_writers_test.cc
diff --git a/test/core/statistics/performance_test.c b/test/core/statistics/performance_test.cc
index 9d4fd6ef90..9d4fd6ef90 100644
--- a/test/core/statistics/performance_test.c
+++ b/test/core/statistics/performance_test.cc
diff --git a/test/core/statistics/quick_test.c b/test/core/statistics/quick_test.cc
index 91ecdde818..91ecdde818 100644
--- a/test/core/statistics/quick_test.c
+++ b/test/core/statistics/quick_test.cc
diff --git a/test/core/statistics/rpc_stats_test.c b/test/core/statistics/rpc_stats_test.cc
index aead5cfdca..aead5cfdca 100644
--- a/test/core/statistics/rpc_stats_test.c
+++ b/test/core/statistics/rpc_stats_test.cc
diff --git a/test/core/statistics/small_log_test.c b/test/core/statistics/small_log_test.cc
index fb8dfc9988..fb8dfc9988 100644
--- a/test/core/statistics/small_log_test.c
+++ b/test/core/statistics/small_log_test.cc
diff --git a/test/core/statistics/trace_test.c b/test/core/statistics/trace_test.cc
index ecbfed09ee..ecbfed09ee 100644
--- a/test/core/statistics/trace_test.c
+++ b/test/core/statistics/trace_test.cc
diff --git a/test/core/statistics/window_stats_test.c b/test/core/statistics/window_stats_test.cc
index 457004bbd0..b17c61a47b 100644
--- a/test/core/statistics/window_stats_test.c
+++ b/test/core/statistics/window_stats_test.cc
@@ -44,11 +44,11 @@ void add_proportion_test_stat(double p, void* base, const void* addme) {
const struct census_window_stats_stat_info kMyStatInfo = {
sizeof(test_stat), NULL, add_test_stat, add_proportion_test_stat};
-const gpr_timespec kMilliSecInterval = {0, 1000000};
-const gpr_timespec kSecInterval = {1, 0};
-const gpr_timespec kMinInterval = {60, 0};
-const gpr_timespec kHourInterval = {3600, 0};
-const gpr_timespec kPrimeInterval = {0, 101};
+const gpr_timespec kMilliSecInterval = {0, 1000000, GPR_CLOCK_MONOTONIC};
+const gpr_timespec kSecInterval = {1, 0, GPR_CLOCK_MONOTONIC};
+const gpr_timespec kMinInterval = {60, 0 GPR_CLOCK_MONOTONIC};
+const gpr_timespec kHourInterval = {3600, 0, GPR_CLOCK_MONOTONIC};
+const gpr_timespec kPrimeInterval = {0, 101, GPR_CLOCK_MONOTONIC};
static int compare_double(double a, double b, double epsilon) {
if (a >= b) {
@@ -60,7 +60,7 @@ static int compare_double(double a, double b, double epsilon) {
void empty_test(void) {
census_window_stats_sums result;
- const gpr_timespec zero = {0, 0};
+ const gpr_timespec zero = {0, 0, GPR_CLOCK_MONOTONIC};
test_stat sum;
struct census_window_stats* stats =
census_window_stats_create(1, &kMinInterval, 5, &kMyStatInfo);
@@ -76,7 +76,7 @@ void empty_test(void) {
void one_interval_test(void) {
const test_stat value = {0.1, 4};
const double epsilon = 1e10 - 11;
- gpr_timespec when = {0, 0};
+ gpr_timespec when = {0, 0, GPR_CLOCK_MONOTONIC};
census_window_stats_sums result;
test_stat sum;
/* granularity == 5 so width of internal windows should be 12s */
@@ -186,7 +186,7 @@ void many_interval_test(void) {
gpr_timespec intervals[4];
const test_stat value = {123.45, 8};
const double epsilon = 1e10 - 11;
- gpr_timespec when = {3600, 0}; /* one hour */
+ gpr_timespec when = {3600, 0, GPR_CLOCK_MONOTONIC}; /* one hour */
census_window_stats_sums result[4];
test_stat sums[4];
int i;
@@ -245,11 +245,11 @@ void many_interval_test(void) {
void rolling_time_test(void) {
const test_stat value = {0.1, 4};
- gpr_timespec when = {0, 0};
+ gpr_timespec when = {0, 0, GPR_CLOCK_MONOTONIC};
census_window_stats_sums result;
test_stat sum;
int i;
- gpr_timespec increment = {0, 0};
+ gpr_timespec increment = {0, 0, GPR_CLOCK_MONOTONIC};
struct census_window_stats* stats =
census_window_stats_create(1, &kMinInterval, 7, &kMyStatInfo);
GPR_ASSERT(stats != NULL);
@@ -270,12 +270,13 @@ void rolling_time_test(void) {
#include <stdio.h>
void infinite_interval_test(void) {
const test_stat value = {0.1, 4};
- gpr_timespec when = {0, 0};
+ gpr_timespec when = {0, 0, GPR_CLOCK_MONOTONIC};
census_window_stats_sums result;
test_stat sum;
int i;
const int count = 100000;
- gpr_timespec increment = {0, 0};
+ gpr_timespec increment = {0, 0, GPR_CLOCK_MONOTONIC};
+ gpr_timespec temp = gpr_inf_future(GPR_CLOCK_REALTIME);
struct census_window_stats* stats = census_window_stats_create(
1, &gpr_inf_future(GPR_CLOCK_REALTIME), 10, &kMyStatInfo);
srand(gpr_now(GPR_CLOCK_REALTIME).tv_nsec);
diff --git a/test/core/support/BUILD b/test/core/support/BUILD
index 3bdc1c4186..9d042fdc9f 100644
--- a/test/core/support/BUILD
+++ b/test/core/support/BUILD
@@ -20,8 +20,8 @@ grpc_package(name = "test/core/support")
grpc_cc_test(
name = "alloc_test",
- srcs = ["alloc_test.c"],
- language = "C",
+ srcs = ["alloc_test.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//test/core/util:gpr_test_util",
@@ -30,8 +30,8 @@ grpc_cc_test(
grpc_cc_test(
name = "avl_test",
- srcs = ["avl_test.c"],
- language = "C",
+ srcs = ["avl_test.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//test/core/util:gpr_test_util",
@@ -40,8 +40,8 @@ grpc_cc_test(
grpc_cc_test(
name = "cmdline_test",
- srcs = ["cmdline_test.c"],
- language = "C",
+ srcs = ["cmdline_test.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//test/core/util:gpr_test_util",
@@ -50,8 +50,8 @@ grpc_cc_test(
grpc_cc_test(
name = "cpu_test",
- srcs = ["cpu_test.c"],
- language = "C",
+ srcs = ["cpu_test.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//test/core/util:gpr_test_util",
@@ -60,8 +60,8 @@ grpc_cc_test(
grpc_cc_test(
name = "env_test",
- srcs = ["env_test.c"],
- language = "C",
+ srcs = ["env_test.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//test/core/util:gpr_test_util",
@@ -70,8 +70,8 @@ grpc_cc_test(
grpc_cc_test(
name = "histogram_test",
- srcs = ["histogram_test.c"],
- language = "C",
+ srcs = ["histogram_test.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//test/core/util:gpr_test_util",
@@ -80,8 +80,8 @@ grpc_cc_test(
grpc_cc_test(
name = "host_port_test",
- srcs = ["host_port_test.c"],
- language = "C",
+ srcs = ["host_port_test.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//test/core/util:gpr_test_util",
@@ -90,8 +90,8 @@ grpc_cc_test(
grpc_cc_test(
name = "log_test",
- srcs = ["log_test.c"],
- language = "C",
+ srcs = ["log_test.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//test/core/util:gpr_test_util",
@@ -100,8 +100,8 @@ grpc_cc_test(
grpc_cc_test(
name = "mpscq_test",
- srcs = ["mpscq_test.c"],
- language = "C",
+ srcs = ["mpscq_test.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//test/core/util:gpr_test_util",
@@ -110,8 +110,8 @@ grpc_cc_test(
grpc_cc_test(
name = "murmur_hash_test",
- srcs = ["murmur_hash_test.c"],
- language = "C",
+ srcs = ["murmur_hash_test.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//test/core/util:gpr_test_util",
@@ -120,8 +120,8 @@ grpc_cc_test(
grpc_cc_test(
name = "stack_lockfree_test",
- srcs = ["stack_lockfree_test.c"],
- language = "C",
+ srcs = ["stack_lockfree_test.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//test/core/util:gpr_test_util",
@@ -130,8 +130,8 @@ grpc_cc_test(
grpc_cc_test(
name = "string_test",
- srcs = ["string_test.c"],
- language = "C",
+ srcs = ["string_test.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//test/core/util:gpr_test_util",
@@ -140,8 +140,8 @@ grpc_cc_test(
grpc_cc_test(
name = "spinlock_test",
- srcs = ["spinlock_test.c"],
- language = "C",
+ srcs = ["spinlock_test.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//test/core/util:gpr_test_util",
@@ -150,8 +150,8 @@ grpc_cc_test(
grpc_cc_test(
name = "sync_test",
- srcs = ["sync_test.c"],
- language = "C",
+ srcs = ["sync_test.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//test/core/util:gpr_test_util",
@@ -160,8 +160,8 @@ grpc_cc_test(
grpc_cc_test(
name = "thd_test",
- srcs = ["thd_test.c"],
- language = "C",
+ srcs = ["thd_test.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//test/core/util:gpr_test_util",
@@ -170,8 +170,8 @@ grpc_cc_test(
grpc_cc_test(
name = "time_test",
- srcs = ["time_test.c"],
- language = "C",
+ srcs = ["time_test.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//test/core/util:gpr_test_util",
@@ -180,8 +180,8 @@ grpc_cc_test(
grpc_cc_test(
name = "tls_test",
- srcs = ["tls_test.c"],
- language = "C",
+ srcs = ["tls_test.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//test/core/util:gpr_test_util",
@@ -190,8 +190,8 @@ grpc_cc_test(
grpc_cc_test(
name = "useful_test",
- srcs = ["useful_test.c"],
- language = "C",
+ srcs = ["useful_test.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//test/core/util:gpr_test_util",
diff --git a/test/core/support/alloc_test.c b/test/core/support/alloc_test.cc
index 37f2c2ef42..ee590366b9 100644
--- a/test/core/support/alloc_test.c
+++ b/test/core/support/alloc_test.cc
@@ -41,8 +41,9 @@ static void test_custom_allocs() {
/* Restore and check we don't get funky values and that we don't leak */
gpr_set_allocation_functions(default_fns);
- GPR_ASSERT((void*)sizeof(*i) != (i = gpr_malloc(sizeof(*i))));
- GPR_ASSERT((void*)2 != (i = gpr_realloc(i, 2)));
+ GPR_ASSERT((void*)sizeof(*i) !=
+ (i = static_cast<char*>(gpr_malloc(sizeof(*i)))));
+ GPR_ASSERT((void*)2 != (i = static_cast<char*>(gpr_realloc(i, 2))));
gpr_free(i);
}
diff --git a/test/core/support/arena_test.c b/test/core/support/arena_test.cc
index d198c4053d..6c666af096 100644
--- a/test/core/support/arena_test.c
+++ b/test/core/support/arena_test.cc
@@ -50,7 +50,7 @@ static void test(const char* name, size_t init_size, const size_t* allocs,
gpr_free(s);
gpr_arena* a = gpr_arena_create(init_size);
- void** ps = gpr_zalloc(sizeof(*ps) * nallocs);
+ void** ps = static_cast<void**>(gpr_zalloc(sizeof(*ps) * nallocs));
for (size_t i = 0; i < nallocs; i++) {
ps[i] = gpr_arena_alloc(a, allocs[i]);
// ensure no duplicate results
@@ -81,7 +81,7 @@ typedef struct {
} concurrent_test_args;
static void concurrent_test_body(void* arg) {
- concurrent_test_args* a = arg;
+ concurrent_test_args* a = static_cast<concurrent_test_args*>(arg);
gpr_event_wait(&a->ev_start, gpr_inf_future(GPR_CLOCK_REALTIME));
for (size_t i = 0; i < concurrent_test_iterations(); i++) {
*(char*)gpr_arena_alloc(a->arena, 1) = (char)i;
diff --git a/test/core/support/avl_test.c b/test/core/support/avl_test.cc
index bd7487f6da..cd3a852e9d 100644
--- a/test/core/support/avl_test.c
+++ b/test/core/support/avl_test.cc
@@ -28,7 +28,7 @@
#include "test/core/util/test_config.h"
static int* box(int x) {
- int* b = gpr_malloc(sizeof(*b));
+ int* b = static_cast<int*>(gpr_malloc(sizeof(*b)));
*b = x;
return b;
}
diff --git a/test/core/support/cmdline_test.c b/test/core/support/cmdline_test.cc
index 8d6a372c13..5afaa2a60a 100644
--- a/test/core/support/cmdline_test.c
+++ b/test/core/support/cmdline_test.cc
@@ -30,7 +30,8 @@
static void test_simple_int(void) {
int x = 1;
gpr_cmdline* cl;
- char* args[] = {(char*)__FILE__, "-foo", "3"};
+ char* args[] = {(char*)__FILE__, const_cast<char*>("-foo"),
+ const_cast<char*>("3")};
LOG_TEST();
@@ -45,7 +46,7 @@ static void test_simple_int(void) {
static void test_eq_int(void) {
int x = 1;
gpr_cmdline* cl;
- char* args[] = {(char*)__FILE__, "-foo=3"};
+ char* args[] = {(char*)__FILE__, const_cast<char*>("-foo=3")};
LOG_TEST();
@@ -60,7 +61,8 @@ static void test_eq_int(void) {
static void test_2dash_int(void) {
int x = 1;
gpr_cmdline* cl;
- char* args[] = {(char*)__FILE__, "--foo", "3"};
+ char* args[] = {(char*)__FILE__, const_cast<char*>("--foo"),
+ const_cast<char*>("3")};
LOG_TEST();
@@ -75,7 +77,7 @@ static void test_2dash_int(void) {
static void test_2dash_eq_int(void) {
int x = 1;
gpr_cmdline* cl;
- char* args[] = {(char*)__FILE__, "--foo=3"};
+ char* args[] = {(char*)__FILE__, const_cast<char*>("--foo=3")};
LOG_TEST();
@@ -88,9 +90,10 @@ static void test_2dash_eq_int(void) {
}
static void test_simple_string(void) {
- char* x = NULL;
+ const char* x = NULL;
gpr_cmdline* cl;
- char* args[] = {(char*)__FILE__, "-foo", "3"};
+ char* args[] = {(char*)__FILE__, const_cast<char*>("-foo"),
+ const_cast<char*>("3")};
LOG_TEST();
@@ -103,9 +106,9 @@ static void test_simple_string(void) {
}
static void test_eq_string(void) {
- char* x = NULL;
+ const char* x = NULL;
gpr_cmdline* cl;
- char* args[] = {(char*)__FILE__, "-foo=3"};
+ char* args[] = {(char*)__FILE__, const_cast<char*>("-foo=3")};
LOG_TEST();
@@ -118,9 +121,10 @@ static void test_eq_string(void) {
}
static void test_2dash_string(void) {
- char* x = NULL;
+ const char* x = NULL;
gpr_cmdline* cl;
- char* args[] = {(char*)__FILE__, "--foo", "3"};
+ char* args[] = {(char*)__FILE__, const_cast<char*>("--foo"),
+ const_cast<char*>("3")};
LOG_TEST();
@@ -133,9 +137,9 @@ static void test_2dash_string(void) {
}
static void test_2dash_eq_string(void) {
- char* x = NULL;
+ const char* x = NULL;
gpr_cmdline* cl;
- char* args[] = {(char*)__FILE__, "--foo=3"};
+ char* args[] = {(char*)__FILE__, const_cast<char*>("--foo=3")};
LOG_TEST();
@@ -150,7 +154,7 @@ static void test_2dash_eq_string(void) {
static void test_flag_on(void) {
int x = 2;
gpr_cmdline* cl;
- char* args[] = {(char*)__FILE__, "--foo"};
+ char* args[] = {(char*)__FILE__, const_cast<char*>("--foo")};
LOG_TEST();
@@ -165,7 +169,7 @@ static void test_flag_on(void) {
static void test_flag_no(void) {
int x = 2;
gpr_cmdline* cl;
- char* args[] = {(char*)__FILE__, "--no-foo"};
+ char* args[] = {(char*)__FILE__, const_cast<char*>("--no-foo")};
LOG_TEST();
@@ -180,7 +184,7 @@ static void test_flag_no(void) {
static void test_flag_val_1(void) {
int x = 2;
gpr_cmdline* cl;
- char* args[] = {(char*)__FILE__, "--foo=1"};
+ char* args[] = {(char*)__FILE__, const_cast<char*>("--foo=1")};
LOG_TEST();
@@ -195,7 +199,7 @@ static void test_flag_val_1(void) {
static void test_flag_val_0(void) {
int x = 2;
gpr_cmdline* cl;
- char* args[] = {(char*)__FILE__, "--foo=0"};
+ char* args[] = {(char*)__FILE__, const_cast<char*>("--foo=0")};
LOG_TEST();
@@ -210,7 +214,7 @@ static void test_flag_val_0(void) {
static void test_flag_val_true(void) {
int x = 2;
gpr_cmdline* cl;
- char* args[] = {(char*)__FILE__, "--foo=true"};
+ char* args[] = {(char*)__FILE__, const_cast<char*>("--foo=true")};
LOG_TEST();
@@ -225,7 +229,7 @@ static void test_flag_val_true(void) {
static void test_flag_val_false(void) {
int x = 2;
gpr_cmdline* cl;
- char* args[] = {(char*)__FILE__, "--foo=false"};
+ char* args[] = {(char*)__FILE__, const_cast<char*>("--foo=false")};
LOG_TEST();
@@ -238,12 +242,14 @@ static void test_flag_val_false(void) {
}
static void test_many(void) {
- char* str = NULL;
+ const char* str = NULL;
int x = 0;
int flag = 2;
gpr_cmdline* cl;
- char* args[] = {(char*)__FILE__, "--str", "hello", "-x=4", "-no-flag"};
+ char* args[] = {(char*)__FILE__, const_cast<char*>("--str"),
+ const_cast<char*>("hello"), const_cast<char*>("-x=4"),
+ const_cast<char*>("-no-flag")};
LOG_TEST();
@@ -259,7 +265,7 @@ static void test_many(void) {
}
static void extra_arg_cb(void* user_data, const char* arg) {
- int* count = user_data;
+ int* count = static_cast<int*>(user_data);
GPR_ASSERT(arg != NULL);
GPR_ASSERT(strlen(arg) == 1);
GPR_ASSERT(arg[0] == 'a' + *count);
@@ -269,7 +275,8 @@ static void extra_arg_cb(void* user_data, const char* arg) {
static void test_extra(void) {
gpr_cmdline* cl;
int count = 0;
- char* args[] = {(char*)__FILE__, "a", "b", "c"};
+ char* args[] = {(char*)__FILE__, const_cast<char*>("a"),
+ const_cast<char*>("b"), const_cast<char*>("c")};
LOG_TEST();
@@ -284,7 +291,9 @@ static void test_extra(void) {
static void test_extra_dashdash(void) {
gpr_cmdline* cl;
int count = 0;
- char* args[] = {(char*)__FILE__, "--", "a", "b", "c"};
+ char* args[] = {(char*)__FILE__, const_cast<char*>("--"),
+ const_cast<char*>("a"), const_cast<char*>("b"),
+ const_cast<char*>("c")};
LOG_TEST();
@@ -300,7 +309,7 @@ static void test_usage(void) {
gpr_cmdline* cl;
char* usage;
- char* str = NULL;
+ const char* str = NULL;
int x = 0;
int flag = 2;
@@ -331,11 +340,11 @@ static void test_usage(void) {
static void test_help(void) {
gpr_cmdline* cl;
- char* str = NULL;
+ const char* str = NULL;
int x = 0;
int flag = 2;
- char* help[] = {(char*)__FILE__, "-h"};
+ char* help[] = {(char*)__FILE__, const_cast<char*>("-h")};
LOG_TEST();
@@ -355,11 +364,11 @@ static void test_help(void) {
static void test_badargs1(void) {
gpr_cmdline* cl;
- char* str = NULL;
+ const char* str = NULL;
int x = 0;
int flag = 2;
- char* bad_arg_name[] = {(char*)__FILE__, "--y"};
+ char* bad_arg_name[] = {(char*)__FILE__, const_cast<char*>("--y")};
LOG_TEST();
@@ -380,11 +389,12 @@ static void test_badargs1(void) {
static void test_badargs2(void) {
gpr_cmdline* cl;
- char* str = NULL;
+ const char* str = NULL;
int x = 0;
int flag = 2;
- char* bad_int_value[] = {(char*)__FILE__, "--x", "henry"};
+ char* bad_int_value[] = {(char*)__FILE__, const_cast<char*>("--x"),
+ const_cast<char*>("henry")};
LOG_TEST();
@@ -405,11 +415,11 @@ static void test_badargs2(void) {
static void test_badargs3(void) {
gpr_cmdline* cl;
- char* str = NULL;
+ const char* str = NULL;
int x = 0;
int flag = 2;
- char* bad_bool_value[] = {(char*)__FILE__, "--flag=henry"};
+ char* bad_bool_value[] = {(char*)__FILE__, const_cast<char*>("--flag=henry")};
LOG_TEST();
@@ -430,11 +440,11 @@ static void test_badargs3(void) {
static void test_badargs4(void) {
gpr_cmdline* cl;
- char* str = NULL;
+ const char* str = NULL;
int x = 0;
int flag = 2;
- char* bad_bool_value[] = {(char*)__FILE__, "--no-str"};
+ char* bad_bool_value[] = {(char*)__FILE__, const_cast<char*>("--no-str")};
LOG_TEST();
diff --git a/test/core/support/cpu_test.c b/test/core/support/cpu_test.cc
index 3c49486651..a76531ead9 100644
--- a/test/core/support/cpu_test.c
+++ b/test/core/support/cpu_test.cc
@@ -104,7 +104,7 @@ static void cpu_test(void) {
ct.ncores = gpr_cpu_num_cores();
GPR_ASSERT(ct.ncores > 0);
ct.nthreads = (int)ct.ncores * 3;
- ct.used = gpr_malloc(ct.ncores * sizeof(int));
+ ct.used = static_cast<int*>(gpr_malloc(ct.ncores * sizeof(int)));
memset(ct.used, 0, ct.ncores * sizeof(int));
gpr_mu_init(&ct.mu);
gpr_cv_init(&ct.done_cv);
diff --git a/test/core/support/env_test.c b/test/core/support/env_test.cc
index 54009536b4..54009536b4 100644
--- a/test/core/support/env_test.c
+++ b/test/core/support/env_test.cc
diff --git a/test/core/support/histogram_test.c b/test/core/support/histogram_test.cc
index 86b7d599e6..86b7d599e6 100644
--- a/test/core/support/histogram_test.c
+++ b/test/core/support/histogram_test.cc
diff --git a/test/core/support/host_port_test.c b/test/core/support/host_port_test.cc
index 42dd56524f..42dd56524f 100644
--- a/test/core/support/host_port_test.c
+++ b/test/core/support/host_port_test.cc
diff --git a/test/core/support/log_test.c b/test/core/support/log_test.cc
index 9602bbb090..9602bbb090 100644
--- a/test/core/support/log_test.c
+++ b/test/core/support/log_test.cc
diff --git a/test/core/support/mpscq_test.c b/test/core/support/mpscq_test.cc
index c71132bde9..d5b7bf21c1 100644
--- a/test/core/support/mpscq_test.c
+++ b/test/core/support/mpscq_test.cc
@@ -34,7 +34,7 @@ typedef struct test_node {
} test_node;
static test_node* new_node(size_t i, size_t* ctr) {
- test_node* n = gpr_malloc(sizeof(test_node));
+ test_node* n = static_cast<test_node*>(gpr_malloc(sizeof(test_node)));
n->i = i;
n->ctr = ctr;
return n;
@@ -64,7 +64,7 @@ typedef struct {
#define THREAD_ITERATIONS 10000
static void test_thread(void* args) {
- thd_args* a = args;
+ thd_args* a = static_cast<thd_args*>(args);
gpr_event_wait(a->start, gpr_inf_future(GPR_CLOCK_REALTIME));
for (size_t i = 1; i <= THREAD_ITERATIONS; i++) {
gpr_mpscq_push(a->q, &new_node(i, &a->ctr)->node);
@@ -119,7 +119,7 @@ typedef struct {
} pull_args;
static void pull_thread(void* arg) {
- pull_args* pa = arg;
+ pull_args* pa = static_cast<pull_args*>(arg);
gpr_event_wait(pa->start, gpr_inf_future(GPR_CLOCK_REALTIME));
for (;;) {
diff --git a/test/core/support/murmur_hash_test.c b/test/core/support/murmur_hash_test.cc
index 461c728951..461c728951 100644
--- a/test/core/support/murmur_hash_test.c
+++ b/test/core/support/murmur_hash_test.cc
diff --git a/test/core/support/spinlock_test.c b/test/core/support/spinlock_test.cc
index 185538ee93..3639802cd7 100644
--- a/test/core/support/spinlock_test.c
+++ b/test/core/support/spinlock_test.cc
@@ -43,9 +43,10 @@ struct test {
/* Return pointer to a new struct test. */
static struct test* test_new(int threads, int64_t iterations, int incr_step) {
- struct test* m = gpr_malloc(sizeof(*m));
+ struct test* m = static_cast<struct test*>(gpr_malloc(sizeof(*m)));
m->thread_count = threads;
- m->threads = gpr_malloc(sizeof(*m->threads) * (size_t)threads);
+ m->threads = static_cast<gpr_thd_id*>(
+ gpr_malloc(sizeof(*m->threads) * (size_t)threads));
m->iterations = iterations;
m->counter = 0;
m->thread_count = 0;
@@ -113,7 +114,7 @@ static void test(const char* name, void (*body)(void* m), int timeout_s,
/* Increment m->counter on each iteration; then mark thread as done. */
static void inc(void* v /*=m*/) {
- struct test* m = v;
+ struct test* m = static_cast<struct test*>(v);
int64_t i;
for (i = 0; i != m->iterations; i++) {
gpr_spinlock_lock(&m->mu);
@@ -125,7 +126,7 @@ static void inc(void* v /*=m*/) {
/* Increment m->counter under lock acquired with trylock, m->iterations times;
then mark thread as done. */
static void inctry(void* v /*=m*/) {
- struct test* m = v;
+ struct test* m = static_cast<struct test*>(v);
int64_t i;
for (i = 0; i != m->iterations;) {
if (gpr_spinlock_trylock(&m->mu)) {
diff --git a/test/core/support/stack_lockfree_test.c b/test/core/support/stack_lockfree_test.cc
index e6d0c9b795..e6d0c9b795 100644
--- a/test/core/support/stack_lockfree_test.c
+++ b/test/core/support/stack_lockfree_test.cc
diff --git a/test/core/support/string_test.c b/test/core/support/string_test.cc
index 4bae158a15..4bae158a15 100644
--- a/test/core/support/string_test.c
+++ b/test/core/support/string_test.cc
diff --git a/test/core/support/sync_test.c b/test/core/support/sync_test.cc
index b4436f7bba..416e94d06d 100644
--- a/test/core/support/sync_test.c
+++ b/test/core/support/sync_test.cc
@@ -157,7 +157,7 @@ struct test {
/* Return pointer to a new struct test. */
static struct test* test_new(int threads, int64_t iterations, int incr_step) {
- struct test* m = gpr_malloc(sizeof(*m));
+ struct test* m = static_cast<struct test*>(gpr_malloc(sizeof(*m)));
m->threads = threads;
m->iterations = iterations;
m->counter = 0;
@@ -263,7 +263,7 @@ static void test(const char* name, void (*body)(void* m),
/* Increment m->counter on each iteration; then mark thread as done. */
static void inc(void* v /*=m*/) {
- struct test* m = v;
+ struct test* m = static_cast<struct test*>(v);
int64_t i;
for (i = 0; i != m->iterations; i++) {
gpr_mu_lock(&m->mu);
@@ -276,7 +276,7 @@ static void inc(void* v /*=m*/) {
/* Increment m->counter under lock acquired with trylock, m->iterations times;
then mark thread as done. */
static void inctry(void* v /*=m*/) {
- struct test* m = v;
+ struct test* m = static_cast<struct test*>(v);
int64_t i;
for (i = 0; i != m->iterations;) {
if (gpr_mu_trylock(&m->mu)) {
@@ -291,7 +291,7 @@ static void inctry(void* v /*=m*/) {
/* Increment counter only when (m->counter%m->threads)==m->thread_id; then mark
thread as done. */
static void inc_by_turns(void* v /*=m*/) {
- struct test* m = v;
+ struct test* m = static_cast<struct test*>(v);
int64_t i;
int id = thread_id(m);
for (i = 0; i != m->iterations; i++) {
@@ -309,7 +309,7 @@ static void inc_by_turns(void* v /*=m*/) {
/* Wait a millisecond and increment counter on each iteration;
then mark thread as done. */
static void inc_with_1ms_delay(void* v /*=m*/) {
- struct test* m = v;
+ struct test* m = static_cast<struct test*>(v);
int64_t i;
for (i = 0; i != m->iterations; i++) {
gpr_timespec deadline;
@@ -327,7 +327,7 @@ static void inc_with_1ms_delay(void* v /*=m*/) {
/* Wait a millisecond and increment counter on each iteration, using an event
for timing; then mark thread as done. */
static void inc_with_1ms_delay_event(void* v /*=m*/) {
- struct test* m = v;
+ struct test* m = static_cast<struct test*>(v);
int64_t i;
for (i = 0; i != m->iterations; i++) {
gpr_timespec deadline;
@@ -345,7 +345,7 @@ static void inc_with_1ms_delay_event(void* v /*=m*/) {
Even threads use queue_append(), and odd threads use queue_try_append()
until it succeeds. */
static void many_producers(void* v /*=m*/) {
- struct test* m = v;
+ struct test* m = static_cast<struct test*>(v);
int64_t i;
int x = thread_id(m);
if ((x & 1) == 0) {
@@ -365,7 +365,7 @@ static void many_producers(void* v /*=m*/) {
wait an extra second to confirm that no more elements are arriving,
then mark thread as done. */
static void consumer(void* v /*=m*/) {
- struct test* m = v;
+ struct test* m = static_cast<struct test*>(v);
int64_t n = m->iterations * m->threads;
int64_t i;
int value;
@@ -385,7 +385,7 @@ static void consumer(void* v /*=m*/) {
/* Increment m->stats_counter m->iterations times, transfer counter value to
m->counter, then mark thread as done. */
static void statsinc(void* v /*=m*/) {
- struct test* m = v;
+ struct test* m = static_cast<struct test*>(v);
int64_t i;
for (i = 0; i != m->iterations; i++) {
gpr_stats_inc(&m->stats_counter, 1);
@@ -400,7 +400,7 @@ static void statsinc(void* v /*=m*/) {
m->thread_refcount once, and if it reaches zero, set m->event to (void*)1;
then mark thread as done. */
static void refinc(void* v /*=m*/) {
- struct test* m = v;
+ struct test* m = static_cast<struct test*>(v);
int64_t i;
for (i = 0; i != m->iterations; i++) {
if (m->incr_step == 1) {
@@ -419,7 +419,7 @@ static void refinc(void* v /*=m*/) {
(m->threads * m->iterations * m->incr_step) times, and ensure that the last
decrement caused the counter to reach zero, then mark thread as done. */
static void refcheck(void* v /*=m*/) {
- struct test* m = v;
+ struct test* m = static_cast<struct test*>(v);
int64_t n = m->iterations * m->threads * m->incr_step;
int64_t i;
GPR_ASSERT(gpr_event_wait(&m->event, gpr_inf_future(GPR_CLOCK_REALTIME)) ==
diff --git a/test/core/support/thd_test.c b/test/core/support/thd_test.cc
index 4fd0051776..f70a3b4fe2 100644
--- a/test/core/support/thd_test.c
+++ b/test/core/support/thd_test.cc
@@ -37,7 +37,7 @@ struct test {
/* A Thread body. Decrement t->n, and if is becomes zero, set t->done. */
static void thd_body(void* v) {
- struct test* t = v;
+ struct test* t = static_cast<struct test*>(v);
gpr_mu_lock(&t->mu);
t->n--;
if (t->n == 0) {
diff --git a/test/core/support/time_test.c b/test/core/support/time_test.cc
index 608169274f..608169274f 100644
--- a/test/core/support/time_test.c
+++ b/test/core/support/time_test.cc
diff --git a/test/core/support/tls_test.c b/test/core/support/tls_test.cc
index b1b4737432..b1b4737432 100644
--- a/test/core/support/tls_test.c
+++ b/test/core/support/tls_test.cc
diff --git a/test/core/support/useful_test.c b/test/core/support/useful_test.cc
index 2f86010d77..2f86010d77 100644
--- a/test/core/support/useful_test.c
+++ b/test/core/support/useful_test.cc
diff --git a/test/core/surface/BUILD b/test/core/surface/BUILD
index 17db7737f7..6cec7feabc 100644
--- a/test/core/surface/BUILD
+++ b/test/core/surface/BUILD
@@ -20,8 +20,8 @@ grpc_package(name = "test/core/surface")
grpc_cc_test(
name = "alarm_test",
- srcs = ["alarm_test.c"],
- language = "C",
+ srcs = ["alarm_test.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//:grpc",
@@ -32,8 +32,8 @@ grpc_cc_test(
grpc_cc_test(
name = "grpc_byte_buffer_reader_test",
- srcs = ["byte_buffer_reader_test.c"],
- language = "C",
+ srcs = ["byte_buffer_reader_test.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//:grpc",
@@ -44,8 +44,8 @@ grpc_cc_test(
grpc_cc_test(
name = "channel_create_test",
- srcs = ["channel_create_test.c"],
- language = "C",
+ srcs = ["channel_create_test.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//:grpc",
@@ -56,8 +56,8 @@ grpc_cc_test(
grpc_cc_test(
name = "grpc_completion_queue_test",
- srcs = ["completion_queue_test.c"],
- language = "C",
+ srcs = ["completion_queue_test.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//:grpc",
@@ -68,8 +68,8 @@ grpc_cc_test(
grpc_cc_test(
name = "concurrent_connectivity_test",
- srcs = ["concurrent_connectivity_test.c"],
- language = "C",
+ srcs = ["concurrent_connectivity_test.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//:grpc",
@@ -80,8 +80,8 @@ grpc_cc_test(
grpc_cc_test(
name = "init_test",
- srcs = ["init_test.c"],
- language = "C",
+ srcs = ["init_test.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//:grpc",
@@ -92,8 +92,8 @@ grpc_cc_test(
grpc_cc_test(
name = "grpc_invalid_channel_args_test",
- srcs = ["invalid_channel_args_test.c"],
- language = "C",
+ srcs = ["invalid_channel_args_test.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//:grpc",
@@ -104,8 +104,8 @@ grpc_cc_test(
grpc_cc_test(
name = "lame_client_test",
- srcs = ["lame_client_test.c"],
- language = "C",
+ srcs = ["lame_client_test.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//:grpc",
@@ -129,8 +129,8 @@ grpc_cc_test(
grpc_cc_test(
name = "secure_channel_create_test",
- srcs = ["secure_channel_create_test.c"],
- language = "C",
+ srcs = ["secure_channel_create_test.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//:grpc",
@@ -141,8 +141,8 @@ grpc_cc_test(
grpc_cc_test(
name = "sequential_connectivity_test",
- srcs = ["sequential_connectivity_test.c"],
- language = "C",
+ srcs = ["sequential_connectivity_test.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//:grpc",
@@ -154,8 +154,8 @@ grpc_cc_test(
grpc_cc_test(
name = "server_chttp2_test",
- srcs = ["server_chttp2_test.c"],
- language = "C",
+ srcs = ["server_chttp2_test.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//:grpc",
@@ -166,8 +166,8 @@ grpc_cc_test(
grpc_cc_test(
name = "server_test",
- srcs = ["server_test.c"],
- language = "C",
+ srcs = ["server_test.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//:grpc",
diff --git a/test/core/surface/alarm_test.c b/test/core/surface/alarm_test.cc
index 88b0b31478..88b0b31478 100644
--- a/test/core/surface/alarm_test.c
+++ b/test/core/surface/alarm_test.cc
diff --git a/test/core/surface/byte_buffer_reader_test.c b/test/core/surface/byte_buffer_reader_test.cc
index e5d2d7c78d..e5d2d7c78d 100644
--- a/test/core/surface/byte_buffer_reader_test.c
+++ b/test/core/surface/byte_buffer_reader_test.cc
diff --git a/test/core/surface/channel_create_test.c b/test/core/surface/channel_create_test.cc
index 4627c57438..4627c57438 100644
--- a/test/core/surface/channel_create_test.c
+++ b/test/core/surface/channel_create_test.cc
diff --git a/test/core/surface/completion_queue_test.c b/test/core/surface/completion_queue_test.cc
index 277ffde553..277ffde553 100644
--- a/test/core/surface/completion_queue_test.c
+++ b/test/core/surface/completion_queue_test.cc
diff --git a/test/core/surface/completion_queue_threading_test.c b/test/core/surface/completion_queue_threading_test.cc
index d98289f80e..043c5c1617 100644
--- a/test/core/surface/completion_queue_threading_test.c
+++ b/test/core/surface/completion_queue_threading_test.cc
@@ -68,7 +68,7 @@ struct thread_state {
};
static void pluck_one(void* arg) {
- struct thread_state* state = arg;
+ struct thread_state* state = static_cast<struct thread_state*>(arg);
grpc_completion_queue_pluck(state->cc, state->tag,
gpr_inf_future(GPR_CLOCK_REALTIME), NULL);
}
@@ -143,7 +143,7 @@ static void free_completion(grpc_exec_ctx* exec_ctx, void* arg,
}
static void producer_thread(void* arg) {
- test_thread_options* opt = arg;
+ test_thread_options* opt = static_cast<test_thread_options*>(arg);
int i;
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
@@ -164,7 +164,8 @@ static void producer_thread(void* arg) {
for (i = 0; i < TEST_THREAD_EVENTS; i++) {
grpc_cq_end_op(&exec_ctx, opt->cc, (void*)(intptr_t)1, GRPC_ERROR_NONE,
free_completion, NULL,
- gpr_malloc(sizeof(grpc_cq_completion)));
+ static_cast<grpc_cq_completion*>(
+ gpr_malloc(sizeof(grpc_cq_completion))));
opt->events_triggered++;
grpc_exec_ctx_finish(&exec_ctx);
}
@@ -175,7 +176,7 @@ static void producer_thread(void* arg) {
}
static void consumer_thread(void* arg) {
- test_thread_options* opt = arg;
+ test_thread_options* opt = static_cast<test_thread_options*>(arg);
grpc_event ev;
gpr_log(GPR_INFO, "consumer %d started", opt->id);
@@ -209,8 +210,8 @@ static void consumer_thread(void* arg) {
}
static void test_threading(size_t producers, size_t consumers) {
- test_thread_options* options =
- gpr_malloc((producers + consumers) * sizeof(test_thread_options));
+ test_thread_options* options = static_cast<test_thread_options*>(
+ gpr_malloc((producers + consumers) * sizeof(test_thread_options)));
gpr_event phase1 = GPR_EVENT_INIT;
gpr_event phase2 = GPR_EVENT_INIT;
grpc_completion_queue* cc = grpc_completion_queue_create_for_next(NULL);
diff --git a/test/core/surface/concurrent_connectivity_test.c b/test/core/surface/concurrent_connectivity_test.cc
index 105905f212..6f6a71e6f5 100644
--- a/test/core/surface/concurrent_connectivity_test.c
+++ b/test/core/surface/concurrent_connectivity_test.cc
@@ -158,7 +158,7 @@ void bad_server_thread(void* vargs) {
static void done_pollset_shutdown(grpc_exec_ctx* exec_ctx, void* pollset,
grpc_error* error) {
- grpc_pollset_destroy(exec_ctx, pollset);
+ grpc_pollset_destroy(exec_ctx, static_cast<grpc_pollset*>(pollset));
gpr_free(pollset);
}
@@ -211,7 +211,7 @@ int run_concurrent_connectivity_test() {
/* Third round, bogus tcp server */
gpr_log(GPR_DEBUG, "Wave 3");
- args.pollset = gpr_zalloc(grpc_pollset_size());
+ args.pollset = static_cast<grpc_pollset*>(gpr_zalloc(grpc_pollset_size()));
grpc_pollset_init(args.pollset, &args.mu);
gpr_event_init(&args.ready);
gpr_thd_new(&server, bad_server_thread, &args, &options);
diff --git a/test/core/surface/init_test.c b/test/core/surface/init_test.cc
index 5749bc8b36..5749bc8b36 100644
--- a/test/core/surface/init_test.c
+++ b/test/core/surface/init_test.cc
diff --git a/test/core/surface/invalid_channel_args_test.c b/test/core/surface/invalid_channel_args_test.cc
index 1f81b3c8f5..6a58a32e3c 100644
--- a/test/core/surface/invalid_channel_args_test.c
+++ b/test/core/surface/invalid_channel_args_test.cc
@@ -75,7 +75,7 @@ static void test_default_authority_type(void) {
char* expected_error_message;
client_arg.type = GRPC_ARG_INTEGER;
- client_arg.key = GRPC_ARG_DEFAULT_AUTHORITY;
+ client_arg.key = const_cast<char*>(GRPC_ARG_DEFAULT_AUTHORITY);
client_arg.value.integer = 0;
client_args.num_args = 1;
@@ -91,7 +91,7 @@ static void test_ssl_name_override_type(void) {
char* expected_error_message;
client_arg.type = GRPC_ARG_INTEGER;
- client_arg.key = GRPC_SSL_TARGET_NAME_OVERRIDE_ARG;
+ client_arg.key = const_cast<char*>(GRPC_SSL_TARGET_NAME_OVERRIDE_ARG);
client_arg.value.integer = 0;
client_args.num_args = 1;
@@ -107,11 +107,11 @@ static void test_ssl_name_override_failed(void) {
char* expected_error_message;
client_arg[0].type = GRPC_ARG_STRING;
- client_arg[0].key = GRPC_ARG_DEFAULT_AUTHORITY;
- client_arg[0].value.string = "default";
+ client_arg[0].key = const_cast<char*>(GRPC_ARG_DEFAULT_AUTHORITY);
+ client_arg[0].value.string = const_cast<char*>("default");
client_arg[1].type = GRPC_ARG_STRING;
- client_arg[1].key = GRPC_SSL_TARGET_NAME_OVERRIDE_ARG;
- client_arg[1].value.string = "ssl";
+ client_arg[1].key = const_cast<char*>(GRPC_SSL_TARGET_NAME_OVERRIDE_ARG);
+ client_arg[1].value.string = const_cast<char*>("ssl");
client_args.num_args = 2;
client_args.args = client_arg;
diff --git a/test/core/surface/lame_client_test.c b/test/core/surface/lame_client_test.cc
index 274efa634a..c374adc08d 100644
--- a/test/core/surface/lame_client_test.c
+++ b/test/core/surface/lame_client_test.cc
@@ -34,7 +34,7 @@ static void* tag(intptr_t x) { return (void*)x; }
void verify_connectivity(grpc_exec_ctx* exec_ctx, void* arg,
grpc_error* error) {
- grpc_connectivity_state* state = arg;
+ grpc_connectivity_state* state = static_cast<grpc_connectivity_state*>(arg);
GPR_ASSERT(GRPC_CHANNEL_SHUTDOWN == *state);
GPR_ASSERT(error == GRPC_ERROR_NONE);
}
diff --git a/test/core/surface/num_external_connectivity_watchers_test.c b/test/core/surface/num_external_connectivity_watchers_test.cc
index faf3945d6f..89dc364fb8 100644
--- a/test/core/surface/num_external_connectivity_watchers_test.c
+++ b/test/core/surface/num_external_connectivity_watchers_test.cc
@@ -169,9 +169,10 @@ static const test_fixture insecure_test = {
static grpc_channel* secure_test_create_channel(const char* addr) {
grpc_channel_credentials* ssl_creds =
grpc_ssl_credentials_create(test_root_cert, 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(NULL, &ssl_name_override, 1);
grpc_channel* channel =
diff --git a/test/core/surface/secure_channel_create_test.c b/test/core/surface/secure_channel_create_test.cc
index a052e107f7..f3163c1d80 100644
--- a/test/core/surface/secure_channel_create_test.c
+++ b/test/core/surface/secure_channel_create_test.cc
@@ -47,7 +47,7 @@ void test_security_connector_already_in_arg(void) {
grpc_arg arg;
arg.type = GRPC_ARG_POINTER;
arg.value.pointer.p = NULL;
- arg.key = GRPC_ARG_SECURITY_CONNECTOR;
+ arg.key = const_cast<char*>(GRPC_ARG_SECURITY_CONNECTOR);
grpc_channel_args args;
args.num_args = 1;
args.args = &arg;
diff --git a/test/core/surface/sequential_connectivity_test.c b/test/core/surface/sequential_connectivity_test.cc
index 712bfb9f68..9ffbc82667 100644
--- a/test/core/surface/sequential_connectivity_test.c
+++ b/test/core/surface/sequential_connectivity_test.cc
@@ -43,7 +43,7 @@ typedef struct {
} server_thread_args;
static void server_thread_func(void* args) {
- server_thread_args* a = args;
+ server_thread_args* a = static_cast<server_thread_args*>(args);
grpc_event ev = grpc_completion_queue_next(
a->cq, gpr_inf_future(GPR_CLOCK_REALTIME), NULL);
GPR_ASSERT(ev.type == GRPC_OP_COMPLETE);
@@ -147,9 +147,10 @@ static void secure_test_add_port(grpc_server* server, const char* addr) {
static grpc_channel* secure_test_create_channel(const char* addr) {
grpc_channel_credentials* ssl_creds =
grpc_ssl_credentials_create(test_root_cert, 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(NULL, &ssl_name_override, 1);
grpc_channel* channel =
diff --git a/test/core/surface/server_chttp2_test.c b/test/core/surface/server_chttp2_test.cc
index f90dcccc30..b0ffb1de3c 100644
--- a/test/core/surface/server_chttp2_test.c
+++ b/test/core/surface/server_chttp2_test.cc
@@ -39,7 +39,7 @@ void test_unparsable_target(void) {
void test_add_same_port_twice() {
grpc_arg a;
a.type = GRPC_ARG_INTEGER;
- a.key = GRPC_ARG_ALLOW_REUSEPORT;
+ a.key = const_cast<char*>(GRPC_ARG_ALLOW_REUSEPORT);
a.value.integer = 0;
grpc_channel_args args = {1, &a};
diff --git a/test/core/surface/server_test.c b/test/core/surface/server_test.cc
index 6e1e1b6c57..240969a121 100644
--- a/test/core/surface/server_test.c
+++ b/test/core/surface/server_test.cc
@@ -69,7 +69,7 @@ void test_request_call_on_no_server_cq(void) {
void test_bind_server_twice(void) {
grpc_arg a;
a.type = GRPC_ARG_INTEGER;
- a.key = GRPC_ARG_ALLOW_REUSEPORT;
+ a.key = const_cast<char*>(GRPC_ARG_ALLOW_REUSEPORT);
a.value.integer = 0;
grpc_channel_args args = {1, &a};
diff --git a/test/core/transport/BUILD b/test/core/transport/BUILD
index edd27b8a5f..b31d4ff899 100644
--- a/test/core/transport/BUILD
+++ b/test/core/transport/BUILD
@@ -35,8 +35,8 @@ grpc_cc_test(
grpc_cc_test(
name = "byte_stream_test",
- srcs = ["byte_stream_test.c"],
- language = "C",
+ srcs = ["byte_stream_test.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//:grpc",
@@ -47,8 +47,8 @@ grpc_cc_test(
grpc_cc_test(
name = "connectivity_state_test",
- srcs = ["connectivity_state_test.c"],
- language = "C",
+ srcs = ["connectivity_state_test.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//:grpc",
@@ -59,8 +59,8 @@ grpc_cc_test(
grpc_cc_test(
name = "metadata_test",
- srcs = ["metadata_test.c"],
- language = "C",
+ srcs = ["metadata_test.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//:grpc",
@@ -86,8 +86,8 @@ grpc_cc_test(
grpc_cc_test(
name = "status_conversion_test",
- srcs = ["status_conversion_test.c"],
- language = "C",
+ srcs = ["status_conversion_test.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//:grpc",
@@ -98,8 +98,8 @@ grpc_cc_test(
grpc_cc_test(
name = "stream_owned_slice_test",
- srcs = ["stream_owned_slice_test.c"],
- language = "C",
+ srcs = ["stream_owned_slice_test.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//:grpc",
@@ -110,8 +110,8 @@ grpc_cc_test(
grpc_cc_test(
name = "timeout_encoding_test",
- srcs = ["timeout_encoding_test.c"],
- language = "C",
+ srcs = ["timeout_encoding_test.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//:grpc",
diff --git a/test/core/transport/byte_stream_test.c b/test/core/transport/byte_stream_test.cc
index e62a697284..e62a697284 100644
--- a/test/core/transport/byte_stream_test.c
+++ b/test/core/transport/byte_stream_test.cc
diff --git a/test/core/transport/chttp2/BUILD b/test/core/transport/chttp2/BUILD
index 6081940243..1ea7d0341d 100644
--- a/test/core/transport/chttp2/BUILD
+++ b/test/core/transport/chttp2/BUILD
@@ -22,7 +22,7 @@ load("//test/core/util:grpc_fuzzer.bzl", "grpc_fuzzer")
grpc_fuzzer(
name = "hpack_parser_fuzzer",
- srcs = ["hpack_parser_fuzzer_test.c"],
+ srcs = ["hpack_parser_fuzzer_test.cc"],
corpus = "hpack_parser_corpus",
deps = [
"//:grpc",
@@ -32,8 +32,8 @@ grpc_fuzzer(
grpc_cc_test(
name = "alpn_test",
- srcs = ["alpn_test.c"],
- language = "C",
+ srcs = ["alpn_test.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//:grpc",
@@ -44,8 +44,8 @@ grpc_cc_test(
grpc_cc_test(
name = "bin_decoder_test",
- srcs = ["bin_decoder_test.c"],
- language = "C",
+ srcs = ["bin_decoder_test.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//:grpc",
@@ -56,8 +56,8 @@ grpc_cc_test(
grpc_cc_test(
name = "bin_encoder_test",
- srcs = ["bin_encoder_test.c"],
- language = "C",
+ srcs = ["bin_encoder_test.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//:grpc",
@@ -68,8 +68,8 @@ grpc_cc_test(
grpc_cc_test(
name = "hpack_encoder_test",
- srcs = ["hpack_encoder_test.c"],
- language = "C",
+ srcs = ["hpack_encoder_test.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//:grpc",
@@ -80,8 +80,8 @@ grpc_cc_test(
grpc_cc_test(
name = "hpack_parser_test",
- srcs = ["hpack_parser_test.c"],
- language = "C",
+ srcs = ["hpack_parser_test.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//:grpc",
@@ -92,8 +92,8 @@ grpc_cc_test(
grpc_cc_test(
name = "hpack_table_test",
- srcs = ["hpack_table_test.c"],
- language = "C",
+ srcs = ["hpack_table_test.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//:grpc",
@@ -104,8 +104,8 @@ grpc_cc_test(
grpc_cc_test(
name = "stream_map_test",
- srcs = ["stream_map_test.c"],
- language = "C",
+ srcs = ["stream_map_test.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//:grpc",
@@ -116,8 +116,8 @@ grpc_cc_test(
grpc_cc_test(
name = "varint_test",
- srcs = ["varint_test.c"],
- language = "C",
+ srcs = ["varint_test.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//:grpc",
diff --git a/test/core/transport/chttp2/alpn_test.c b/test/core/transport/chttp2/alpn_test.cc
index a43377393e..a43377393e 100644
--- a/test/core/transport/chttp2/alpn_test.c
+++ b/test/core/transport/chttp2/alpn_test.cc
diff --git a/test/core/transport/chttp2/bin_decoder_test.c b/test/core/transport/chttp2/bin_decoder_test.cc
index 64cb1589f5..a29ec8a13f 100644
--- a/test/core/transport/chttp2/bin_decoder_test.c
+++ b/test/core/transport/chttp2/bin_decoder_test.cc
@@ -30,7 +30,7 @@
static int all_ok = 1;
static void expect_slice_eq(grpc_exec_ctx* exec_ctx, grpc_slice expected,
- grpc_slice slice, char* debug, int line) {
+ grpc_slice slice, const char* debug, int line) {
if (!grpc_slice_eq(slice, expected)) {
char* hs = grpc_dump_slice(slice, GPR_DUMP_HEX | GPR_DUMP_ASCII);
char* he = grpc_dump_slice(expected, GPR_DUMP_HEX | GPR_DUMP_ASCII);
diff --git a/test/core/transport/chttp2/bin_encoder_test.c b/test/core/transport/chttp2/bin_encoder_test.cc
index 2465c59355..78b8808c41 100644
--- a/test/core/transport/chttp2/bin_encoder_test.c
+++ b/test/core/transport/chttp2/bin_encoder_test.cc
@@ -31,8 +31,8 @@
static int all_ok = 1;
-static void expect_slice_eq(grpc_slice expected, grpc_slice slice, char* debug,
- int line) {
+static void expect_slice_eq(grpc_slice expected, grpc_slice slice,
+ const char* debug, int line) {
if (!grpc_slice_eq(slice, expected)) {
char* hs = grpc_dump_slice(slice, GPR_DUMP_HEX | GPR_DUMP_ASCII);
char* he = grpc_dump_slice(expected, GPR_DUMP_HEX | GPR_DUMP_ASCII);
diff --git a/test/core/transport/chttp2/hpack_encoder_test.c b/test/core/transport/chttp2/hpack_encoder_test.cc
index 9045f32643..a7e44abc2b 100644
--- a/test/core/transport/chttp2/hpack_encoder_test.c
+++ b/test/core/transport/chttp2/hpack_encoder_test.cc
@@ -58,7 +58,8 @@ static void verify(grpc_exec_ctx* exec_ctx, const verify_params params,
grpc_slice expect = parse_hexstring(expected);
size_t i;
va_list l;
- grpc_linked_mdelem* e = gpr_malloc(sizeof(*e) * nheaders);
+ grpc_linked_mdelem* e =
+ static_cast<grpc_linked_mdelem*>(gpr_malloc(sizeof(*e) * nheaders));
grpc_metadata_batch b;
grpc_metadata_batch_init(&b);
@@ -89,7 +90,8 @@ static void verify(grpc_exec_ctx* exec_ctx, const verify_params params,
if (cap_to_delete == num_to_delete) {
cap_to_delete = GPR_MAX(2 * cap_to_delete, 1000);
- to_delete = gpr_realloc(to_delete, sizeof(*to_delete) * cap_to_delete);
+ to_delete = static_cast<void**>(
+ gpr_realloc(to_delete, sizeof(*to_delete) * cap_to_delete));
}
to_delete[num_to_delete++] = e;
@@ -98,11 +100,11 @@ static void verify(grpc_exec_ctx* exec_ctx, const verify_params params,
grpc_transport_one_way_stats stats;
memset(&stats, 0, sizeof(stats));
grpc_encode_header_options hopt = {
- .stream_id = 0xdeadbeef,
- .is_eof = params.eof,
- .use_true_binary_metadata = params.use_true_binary_metadata,
- .max_frame_size = 16384,
- .stats = &stats,
+ 0xdeadbeef, /* stream_id */
+ params.eof, /* is_eof */
+ params.use_true_binary_metadata, /* use_true_binary_metadata */
+ 16384, /* max_frame_size */
+ &stats /* stats */
};
grpc_chttp2_encode_header(exec_ctx, &g_compressor, NULL, 0, &b, &hopt,
&output);
@@ -129,9 +131,9 @@ static void test_basic_headers(grpc_exec_ctx* exec_ctx) {
int i;
verify_params params = {
- .eof = false,
- .use_true_binary_metadata = false,
- .only_intern_key = false,
+ false,
+ false,
+ false,
};
verify(exec_ctx, params, "000005 0104 deadbeef 40 0161 0161", 1, "a", "a");
verify(exec_ctx, params, "000001 0104 deadbeef be", 1, "a", "a");
@@ -167,9 +169,9 @@ static void test_decode_table_overflow(grpc_exec_ctx* exec_ctx) {
char* expect;
verify_params params = {
- .eof = false,
- .use_true_binary_metadata = false,
- .only_intern_key = false,
+ false,
+ false,
+ false,
};
for (i = 0; i < 114; i++) {
@@ -213,7 +215,8 @@ static void verify_table_size_change_match_elem_size(grpc_exec_ctx* exec_ctx,
grpc_slice_intern(grpc_slice_from_static_string(value)));
size_t elem_size = grpc_mdelem_get_size_in_hpack_table(elem, use_true_binary);
size_t initial_table_size = g_compressor.table_size;
- grpc_linked_mdelem* e = gpr_malloc(sizeof(*e));
+ grpc_linked_mdelem* e =
+ static_cast<grpc_linked_mdelem*>(gpr_malloc(sizeof(*e)));
grpc_metadata_batch b;
grpc_metadata_batch_init(&b);
e[0].md = elem;
@@ -227,11 +230,11 @@ static void verify_table_size_change_match_elem_size(grpc_exec_ctx* exec_ctx,
grpc_transport_one_way_stats stats;
memset(&stats, 0, sizeof(stats));
grpc_encode_header_options hopt = {
- .stream_id = 0xdeadbeef,
- .is_eof = false,
- .use_true_binary_metadata = use_true_binary,
- .max_frame_size = 16384,
- .stats = &stats};
+ 0xdeadbeef, /* stream_id */
+ false, /* is_eof */
+ use_true_binary, /* use_true_binary_metadata */
+ 16384, /* max_frame_size */
+ &stats /* stats */};
grpc_chttp2_encode_header(exec_ctx, &g_compressor, NULL, 0, &b, &hopt,
&output);
grpc_slice_buffer_destroy_internal(exec_ctx, &output);
@@ -251,11 +254,7 @@ static void test_encode_header_size(grpc_exec_ctx* exec_ctx) {
static void test_interned_key_indexed(grpc_exec_ctx* exec_ctx) {
int i;
- verify_params params = {
- .eof = false,
- .use_true_binary_metadata = false,
- .only_intern_key = true,
- };
+ verify_params params = {false, false, true};
verify(exec_ctx, params, "000009 0104 deadbeef 40 0161 0162 0f2f 0163", 2,
"a", "b", "a", "c");
for (i = 0; i < 10; i++) {
diff --git a/test/core/transport/chttp2/hpack_parser_fuzzer_test.c b/test/core/transport/chttp2/hpack_parser_fuzzer_test.cc
index 01230eb675..942f25e0b7 100644
--- a/test/core/transport/chttp2/hpack_parser_fuzzer_test.c
+++ b/test/core/transport/chttp2/hpack_parser_fuzzer_test.cc
@@ -34,7 +34,7 @@ static void onhdr(grpc_exec_ctx* exec_ctx, void* ud, grpc_mdelem md) {
}
static void dont_log(gpr_log_func_args* args) {}
-int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
grpc_test_only_set_slice_hash_seed(0);
if (squelch) gpr_set_log_function(dont_log);
grpc_init();
diff --git a/test/core/transport/chttp2/hpack_parser_test.c b/test/core/transport/chttp2/hpack_parser_test.cc
index 6fbbaca1ab..434b46eb2e 100644
--- a/test/core/transport/chttp2/hpack_parser_test.c
+++ b/test/core/transport/chttp2/hpack_parser_test.cc
@@ -34,7 +34,7 @@ typedef struct {
static void onhdr(grpc_exec_ctx* exec_ctx, void* ud, grpc_mdelem md) {
const char *ekey, *evalue;
- test_checker* chk = ud;
+ test_checker* chk = static_cast<test_checker*>(ud);
ekey = va_arg(chk->args, char*);
GPR_ASSERT(ekey);
evalue = va_arg(chk->args, char*);
diff --git a/test/core/transport/chttp2/hpack_table_test.c b/test/core/transport/chttp2/hpack_table_test.cc
index ff7c2de538..ff7c2de538 100644
--- a/test/core/transport/chttp2/hpack_table_test.c
+++ b/test/core/transport/chttp2/hpack_table_test.cc
diff --git a/test/core/transport/chttp2/stream_map_test.c b/test/core/transport/chttp2/stream_map_test.cc
index 43e7e7f59c..23a7b3f4c2 100644
--- a/test/core/transport/chttp2/stream_map_test.c
+++ b/test/core/transport/chttp2/stream_map_test.cc
@@ -92,7 +92,7 @@ static void test_basic_add_find(uint32_t n) {
/* verify that for_each gets the right values during test_delete_evens_XXX */
static void verify_for_each(void* user_data, uint32_t stream_id, void* ptr) {
- uint32_t* for_each_check = user_data;
+ uint32_t* for_each_check = static_cast<uint32_t*>(user_data);
GPR_ASSERT(ptr);
GPR_ASSERT(*for_each_check == stream_id);
*for_each_check += 2;
diff --git a/test/core/transport/chttp2/varint_test.c b/test/core/transport/chttp2/varint_test.cc
index 413b461b3a..413b461b3a 100644
--- a/test/core/transport/chttp2/varint_test.c
+++ b/test/core/transport/chttp2/varint_test.cc
diff --git a/test/core/transport/connectivity_state_test.c b/test/core/transport/connectivity_state_test.cc
index 8cd7b30b66..8cd7b30b66 100644
--- a/test/core/transport/connectivity_state_test.c
+++ b/test/core/transport/connectivity_state_test.cc
diff --git a/test/core/transport/metadata_test.c b/test/core/transport/metadata_test.cc
index c555159a7a..b60a9619fb 100644
--- a/test/core/transport/metadata_test.c
+++ b/test/core/transport/metadata_test.cc
@@ -114,7 +114,8 @@ static void test_create_many_ephemeral_metadata(bool intern_keys,
static void test_create_many_persistant_metadata(void) {
char buffer[GPR_LTOA_MIN_BUFSIZE];
long i;
- grpc_mdelem* created = gpr_malloc(sizeof(grpc_mdelem) * MANY);
+ grpc_mdelem* created =
+ static_cast<grpc_mdelem*>(gpr_malloc(sizeof(grpc_mdelem) * MANY));
grpc_mdelem md;
gpr_log(GPR_INFO, "test_create_many_persistant_metadata");
@@ -226,8 +227,9 @@ static void test_things_stick_around(void) {
size_t i, j;
char* buffer;
size_t nstrs = 1000;
- grpc_slice* strs = gpr_malloc(sizeof(grpc_slice) * nstrs);
- size_t* shuf = gpr_malloc(sizeof(size_t) * nstrs);
+ grpc_slice* strs =
+ static_cast<grpc_slice*>(gpr_malloc(sizeof(grpc_slice) * nstrs));
+ size_t* shuf = static_cast<size_t*>(gpr_malloc(sizeof(size_t) * nstrs));
grpc_slice test;
gpr_log(GPR_INFO, "test_things_stick_around");
@@ -281,9 +283,9 @@ static void test_user_data_works(void) {
grpc_init();
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- ud1 = gpr_malloc(sizeof(int));
+ ud1 = static_cast<int*>(gpr_malloc(sizeof(int)));
*ud1 = 1;
- ud2 = gpr_malloc(sizeof(int));
+ ud2 = static_cast<int*>(gpr_malloc(sizeof(int)));
*ud2 = 2;
md = grpc_mdelem_from_slices(
&exec_ctx, grpc_slice_intern(grpc_slice_from_static_string("abc")),
diff --git a/test/core/transport/status_conversion_test.c b/test/core/transport/status_conversion_test.cc
index 7af5d12cb7..7af5d12cb7 100644
--- a/test/core/transport/status_conversion_test.c
+++ b/test/core/transport/status_conversion_test.cc
diff --git a/test/core/transport/stream_owned_slice_test.c b/test/core/transport/stream_owned_slice_test.cc
index 0b592a0496..0b592a0496 100644
--- a/test/core/transport/stream_owned_slice_test.c
+++ b/test/core/transport/stream_owned_slice_test.cc
diff --git a/test/core/transport/timeout_encoding_test.c b/test/core/transport/timeout_encoding_test.cc
index 0930bc836d..0930bc836d 100644
--- a/test/core/transport/timeout_encoding_test.c
+++ b/test/core/transport/timeout_encoding_test.cc
diff --git a/test/core/tsi/BUILD b/test/core/tsi/BUILD
index 0c5509dda6..e28c0b5f84 100644
--- a/test/core/tsi/BUILD
+++ b/test/core/tsi/BUILD
@@ -20,7 +20,7 @@ grpc_package(name = "test/core/tsi")
grpc_cc_library(
name = "transport_security_test_lib",
- srcs = ["transport_security_test_lib.c"],
+ srcs = ["transport_security_test_lib.cc"],
hdrs = ["transport_security_test_lib.h"],
deps = [
"//:grpc",
@@ -30,8 +30,8 @@ grpc_cc_library(
grpc_cc_test(
name = "fake_transport_security_test",
- srcs = ["fake_transport_security_test.c"],
- language = "C",
+ srcs = ["fake_transport_security_test.cc"],
+ language = "C++",
deps = [
":transport_security_test_lib",
"//:grpc",
@@ -44,7 +44,7 @@ grpc_cc_test(
grpc_cc_test(
name = "ssl_transport_security_test",
- srcs = ["ssl_transport_security_test.c"],
+ srcs = ["ssl_transport_security_test.cc"],
data = [
"//src/core/tsi/test_creds:badclient.key",
"//src/core/tsi/test_creds:badclient.pem",
@@ -58,7 +58,7 @@ grpc_cc_test(
"//src/core/tsi/test_creds:server1.key",
"//src/core/tsi/test_creds:server1.pem",
],
- language = "C",
+ language = "C++",
deps = [
":transport_security_test_lib",
"//:grpc",
@@ -70,8 +70,8 @@ grpc_cc_test(
grpc_cc_test(
name = "transport_security_test",
- srcs = ["transport_security_test.c"],
- language = "C",
+ srcs = ["transport_security_test.cc"],
+ language = "C++",
deps = [
"//:grpc",
"//:gpr",
diff --git a/test/core/tsi/fake_transport_security_test.c b/test/core/tsi/fake_transport_security_test.cc
index 39b36cd848..32b0f898af 100644
--- a/test/core/tsi/fake_transport_security_test.c
+++ b/test/core/tsi/fake_transport_security_test.cc
@@ -64,7 +64,8 @@ static const struct tsi_test_fixture_vtable vtable = {
fake_test_destruct};
static tsi_test_fixture* fake_tsi_test_fixture_create() {
- fake_tsi_test_fixture* fake_fixture = gpr_zalloc(sizeof(*fake_fixture));
+ fake_tsi_test_fixture* fake_fixture =
+ static_cast<fake_tsi_test_fixture*>(gpr_zalloc(sizeof(*fake_fixture)));
tsi_test_fixture_init(&fake_fixture->base);
fake_fixture->base.vtable = &vtable;
return &fake_fixture->base;
@@ -91,8 +92,8 @@ void fake_tsi_test_do_handshake() {
}
void fake_tsi_test_do_round_trip_for_all_configs() {
- unsigned int* bit_array =
- gpr_zalloc(sizeof(unsigned int) * TSI_TEST_NUM_OF_ARGUMENTS);
+ unsigned int* bit_array = static_cast<unsigned int*>(
+ gpr_zalloc(sizeof(unsigned int) * TSI_TEST_NUM_OF_ARGUMENTS));
const unsigned int mask = 1U << (TSI_TEST_NUM_OF_ARGUMENTS - 1);
for (unsigned int val = 0; val < TSI_TEST_NUM_OF_COMBINATIONS; val++) {
unsigned int v = val;
diff --git a/test/core/tsi/ssl_transport_security_test.c b/test/core/tsi/ssl_transport_security_test.cc
index ad133bcd6c..0903ce8625 100644
--- a/test/core/tsi/ssl_transport_security_test.c
+++ b/test/core/tsi/ssl_transport_security_test.cc
@@ -324,8 +324,8 @@ static const struct tsi_test_fixture_vtable vtable = {
ssl_test_destruct};
static char* load_file(const char* dir_path, const char* file_name) {
- char* file_path =
- gpr_zalloc(sizeof(char) * (strlen(dir_path) + strlen(file_name) + 1));
+ char* file_path = static_cast<char*>(
+ gpr_zalloc(sizeof(char) * (strlen(dir_path) + strlen(file_name) + 1)));
memcpy(file_path, dir_path, strlen(dir_path));
memcpy(file_path + strlen(dir_path), file_name, strlen(file_name));
grpc_slice slice;
@@ -337,12 +337,14 @@ static char* load_file(const char* dir_path, const char* file_name) {
}
static tsi_test_fixture* ssl_tsi_test_fixture_create() {
- ssl_tsi_test_fixture* ssl_fixture = gpr_zalloc(sizeof(*ssl_fixture));
+ ssl_tsi_test_fixture* ssl_fixture =
+ static_cast<ssl_tsi_test_fixture*>(gpr_zalloc(sizeof(*ssl_fixture)));
tsi_test_fixture_init(&ssl_fixture->base);
ssl_fixture->base.test_unused_bytes = false;
ssl_fixture->base.vtable = &vtable;
/* Create ssl_key_cert_lib. */
- ssl_key_cert_lib* key_cert_lib = gpr_zalloc(sizeof(*key_cert_lib));
+ ssl_key_cert_lib* key_cert_lib =
+ static_cast<ssl_key_cert_lib*>(gpr_zalloc(sizeof(*key_cert_lib)));
key_cert_lib->use_bad_server_cert = false;
key_cert_lib->use_bad_client_cert = false;
key_cert_lib->server_num_key_cert_pairs =
@@ -350,11 +352,13 @@ static tsi_test_fixture* ssl_tsi_test_fixture_create() {
key_cert_lib->bad_server_num_key_cert_pairs =
SSL_TSI_TEST_BAD_SERVER_KEY_CERT_PAIRS_NUM;
key_cert_lib->server_pem_key_cert_pairs =
- gpr_malloc(sizeof(tsi_ssl_pem_key_cert_pair) *
- key_cert_lib->server_num_key_cert_pairs);
+ static_cast<tsi_ssl_pem_key_cert_pair*>(
+ gpr_malloc(sizeof(tsi_ssl_pem_key_cert_pair) *
+ key_cert_lib->server_num_key_cert_pairs));
key_cert_lib->bad_server_pem_key_cert_pairs =
- gpr_malloc(sizeof(tsi_ssl_pem_key_cert_pair) *
- key_cert_lib->bad_server_num_key_cert_pairs);
+ static_cast<tsi_ssl_pem_key_cert_pair*>(
+ gpr_malloc(sizeof(tsi_ssl_pem_key_cert_pair) *
+ key_cert_lib->bad_server_num_key_cert_pairs));
key_cert_lib->server_pem_key_cert_pairs[0].private_key =
load_file(SSL_TSI_TEST_CREDENTIALS_DIR, "server0.key");
key_cert_lib->server_pem_key_cert_pairs[0].cert_chain =
@@ -378,11 +382,12 @@ static tsi_test_fixture* ssl_tsi_test_fixture_create() {
key_cert_lib->root_cert = load_file(SSL_TSI_TEST_CREDENTIALS_DIR, "ca.pem");
ssl_fixture->key_cert_lib = key_cert_lib;
/* Create ssl_alpn_lib. */
- ssl_alpn_lib* alpn_lib = gpr_zalloc(sizeof(*alpn_lib));
+ ssl_alpn_lib* alpn_lib =
+ static_cast<ssl_alpn_lib*>(gpr_zalloc(sizeof(*alpn_lib)));
alpn_lib->server_alpn_protocols =
- gpr_zalloc(sizeof(char*) * SSL_TSI_TEST_ALPN_NUM);
+ static_cast<char**>(gpr_zalloc(sizeof(char*) * SSL_TSI_TEST_ALPN_NUM));
alpn_lib->client_alpn_protocols =
- gpr_zalloc(sizeof(char*) * SSL_TSI_TEST_ALPN_NUM);
+ static_cast<char**>(gpr_zalloc(sizeof(char*) * SSL_TSI_TEST_ALPN_NUM));
alpn_lib->server_alpn_protocols[0] = gpr_strdup(SSL_TSI_TEST_ALPN1);
alpn_lib->server_alpn_protocols[1] = gpr_strdup(SSL_TSI_TEST_ALPN3);
alpn_lib->client_alpn_protocols[0] = gpr_strdup(SSL_TSI_TEST_ALPN2);
@@ -429,7 +434,8 @@ void ssl_tsi_test_do_handshake_with_server_name_indication_exact_domain() {
/* server1 cert contains "waterzooi.test.google.be" in SAN. */
tsi_test_fixture* fixture = ssl_tsi_test_fixture_create();
ssl_tsi_test_fixture* ssl_fixture = (ssl_tsi_test_fixture*)fixture;
- ssl_fixture->server_name_indication = "waterzooi.test.google.be";
+ ssl_fixture->server_name_indication =
+ const_cast<char*>("waterzooi.test.google.be");
tsi_test_do_handshake(fixture);
tsi_test_fixture_destroy(fixture);
}
@@ -438,7 +444,8 @@ void ssl_tsi_test_do_handshake_with_server_name_indication_wild_star_domain() {
/* server1 cert contains "*.test.google.fr" in SAN. */
tsi_test_fixture* fixture = ssl_tsi_test_fixture_create();
ssl_tsi_test_fixture* ssl_fixture = (ssl_tsi_test_fixture*)fixture;
- ssl_fixture->server_name_indication = "juju.test.google.fr";
+ ssl_fixture->server_name_indication =
+ const_cast<char*>("juju.test.google.fr");
tsi_test_do_handshake(fixture);
tsi_test_fixture_destroy(fixture);
}
@@ -493,8 +500,8 @@ void ssl_tsi_test_do_handshake_alpn_client_server_ok() {
}
void ssl_tsi_test_do_round_trip_for_all_configs() {
- unsigned int* bit_array =
- gpr_zalloc(sizeof(unsigned int) * TSI_TEST_NUM_OF_ARGUMENTS);
+ unsigned int* bit_array = static_cast<unsigned int*>(
+ gpr_zalloc(sizeof(unsigned int) * TSI_TEST_NUM_OF_ARGUMENTS));
const unsigned int mask = 1U << (TSI_TEST_NUM_OF_ARGUMENTS - 1);
for (unsigned int val = 0; val < TSI_TEST_NUM_OF_COMBINATIONS; val++) {
unsigned int v = val;
diff --git a/test/core/tsi/transport_security_test.c b/test/core/tsi/transport_security_test.cc
index f99afd8101..39adf2fab6 100644
--- a/test/core/tsi/transport_security_test.c
+++ b/test/core/tsi/transport_security_test.cc
@@ -200,7 +200,7 @@ typedef struct {
} parsed_names;
name_list* name_list_add(const char* n) {
- name_list* result = gpr_malloc(sizeof(name_list));
+ name_list* result = static_cast<name_list*>(gpr_malloc(sizeof(name_list)));
result->name = n;
result->next = NULL;
return result;
diff --git a/test/core/tsi/transport_security_test_lib.c b/test/core/tsi/transport_security_test_lib.cc
index 090f0cf79e..af8316873e 100644
--- a/test/core/tsi/transport_security_test_lib.c
+++ b/test/core/tsi/transport_security_test_lib.cc
@@ -57,10 +57,12 @@ static handshaker_args* handshaker_args_create(tsi_test_fixture* fixture,
bool is_client) {
GPR_ASSERT(fixture != NULL);
GPR_ASSERT(fixture->config != NULL);
- handshaker_args* args = gpr_zalloc(sizeof(*args));
+ handshaker_args* args =
+ static_cast<handshaker_args*>(gpr_zalloc(sizeof(*args)));
args->fixture = fixture;
args->handshake_buffer_size = fixture->handshake_buffer_size;
- args->handshake_buffer = gpr_zalloc(args->handshake_buffer_size);
+ args->handshake_buffer =
+ static_cast<unsigned char*>(gpr_zalloc(args->handshake_buffer_size));
args->is_client = is_client;
args->error = GRPC_ERROR_NONE;
return args;
@@ -181,7 +183,8 @@ static void send_message_to_peer(tsi_test_fixture* fixture,
GPR_ASSERT(fixture->config != NULL);
GPR_ASSERT(protector != NULL);
tsi_test_frame_protector_config* config = fixture->config;
- unsigned char* protected_buffer = gpr_zalloc(config->protected_buffer_size);
+ unsigned char* protected_buffer =
+ static_cast<unsigned char*>(gpr_zalloc(config->protected_buffer_size));
size_t message_size =
is_client ? config->client_message_size : config->server_message_size;
uint8_t* message =
@@ -238,9 +241,10 @@ static void receive_message_from_peer(tsi_test_fixture* fixture,
size_t read_from_peer_size = 0;
tsi_result result = TSI_OK;
bool done = false;
- unsigned char* read_buffer = gpr_zalloc(config->read_buffer_allocated_size);
- unsigned char* message_buffer =
- gpr_zalloc(config->message_buffer_allocated_size);
+ unsigned char* read_buffer = static_cast<unsigned char*>(
+ gpr_zalloc(config->read_buffer_allocated_size));
+ unsigned char* message_buffer = static_cast<unsigned char*>(
+ gpr_zalloc(config->message_buffer_allocated_size));
/* Do unprotect on data received from peer. */
while (!done && result == TSI_OK) {
/* Receive data from peer. */
@@ -432,7 +436,7 @@ void tsi_test_do_round_trip(tsi_test_fixture* fixture) {
/* Client sends a message to server. */
send_message_to_peer(fixture, client_frame_protector, true /* is_client */);
unsigned char* server_received_message =
- gpr_zalloc(TSI_TEST_DEFAULT_CHANNEL_SIZE);
+ static_cast<unsigned char*>(gpr_zalloc(TSI_TEST_DEFAULT_CHANNEL_SIZE));
size_t server_received_message_size = 0;
receive_message_from_peer(
fixture, server_frame_protector, server_received_message,
@@ -443,7 +447,7 @@ void tsi_test_do_round_trip(tsi_test_fixture* fixture) {
/* Server sends a message to client. */
send_message_to_peer(fixture, server_frame_protector, false /* is_client */);
unsigned char* client_received_message =
- gpr_zalloc(TSI_TEST_DEFAULT_CHANNEL_SIZE);
+ static_cast<unsigned char*>(gpr_zalloc(TSI_TEST_DEFAULT_CHANNEL_SIZE));
size_t client_received_message_size = 0;
receive_message_from_peer(
fixture, client_frame_protector, client_received_message,
@@ -461,7 +465,8 @@ void tsi_test_do_round_trip(tsi_test_fixture* fixture) {
static unsigned char* generate_random_message(size_t size) {
size_t i;
unsigned char chars[] = "abcdefghijklmnopqrstuvwxyz1234567890";
- unsigned char* output = gpr_zalloc(sizeof(unsigned char) * size);
+ unsigned char* output =
+ static_cast<unsigned char*>(gpr_zalloc(sizeof(unsigned char) * size));
for (i = 0; i < size - 1; ++i) {
output[i] = chars[rand() % (int)(sizeof(chars) - 1)];
}
@@ -476,7 +481,9 @@ tsi_test_frame_protector_config* tsi_test_frame_protector_config_create(
bool use_default_client_max_output_protected_frame_size,
bool use_default_server_max_output_protected_frame_size,
bool use_default_handshake_buffer_size) {
- tsi_test_frame_protector_config* config = gpr_zalloc(sizeof(*config));
+ tsi_test_frame_protector_config* config =
+ static_cast<tsi_test_frame_protector_config*>(
+ gpr_zalloc(sizeof(*config)));
/* Set the value for read_buffer_allocated_size. */
config->read_buffer_allocated_size =
use_default_read_buffer_allocated_size
@@ -551,8 +558,10 @@ void tsi_test_fixture_init(tsi_test_fixture* fixture) {
fixture->config = tsi_test_frame_protector_config_create(
true, true, true, true, true, true, true, true);
fixture->handshake_buffer_size = TSI_TEST_DEFAULT_BUFFER_SIZE;
- fixture->client_channel = gpr_zalloc(TSI_TEST_DEFAULT_CHANNEL_SIZE);
- fixture->server_channel = gpr_zalloc(TSI_TEST_DEFAULT_CHANNEL_SIZE);
+ fixture->client_channel =
+ static_cast<uint8_t*>(gpr_zalloc(TSI_TEST_DEFAULT_CHANNEL_SIZE));
+ fixture->server_channel =
+ static_cast<uint8_t*>(gpr_zalloc(TSI_TEST_DEFAULT_CHANNEL_SIZE));
fixture->bytes_written_to_client_channel = 0;
fixture->bytes_written_to_server_channel = 0;
fixture->bytes_read_from_client_channel = 0;
diff --git a/test/core/tsi/transport_security_test_lib.h b/test/core/tsi/transport_security_test_lib.h
index d067b6d3dd..9b07448cc5 100644
--- a/test/core/tsi/transport_security_test_lib.h
+++ b/test/core/tsi/transport_security_test_lib.h
@@ -23,10 +23,6 @@
#include <grpc/support/sync.h>
-#ifdef __cplusplus
-extern "C" {
-#endif
-
#define TSI_TEST_TINY_HANDSHAKE_BUFFER_SIZE 32
#define TSI_TEST_SMALL_HANDSHAKE_BUFFER_SIZE 128
#define TSI_TEST_SMALL_READ_BUFFER_ALLOCATED_SIZE 41
@@ -175,8 +171,4 @@ void tsi_test_do_handshake(tsi_test_fixture* fixture);
the client and server switching its role. */
void tsi_test_do_round_trip(tsi_test_fixture* fixture);
-#ifdef __cplusplus
-}
-#endif
-
#endif // GRPC_TEST_CORE_TSI_TRANSPORT_SECURITY_TEST_LIB_H_
diff --git a/test/core/util/BUILD b/test/core/util/BUILD
index 5844a17728..bc6fe9dd64 100644
--- a/test/core/util/BUILD
+++ b/test/core/util/BUILD
@@ -21,8 +21,8 @@ grpc_package(name = "test/core/util", visibility = "public")
grpc_cc_library(
name = "gpr_test_util",
srcs = [
- "memory_counters.c",
- "test_config.c",
+ "memory_counters.cc",
+ "test_config.cc",
],
hdrs = [
"memory_counters.h",
@@ -48,16 +48,16 @@ grpc_cc_library(
grpc_cc_library(
name = "grpc_test_util_base",
srcs = [
- "grpc_profiler.c",
- "mock_endpoint.c",
- "parse_hexstring.c",
- "passthru_endpoint.c",
- "port.c",
- "port_server_client.c",
- "reconnect_server.c",
- "slice_splitter.c",
- "test_tcp_server.c",
- "trickle_endpoint.c",
+ "grpc_profiler.cc",
+ "mock_endpoint.cc",
+ "parse_hexstring.cc",
+ "passthru_endpoint.cc",
+ "port.cc",
+ "port_server_client.cc",
+ "reconnect_server.cc",
+ "slice_splitter.cc",
+ "test_tcp_server.cc",
+ "trickle_endpoint.cc",
],
hdrs = [
"grpc_profiler.h",
@@ -71,7 +71,7 @@ grpc_cc_library(
"test_tcp_server.h",
"trickle_endpoint.h",
],
- language = "C",
+ language = "C++",
deps = [
":gpr_test_util",
"//:grpc_common",
@@ -83,7 +83,7 @@ grpc_cc_library(
name = "grpc_test_util",
srcs = [],
hdrs = [],
- language = "C",
+ language = "C++",
deps = [
":grpc_test_util_base",
"//:grpc",
@@ -94,7 +94,7 @@ grpc_cc_library(
name = "grpc_test_util_unsecure",
srcs = [],
hdrs = [],
- language = "C",
+ language = "C++",
deps = [
":grpc_test_util_base",
"//:grpc_unsecure",
diff --git a/test/core/util/debugger_macros.cc b/test/core/util/debugger_macros.cc
index 5985fcfb83..d344c3fb74 100644
--- a/test/core/util/debugger_macros.cc
+++ b/test/core/util/debugger_macros.cc
@@ -29,7 +29,7 @@
#include "src/core/lib/channel/connected_channel.h"
#include "src/core/lib/surface/call.h"
-extern "C" void grpc_summon_debugger_macros() {}
+void grpc_summon_debugger_macros() {}
grpc_stream* grpc_transport_stream_from_call(grpc_call* call) {
grpc_call_stack* cs = grpc_call_get_call_stack(call);
diff --git a/test/core/util/debugger_macros.h b/test/core/util/debugger_macros.h
index 24718d9307..c6b3720c5a 100644
--- a/test/core/util/debugger_macros.h
+++ b/test/core/util/debugger_macros.h
@@ -19,14 +19,6 @@
#ifndef GRPC_TEST_CORE_UTIL_DEBUGGER_MACROS_H
#define GRPC_TEST_CORE_UTIL_DEBUGGER_MACROS_H
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
void grpc_summon_debugger_macros();
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
#endif /* GRPC_TEST_CORE_UTIL_DEBUGGER_MACROS_H */
diff --git a/test/core/util/grpc_profiler.c b/test/core/util/grpc_profiler.cc
index 88f233598b..88f233598b 100644
--- a/test/core/util/grpc_profiler.c
+++ b/test/core/util/grpc_profiler.cc
diff --git a/test/core/util/grpc_profiler.h b/test/core/util/grpc_profiler.h
index 0c35822f88..f9ddd2242e 100644
--- a/test/core/util/grpc_profiler.h
+++ b/test/core/util/grpc_profiler.h
@@ -19,15 +19,7 @@
#ifndef GRPC_TEST_CORE_UTIL_GRPC_PROFILER_H
#define GRPC_TEST_CORE_UTIL_GRPC_PROFILER_H
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
void grpc_profiler_start(const char* filename);
void grpc_profiler_stop();
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
#endif /* GRPC_TEST_CORE_UTIL_GRPC_PROFILER_H */
diff --git a/test/core/util/memory_counters.c b/test/core/util/memory_counters.cc
index ff85a63803..ff85a63803 100644
--- a/test/core/util/memory_counters.c
+++ b/test/core/util/memory_counters.cc
diff --git a/test/core/util/mock_endpoint.c b/test/core/util/mock_endpoint.cc
index a467dcdc18..a467dcdc18 100644
--- a/test/core/util/mock_endpoint.c
+++ b/test/core/util/mock_endpoint.cc
diff --git a/test/core/util/one_corpus_entry_fuzzer.c b/test/core/util/one_corpus_entry_fuzzer.cc
index cfd5a1099f..c0b67da1e2 100644
--- a/test/core/util/one_corpus_entry_fuzzer.c
+++ b/test/core/util/one_corpus_entry_fuzzer.cc
@@ -21,7 +21,7 @@
#include <grpc/support/log.h>
#include "src/core/lib/iomgr/load_file.h"
-extern int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size);
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size);
extern bool squelch;
extern bool leak_check;
diff --git a/test/core/util/parse_hexstring.c b/test/core/util/parse_hexstring.cc
index 6dee0f163a..6dee0f163a 100644
--- a/test/core/util/parse_hexstring.c
+++ b/test/core/util/parse_hexstring.cc
diff --git a/test/core/util/passthru_endpoint.c b/test/core/util/passthru_endpoint.cc
index acce902010..acce902010 100644
--- a/test/core/util/passthru_endpoint.c
+++ b/test/core/util/passthru_endpoint.cc
diff --git a/test/core/util/port.c b/test/core/util/port.cc
index c5bebe08e7..c5bebe08e7 100644
--- a/test/core/util/port.c
+++ b/test/core/util/port.cc
diff --git a/test/core/util/port_server_client.c b/test/core/util/port_server_client.cc
index 988a5384b9..927bc91d38 100644
--- a/test/core/util/port_server_client.c
+++ b/test/core/util/port_server_client.cc
@@ -80,7 +80,7 @@ void grpc_free_port_using_server(int port) {
shutdown_closure = GRPC_CLOSURE_CREATE(destroy_pops_and_shutdown, &pr.pops,
grpc_schedule_on_exec_ctx);
- req.host = GRPC_PORT_SERVER_ADDRESS;
+ req.host = const_cast<char*>(GRPC_PORT_SERVER_ADDRESS);
gpr_asprintf(&path, "/drop/%d", port);
req.http.path = path;
@@ -167,7 +167,7 @@ static void got_port_from_server(grpc_exec_ctx* exec_ctx, void* arg,
GPR_TIMESPAN)));
pr->retries++;
req.host = pr->server;
- req.http.path = "/get";
+ req.http.path = const_cast<char*>("/get");
grpc_http_response_destroy(&pr->response);
memset(&pr->response, 0, sizeof(pr->response));
grpc_resource_quota* resource_quota =
@@ -213,11 +213,11 @@ int grpc_pick_port_using_server(void) {
shutdown_closure = GRPC_CLOSURE_CREATE(destroy_pops_and_shutdown, &pr.pops,
grpc_schedule_on_exec_ctx);
pr.port = -1;
- pr.server = GRPC_PORT_SERVER_ADDRESS;
+ pr.server = const_cast<char*>(GRPC_PORT_SERVER_ADDRESS);
pr.ctx = &context;
- req.host = GRPC_PORT_SERVER_ADDRESS;
- req.http.path = "/get";
+ req.host = const_cast<char*>(GRPC_PORT_SERVER_ADDRESS);
+ req.http.path = const_cast<char*>("/get");
grpc_httpcli_context_init(&context);
grpc_resource_quota* resource_quota =
diff --git a/test/core/util/reconnect_server.c b/test/core/util/reconnect_server.cc
index 742bcf560e..c7c0595d7f 100644
--- a/test/core/util/reconnect_server.c
+++ b/test/core/util/reconnect_server.cc
@@ -82,7 +82,7 @@ static void on_connect(grpc_exec_ctx* exec_ctx, void* arg, grpc_endpoint* tcp,
gpr_free(peer);
}
}
- new_tail = gpr_malloc(sizeof(timestamp_list));
+ new_tail = static_cast<timestamp_list*>(gpr_malloc(sizeof(timestamp_list)));
new_tail->timestamp = now;
new_tail->next = NULL;
if (server->tail == NULL) {
diff --git a/test/core/util/reconnect_server.h b/test/core/util/reconnect_server.h
index 5aec586ff6..d15abe529d 100644
--- a/test/core/util/reconnect_server.h
+++ b/test/core/util/reconnect_server.h
@@ -23,10 +23,6 @@
#include <grpc/support/time.h>
#include "test/core/util/test_tcp_server.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
-
typedef struct timestamp_list {
gpr_timespec timestamp;
struct timestamp_list* next;
@@ -46,8 +42,4 @@ void reconnect_server_poll(reconnect_server* server, int seconds);
void reconnect_server_destroy(reconnect_server* server);
void reconnect_server_clear_timestamps(reconnect_server* server);
-#ifdef __cplusplus
-}
-#endif
-
#endif /* GRPC_TEST_CORE_UTIL_RECONNECT_SERVER_H */
diff --git a/test/core/util/slice_splitter.c b/test/core/util/slice_splitter.cc
index e25e1d862a..e25e1d862a 100644
--- a/test/core/util/slice_splitter.c
+++ b/test/core/util/slice_splitter.cc
diff --git a/test/core/util/test_config.c b/test/core/util/test_config.cc
index ea3a4b5ca0..3106fb01ea 100644
--- a/test/core/util/test_config.c
+++ b/test/core/util/test_config.cc
@@ -176,7 +176,7 @@ static LONG crash_handler(struct _EXCEPTION_POINTERS* ex_info) {
static void abort_handler(int sig) {
fprintf(stderr, "Abort handler called.\n");
- print_current_stack(NULL);
+ print_current_stack();
if (IsDebuggerPresent()) {
__debugbreak();
} else {
diff --git a/test/core/util/test_config.h b/test/core/util/test_config.h
index edc0fbad7c..4383fbfce8 100644
--- a/test/core/util/test_config.h
+++ b/test/core/util/test_config.h
@@ -23,7 +23,7 @@
#ifdef __cplusplus
extern "C" {
-#endif /* __cplusplus */
+#endif
extern int64_t g_fixture_slowdown_factor;
extern int64_t g_poller_slowdown_factor;
@@ -45,6 +45,6 @@ void grpc_test_init(int argc, char** argv);
#ifdef __cplusplus
}
-#endif /* __cplusplus */
+#endif
#endif /* GRPC_TEST_CORE_UTIL_TEST_CONFIG_H */
diff --git a/test/core/util/test_tcp_server.c b/test/core/util/test_tcp_server.cc
index d97f2c7bda..925209d255 100644
--- a/test/core/util/test_tcp_server.c
+++ b/test/core/util/test_tcp_server.cc
@@ -35,7 +35,7 @@
static void on_server_destroyed(grpc_exec_ctx* exec_ctx, void* data,
grpc_error* error) {
- test_tcp_server* server = data;
+ test_tcp_server* server = static_cast<test_tcp_server*>(data);
server->shutdown = 1;
}
@@ -46,7 +46,7 @@ void test_tcp_server_init(test_tcp_server* server,
GRPC_CLOSURE_INIT(&server->shutdown_complete, on_server_destroyed, server,
grpc_schedule_on_exec_ctx);
server->shutdown = 0;
- server->pollset = gpr_zalloc(grpc_pollset_size());
+ server->pollset = static_cast<grpc_pollset*>(gpr_zalloc(grpc_pollset_size()));
grpc_pollset_init(server->pollset, &server->mu);
server->on_connect = on_connect;
server->cb_data = user_data;
@@ -93,7 +93,7 @@ void test_tcp_server_poll(test_tcp_server* server, int seconds) {
static void do_nothing(grpc_exec_ctx* exec_ctx, void* arg, grpc_error* error) {}
static void finish_pollset(grpc_exec_ctx* exec_ctx, void* arg,
grpc_error* error) {
- grpc_pollset_destroy(exec_ctx, arg);
+ grpc_pollset_destroy(exec_ctx, static_cast<grpc_pollset*>(arg));
}
void test_tcp_server_destroy(test_tcp_server* server) {
diff --git a/test/core/util/trickle_endpoint.c b/test/core/util/trickle_endpoint.cc
index c8b54b481d..c8b54b481d 100644
--- a/test/core/util/trickle_endpoint.c
+++ b/test/core/util/trickle_endpoint.cc
diff --git a/test/core/util/trickle_endpoint.h b/test/core/util/trickle_endpoint.h
index de87a1f4ab..11c113bda8 100644
--- a/test/core/util/trickle_endpoint.h
+++ b/test/core/util/trickle_endpoint.h
@@ -21,10 +21,6 @@
#include "src/core/lib/iomgr/endpoint.h"
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
grpc_endpoint* grpc_trickle_endpoint_create(grpc_endpoint* wrap,
double bytes_per_second);
@@ -34,8 +30,4 @@ size_t grpc_trickle_endpoint_trickle(grpc_exec_ctx* exec_ctx,
size_t grpc_trickle_get_backlog(grpc_endpoint* endpoint);
-#ifdef __cplusplus
-}
-#endif // __cplusplus
-
#endif