diff options
author | Yash Tibrewal <yashkt@google.com> | 2017-12-06 09:47:49 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-06 09:47:49 -0800 |
commit | 1d4e99508409be052bd129ba507bae1fbe7eb7fa (patch) | |
tree | 6a657f8c6179d873b34505cdc24bce9462ca68eb /test/core/end2end/tests | |
parent | a3df36cc2505a89c2f481eea4a66a87b3002844a (diff) | |
parent | ad4d2dde0052efbbf49d64b0843c45f0381cfeb3 (diff) |
Merge pull request #13658 from grpc/revert-13058-execctx
Revert "All instances of exec_ctx being passed around in src/core removed"
Diffstat (limited to 'test/core/end2end/tests')
12 files changed, 97 insertions, 61 deletions
diff --git a/test/core/end2end/tests/cancel_after_accept.cc b/test/core/end2end/tests/cancel_after_accept.cc index f59caf7e35..83439d71d2 100644 --- a/test/core/end2end/tests/cancel_after_accept.cc +++ b/test/core/end2end/tests/cancel_after_accept.cc @@ -245,8 +245,9 @@ static void test_cancel_after_accept(grpc_end2end_test_config config, grpc_call_unref(s); if (args != nullptr) { - grpc_core::ExecCtx exec_ctx; - grpc_channel_args_destroy(args); + 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); diff --git a/test/core/end2end/tests/cancel_after_round_trip.cc b/test/core/end2end/tests/cancel_after_round_trip.cc index b10b93978d..ddcec67de5 100644 --- a/test/core/end2end/tests/cancel_after_round_trip.cc +++ b/test/core/end2end/tests/cancel_after_round_trip.cc @@ -278,8 +278,9 @@ static void test_cancel_after_round_trip(grpc_end2end_test_config config, grpc_call_unref(s); if (args != nullptr) { - grpc_core::ExecCtx exec_ctx; - grpc_channel_args_destroy(args); + 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); diff --git a/test/core/end2end/tests/compressed_payload.cc b/test/core/end2end/tests/compressed_payload.cc index 944edc7a70..a8ea0ff2e0 100644 --- a/test/core/end2end/tests/compressed_payload.cc +++ b/test/core/end2end/tests/compressed_payload.cc @@ -129,9 +129,10 @@ static void request_for_disabled_algorithm( server_args = grpc_channel_args_set_compression_algorithm(nullptr, GRPC_COMPRESS_NONE); { - grpc_core::ExecCtx exec_ctx; + grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; server_args = grpc_channel_args_compression_algorithm_set_state( - &server_args, algorithm_to_disable, false); + &exec_ctx, &server_args, algorithm_to_disable, false); + grpc_exec_ctx_finish(&exec_ctx); } f = begin_test(config, test_name, client_args, server_args); @@ -256,9 +257,10 @@ static void request_for_disabled_algorithm( grpc_byte_buffer_destroy(request_payload_recv); { - grpc_core::ExecCtx exec_ctx; - 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); @@ -537,9 +539,10 @@ static void request_with_payload_template( cq_verifier_destroy(cqv); { - grpc_core::ExecCtx exec_ctx; - 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); diff --git a/test/core/end2end/tests/filter_call_init_fails.cc b/test/core/end2end/tests/filter_call_init_fails.cc index 8f46f0bb91..6eed68a2f9 100644 --- a/test/core/end2end/tests/filter_call_init_fails.cc +++ b/test/core/end2end/tests/filter_call_init_fails.cc @@ -399,23 +399,26 @@ static void test_client_subchannel_filter(grpc_end2end_test_config config) { * Test filter - always fails to initialize a call */ -static grpc_error* init_call_elem(grpc_call_element* elem, +static grpc_error* init_call_elem(grpc_exec_ctx* exec_ctx, + grpc_call_element* elem, const grpc_call_element_args* args) { return grpc_error_set_int( GRPC_ERROR_CREATE_FROM_STATIC_STRING("access denied"), GRPC_ERROR_INT_GRPC_STATUS, GRPC_STATUS_PERMISSION_DENIED); } -static void destroy_call_elem(grpc_call_element* elem, +static void destroy_call_elem(grpc_exec_ctx* exec_ctx, grpc_call_element* elem, const grpc_call_final_info* final_info, grpc_closure* ignored) {} -static grpc_error* init_channel_elem(grpc_channel_element* elem, +static grpc_error* init_channel_elem(grpc_exec_ctx* exec_ctx, + grpc_channel_element* elem, grpc_channel_element_args* args) { return GRPC_ERROR_NONE; } -static void destroy_channel_elem(grpc_channel_element* elem) {} +static void destroy_channel_elem(grpc_exec_ctx* exec_ctx, + grpc_channel_element* elem) {} static const grpc_channel_filter test_filter = { grpc_call_next_op, @@ -434,7 +437,8 @@ static const grpc_channel_filter test_filter = { * Registration */ -static bool maybe_add_server_channel_filter(grpc_channel_stack_builder* builder, +static bool maybe_add_server_channel_filter(grpc_exec_ctx* exec_ctx, + grpc_channel_stack_builder* builder, void* arg) { if (g_enable_server_channel_filter) { // Want to add the filter as close to the end as possible, to make @@ -453,7 +457,8 @@ static bool maybe_add_server_channel_filter(grpc_channel_stack_builder* builder, } } -static bool maybe_add_client_channel_filter(grpc_channel_stack_builder* builder, +static bool maybe_add_client_channel_filter(grpc_exec_ctx* exec_ctx, + grpc_channel_stack_builder* builder, void* arg) { if (g_enable_client_channel_filter) { // Want to add the filter as close to the end as possible, to make @@ -473,7 +478,7 @@ static bool maybe_add_client_channel_filter(grpc_channel_stack_builder* builder, } static bool maybe_add_client_subchannel_filter( - grpc_channel_stack_builder* builder, void* arg) { + grpc_exec_ctx* exec_ctx, grpc_channel_stack_builder* builder, void* arg) { if (g_enable_client_subchannel_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.cc b/test/core/end2end/tests/filter_causes_close.cc index ec8f9dbe00..793f590686 100644 --- a/test/core/end2end/tests/filter_causes_close.cc +++ b/test/core/end2end/tests/filter_causes_close.cc @@ -197,11 +197,12 @@ typedef struct { uint8_t unused; } channel_data; -static void recv_im_ready(void* arg, grpc_error* error) { +static void recv_im_ready(grpc_exec_ctx* exec_ctx, void* arg, + grpc_error* error) { grpc_call_element* elem = (grpc_call_element*)arg; call_data* calld = (call_data*)elem->call_data; GRPC_CLOSURE_RUN( - calld->recv_im_ready, + exec_ctx, calld->recv_im_ready, grpc_error_set_int(GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING( "Failure that's not preventable.", &error, 1), GRPC_ERROR_INT_GRPC_STATUS, @@ -209,7 +210,8 @@ static void recv_im_ready(void* arg, grpc_error* error) { } static void start_transport_stream_op_batch( - grpc_call_element* elem, grpc_transport_stream_op_batch* op) { + grpc_exec_ctx* exec_ctx, grpc_call_element* elem, + grpc_transport_stream_op_batch* op) { call_data* calld = (call_data*)elem->call_data; if (op->recv_initial_metadata) { calld->recv_im_ready = @@ -217,24 +219,27 @@ static void start_transport_stream_op_batch( op->payload->recv_initial_metadata.recv_initial_metadata_ready = GRPC_CLOSURE_CREATE(recv_im_ready, elem, grpc_schedule_on_exec_ctx); } - grpc_call_next_op(elem, op); + grpc_call_next_op(exec_ctx, elem, op); } -static grpc_error* init_call_elem(grpc_call_element* elem, +static grpc_error* init_call_elem(grpc_exec_ctx* exec_ctx, + grpc_call_element* elem, const grpc_call_element_args* args) { return GRPC_ERROR_NONE; } -static void destroy_call_elem(grpc_call_element* elem, +static void destroy_call_elem(grpc_exec_ctx* exec_ctx, grpc_call_element* elem, const grpc_call_final_info* final_info, grpc_closure* ignored) {} -static grpc_error* init_channel_elem(grpc_channel_element* elem, +static grpc_error* init_channel_elem(grpc_exec_ctx* exec_ctx, + grpc_channel_element* elem, grpc_channel_element_args* args) { return GRPC_ERROR_NONE; } -static void destroy_channel_elem(grpc_channel_element* elem) {} +static void destroy_channel_elem(grpc_exec_ctx* exec_ctx, + grpc_channel_element* elem) {} static const grpc_channel_filter test_filter = { start_transport_stream_op_batch, @@ -253,7 +258,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, nullptr, nullptr); diff --git a/test/core/end2end/tests/filter_latency.cc b/test/core/end2end/tests/filter_latency.cc index 845cbc01cf..c4d96ebfe2 100644 --- a/test/core/end2end/tests/filter_latency.cc +++ b/test/core/end2end/tests/filter_latency.cc @@ -247,12 +247,14 @@ static void test_request(grpc_end2end_test_config config) { * Test latency filter */ -static grpc_error* init_call_elem(grpc_call_element* elem, +static grpc_error* init_call_elem(grpc_exec_ctx* exec_ctx, + grpc_call_element* elem, const grpc_call_element_args* args) { return GRPC_ERROR_NONE; } -static void client_destroy_call_elem(grpc_call_element* elem, +static void client_destroy_call_elem(grpc_exec_ctx* exec_ctx, + grpc_call_element* elem, const grpc_call_final_info* final_info, grpc_closure* ignored) { gpr_mu_lock(&g_mu); @@ -260,7 +262,8 @@ static void client_destroy_call_elem(grpc_call_element* elem, gpr_mu_unlock(&g_mu); } -static void server_destroy_call_elem(grpc_call_element* elem, +static void server_destroy_call_elem(grpc_exec_ctx* exec_ctx, + grpc_call_element* elem, const grpc_call_final_info* final_info, grpc_closure* ignored) { gpr_mu_lock(&g_mu); @@ -268,12 +271,14 @@ static void server_destroy_call_elem(grpc_call_element* elem, gpr_mu_unlock(&g_mu); } -static grpc_error* init_channel_elem(grpc_channel_element* elem, +static grpc_error* init_channel_elem(grpc_exec_ctx* exec_ctx, + grpc_channel_element* elem, grpc_channel_element_args* args) { return GRPC_ERROR_NONE; } -static void destroy_channel_elem(grpc_channel_element* elem) {} +static void destroy_channel_elem(grpc_exec_ctx* exec_ctx, + grpc_channel_element* elem) {} static const grpc_channel_filter test_client_filter = { grpc_call_next_op, @@ -305,7 +310,8 @@ static const grpc_channel_filter test_server_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) { grpc_channel_filter* filter = (grpc_channel_filter*)arg; if (g_enable_filter) { // Want to add the filter as close to the end as possible, to make diff --git a/test/core/end2end/tests/load_reporting_hook.cc b/test/core/end2end/tests/load_reporting_hook.cc index e056bd547b..faabec34cb 100644 --- a/test/core/end2end/tests/load_reporting_hook.cc +++ b/test/core/end2end/tests/load_reporting_hook.cc @@ -300,8 +300,9 @@ static void test_load_reporting_hook(grpc_end2end_test_config config) { &trailing_lr_metadata); end_test(&f); { - grpc_core::ExecCtx exec_ctx; - 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.cc b/test/core/end2end/tests/max_message_length.cc index e581f1fc20..f1ac27fa7c 100644 --- a/test/core/end2end/tests/max_message_length.cc +++ b/test/core/end2end/tests/max_message_length.cc @@ -173,9 +173,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); { - grpc_core::ExecCtx exec_ctx; - if (client_args != nullptr) grpc_channel_args_destroy(client_args); - if (server_args != nullptr) grpc_channel_args_destroy(server_args); + grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; + if (client_args != nullptr) + grpc_channel_args_destroy(&exec_ctx, client_args); + if (server_args != nullptr) + grpc_channel_args_destroy(&exec_ctx, server_args); + grpc_exec_ctx_finish(&exec_ctx); } cqv = cq_verifier_create(f.cq); @@ -363,9 +366,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); { - grpc_core::ExecCtx exec_ctx; - if (client_args != nullptr) grpc_channel_args_destroy(client_args); - if (server_args != nullptr) grpc_channel_args_destroy(server_args); + grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; + if (client_args != nullptr) + grpc_channel_args_destroy(&exec_ctx, client_args); + if (server_args != nullptr) + grpc_channel_args_destroy(&exec_ctx, server_args); + grpc_exec_ctx_finish(&exec_ctx); } cqv = cq_verifier_create(f.cq); diff --git a/test/core/end2end/tests/stream_compression_compressed_payload.cc b/test/core/end2end/tests/stream_compression_compressed_payload.cc index ec3050ad45..d73346468a 100644 --- a/test/core/end2end/tests/stream_compression_compressed_payload.cc +++ b/test/core/end2end/tests/stream_compression_compressed_payload.cc @@ -129,9 +129,10 @@ static void request_for_disabled_algorithm( server_args = grpc_channel_args_set_stream_compression_algorithm( nullptr, GRPC_STREAM_COMPRESS_NONE); { - grpc_core::ExecCtx exec_ctx; + grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; server_args = grpc_channel_args_stream_compression_algorithm_set_state( - &server_args, algorithm_to_disable, false); + &exec_ctx, &server_args, algorithm_to_disable, false); + grpc_exec_ctx_finish(&exec_ctx); } f = begin_test(config, test_name, client_args, server_args); @@ -257,9 +258,10 @@ static void request_for_disabled_algorithm( grpc_byte_buffer_destroy(request_payload_recv); { - grpc_core::ExecCtx exec_ctx; - 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); @@ -545,9 +547,10 @@ static void request_with_payload_template( cq_verifier_destroy(cqv); { - grpc_core::ExecCtx exec_ctx; - 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); diff --git a/test/core/end2end/tests/stream_compression_payload.cc b/test/core/end2end/tests/stream_compression_payload.cc index b95e6528cd..924961ea55 100644 --- a/test/core/end2end/tests/stream_compression_payload.cc +++ b/test/core/end2end/tests/stream_compression_payload.cc @@ -277,9 +277,10 @@ static void test_invoke_request_response_with_payload( end_test(&f); config.tear_down_data(&f); { - grpc_core::ExecCtx exec_ctx; - 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); } } diff --git a/test/core/end2end/tests/stream_compression_ping_pong_streaming.cc b/test/core/end2end/tests/stream_compression_ping_pong_streaming.cc index 2a8799ee67..d3b526f04e 100644 --- a/test/core/end2end/tests/stream_compression_ping_pong_streaming.cc +++ b/test/core/end2end/tests/stream_compression_ping_pong_streaming.cc @@ -275,9 +275,10 @@ static void test_pingpong_streaming(grpc_end2end_test_config config, end_test(&f); config.tear_down_data(&f); { - grpc_core::ExecCtx exec_ctx; - 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); } } diff --git a/test/core/end2end/tests/workaround_cronet_compression.cc b/test/core/end2end/tests/workaround_cronet_compression.cc index d4decce0aa..bc4d5079d8 100644 --- a/test/core/end2end/tests/workaround_cronet_compression.cc +++ b/test/core/end2end/tests/workaround_cronet_compression.cc @@ -142,14 +142,15 @@ static void request_with_payload_template( nullptr, default_server_channel_compression_algorithm); if (user_agent_override) { - grpc_core::ExecCtx exec_ctx; + grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_channel_args* client_args_old = client_args; grpc_arg arg; 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); - grpc_channel_args_destroy(client_args_old); + grpc_channel_args_destroy(&exec_ctx, client_args_old); + grpc_exec_ctx_finish(&exec_ctx); } f = begin_test(config, test_name, client_args, server_args); @@ -350,9 +351,10 @@ static void request_with_payload_template( cq_verifier_destroy(cqv); { - grpc_core::ExecCtx exec_ctx; - 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); |