diff options
Diffstat (limited to 'test')
27 files changed, 153 insertions, 97 deletions
diff --git a/test/core/bad_client/bad_client.c b/test/core/bad_client/bad_client.c index 07fcd995d7..1ce3a49097 100644 --- a/test/core/bad_client/bad_client.c +++ b/test/core/bad_client/bad_client.c @@ -33,15 +33,18 @@ #include "test/core/bad_client/bad_client.h" +#include <stdio.h> + #include <grpc/support/alloc.h> #include <grpc/support/string_util.h> #include <grpc/support/sync.h> #include <grpc/support/thd.h> -#include <stdio.h> + #include "src/core/ext/transport/chttp2/transport/chttp2_transport.h" #include "src/core/lib/channel/channel_stack.h" #include "src/core/lib/channel/http_server_filter.h" #include "src/core/lib/iomgr/endpoint_pair.h" +#include "src/core/lib/slice/slice_internal.h" #include "src/core/lib/support/murmur_hash.h" #include "src/core/lib/support/string.h" #include "src/core/lib/surface/completion_queue.h" @@ -117,7 +120,7 @@ void grpc_run_bad_client_test( grpc_resource_quota *resource_quota = grpc_resource_quota_create("bad_client_test"); sfd = grpc_iomgr_create_endpoint_pair("fixture", resource_quota, 65536); - grpc_resource_quota_internal_unref(&exec_ctx, resource_quota); + grpc_resource_quota_unref_internal(&exec_ctx, resource_quota); /* Create server, completion events */ a.server = grpc_server_create(NULL, NULL); @@ -181,7 +184,7 @@ void grpc_run_bad_client_test( grpc_exec_ctx_finish(&exec_ctx); GPR_ASSERT( gpr_event_wait(&args.read_done, GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5))); - grpc_slice_buffer_destroy(&args.incoming); + grpc_slice_buffer_destroy_internal(&exec_ctx, &args.incoming); } // Shutdown. grpc_endpoint_shutdown(&exec_ctx, sfd.client); @@ -194,7 +197,7 @@ void grpc_run_bad_client_test( .type == GRPC_OP_COMPLETE); grpc_server_destroy(a.server); grpc_completion_queue_destroy(a.cq); - grpc_slice_buffer_destroy(&outgoing); + grpc_slice_buffer_destroy_internal(&exec_ctx, &outgoing); grpc_exec_ctx_finish(&exec_ctx); grpc_shutdown(); diff --git a/test/core/bad_client/tests/large_metadata.c b/test/core/bad_client/tests/large_metadata.c index 9c804e78c1..809bbe4094 100644 --- a/test/core/bad_client/tests/large_metadata.c +++ b/test/core/bad_client/tests/large_metadata.c @@ -213,7 +213,7 @@ static void client_validator(grpc_slice_buffer *incoming) { *p++ = 11; // Compare actual and expected. GPR_ASSERT(grpc_slice_cmp(last_frame, expected) == 0); - grpc_slice_buffer_destroy(&last_frame_buffer); + grpc_slice_buffer_destroy_internal(exec_ctx, &last_frame_buffer); } int main(int argc, char **argv) { diff --git a/test/core/client_channel/set_initial_connect_string_test.c b/test/core/client_channel/set_initial_connect_string_test.c index b16a3ebf45..b342d613b2 100644 --- a/test/core/client_channel/set_initial_connect_string_test.c +++ b/test/core/client_channel/set_initial_connect_string_test.c @@ -155,8 +155,8 @@ static void start_rpc(int use_creds, int target_port) { static void cleanup_rpc(void) { grpc_event ev; - grpc_slice_buffer_destroy(&state.incoming_buffer); - grpc_slice_buffer_destroy(&state.temp_incoming_buffer); + grpc_slice_buffer_destroy_internal(exec_ctx, &state.incoming_buffer); + grpc_slice_buffer_destroy_internal(exec_ctx, &state.temp_incoming_buffer); grpc_channel_credentials_unref(state.creds); grpc_call_destroy(state.call); grpc_completion_queue_shutdown(state.cq); diff --git a/test/core/compression/message_compress_test.c b/test/core/compression/message_compress_test.c index fc53cd9d36..ee4f0dbe40 100644 --- a/test/core/compression/message_compress_test.c +++ b/test/core/compression/message_compress_test.c @@ -105,10 +105,10 @@ static void assert_passthrough(grpc_slice value, final = grpc_slice_merge(output.slices, output.count); GPR_ASSERT(0 == grpc_slice_cmp(value, final)); - grpc_slice_buffer_destroy(&input); - grpc_slice_buffer_destroy(&compressed); - grpc_slice_buffer_destroy(&compressed_raw); - grpc_slice_buffer_destroy(&output); + grpc_slice_buffer_destroy_internal(exec_ctx, &input); + grpc_slice_buffer_destroy_internal(exec_ctx, &compressed); + grpc_slice_buffer_destroy_internal(exec_ctx, &compressed_raw); + grpc_slice_buffer_destroy_internal(exec_ctx, &output); grpc_slice_unref(final); } @@ -164,8 +164,8 @@ static void test_tiny_data_compress(void) { GPR_ASSERT(1 == output.count); } - grpc_slice_buffer_destroy(&input); - grpc_slice_buffer_destroy(&output); + grpc_slice_buffer_destroy_internal(exec_ctx, &input); + grpc_slice_buffer_destroy_internal(exec_ctx, &output); } static void test_bad_decompression_data_crc(void) { @@ -191,9 +191,9 @@ static void test_bad_decompression_data_crc(void) { /* try (and fail) to decompress the corrupted compresed buffer */ GPR_ASSERT(0 == grpc_msg_decompress(GRPC_COMPRESS_GZIP, &corrupted, &output)); - grpc_slice_buffer_destroy(&input); - grpc_slice_buffer_destroy(&corrupted); - grpc_slice_buffer_destroy(&output); + grpc_slice_buffer_destroy_internal(exec_ctx, &input); + grpc_slice_buffer_destroy_internal(exec_ctx, &corrupted); + grpc_slice_buffer_destroy_internal(exec_ctx, &output); } static void test_bad_decompression_data_trailing_garbage(void) { @@ -210,8 +210,8 @@ static void test_bad_decompression_data_trailing_garbage(void) { /* try (and fail) to decompress the invalid compresed buffer */ GPR_ASSERT(0 == grpc_msg_decompress(GRPC_COMPRESS_DEFLATE, &input, &output)); - grpc_slice_buffer_destroy(&input); - grpc_slice_buffer_destroy(&output); + grpc_slice_buffer_destroy_internal(exec_ctx, &input); + grpc_slice_buffer_destroy_internal(exec_ctx, &output); } static void test_bad_decompression_data_stream(void) { @@ -226,8 +226,8 @@ static void test_bad_decompression_data_stream(void) { /* try (and fail) to decompress the invalid compresed buffer */ GPR_ASSERT(0 == grpc_msg_decompress(GRPC_COMPRESS_DEFLATE, &input, &output)); - grpc_slice_buffer_destroy(&input); - grpc_slice_buffer_destroy(&output); + grpc_slice_buffer_destroy_internal(exec_ctx, &input); + grpc_slice_buffer_destroy_internal(exec_ctx, &output); } static void test_bad_compression_algorithm(void) { @@ -247,8 +247,8 @@ static void test_bad_compression_algorithm(void) { grpc_msg_compress(GRPC_COMPRESS_ALGORITHMS_COUNT + 123, &input, &output); GPR_ASSERT(0 == was_compressed); - grpc_slice_buffer_destroy(&input); - grpc_slice_buffer_destroy(&output); + grpc_slice_buffer_destroy_internal(exec_ctx, &input); + grpc_slice_buffer_destroy_internal(exec_ctx, &output); } static void test_bad_decompression_algorithm(void) { @@ -269,8 +269,8 @@ static void test_bad_decompression_algorithm(void) { &input, &output); GPR_ASSERT(0 == was_decompressed); - grpc_slice_buffer_destroy(&input); - grpc_slice_buffer_destroy(&output); + grpc_slice_buffer_destroy_internal(exec_ctx, &input); + grpc_slice_buffer_destroy_internal(exec_ctx, &output); } int main(int argc, char **argv) { diff --git a/test/core/end2end/bad_server_response_test.c b/test/core/end2end/bad_server_response_test.c index 1c4a17fda8..9dc70d79ec 100644 --- a/test/core/end2end/bad_server_response_test.c +++ b/test/core/end2end/bad_server_response_test.c @@ -228,8 +228,8 @@ static void start_rpc(int target_port, grpc_status_code expected_status, static void cleanup_rpc(void) { grpc_event ev; - grpc_slice_buffer_destroy(&state.temp_incoming_buffer); - grpc_slice_buffer_destroy(&state.outgoing_buffer); + grpc_slice_buffer_destroy_internal(exec_ctx, &state.temp_incoming_buffer); + grpc_slice_buffer_destroy_internal(exec_ctx, &state.outgoing_buffer); grpc_call_destroy(state.call); grpc_completion_queue_shutdown(state.cq); do { diff --git a/test/core/end2end/dualstack_socket_test.c b/test/core/end2end/dualstack_socket_test.c index 11e8604f56..dc03861f86 100644 --- a/test/core/end2end/dualstack_socket_test.c +++ b/test/core/end2end/dualstack_socket_test.c @@ -145,7 +145,7 @@ void test_connect(const char *server_host, const char *client_host, int port, gpr_free(hosts_with_port[i]); } gpr_free(hosts_with_port); - grpc_slice_buffer_destroy(&uri_parts); + grpc_slice_buffer_destroy_internal(exec_ctx, &uri_parts); grpc_slice_unref(uri_slice); } else { gpr_join_host_port(&client_hostport, client_host, port); diff --git a/test/core/end2end/fake_resolver.c b/test/core/end2end/fake_resolver.c index 865b55de4d..55a42b8fa3 100644 --- a/test/core/end2end/fake_resolver.c +++ b/test/core/end2end/fake_resolver.c @@ -48,6 +48,7 @@ #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/iomgr/resolve_address.h" #include "src/core/lib/iomgr/unix_sockets_posix.h" +#include "src/core/lib/slice/slice_internal.h" #include "src/core/lib/slice/slice_string_helpers.h" #include "src/core/lib/support/string.h" @@ -76,8 +77,8 @@ typedef struct { static void fake_resolver_destroy(grpc_exec_ctx* exec_ctx, grpc_resolver* gr) { fake_resolver* r = (fake_resolver*)gr; gpr_mu_destroy(&r->mu); - grpc_channel_args_destroy(r->channel_args); - grpc_lb_addresses_destroy(r->addresses); + grpc_channel_args_destroy(exec_ctx, r->channel_args); + grpc_lb_addresses_destroy(exec_ctx, r->addresses); gpr_free(r); } @@ -140,7 +141,8 @@ static void fake_resolver_factory_unref(grpc_resolver_factory* factory) {} static void do_nothing(void* ignored) {} -static grpc_resolver* fake_resolver_create(grpc_resolver_factory* factory, +static grpc_resolver* fake_resolver_create(grpc_exec_ctx* exec_ctx, + grpc_resolver_factory* factory, grpc_resolver_args* args) { if (0 != strcmp(args->uri->authority, "")) { gpr_log(GPR_ERROR, "authority based uri's not supported by the %s scheme", @@ -172,10 +174,10 @@ static grpc_resolver* fake_resolver_create(grpc_resolver_factory* factory, addresses->addresses[i].is_balancer = lb_enabled; if (errors_found) break; } - grpc_slice_buffer_destroy(&path_parts); + grpc_slice_buffer_destroy_internal(exec_ctx, &path_parts); grpc_slice_unref(path_slice); if (errors_found) { - grpc_lb_addresses_destroy(addresses); + grpc_lb_addresses_destroy(exec_ctx, addresses); return NULL; } // Instantiate resolver. diff --git a/test/core/end2end/fixtures/http_proxy.c b/test/core/end2end/fixtures/http_proxy.c index 57fc4a38f8..f60c405cda 100644 --- a/test/core/end2end/fixtures/http_proxy.c +++ b/test/core/end2end/fixtures/http_proxy.c @@ -59,6 +59,7 @@ #include "src/core/lib/iomgr/sockaddr_utils.h" #include "src/core/lib/iomgr/tcp_client.h" #include "src/core/lib/iomgr/tcp_server.h" +#include "src/core/lib/slice/slice_internal.h" #include "test/core/util/port.h" struct grpc_end2end_http_proxy { @@ -110,12 +111,14 @@ static void proxy_connection_unref(grpc_exec_ctx* exec_ctx, if (conn->server_endpoint != NULL) grpc_endpoint_destroy(exec_ctx, conn->server_endpoint); grpc_pollset_set_destroy(conn->pollset_set); - grpc_slice_buffer_destroy(&conn->client_read_buffer); - grpc_slice_buffer_destroy(&conn->client_deferred_write_buffer); - grpc_slice_buffer_destroy(&conn->client_write_buffer); - grpc_slice_buffer_destroy(&conn->server_read_buffer); - grpc_slice_buffer_destroy(&conn->server_deferred_write_buffer); - grpc_slice_buffer_destroy(&conn->server_write_buffer); + grpc_slice_buffer_destroy_internal(exec_ctx, &conn->client_read_buffer); + grpc_slice_buffer_destroy_internal(exec_ctx, + &conn->client_deferred_write_buffer); + grpc_slice_buffer_destroy_internal(exec_ctx, &conn->client_write_buffer); + grpc_slice_buffer_destroy_internal(exec_ctx, &conn->server_read_buffer); + grpc_slice_buffer_destroy_internal(exec_ctx, + &conn->server_deferred_write_buffer); + grpc_slice_buffer_destroy_internal(exec_ctx, &conn->server_write_buffer); grpc_http_parser_destroy(&conn->http_parser); grpc_http_request_destroy(&conn->http_request); gpr_free(conn); @@ -468,7 +471,7 @@ void grpc_end2end_http_proxy_destroy(grpc_end2end_http_proxy* proxy) { grpc_tcp_server_shutdown_listeners(&exec_ctx, proxy->server); grpc_tcp_server_unref(&exec_ctx, proxy->server); gpr_free(proxy->proxy_name); - grpc_channel_args_destroy(proxy->channel_args); + grpc_channel_args_destroy(&exec_ctx, proxy->channel_args); grpc_closure destroyed; grpc_closure_init(&destroyed, destroy_pollset, proxy->pollset); grpc_pollset_shutdown(&exec_ctx, proxy->pollset, &destroyed); diff --git a/test/core/end2end/fuzzers/client_fuzzer.c b/test/core/end2end/fuzzers/client_fuzzer.c index c5260cd287..26b520885b 100644 --- a/test/core/end2end/fuzzers/client_fuzzer.c +++ b/test/core/end2end/fuzzers/client_fuzzer.c @@ -62,7 +62,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { grpc_resource_quota_create("client_fuzzer"); grpc_endpoint *mock_endpoint = grpc_mock_endpoint_create(discard_write, resource_quota); - grpc_resource_quota_internal_unref(&exec_ctx, resource_quota); + grpc_resource_quota_unref_internal(&exec_ctx, resource_quota); grpc_completion_queue *cq = grpc_completion_queue_create(NULL); grpc_transport *transport = diff --git a/test/core/end2end/fuzzers/server_fuzzer.c b/test/core/end2end/fuzzers/server_fuzzer.c index 164022ec79..115fb06925 100644 --- a/test/core/end2end/fuzzers/server_fuzzer.c +++ b/test/core/end2end/fuzzers/server_fuzzer.c @@ -60,7 +60,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { grpc_resource_quota_create("server_fuzzer"); grpc_endpoint *mock_endpoint = grpc_mock_endpoint_create(discard_write, resource_quota); - grpc_resource_quota_internal_unref(&exec_ctx, resource_quota); + grpc_resource_quota_unref_internal(&exec_ctx, resource_quota); grpc_mock_endpoint_put_read( &exec_ctx, mock_endpoint, grpc_slice_from_copied_buffer((const char *)data, size)); diff --git a/test/core/end2end/tests/cancel_after_accept.c b/test/core/end2end/tests/cancel_after_accept.c index 428a2d1c3c..c0beb456ad 100644 --- a/test/core/end2end/tests/cancel_after_accept.c +++ b/test/core/end2end/tests/cancel_after_accept.c @@ -139,14 +139,16 @@ static void test_cancel_after_accept(grpc_end2end_test_config config, grpc_mdstr_from_string("/service/method"), grpc_method_config_create(NULL, &timeout, NULL, NULL), }; + grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_method_config_table *method_config_table = grpc_method_config_table_create(1, &entry); - GRPC_MDSTR_UNREF(entry.method_name); - grpc_method_config_unref(entry.method_config); + GRPC_MDSTR_UNREF(&exec_ctx, entry.method_name); + grpc_method_config_unref(&exec_ctx, entry.method_config); grpc_arg arg = grpc_method_config_table_create_channel_arg(method_config_table); args = grpc_channel_args_copy_and_add(args, &arg, 1); - grpc_method_config_table_unref(method_config_table); + grpc_method_config_table_unref(&exec_ctx, method_config_table); + grpc_exec_ctx_finish(&exec_ctx); } grpc_end2end_test_fixture f = @@ -251,7 +253,11 @@ static void test_cancel_after_accept(grpc_end2end_test_config config, grpc_call_destroy(c); grpc_call_destroy(s); - if (args != NULL) grpc_channel_args_destroy(args); + if (args != NULL) { + grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; + grpc_channel_args_destroy(&exec_ctx, args); + grpc_exec_ctx_finish(&exec_ctx); + } cq_verifier_destroy(cqv); end_test(&f); diff --git a/test/core/end2end/tests/compressed_payload.c b/test/core/end2end/tests/compressed_payload.c index 81fc7091f8..d7efe7747b 100644 --- a/test/core/end2end/tests/compressed_payload.c +++ b/test/core/end2end/tests/compressed_payload.c @@ -140,8 +140,12 @@ static void request_for_disabled_algorithm( NULL, requested_client_compression_algorithm); server_args = grpc_channel_args_set_compression_algorithm(NULL, GRPC_COMPRESS_NONE); - server_args = grpc_channel_args_compression_algorithm_set_state( - &server_args, algorithm_to_disable, false); + { + grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; + server_args = grpc_channel_args_compression_algorithm_set_state( + &exec_ctx, &server_args, algorithm_to_disable, false); + grpc_exec_ctx_finish(&exec_ctx); + } f = begin_test(config, test_name, client_args, server_args); cqv = cq_verifier_create(f.cq); @@ -262,8 +266,12 @@ static void request_for_disabled_algorithm( grpc_byte_buffer_destroy(request_payload); grpc_byte_buffer_destroy(request_payload_recv); - grpc_channel_args_destroy(client_args); - grpc_channel_args_destroy(server_args); + { + grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; + grpc_channel_args_destroy(&exec_ctx, client_args); + grpc_channel_args_destroy(&exec_ctx, server_args); + grpc_exec_ctx_finish(&exec_ctx); + } end_test(&f); config.tear_down_data(&f); @@ -512,8 +520,12 @@ static void request_with_payload_template( cq_verifier_destroy(cqv); - grpc_channel_args_destroy(client_args); - grpc_channel_args_destroy(server_args); + { + grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; + grpc_channel_args_destroy(&exec_ctx, client_args); + grpc_channel_args_destroy(&exec_ctx, server_args); + grpc_exec_ctx_finish(&exec_ctx); + } end_test(&f); config.tear_down_data(&f); diff --git a/test/core/end2end/tests/filter_call_init_fails.c b/test/core/end2end/tests/filter_call_init_fails.c index 41ae575fff..01b6c32ee7 100644 --- a/test/core/end2end/tests/filter_call_init_fails.c +++ b/test/core/end2end/tests/filter_call_init_fails.c @@ -241,7 +241,8 @@ static const grpc_channel_filter test_filter = { * Registration */ -static bool maybe_add_filter(grpc_channel_stack_builder *builder, void *arg) { +static bool maybe_add_filter(grpc_exec_ctx *exec_ctx, + grpc_channel_stack_builder *builder, void *arg) { if (g_enable_filter) { // Want to add the filter as close to the end as possible, to make // sure that all of the filters work well together. However, we diff --git a/test/core/end2end/tests/filter_causes_close.c b/test/core/end2end/tests/filter_causes_close.c index bf9fd9073d..def21be43f 100644 --- a/test/core/end2end/tests/filter_causes_close.c +++ b/test/core/end2end/tests/filter_causes_close.c @@ -213,8 +213,8 @@ static void recv_im_ready(grpc_exec_ctx *exec_ctx, void *arg, grpc_slice message = grpc_slice_from_copied_string("Failure that's not preventable."); grpc_transport_stream_op *op = grpc_make_transport_stream_op(NULL); - grpc_transport_stream_op_add_close(op, GRPC_STATUS_PERMISSION_DENIED, - &message); + grpc_transport_stream_op_add_close(exec_ctx, op, + GRPC_STATUS_PERMISSION_DENIED, &message); grpc_call_next_op(exec_ctx, elem, op); } grpc_exec_ctx_sched( @@ -268,7 +268,8 @@ static const grpc_channel_filter test_filter = { * Registration */ -static bool maybe_add_filter(grpc_channel_stack_builder *builder, void *arg) { +static bool maybe_add_filter(grpc_exec_ctx *exec_ctx, + grpc_channel_stack_builder *builder, void *arg) { if (g_enable_filter) { return grpc_channel_stack_builder_prepend_filter(builder, &test_filter, NULL, NULL); diff --git a/test/core/end2end/tests/load_reporting_hook.c b/test/core/end2end/tests/load_reporting_hook.c index 5b75f26bd2..ae5c270629 100644 --- a/test/core/end2end/tests/load_reporting_hook.c +++ b/test/core/end2end/tests/load_reporting_hook.c @@ -311,7 +311,11 @@ static void test_load_reporting_hook(grpc_end2end_test_config config) { response_msg, &initial_lr_metadata, &trailing_lr_metadata); end_test(&f); - grpc_channel_args_destroy(lr_server_args); + { + grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; + grpc_channel_args_destroy(&exec_ctx, lr_server_args); + grpc_exec_ctx_finish(&exec_ctx); + } config.tear_down_data(&f); } diff --git a/test/core/end2end/tests/max_message_length.c b/test/core/end2end/tests/max_message_length.c index 0ddd7bed15..ec85f3cb5d 100644 --- a/test/core/end2end/tests/max_message_length.c +++ b/test/core/end2end/tests/max_message_length.c @@ -137,6 +137,7 @@ static void test_max_message_length_on_request(grpc_end2end_test_config config, grpc_channel_args *server_args = NULL; if (use_service_config) { // We don't currently support service configs on the server side. + grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; GPR_ASSERT(send_limit); int32_t max_request_message_bytes = 5; grpc_method_config_table_entry entry = { @@ -145,12 +146,13 @@ static void test_max_message_length_on_request(grpc_end2end_test_config config, }; grpc_method_config_table *method_config_table = grpc_method_config_table_create(1, &entry); - GRPC_MDSTR_UNREF(entry.method_name); - grpc_method_config_unref(entry.method_config); + GRPC_MDSTR_UNREF(&exec_ctx, entry.method_name); + grpc_method_config_unref(&exec_ctx, entry.method_config); grpc_arg arg = grpc_method_config_table_create_channel_arg(method_config_table); client_args = grpc_channel_args_copy_and_add(NULL, &arg, 1); - grpc_method_config_table_unref(method_config_table); + grpc_method_config_table_unref(&exec_ctx, method_config_table); + grpc_exec_ctx_finish(&exec_ctx); } else { // Set limit via channel args. grpc_arg arg; @@ -168,8 +170,12 @@ static void test_max_message_length_on_request(grpc_end2end_test_config config, f = begin_test(config, "test_max_request_message_length", client_args, server_args); - if (client_args != NULL) grpc_channel_args_destroy(client_args); - if (server_args != NULL) grpc_channel_args_destroy(server_args); + { + grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; + if (client_args != NULL) grpc_channel_args_destroy(&exec_ctx, client_args); + if (server_args != NULL) grpc_channel_args_destroy(&exec_ctx, server_args); + grpc_exec_ctx_finish(&exec_ctx); + } cqv = cq_verifier_create(f.cq); @@ -311,6 +317,7 @@ static void test_max_message_length_on_response(grpc_end2end_test_config config, grpc_channel_args *server_args = NULL; if (use_service_config) { // We don't currently support service configs on the server side. + grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; GPR_ASSERT(!send_limit); int32_t max_response_message_bytes = 5; grpc_method_config_table_entry entry = { @@ -320,12 +327,13 @@ static void test_max_message_length_on_response(grpc_end2end_test_config config, }; grpc_method_config_table *method_config_table = grpc_method_config_table_create(1, &entry); - GRPC_MDSTR_UNREF(entry.method_name); - grpc_method_config_unref(entry.method_config); + GRPC_MDSTR_UNREF(&exec_ctx, entry.method_name); + grpc_method_config_unref(&exec_ctx, entry.method_config); grpc_arg arg = grpc_method_config_table_create_channel_arg(method_config_table); client_args = grpc_channel_args_copy_and_add(NULL, &arg, 1); - grpc_method_config_table_unref(method_config_table); + grpc_method_config_table_unref(&exec_ctx, method_config_table); + grpc_exec_ctx_finish(&exec_ctx); } else { // Set limit via channel args. grpc_arg arg; @@ -343,9 +351,12 @@ static void test_max_message_length_on_response(grpc_end2end_test_config config, f = begin_test(config, "test_max_response_message_length", client_args, server_args); - if (client_args != NULL) grpc_channel_args_destroy(client_args); - if (server_args != NULL) grpc_channel_args_destroy(server_args); - + { + grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; + if (client_args != NULL) grpc_channel_args_destroy(&exec_ctx, client_args); + if (server_args != NULL) grpc_channel_args_destroy(&exec_ctx, server_args); + grpc_exec_ctx_finish(&exec_ctx); + } cqv = cq_verifier_create(f.cq); c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, diff --git a/test/core/http/httpcli_test.c b/test/core/http/httpcli_test.c index 3e312c1dde..57b779cccf 100644 --- a/test/core/http/httpcli_test.c +++ b/test/core/http/httpcli_test.c @@ -93,7 +93,7 @@ static void test_get(int port) { grpc_httpcli_get(&exec_ctx, &g_context, &g_pops, resource_quota, &req, n_seconds_time(15), grpc_closure_create(on_finish, &response), &response); - grpc_resource_quota_internal_unref(&exec_ctx, resource_quota); + grpc_resource_quota_unref_internal(&exec_ctx, resource_quota); gpr_mu_lock(g_mu); while (!g_done) { grpc_pollset_worker *worker = NULL; @@ -133,7 +133,7 @@ static void test_post(int port) { grpc_httpcli_post(&exec_ctx, &g_context, &g_pops, resource_quota, &req, "hello", 5, n_seconds_time(15), grpc_closure_create(on_finish, &response), &response); - grpc_resource_quota_internal_unref(&exec_ctx, resource_quota); + grpc_resource_quota_unref_internal(&exec_ctx, resource_quota); gpr_mu_lock(g_mu); while (!g_done) { grpc_pollset_worker *worker = NULL; diff --git a/test/core/http/httpscli_test.c b/test/core/http/httpscli_test.c index d06035149e..765ae101c5 100644 --- a/test/core/http/httpscli_test.c +++ b/test/core/http/httpscli_test.c @@ -94,7 +94,7 @@ static void test_get(int port) { grpc_httpcli_get(&exec_ctx, &g_context, &g_pops, resource_quota, &req, n_seconds_time(15), grpc_closure_create(on_finish, &response), &response); - grpc_resource_quota_internal_unref(&exec_ctx, resource_quota); + grpc_resource_quota_unref_internal(&exec_ctx, resource_quota); gpr_mu_lock(g_mu); while (!g_done) { grpc_pollset_worker *worker = NULL; @@ -135,7 +135,7 @@ static void test_post(int port) { grpc_httpcli_post(&exec_ctx, &g_context, &g_pops, resource_quota, &req, "hello", 5, n_seconds_time(15), grpc_closure_create(on_finish, &response), &response); - grpc_resource_quota_internal_unref(&exec_ctx, resource_quota); + grpc_resource_quota_unref_internal(&exec_ctx, resource_quota); gpr_mu_lock(g_mu); while (!g_done) { grpc_pollset_worker *worker = NULL; diff --git a/test/core/iomgr/endpoint_tests.c b/test/core/iomgr/endpoint_tests.c index 8186ea7e85..14991c9ad9 100644 --- a/test/core/iomgr/endpoint_tests.c +++ b/test/core/iomgr/endpoint_tests.c @@ -41,6 +41,8 @@ #include <grpc/support/log.h> #include <grpc/support/time.h> #include <grpc/support/useful.h> + +#include "src/core/lib/slice/slice_internal.h" #include "test/core/util/test_config.h" /* @@ -249,8 +251,8 @@ static void read_and_write_test(grpc_endpoint_test_config config, grpc_exec_ctx_flush(&exec_ctx); end_test(config); - grpc_slice_buffer_destroy(&state.outgoing); - grpc_slice_buffer_destroy(&state.incoming); + grpc_slice_buffer_destroy_internal(&exec_ctx, &state.outgoing); + grpc_slice_buffer_destroy_internal(&exec_ctx, &state.incoming); grpc_endpoint_destroy(&exec_ctx, state.read_ep); grpc_endpoint_destroy(&exec_ctx, state.write_ep); grpc_exec_ctx_finish(&exec_ctx); @@ -304,7 +306,7 @@ static void multiple_shutdown_test(grpc_endpoint_test_config config) { grpc_endpoint_shutdown(&exec_ctx, f.client_ep); wait_for_fail_count(&exec_ctx, &fail_count, 3); - grpc_slice_buffer_destroy(&slice_buffer); + grpc_slice_buffer_destroy_internal(&exec_ctx, &slice_buffer); grpc_endpoint_destroy(&exec_ctx, f.client_ep); grpc_endpoint_destroy(&exec_ctx, f.server_ep); diff --git a/test/core/iomgr/resource_quota_test.c b/test/core/iomgr/resource_quota_test.c index a82d44f7f8..43fb838eb4 100644 --- a/test/core/iomgr/resource_quota_test.c +++ b/test/core/iomgr/resource_quota_test.c @@ -36,6 +36,7 @@ #include <grpc/support/alloc.h> #include <grpc/support/log.h> +#include "src/core/lib/slice/slice_internal.h" #include "test/core/util/test_config.h" static void inc_int_cb(grpc_exec_ctx *exec_ctx, void *a, grpc_error *error) { @@ -631,7 +632,11 @@ static void test_one_slice(void) { GPR_ASSERT(num_allocs == start_allocs + 1); } - grpc_slice_buffer_destroy(&buffer); + { + grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; + grpc_slice_buffer_destroy_internal(&exec_ctx, &buffer); + grpc_exec_ctx_finish(&exec_ctx); + } destroy_user(usr); grpc_resource_quota_unref(q); } @@ -667,7 +672,11 @@ static void test_one_slice_deleted_late(void) { } grpc_resource_quota_unref(q); - grpc_slice_buffer_destroy(&buffer); + { + grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; + grpc_slice_buffer_destroy_internal(&exec_ctx, &buffer); + grpc_exec_ctx_finish(&exec_ctx); + } } int main(int argc, char **argv) { diff --git a/test/core/iomgr/tcp_posix_test.c b/test/core/iomgr/tcp_posix_test.c index 5eafa570bb..81b9ef5dff 100644 --- a/test/core/iomgr/tcp_posix_test.c +++ b/test/core/iomgr/tcp_posix_test.c @@ -184,7 +184,7 @@ static void read_test(size_t num_bytes, size_t slice_size) { grpc_resource_quota *resource_quota = grpc_resource_quota_create("read_test"); ep = grpc_tcp_create(grpc_fd_create(sv[1], "read_test"), resource_quota, slice_size, "test"); - grpc_resource_quota_internal_unref(&exec_ctx, resource_quota); + grpc_resource_quota_unref_internal(&exec_ctx, resource_quota); grpc_endpoint_add_to_pollset(&exec_ctx, ep, g_pollset); written_bytes = fill_socket_partial(sv[0], num_bytes); @@ -212,7 +212,7 @@ static void read_test(size_t num_bytes, size_t slice_size) { GPR_ASSERT(state.read_bytes == state.target_read_bytes); gpr_mu_unlock(g_mu); - grpc_slice_buffer_destroy(&state.incoming); + grpc_slice_buffer_destroy_internal(exec_ctx, &state.incoming); grpc_endpoint_destroy(&exec_ctx, ep); grpc_exec_ctx_finish(&exec_ctx); } @@ -235,7 +235,7 @@ static void large_read_test(size_t slice_size) { grpc_resource_quota_create("large_read_test"); ep = grpc_tcp_create(grpc_fd_create(sv[1], "large_read_test"), resource_quota, slice_size, "test"); - grpc_resource_quota_internal_unref(&exec_ctx, resource_quota); + grpc_resource_quota_unref_internal(&exec_ctx, resource_quota); grpc_endpoint_add_to_pollset(&exec_ctx, ep, g_pollset); written_bytes = fill_socket(sv[0]); @@ -263,7 +263,7 @@ static void large_read_test(size_t slice_size) { GPR_ASSERT(state.read_bytes == state.target_read_bytes); gpr_mu_unlock(g_mu); - grpc_slice_buffer_destroy(&state.incoming); + grpc_slice_buffer_destroy_internal(exec_ctx, &state.incoming); grpc_endpoint_destroy(&exec_ctx, ep); grpc_exec_ctx_finish(&exec_ctx); } @@ -374,7 +374,7 @@ static void write_test(size_t num_bytes, size_t slice_size) { grpc_resource_quota_create("write_test"); ep = grpc_tcp_create(grpc_fd_create(sv[1], "write_test"), resource_quota, GRPC_TCP_DEFAULT_READ_SLICE_SIZE, "test"); - grpc_resource_quota_internal_unref(&exec_ctx, resource_quota); + grpc_resource_quota_unref_internal(&exec_ctx, resource_quota); grpc_endpoint_add_to_pollset(&exec_ctx, ep, g_pollset); state.ep = ep; @@ -404,7 +404,7 @@ static void write_test(size_t num_bytes, size_t slice_size) { } gpr_mu_unlock(g_mu); - grpc_slice_buffer_destroy(&outgoing); + grpc_slice_buffer_destroy_internal(exec_ctx, &outgoing); grpc_endpoint_destroy(&exec_ctx, ep); gpr_free(slices); grpc_exec_ctx_finish(&exec_ctx); @@ -442,7 +442,7 @@ static void release_fd_test(size_t num_bytes, size_t slice_size) { ep = grpc_tcp_create(grpc_fd_create(sv[1], "read_test"), resource_quota, slice_size, "test"); GPR_ASSERT(grpc_tcp_fd(ep) == sv[1] && sv[1] >= 0); - grpc_resource_quota_internal_unref(&exec_ctx, resource_quota); + grpc_resource_quota_unref_internal(&exec_ctx, resource_quota); grpc_endpoint_add_to_pollset(&exec_ctx, ep, g_pollset); written_bytes = fill_socket_partial(sv[0], num_bytes); @@ -472,7 +472,7 @@ static void release_fd_test(size_t num_bytes, size_t slice_size) { GPR_ASSERT(state.read_bytes == state.target_read_bytes); gpr_mu_unlock(g_mu); - grpc_slice_buffer_destroy(&state.incoming); + grpc_slice_buffer_destroy_internal(exec_ctx, &state.incoming); grpc_tcp_destroy_and_release_fd(&exec_ctx, ep, &fd, &fd_released_cb); grpc_exec_ctx_flush(&exec_ctx); gpr_mu_lock(g_mu); @@ -534,7 +534,7 @@ static grpc_endpoint_test_fixture create_fixture_tcp_socketpair( resource_quota, slice_size, "test"); f.server_ep = grpc_tcp_create(grpc_fd_create(sv[1], "fixture:server"), resource_quota, slice_size, "test"); - grpc_resource_quota_internal_unref(&exec_ctx, resource_quota); + grpc_resource_quota_unref_internal(&exec_ctx, resource_quota); grpc_endpoint_add_to_pollset(&exec_ctx, f.client_ep, g_pollset); grpc_endpoint_add_to_pollset(&exec_ctx, f.server_ep, g_pollset); diff --git a/test/core/security/secure_endpoint_test.c b/test/core/security/secure_endpoint_test.c index b5d95004fe..e49662d428 100644 --- a/test/core/security/secure_endpoint_test.c +++ b/test/core/security/secure_endpoint_test.c @@ -59,7 +59,7 @@ static grpc_endpoint_test_fixture secure_endpoint_create_fixture_tcp_socketpair( grpc_resource_quota *resource_quota = grpc_resource_quota_create("secure_endpoint_test"); tcp = grpc_iomgr_create_endpoint_pair("fixture", resource_quota, slice_size); - grpc_resource_quota_internal_unref(&exec_ctx, resource_quota); + grpc_resource_quota_unref_internal(&exec_ctx, resource_quota); grpc_endpoint_add_to_pollset(&exec_ctx, tcp.client, g_pollset); grpc_endpoint_add_to_pollset(&exec_ctx, tcp.server, g_pollset); @@ -171,7 +171,7 @@ static void test_leftover(grpc_endpoint_test_config config, size_t slice_size) { grpc_endpoint_destroy(&exec_ctx, f.server_ep); grpc_exec_ctx_finish(&exec_ctx); grpc_slice_unref(s); - grpc_slice_buffer_destroy(&incoming); + grpc_slice_buffer_destroy_internal(exec_ctx, &incoming); clean_up(); } diff --git a/test/core/slice/slice_buffer_test.c b/test/core/slice/slice_buffer_test.c index bf9ae197d2..e5ef3047e5 100644 --- a/test/core/slice/slice_buffer_test.c +++ b/test/core/slice/slice_buffer_test.c @@ -68,7 +68,7 @@ void test_slice_buffer_add() { } GPR_ASSERT(buf.count == 0); GPR_ASSERT(buf.length == 0); - grpc_slice_buffer_destroy(&buf); + grpc_slice_buffer_destroy_internal(exec_ctx, &buf); } void test_slice_buffer_move_first() { diff --git a/test/core/surface/byte_buffer_reader_test.c b/test/core/surface/byte_buffer_reader_test.c index d8d7a52d15..0d1628821b 100644 --- a/test/core/surface/byte_buffer_reader_test.c +++ b/test/core/surface/byte_buffer_reader_test.c @@ -162,8 +162,8 @@ static void read_compressed_slice(grpc_compression_algorithm algorithm, GPR_ASSERT(read_count == input_size); grpc_byte_buffer_reader_destroy(&reader); grpc_byte_buffer_destroy(buffer); - grpc_slice_buffer_destroy(&sliceb_out); - grpc_slice_buffer_destroy(&sliceb_in); + grpc_slice_buffer_destroy_internal(exec_ctx, &sliceb_out); + grpc_slice_buffer_destroy_internal(exec_ctx, &sliceb_in); } static void test_read_gzip_compressed_slice(void) { diff --git a/test/core/transport/chttp2/hpack_encoder_test.c b/test/core/transport/chttp2/hpack_encoder_test.c index 91421e18f4..6f1a1f7223 100644 --- a/test/core/transport/chttp2/hpack_encoder_test.c +++ b/test/core/transport/chttp2/hpack_encoder_test.c @@ -101,7 +101,7 @@ static void verify(size_t window_available, int eof, size_t expect_window_used, grpc_chttp2_encode_header(&g_compressor, 0xdeadbeef, &b, eof, 16384, &stats, &output); merged = grpc_slice_merge(output.slices, output.count); - grpc_slice_buffer_destroy(&output); + grpc_slice_buffer_destroy_internal(exec_ctx, &output); grpc_metadata_batch_destroy(&b); if (0 != grpc_slice_cmp(merged, expect)) { @@ -205,7 +205,7 @@ static void verify_table_size_change_match_elem_size(const char *key, memset(&stats, 0, sizeof(stats)); grpc_chttp2_encode_header(&g_compressor, 0xdeadbeef, &b, 0, 16384, &stats, &output); - grpc_slice_buffer_destroy(&output); + grpc_slice_buffer_destroy_internal(exec_ctx, &output); grpc_metadata_batch_destroy(&b); GPR_ASSERT(g_compressor.table_size == elem_size + initial_table_size); diff --git a/test/core/util/passthru_endpoint.c b/test/core/util/passthru_endpoint.c index 8b323d1e45..62d5f1c3db 100644 --- a/test/core/util/passthru_endpoint.c +++ b/test/core/util/passthru_endpoint.c @@ -38,6 +38,8 @@ #include <grpc/support/alloc.h> #include <grpc/support/string_util.h> +#include "src/core/lib/slice/slice_internal.h" + typedef struct passthru_endpoint passthru_endpoint; typedef struct { @@ -132,8 +134,8 @@ static void me_destroy(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep) { if (0 == --p->halves) { gpr_mu_unlock(&p->mu); gpr_mu_destroy(&p->mu); - grpc_slice_buffer_destroy(&p->client.read_buffer); - grpc_slice_buffer_destroy(&p->server.read_buffer); + grpc_slice_buffer_destroy_internal(exec_ctx, &p->client.read_buffer); + grpc_slice_buffer_destroy_internal(exec_ctx, &p->server.read_buffer); grpc_resource_user_unref(exec_ctx, p->client.resource_user); grpc_resource_user_unref(exec_ctx, p->server.resource_user); gpr_free(p); diff --git a/test/core/util/port_server_client.c b/test/core/util/port_server_client.c index b2342feeb4..384a158c47 100644 --- a/test/core/util/port_server_client.c +++ b/test/core/util/port_server_client.c @@ -104,7 +104,7 @@ void grpc_free_port_using_server(char *server, int port) { grpc_httpcli_get(&exec_ctx, &context, &pr.pops, resource_quota, &req, GRPC_TIMEOUT_SECONDS_TO_DEADLINE(10), grpc_closure_create(freed_port_from_server, &pr), &rsp); - grpc_resource_quota_internal_unref(&exec_ctx, resource_quota); + grpc_resource_quota_unref_internal(&exec_ctx, resource_quota); gpr_mu_lock(pr.mu); while (!pr.done) { grpc_pollset_worker *worker = NULL; @@ -176,7 +176,7 @@ static void got_port_from_server(grpc_exec_ctx *exec_ctx, void *arg, GRPC_TIMEOUT_SECONDS_TO_DEADLINE(10), grpc_closure_create(got_port_from_server, pr), &pr->response); - grpc_resource_quota_internal_unref(exec_ctx, resource_quota); + grpc_resource_quota_unref_internal(exec_ctx, resource_quota); return; } GPR_ASSERT(response); @@ -223,7 +223,7 @@ int grpc_pick_port_using_server(char *server) { GRPC_TIMEOUT_SECONDS_TO_DEADLINE(10), grpc_closure_create(got_port_from_server, &pr), &pr.response); - grpc_resource_quota_internal_unref(&exec_ctx, resource_quota); + grpc_resource_quota_unref_internal(&exec_ctx, resource_quota); grpc_exec_ctx_finish(&exec_ctx); gpr_mu_lock(pr.mu); while (pr.port == -1) { |