aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/core
diff options
context:
space:
mode:
authorGravatar Yash Tibrewal <yashkt@google.com>2017-11-13 15:37:58 -0800
committerGravatar Yash Tibrewal <yashkt@google.com>2017-11-14 01:36:28 -0800
commit75122c23578e24417dcf64081c737571a9fc2dbc (patch)
treef4b8491964ec0508a5826490628c9f87b82c3326 /test/core
parent36cd68f0d543b9024c84eff82319890a791de7f6 (diff)
Address some PR comments
Diffstat (limited to 'test/core')
-rw-r--r--test/core/backoff/backoff_test.cc51
-rw-r--r--test/core/bad_client/bad_client.cc9
-rw-r--r--test/core/channel/channel_args_test.cc4
-rw-r--r--test/core/channel/channel_stack_test.cc3
-rw-r--r--test/core/channel/minimal_stack_is_minimal_test.cc2
-rw-r--r--test/core/client_channel/lb_policies_test.cc2
-rw-r--r--test/core/client_channel/parse_address_test.cc3
-rw-r--r--test/core/client_channel/resolvers/dns_resolver_connectivity_test.cc6
-rw-r--r--test/core/client_channel/resolvers/dns_resolver_test.cc3
-rw-r--r--test/core/client_channel/resolvers/fake_resolver_test.cc8
-rw-r--r--test/core/client_channel/resolvers/sockaddr_resolver_test.cc4
-rw-r--r--test/core/client_channel/uri_fuzzer_test.cc2
-rw-r--r--test/core/client_channel/uri_parser_test.cc8
-rw-r--r--test/core/compression/algorithm_test.cc2
-rw-r--r--test/core/compression/message_compress_test.cc9
-rw-r--r--test/core/debug/stats_test.cc3
-rw-r--r--test/core/end2end/bad_server_response_test.cc2
-rw-r--r--test/core/end2end/connection_refused_test.cc1
-rw-r--r--test/core/end2end/fixtures/h2_census.cc2
-rw-r--r--test/core/end2end/fixtures/h2_compress.cc3
-rw-r--r--test/core/end2end/fixtures/h2_fd.cc4
-rw-r--r--test/core/end2end/fixtures/h2_full+workarounds.cc1
-rw-r--r--test/core/end2end/fixtures/h2_load_reporting.cc1
-rw-r--r--test/core/end2end/fixtures/h2_oauth2.cc1
-rw-r--r--test/core/end2end/fixtures/h2_sockpair+trace.cc4
-rw-r--r--test/core/end2end/fixtures/h2_sockpair.cc3
-rw-r--r--test/core/end2end/fixtures/h2_sockpair_1byte.cc3
-rw-r--r--test/core/end2end/fixtures/h2_ssl.cc1
-rw-r--r--test/core/end2end/fixtures/h2_ssl_proxy.cc2
-rw-r--r--test/core/end2end/fixtures/http_proxy_fixture.cc15
-rw-r--r--test/core/end2end/fuzzers/api_fuzzer.cc10
-rw-r--r--test/core/end2end/fuzzers/client_fuzzer.cc2
-rw-r--r--test/core/end2end/fuzzers/server_fuzzer.cc2
-rw-r--r--test/core/end2end/h2_ssl_cert_test.cc1
-rw-r--r--test/core/end2end/tests/cancel_after_accept.cc1
-rw-r--r--test/core/end2end/tests/cancel_after_round_trip.cc1
-rw-r--r--test/core/end2end/tests/compressed_payload.cc3
-rw-r--r--test/core/end2end/tests/load_reporting_hook.cc1
-rw-r--r--test/core/end2end/tests/max_message_length.cc2
-rw-r--r--test/core/end2end/tests/stream_compression_compressed_payload.cc3
-rw-r--r--test/core/end2end/tests/stream_compression_payload.cc1
-rw-r--r--test/core/end2end/tests/stream_compression_ping_pong_streaming.cc1
-rw-r--r--test/core/end2end/tests/workaround_cronet_compression.cc2
-rw-r--r--test/core/http/httpcli_test.cc6
-rw-r--r--test/core/http/httpscli_test.cc6
-rw-r--r--test/core/iomgr/combiner_test.cc11
-rw-r--r--test/core/iomgr/endpoint_pair_test.cc3
-rw-r--r--test/core/iomgr/endpoint_tests.cc16
-rw-r--r--test/core/iomgr/ev_epollsig_linux_test.cc23
-rw-r--r--test/core/iomgr/fd_conservation_posix_test.cc3
-rw-r--r--test/core/iomgr/fd_posix_test.cc16
-rw-r--r--test/core/iomgr/pollset_set_test.cc32
-rw-r--r--test/core/iomgr/resolve_address_posix_test.cc11
-rw-r--r--test/core/iomgr/resolve_address_test.cc33
-rw-r--r--test/core/iomgr/resource_quota_test.cc86
-rw-r--r--test/core/iomgr/tcp_client_posix_test.cc13
-rw-r--r--test/core/iomgr/tcp_client_uv_test.cc11
-rw-r--r--test/core/iomgr/tcp_posix_test.cc20
-rw-r--r--test/core/iomgr/tcp_server_posix_test.cc11
-rw-r--r--test/core/iomgr/tcp_server_uv_test.cc9
-rw-r--r--test/core/iomgr/timer_list_test.cc28
-rw-r--r--test/core/iomgr/udp_server_test.cc13
-rw-r--r--test/core/security/credentials_test.cc46
-rw-r--r--test/core/security/json_token_test.cc4
-rw-r--r--test/core/security/jwt_verifier_test.cc20
-rw-r--r--test/core/security/oauth2_utils.cc4
-rw-r--r--test/core/security/print_google_default_creds_token.cc4
-rw-r--r--test/core/security/secure_endpoint_test.cc8
-rw-r--r--test/core/security/ssl_server_fuzzer.cc8
-rw-r--r--test/core/security/verify_jwt.cc4
-rw-r--r--test/core/slice/b64_test.cc5
-rw-r--r--test/core/slice/slice_hash_table_test.cc3
-rw-r--r--test/core/surface/byte_buffer_reader_test.cc1
-rw-r--r--test/core/surface/channel_create_test.cc1
-rw-r--r--test/core/surface/completion_queue_test.cc4
-rw-r--r--test/core/surface/completion_queue_threading_test.cc3
-rw-r--r--test/core/surface/concurrent_connectivity_test.cc7
-rw-r--r--test/core/surface/lame_client_test.cc2
-rw-r--r--test/core/surface/num_external_connectivity_watchers_test.cc1
-rw-r--r--test/core/surface/secure_channel_create_test.cc3
-rw-r--r--test/core/surface/sequential_connectivity_test.cc1
-rw-r--r--test/core/transport/bdp_estimator_test.cc3
-rw-r--r--test/core/transport/byte_stream_test.cc5
-rw-r--r--test/core/transport/chttp2/bin_decoder_test.cc2
-rw-r--r--test/core/transport/chttp2/hpack_encoder_test.cc1
-rw-r--r--test/core/transport/chttp2/hpack_parser_fuzzer_test.cc2
-rw-r--r--test/core/transport/chttp2/hpack_parser_test.cc3
-rw-r--r--test/core/transport/chttp2/hpack_table_test.cc5
-rw-r--r--test/core/transport/connectivity_state_test.cc14
-rw-r--r--test/core/transport/metadata_test.cc15
-rw-r--r--test/core/transport/status_conversion_test.cc2
-rw-r--r--test/core/util/port_server_client.cc18
-rw-r--r--test/core/util/test_tcp_server.cc5
93 files changed, 244 insertions, 503 deletions
diff --git a/test/core/backoff/backoff_test.cc b/test/core/backoff/backoff_test.cc
index 4e32298da4..739ab86bb2 100644
--- a/test/core/backoff/backoff_test.cc
+++ b/test/core/backoff/backoff_test.cc
@@ -34,19 +34,18 @@ static void test_constant_backoff(void) {
min_connect_timeout, max_backoff);
ExecCtx _local_exec_ctx;
grpc_backoff_result next_deadlines = grpc_backoff_begin(&backoff);
- GPR_ASSERT(next_deadlines.current_deadline - grpc_exec_ctx_now() ==
+ GPR_ASSERT(next_deadlines.current_deadline - ExecCtx::Get()->Now() ==
initial_backoff);
- GPR_ASSERT(next_deadlines.next_attempt_start_time - grpc_exec_ctx_now() ==
+ GPR_ASSERT(next_deadlines.next_attempt_start_time - ExecCtx::Get()->Now() ==
initial_backoff);
for (int i = 0; i < 10000; i++) {
next_deadlines = grpc_backoff_step(&backoff);
- GPR_ASSERT(next_deadlines.current_deadline - grpc_exec_ctx_now() ==
+ GPR_ASSERT(next_deadlines.current_deadline - ExecCtx::Get()->Now() ==
initial_backoff);
- GPR_ASSERT(next_deadlines.next_attempt_start_time - grpc_exec_ctx_now() ==
+ GPR_ASSERT(next_deadlines.next_attempt_start_time - ExecCtx::Get()->Now() ==
initial_backoff);
- exec_ctx->now = next_deadlines.current_deadline;
+ ExecCtx::Get()->SetNow(next_deadlines.current_deadline);
}
- grpc_exec_ctx_finish();
}
static void test_min_connect(void) {
@@ -62,13 +61,12 @@ static void test_min_connect(void) {
grpc_backoff_result next = grpc_backoff_begin(&backoff);
// Because the min_connect_timeout > initial_backoff, current_deadline is used
// as the deadline for the current attempt.
- GPR_ASSERT(next.current_deadline - grpc_exec_ctx_now() ==
+ GPR_ASSERT(next.current_deadline - ExecCtx::Get()->Now() ==
min_connect_timeout);
// ... while, if the current attempt fails, the next one will happen after
// initial_backoff.
- GPR_ASSERT(next.next_attempt_start_time - grpc_exec_ctx_now() ==
+ GPR_ASSERT(next.next_attempt_start_time - ExecCtx::Get()->Now() ==
initial_backoff);
- grpc_exec_ctx_finish();
}
static void test_no_jitter_backoff(void) {
@@ -83,48 +81,46 @@ static void test_no_jitter_backoff(void) {
// x_1 = 2
// x_n = 2**i + x_{i-1} ( = 2**(n+1) - 2 )
ExecCtx _local_exec_ctx;
- exec_ctx->now = 0;
- exec_ctx->now_is_valid = true;
+ ExecCtx::Get()->SetNow(0);
grpc_backoff_result next_deadlines = grpc_backoff_begin(&backoff);
GPR_ASSERT(next_deadlines.current_deadline ==
next_deadlines.next_attempt_start_time);
GPR_ASSERT(next_deadlines.current_deadline == 2);
- exec_ctx->now = next_deadlines.current_deadline;
+ ExecCtx::Get()->SetNow(next_deadlines.current_deadline);
next_deadlines = grpc_backoff_step(&backoff);
GPR_ASSERT(next_deadlines.current_deadline == 6);
- exec_ctx->now = next_deadlines.current_deadline;
+ ExecCtx::Get()->SetNow(next_deadlines.current_deadline);
next_deadlines = grpc_backoff_step(&backoff);
GPR_ASSERT(next_deadlines.current_deadline == 14);
- exec_ctx->now = next_deadlines.current_deadline;
+ ExecCtx::Get()->SetNow(next_deadlines.current_deadline);
next_deadlines = grpc_backoff_step(&backoff);
GPR_ASSERT(next_deadlines.current_deadline == 30);
- exec_ctx->now = next_deadlines.current_deadline;
+ ExecCtx::Get()->SetNow(next_deadlines.current_deadline);
next_deadlines = grpc_backoff_step(&backoff);
GPR_ASSERT(next_deadlines.current_deadline == 62);
- exec_ctx->now = next_deadlines.current_deadline;
+ ExecCtx::Get()->SetNow(next_deadlines.current_deadline);
next_deadlines = grpc_backoff_step(&backoff);
GPR_ASSERT(next_deadlines.current_deadline == 126);
- exec_ctx->now = next_deadlines.current_deadline;
+ ExecCtx::Get()->SetNow(next_deadlines.current_deadline);
next_deadlines = grpc_backoff_step(&backoff);
GPR_ASSERT(next_deadlines.current_deadline == 254);
- exec_ctx->now = next_deadlines.current_deadline;
+ ExecCtx::Get()->SetNow(next_deadlines.current_deadline);
next_deadlines = grpc_backoff_step(&backoff);
GPR_ASSERT(next_deadlines.current_deadline == 510);
- exec_ctx->now = next_deadlines.current_deadline;
+ ExecCtx::Get()->SetNow(next_deadlines.current_deadline);
next_deadlines = grpc_backoff_step(&backoff);
GPR_ASSERT(next_deadlines.current_deadline == 1022);
- exec_ctx->now = next_deadlines.current_deadline;
+ ExecCtx::Get()->SetNow(next_deadlines.current_deadline);
next_deadlines = grpc_backoff_step(&backoff);
// Hit the maximum timeout. From this point onwards, retries will increase
// only by max timeout.
GPR_ASSERT(next_deadlines.current_deadline == 1535);
- exec_ctx->now = next_deadlines.current_deadline;
+ ExecCtx::Get()->SetNow(next_deadlines.current_deadline);
next_deadlines = grpc_backoff_step(&backoff);
GPR_ASSERT(next_deadlines.current_deadline == 2048);
- exec_ctx->now = next_deadlines.current_deadline;
+ ExecCtx::Get()->SetNow(next_deadlines.current_deadline);
next_deadlines = grpc_backoff_step(&backoff);
GPR_ASSERT(next_deadlines.current_deadline == 2561);
- grpc_exec_ctx_finish();
}
static void test_jitter_backoff(void) {
@@ -142,9 +138,9 @@ static void test_jitter_backoff(void) {
ExecCtx _local_exec_ctx;
grpc_backoff_result next_deadlines = grpc_backoff_begin(&backoff);
- GPR_ASSERT(next_deadlines.current_deadline - grpc_exec_ctx_now() ==
+ GPR_ASSERT(next_deadlines.current_deadline - ExecCtx::Get()->Now() ==
initial_backoff);
- GPR_ASSERT(next_deadlines.next_attempt_start_time - grpc_exec_ctx_now() ==
+ GPR_ASSERT(next_deadlines.next_attempt_start_time - ExecCtx::Get()->Now() ==
initial_backoff);
grpc_millis expected_next_lower_bound =
@@ -157,7 +153,7 @@ static void test_jitter_backoff(void) {
// next-now must be within (jitter*100)% of the current backoff (which
// increases by * multiplier up to max_backoff).
const grpc_millis timeout_millis =
- next_deadlines.current_deadline - grpc_exec_ctx_now();
+ next_deadlines.current_deadline - ExecCtx::Get()->Now();
GPR_ASSERT(timeout_millis >= expected_next_lower_bound);
GPR_ASSERT(timeout_millis <= expected_next_upper_bound);
current_backoff = GPR_MIN(
@@ -166,9 +162,8 @@ static void test_jitter_backoff(void) {
(grpc_millis)((double)current_backoff * (1 - jitter));
expected_next_upper_bound =
(grpc_millis)((double)current_backoff * (1 + jitter));
- exec_ctx->now = next_deadlines.current_deadline;
+ ExecCtx::Get()->SetNow(next_deadlines.current_deadline);
}
- grpc_exec_ctx_finish();
}
int main(int argc, char** argv) {
diff --git a/test/core/bad_client/bad_client.cc b/test/core/bad_client/bad_client.cc
index c7e074ae6f..bc9e65089c 100644
--- a/test/core/bad_client/bad_client.cc
+++ b/test/core/bad_client/bad_client.cc
@@ -60,7 +60,6 @@ static void server_setup_transport(void* ts, grpc_transport* transport) {
ExecCtx _local_exec_ctx;
grpc_server_setup_transport(a->server, transport, NULL,
grpc_server_get_channel_args(a->server));
- grpc_exec_ctx_finish();
}
static void read_done(void* arg, grpc_error* error) {
@@ -118,7 +117,6 @@ void grpc_run_bad_client_test(
transport = grpc_create_chttp2_transport(NULL, sfd.server, 0);
server_setup_transport(&a, transport);
grpc_chttp2_transport_start_reading(transport, NULL);
- grpc_exec_ctx_finish();
/* Bind everything into the same pollset */
grpc_endpoint_add_to_pollset(sfd.client, grpc_cq_pollset(a.cq));
@@ -137,7 +135,6 @@ void grpc_run_bad_client_test(
/* Write data */
grpc_endpoint_write(sfd.client, &outgoing, &done_write_closure);
- grpc_exec_ctx_finish();
/* Await completion, unless the request is large and write may not finish
* before the peer shuts down. */
@@ -150,7 +147,7 @@ void grpc_run_bad_client_test(
grpc_endpoint_shutdown(
sfd.client, GRPC_ERROR_CREATE_FROM_STATIC_STRING("Forced Disconnect"));
grpc_endpoint_destroy(sfd.client);
- grpc_exec_ctx_finish();
+
sfd.client = NULL;
}
@@ -170,7 +167,7 @@ void grpc_run_bad_client_test(
GRPC_CLOSURE_INIT(&read_done_closure, read_done, &read_done_event,
grpc_schedule_on_exec_ctx);
grpc_endpoint_read(sfd.client, &incoming, &read_done_closure);
- grpc_exec_ctx_finish();
+
do {
GPR_ASSERT(gpr_time_cmp(deadline, gpr_now(deadline.clock_type)) > 0);
GPR_ASSERT(grpc_completion_queue_next(
@@ -188,7 +185,6 @@ void grpc_run_bad_client_test(
grpc_endpoint_shutdown(
sfd.client, GRPC_ERROR_CREATE_FROM_STATIC_STRING("Test Shutdown"));
grpc_endpoint_destroy(sfd.client);
- grpc_exec_ctx_finish();
}
GPR_ASSERT(
@@ -203,6 +199,5 @@ void grpc_run_bad_client_test(
grpc_completion_queue_destroy(a.cq);
grpc_slice_buffer_destroy_internal(&outgoing);
- grpc_exec_ctx_finish();
grpc_shutdown();
}
diff --git a/test/core/channel/channel_args_test.cc b/test/core/channel/channel_args_test.cc
index 03b1cbf265..f0393b0f40 100644
--- a/test/core/channel/channel_args_test.cc
+++ b/test/core/channel/channel_args_test.cc
@@ -56,7 +56,6 @@ static void test_create(void) {
0);
grpc_channel_args_destroy(ch_args);
- grpc_exec_ctx_finish();
}
static void test_set_compression_algorithm(void) {
@@ -71,7 +70,6 @@ static void test_set_compression_algorithm(void) {
GPR_ASSERT(ch_args->args[0].type == GRPC_ARG_INTEGER);
grpc_channel_args_destroy(ch_args);
- grpc_exec_ctx_finish();
}
static void test_compression_algorithm_states(void) {
@@ -123,7 +121,6 @@ static void test_compression_algorithm_states(void) {
}
grpc_channel_args_destroy(ch_args);
- grpc_exec_ctx_finish();
}
static void test_set_socket_mutator(void) {
@@ -139,7 +136,6 @@ static void test_set_socket_mutator(void) {
{
ExecCtx _local_exec_ctx;
grpc_channel_args_destroy(ch_args);
- grpc_exec_ctx_finish();
}
}
diff --git a/test/core/channel/channel_stack_test.cc b/test/core/channel/channel_stack_test.cc
index 0433758905..66ee2948b1 100644
--- a/test/core/channel/channel_stack_test.cc
+++ b/test/core/channel/channel_stack_test.cc
@@ -138,13 +138,12 @@ static void test_create_channel_stack(void) {
GPR_ASSERT(*channel_data == 1);
GRPC_CALL_STACK_UNREF(call_stack, "done");
- grpc_exec_ctx_flush();
+ ExecCtx::Get()->Flush();
GPR_ASSERT(*channel_data == 2);
GRPC_CHANNEL_STACK_UNREF(channel_stack, "done");
grpc_slice_unref_internal(path);
- grpc_exec_ctx_finish();
}
int main(int argc, char** argv) {
diff --git a/test/core/channel/minimal_stack_is_minimal_test.cc b/test/core/channel/minimal_stack_is_minimal_test.cc
index f35557324f..dd3c70a261 100644
--- a/test/core/channel/minimal_stack_is_minimal_test.cc
+++ b/test/core/channel/minimal_stack_is_minimal_test.cc
@@ -128,7 +128,6 @@ static int check_stack(const char* file, int line, const char* transport_name,
grpc_channel_stack_builder_set_channel_arguments(builder, channel_args);
GPR_ASSERT(grpc_channel_init_create_stack(
builder, (grpc_channel_stack_type)channel_stack_type));
- grpc_exec_ctx_finish();
}
// build up our expectation list
@@ -213,7 +212,6 @@ static int check_stack(const char* file, int line, const char* transport_name,
ExecCtx _local_exec_ctx;
grpc_channel_stack_builder_destroy(builder);
grpc_channel_args_destroy(channel_args);
- grpc_exec_ctx_finish();
}
return result;
diff --git a/test/core/client_channel/lb_policies_test.cc b/test/core/client_channel/lb_policies_test.cc
index aabe8dea3c..5b412cc622 100644
--- a/test/core/client_channel/lb_policies_test.cc
+++ b/test/core/client_channel/lb_policies_test.cc
@@ -653,7 +653,6 @@ static void test_get_channel_info() {
{
ExecCtx _local_exec_ctx;
grpc_channel_args_destroy(args);
- grpc_exec_ctx_finish();
}
// Ensures that resolver returns.
grpc_channel_check_connectivity_state(channel, true /* try_to_connect */);
@@ -1025,7 +1024,6 @@ int main(int argc, char** argv) {
test_ping();
test_get_channel_info();
- grpc_exec_ctx_finish();
grpc_shutdown();
return 0;
}
diff --git a/test/core/client_channel/parse_address_test.cc b/test/core/client_channel/parse_address_test.cc
index 17725ba5ff..597a1212c1 100644
--- a/test/core/client_channel/parse_address_test.cc
+++ b/test/core/client_channel/parse_address_test.cc
@@ -43,7 +43,6 @@ static void test_grpc_parse_unix(const char* uri_text, const char* pathname) {
GPR_ASSERT(0 == strcmp(addr_un->sun_path, pathname));
grpc_uri_destroy(uri);
- grpc_exec_ctx_finish();
}
#else /* GRPC_HAVE_UNIX_SOCKET */
@@ -68,7 +67,6 @@ static void test_grpc_parse_ipv4(const char* uri_text, const char* host,
GPR_ASSERT(ntohs(addr_in->sin_port) == port);
grpc_uri_destroy(uri);
- grpc_exec_ctx_finish();
}
static void test_grpc_parse_ipv6(const char* uri_text, const char* host,
@@ -88,7 +86,6 @@ static void test_grpc_parse_ipv6(const char* uri_text, const char* host,
GPR_ASSERT(addr_in6->sin6_scope_id == scope_id);
grpc_uri_destroy(uri);
- grpc_exec_ctx_finish();
}
int main(int argc, char** argv) {
diff --git a/test/core/client_channel/resolvers/dns_resolver_connectivity_test.cc b/test/core/client_channel/resolvers/dns_resolver_connectivity_test.cc
index e2823a4501..c7a0e029f2 100644
--- a/test/core/client_channel/resolvers/dns_resolver_connectivity_test.cc
+++ b/test/core/client_channel/resolvers/dns_resolver_connectivity_test.cc
@@ -106,7 +106,6 @@ static bool wait_loop(int deadline_seconds, gpr_event* ev) {
ExecCtx _local_exec_ctx;
grpc_timer_check(NULL);
- grpc_exec_ctx_finish();
}
return false;
}
@@ -154,7 +153,7 @@ int main(int argc, char** argv) {
call_resolver_next_after_locking(
resolver, &result,
GRPC_CLOSURE_CREATE(on_done, &ev1, grpc_schedule_on_exec_ctx));
- grpc_exec_ctx_flush();
+ ExecCtx::Get()->Flush();
GPR_ASSERT(wait_loop(5, &ev1));
GPR_ASSERT(result == NULL);
@@ -163,14 +162,13 @@ int main(int argc, char** argv) {
call_resolver_next_after_locking(
resolver, &result,
GRPC_CLOSURE_CREATE(on_done, &ev2, grpc_schedule_on_exec_ctx));
- grpc_exec_ctx_flush();
+ ExecCtx::Get()->Flush();
GPR_ASSERT(wait_loop(30, &ev2));
GPR_ASSERT(result != NULL);
grpc_channel_args_destroy(result);
GRPC_RESOLVER_UNREF(resolver, "test");
GRPC_COMBINER_UNREF(g_combiner, "test");
- grpc_exec_ctx_finish();
grpc_shutdown();
gpr_mu_destroy(&g_mu);
diff --git a/test/core/client_channel/resolvers/dns_resolver_test.cc b/test/core/client_channel/resolvers/dns_resolver_test.cc
index 8b40360263..33916b59ec 100644
--- a/test/core/client_channel/resolvers/dns_resolver_test.cc
+++ b/test/core/client_channel/resolvers/dns_resolver_test.cc
@@ -42,7 +42,6 @@ static void test_succeeds(grpc_resolver_factory* factory, const char* string) {
GPR_ASSERT(resolver != NULL);
GRPC_RESOLVER_UNREF(resolver, "test_succeeds");
grpc_uri_destroy(uri);
- grpc_exec_ctx_finish();
}
static void test_fails(grpc_resolver_factory* factory, const char* string) {
@@ -59,7 +58,6 @@ static void test_fails(grpc_resolver_factory* factory, const char* string) {
resolver = grpc_resolver_factory_create_resolver(factory, &args);
GPR_ASSERT(resolver == NULL);
grpc_uri_destroy(uri);
- grpc_exec_ctx_finish();
}
int main(int argc, char** argv) {
@@ -84,7 +82,6 @@ int main(int argc, char** argv) {
{
ExecCtx _local_exec_ctx;
GRPC_COMBINER_UNREF(g_combiner, "test");
- grpc_exec_ctx_finish();
}
grpc_shutdown();
diff --git a/test/core/client_channel/resolvers/fake_resolver_test.cc b/test/core/client_channel/resolvers/fake_resolver_test.cc
index ec49558f87..9a1971561c 100644
--- a/test/core/client_channel/resolvers/fake_resolver_test.cc
+++ b/test/core/client_channel/resolvers/fake_resolver_test.cc
@@ -109,7 +109,7 @@ static void test_fake_resolver() {
results);
grpc_resolver_next_locked(resolver, &on_res_arg.resolver_result,
on_resolution);
- grpc_exec_ctx_flush();
+ ExecCtx::Get()->Flush();
GPR_ASSERT(gpr_event_wait(&on_res_arg.ev,
grpc_timeout_seconds_to_deadline(5)) != NULL);
@@ -144,7 +144,7 @@ static void test_fake_resolver() {
results_update);
grpc_resolver_next_locked(resolver, &on_res_arg_update.resolver_result,
on_resolution);
- grpc_exec_ctx_flush();
+ ExecCtx::Get()->Flush();
GPR_ASSERT(gpr_event_wait(&on_res_arg_update.ev,
grpc_timeout_seconds_to_deadline(5)) != NULL);
@@ -153,14 +153,14 @@ static void test_fake_resolver() {
memset(&on_res_arg, 0, sizeof(on_res_arg));
grpc_resolver_next_locked(resolver, &on_res_arg.resolver_result,
on_resolution);
- grpc_exec_ctx_flush();
+ ExecCtx::Get()->Flush();
GPR_ASSERT(gpr_event_wait(&on_res_arg.ev,
grpc_timeout_milliseconds_to_deadline(100)) ==
NULL);
GRPC_COMBINER_UNREF(combiner, "test_fake_resolver");
GRPC_RESOLVER_UNREF(resolver, "test_fake_resolver");
- grpc_exec_ctx_finish();
+
grpc_fake_resolver_response_generator_unref(response_generator);
}
diff --git a/test/core/client_channel/resolvers/sockaddr_resolver_test.cc b/test/core/client_channel/resolvers/sockaddr_resolver_test.cc
index dbc8a965d5..70b3cbf5b7 100644
--- a/test/core/client_channel/resolvers/sockaddr_resolver_test.cc
+++ b/test/core/client_channel/resolvers/sockaddr_resolver_test.cc
@@ -63,7 +63,7 @@ static void test_succeeds(grpc_resolver_factory* factory, const char* string) {
grpc_resolver_next_locked(resolver, &on_res_arg.resolver_result,
on_resolution);
GRPC_RESOLVER_UNREF(resolver, "test_succeeds");
- grpc_exec_ctx_finish();
+
grpc_uri_destroy(uri);
}
@@ -81,7 +81,6 @@ static void test_fails(grpc_resolver_factory* factory, const char* string) {
resolver = grpc_resolver_factory_create_resolver(factory, &args);
GPR_ASSERT(resolver == NULL);
grpc_uri_destroy(uri);
- grpc_exec_ctx_finish();
}
int main(int argc, char** argv) {
@@ -114,7 +113,6 @@ int main(int argc, char** argv) {
{
ExecCtx _local_exec_ctx;
GRPC_COMBINER_UNREF(g_combiner, "test");
- grpc_exec_ctx_finish();
}
grpc_shutdown();
diff --git a/test/core/client_channel/uri_fuzzer_test.cc b/test/core/client_channel/uri_fuzzer_test.cc
index 805becad18..6c1e8cb137 100644
--- a/test/core/client_channel/uri_fuzzer_test.cc
+++ b/test/core/client_channel/uri_fuzzer_test.cc
@@ -38,7 +38,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
if ((x = grpc_uri_parse(s, 1))) {
grpc_uri_destroy(x);
}
- grpc_exec_ctx_finish();
+
gpr_free(s);
return 0;
}
diff --git a/test/core/client_channel/uri_parser_test.cc b/test/core/client_channel/uri_parser_test.cc
index 591c642f4e..024c30faee 100644
--- a/test/core/client_channel/uri_parser_test.cc
+++ b/test/core/client_channel/uri_parser_test.cc
@@ -36,14 +36,13 @@ static void test_succeeds(const char* uri_text, const char* scheme,
GPR_ASSERT(0 == strcmp(path, uri->path));
GPR_ASSERT(0 == strcmp(query, uri->query));
GPR_ASSERT(0 == strcmp(fragment, uri->fragment));
- grpc_exec_ctx_finish();
+
grpc_uri_destroy(uri);
}
static void test_fails(const char* uri_text) {
ExecCtx _local_exec_ctx;
GPR_ASSERT(NULL == grpc_uri_parse(uri_text, 0));
- grpc_exec_ctx_finish();
}
static void test_query_parts() {
@@ -77,7 +76,7 @@ static void test_query_parts() {
GPR_ASSERT(NULL == grpc_uri_get_query_arg(uri, ""));
GPR_ASSERT(0 == strcmp("frag", uri->fragment));
- grpc_exec_ctx_finish();
+
grpc_uri_destroy(uri);
}
{
@@ -96,7 +95,6 @@ static void test_query_parts() {
GPR_ASSERT(0 == strcmp("bar", grpc_uri_get_query_arg(uri, "foo")));
GPR_ASSERT(0 == strcmp("", grpc_uri_get_query_arg(uri, "foobar")));
- grpc_exec_ctx_finish();
grpc_uri_destroy(uri);
}
{
@@ -114,7 +112,7 @@ static void test_query_parts() {
GPR_ASSERT(NULL == uri->query_parts);
GPR_ASSERT(NULL == uri->query_parts_values);
GPR_ASSERT(0 == strcmp("", uri->fragment));
- grpc_exec_ctx_finish();
+
grpc_uri_destroy(uri);
}
}
diff --git a/test/core/compression/algorithm_test.cc b/test/core/compression/algorithm_test.cc
index dea8e33030..9ae6363d97 100644
--- a/test/core/compression/algorithm_test.cc
+++ b/test/core/compression/algorithm_test.cc
@@ -53,7 +53,6 @@ static void test_algorithm_mesh(void) {
GPR_ASSERT(grpc_slice_eq(GRPC_MDKEY(mdelem), GRPC_MDSTR_GRPC_ENCODING));
grpc_slice_unref_internal(mdstr);
GRPC_MDELEM_UNREF(mdelem);
- grpc_exec_ctx_finish();
}
/* test failure */
@@ -84,7 +83,6 @@ static void test_algorithm_failure(void) {
static_cast<int>(GRPC_COMPRESS_ALGORITHMS_COUNT) + 1)),
grpc_empty_slice()));
grpc_slice_unref_internal(mdstr);
- grpc_exec_ctx_finish();
}
int main(int argc, char** argv) {
diff --git a/test/core/compression/message_compress_test.cc b/test/core/compression/message_compress_test.cc
index d642e056d8..a5dfdc884f 100644
--- a/test/core/compression/message_compress_test.cc
+++ b/test/core/compression/message_compress_test.cc
@@ -72,7 +72,6 @@ static void assert_passthrough(grpc_slice value,
{
ExecCtx _local_exec_ctx;
was_compressed = grpc_msg_compress(algorithm, &input, &compressed_raw);
- grpc_exec_ctx_finish();
}
GPR_ASSERT(input.count > 0);
@@ -94,7 +93,6 @@ static void assert_passthrough(grpc_slice value,
ExecCtx _local_exec_ctx;
GPR_ASSERT(grpc_msg_decompress(
was_compressed ? algorithm : GRPC_COMPRESS_NONE, &compressed, &output));
- grpc_exec_ctx_finish();
}
final = grpc_slice_merge(output.slices, output.count);
@@ -158,7 +156,7 @@ static void test_tiny_data_compress(void) {
GPR_ASSERT(0 ==
grpc_msg_compress(static_cast<grpc_compression_algorithm>(i),
&input, &output));
- grpc_exec_ctx_finish();
+
GPR_ASSERT(1 == output.count);
}
@@ -189,7 +187,6 @@ 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_exec_ctx_finish();
grpc_slice_buffer_destroy(&input);
grpc_slice_buffer_destroy(&corrupted);
@@ -210,7 +207,6 @@ static void test_bad_decompression_data_trailing_garbage(void) {
/* try (and fail) to decompress the invalid compresed buffer */
ExecCtx _local_exec_ctx;
GPR_ASSERT(0 == grpc_msg_decompress(GRPC_COMPRESS_DEFLATE, &input, &output));
- grpc_exec_ctx_finish();
grpc_slice_buffer_destroy(&input);
grpc_slice_buffer_destroy(&output);
@@ -228,7 +224,6 @@ static void test_bad_decompression_data_stream(void) {
/* try (and fail) to decompress the invalid compresed buffer */
ExecCtx _local_exec_ctx;
GPR_ASSERT(0 == grpc_msg_decompress(GRPC_COMPRESS_DEFLATE, &input, &output));
- grpc_exec_ctx_finish();
grpc_slice_buffer_destroy(&input);
grpc_slice_buffer_destroy(&output);
@@ -253,7 +248,6 @@ static void test_bad_compression_algorithm(void) {
GRPC_COMPRESS_ALGORITHMS_COUNT + 123),
&input, &output);
GPR_ASSERT(0 == was_compressed);
- grpc_exec_ctx_finish();
grpc_slice_buffer_destroy(&input);
grpc_slice_buffer_destroy(&output);
@@ -279,7 +273,6 @@ static void test_bad_decompression_algorithm(void) {
GRPC_COMPRESS_ALGORITHMS_COUNT + 123),
&input, &output);
GPR_ASSERT(0 == was_decompressed);
- grpc_exec_ctx_finish();
grpc_slice_buffer_destroy(&input);
grpc_slice_buffer_destroy(&output);
diff --git a/test/core/debug/stats_test.cc b/test/core/debug/stats_test.cc
index 8401618670..c7aaf68dd3 100644
--- a/test/core/debug/stats_test.cc
+++ b/test/core/debug/stats_test.cc
@@ -51,7 +51,6 @@ TEST(StatsTest, IncCounters) {
ExecCtx _local_exec_ctx;
GRPC_STATS_INC_COUNTER((grpc_stats_counters)i);
- grpc_exec_ctx_finish();
EXPECT_EQ(snapshot.delta().counters[i], 1);
}
@@ -62,7 +61,6 @@ TEST(StatsTest, IncSpecificCounter) {
ExecCtx _local_exec_ctx;
GRPC_STATS_INC_SYSCALL_POLL();
- grpc_exec_ctx_finish();
EXPECT_EQ(snapshot.delta().counters[GRPC_STATS_COUNTER_SYSCALL_POLL], 1);
}
@@ -96,7 +94,6 @@ TEST_P(HistogramTest, IncHistogram) {
ExecCtx _local_exec_ctx;
grpc_stats_inc_histogram[kHistogram](j);
- grpc_exec_ctx_finish();
auto delta = snapshot.delta();
diff --git a/test/core/end2end/bad_server_response_test.cc b/test/core/end2end/bad_server_response_test.cc
index 9ae3d3cfbf..5e7e12643e 100644
--- a/test/core/end2end/bad_server_response_test.cc
+++ b/test/core/end2end/bad_server_response_test.cc
@@ -290,7 +290,7 @@ static void run_test(const char* response_payload,
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Test Shutdown"));
grpc_endpoint_destroy(state.tcp);
cleanup_rpc();
- grpc_exec_ctx_finish();
+
test_tcp_server_destroy(&test_server);
grpc_shutdown();
diff --git a/test/core/end2end/connection_refused_test.cc b/test/core/end2end/connection_refused_test.cc
index 677e315112..1372c5a746 100644
--- a/test/core/end2end/connection_refused_test.cc
+++ b/test/core/end2end/connection_refused_test.cc
@@ -133,7 +133,6 @@ static void run_test(bool wait_for_ready, bool use_service_config) {
{
ExecCtx _local_exec_ctx;
if (args != NULL) grpc_channel_args_destroy(args);
- grpc_exec_ctx_finish();
}
grpc_shutdown();
diff --git a/test/core/end2end/fixtures/h2_census.cc b/test/core/end2end/fixtures/h2_census.cc
index c3c3e961e7..a43d963c54 100644
--- a/test/core/end2end/fixtures/h2_census.cc
+++ b/test/core/end2end/fixtures/h2_census.cc
@@ -76,7 +76,6 @@ void chttp2_init_client_fullstack(grpc_end2end_test_fixture* f,
{
ExecCtx _local_exec_ctx;
grpc_channel_args_destroy(client_args);
- grpc_exec_ctx_finish();
}
}
@@ -93,7 +92,6 @@ void chttp2_init_server_fullstack(grpc_end2end_test_fixture* f,
{
ExecCtx _local_exec_ctx;
grpc_channel_args_destroy(server_args);
- grpc_exec_ctx_finish();
}
grpc_server_register_completion_queue(f->server, f->cq, NULL);
GPR_ASSERT(grpc_server_add_insecure_http2_port(f->server, ffd->localaddr));
diff --git a/test/core/end2end/fixtures/h2_compress.cc b/test/core/end2end/fixtures/h2_compress.cc
index f520b48fa3..3f9a87d0fc 100644
--- a/test/core/end2end/fixtures/h2_compress.cc
+++ b/test/core/end2end/fixtures/h2_compress.cc
@@ -68,7 +68,6 @@ void chttp2_init_client_fullstack_compression(grpc_end2end_test_fixture* f,
if (ffd->client_args_compression != NULL) {
ExecCtx _local_exec_ctx;
grpc_channel_args_destroy(ffd->client_args_compression);
- grpc_exec_ctx_finish();
}
ffd->client_args_compression = grpc_channel_args_set_compression_algorithm(
client_args, GRPC_COMPRESS_GZIP);
@@ -83,7 +82,6 @@ void chttp2_init_server_fullstack_compression(grpc_end2end_test_fixture* f,
if (ffd->server_args_compression != NULL) {
ExecCtx _local_exec_ctx;
grpc_channel_args_destroy(ffd->server_args_compression);
- grpc_exec_ctx_finish();
}
ffd->server_args_compression = grpc_channel_args_set_compression_algorithm(
server_args, GRPC_COMPRESS_GZIP);
@@ -104,7 +102,6 @@ void chttp2_tear_down_fullstack_compression(grpc_end2end_test_fixture* f) {
grpc_channel_args_destroy(ffd->server_args_compression);
gpr_free(ffd->localaddr);
gpr_free(ffd);
- grpc_exec_ctx_finish();
}
/* All test configurations */
diff --git a/test/core/end2end/fixtures/h2_fd.cc b/test/core/end2end/fixtures/h2_fd.cc
index 48e1b313fd..99bced8651 100644
--- a/test/core/end2end/fixtures/h2_fd.cc
+++ b/test/core/end2end/fixtures/h2_fd.cc
@@ -75,8 +75,6 @@ static void chttp2_init_client_socketpair(grpc_end2end_test_fixture* f,
f->client = grpc_insecure_channel_create_from_fd(
"fixture_client", sfd->fd_pair[0], client_args);
GPR_ASSERT(f->client);
-
- grpc_exec_ctx_finish();
}
static void chttp2_init_server_socketpair(grpc_end2end_test_fixture* f,
@@ -90,8 +88,6 @@ static void chttp2_init_server_socketpair(grpc_end2end_test_fixture* f,
grpc_server_start(f->server);
grpc_server_add_insecure_channel_from_fd(f->server, NULL, sfd->fd_pair[1]);
-
- grpc_exec_ctx_finish();
}
static void chttp2_tear_down_socketpair(grpc_end2end_test_fixture* f) {
diff --git a/test/core/end2end/fixtures/h2_full+workarounds.cc b/test/core/end2end/fixtures/h2_full+workarounds.cc
index 563e1e1ac2..e98df083f2 100644
--- a/test/core/end2end/fixtures/h2_full+workarounds.cc
+++ b/test/core/end2end/fixtures/h2_full+workarounds.cc
@@ -90,7 +90,6 @@ void chttp2_init_server_fullstack(grpc_end2end_test_fixture* f,
GPR_ASSERT(grpc_server_add_insecure_http2_port(f->server, ffd->localaddr));
grpc_server_start(f->server);
grpc_channel_args_destroy(server_args_new);
- grpc_exec_ctx_finish();
}
void chttp2_tear_down_fullstack(grpc_end2end_test_fixture* f) {
diff --git a/test/core/end2end/fixtures/h2_load_reporting.cc b/test/core/end2end/fixtures/h2_load_reporting.cc
index 74b5983364..84eb9e4513 100644
--- a/test/core/end2end/fixtures/h2_load_reporting.cc
+++ b/test/core/end2end/fixtures/h2_load_reporting.cc
@@ -79,7 +79,6 @@ void chttp2_init_server_load_reporting(grpc_end2end_test_fixture* f,
{
ExecCtx _local_exec_ctx;
grpc_channel_args_destroy(server_args);
- grpc_exec_ctx_finish();
}
grpc_server_register_completion_queue(f->server, f->cq, NULL);
GPR_ASSERT(grpc_server_add_insecure_http2_port(f->server, ffd->localaddr));
diff --git a/test/core/end2end/fixtures/h2_oauth2.cc b/test/core/end2end/fixtures/h2_oauth2.cc
index 8ff7cb304c..9ffc5b7b7e 100644
--- a/test/core/end2end/fixtures/h2_oauth2.cc
+++ b/test/core/end2end/fixtures/h2_oauth2.cc
@@ -160,7 +160,6 @@ static void chttp2_init_client_simple_ssl_with_oauth2_secure_fullstack(
grpc_channel_args_destroy(new_client_args);
grpc_channel_credentials_release(ssl_creds);
grpc_call_credentials_release(oauth2_creds);
- grpc_exec_ctx_finish();
}
static int fail_server_auth_check(grpc_channel_args* server_args) {
diff --git a/test/core/end2end/fixtures/h2_sockpair+trace.cc b/test/core/end2end/fixtures/h2_sockpair+trace.cc
index 391de0bd0b..9e87a22962 100644
--- a/test/core/end2end/fixtures/h2_sockpair+trace.cc
+++ b/test/core/end2end/fixtures/h2_sockpair+trace.cc
@@ -55,7 +55,6 @@ static void server_setup_transport(void* ts, grpc_transport* transport) {
grpc_endpoint_add_to_pollset(sfd->server, grpc_cq_pollset(f->cq));
grpc_server_setup_transport(f->server, transport, NULL,
grpc_server_get_channel_args(f->server));
- grpc_exec_ctx_finish();
}
typedef struct {
@@ -98,7 +97,6 @@ static void chttp2_init_client_socketpair(grpc_end2end_test_fixture* f,
client_setup_transport(&cs, transport);
GPR_ASSERT(f->client);
grpc_chttp2_transport_start_reading(transport, NULL);
- grpc_exec_ctx_finish();
}
static void chttp2_init_server_socketpair(grpc_end2end_test_fixture* f,
@@ -113,7 +111,6 @@ static void chttp2_init_server_socketpair(grpc_end2end_test_fixture* f,
transport = grpc_create_chttp2_transport(server_args, sfd->server, 0);
server_setup_transport(f, transport);
grpc_chttp2_transport_start_reading(transport, NULL);
- grpc_exec_ctx_finish();
}
static void chttp2_tear_down_socketpair(grpc_end2end_test_fixture* f) {
@@ -143,7 +140,6 @@ int main(int argc, char** argv) {
grpc_test_init(argc, argv);
grpc_end2end_tests_pre_init();
grpc_init();
- grpc_exec_ctx_finish();
GPR_ASSERT(0 == grpc_tracer_set_enabled("also-doesnt-exist", 0));
GPR_ASSERT(1 == grpc_tracer_set_enabled("http", 1));
diff --git a/test/core/end2end/fixtures/h2_sockpair.cc b/test/core/end2end/fixtures/h2_sockpair.cc
index 4e7eb3dbb8..fa69ad84cf 100644
--- a/test/core/end2end/fixtures/h2_sockpair.cc
+++ b/test/core/end2end/fixtures/h2_sockpair.cc
@@ -49,7 +49,6 @@ static void server_setup_transport(void* ts, grpc_transport* transport) {
grpc_endpoint_add_to_pollset(sfd->server, grpc_cq_pollset(f->cq));
grpc_server_setup_transport(f->server, transport, NULL,
grpc_server_get_channel_args(f->server));
- grpc_exec_ctx_finish();
}
typedef struct {
@@ -92,7 +91,6 @@ static void chttp2_init_client_socketpair(grpc_end2end_test_fixture* f,
client_setup_transport(&cs, transport);
GPR_ASSERT(f->client);
grpc_chttp2_transport_start_reading(transport, NULL);
- grpc_exec_ctx_finish();
}
static void chttp2_init_server_socketpair(grpc_end2end_test_fixture* f,
@@ -107,7 +105,6 @@ static void chttp2_init_server_socketpair(grpc_end2end_test_fixture* f,
transport = grpc_create_chttp2_transport(server_args, sfd->server, 0);
server_setup_transport(f, transport);
grpc_chttp2_transport_start_reading(transport, NULL);
- grpc_exec_ctx_finish();
}
static void chttp2_tear_down_socketpair(grpc_end2end_test_fixture* f) {
diff --git a/test/core/end2end/fixtures/h2_sockpair_1byte.cc b/test/core/end2end/fixtures/h2_sockpair_1byte.cc
index cfa32d4a27..a12d60575b 100644
--- a/test/core/end2end/fixtures/h2_sockpair_1byte.cc
+++ b/test/core/end2end/fixtures/h2_sockpair_1byte.cc
@@ -49,7 +49,6 @@ static void server_setup_transport(void* ts, grpc_transport* transport) {
grpc_endpoint_add_to_pollset(sfd->server, grpc_cq_pollset(f->cq));
grpc_server_setup_transport(f->server, transport, NULL,
grpc_server_get_channel_args(f->server));
- grpc_exec_ctx_finish();
}
typedef struct {
@@ -103,7 +102,6 @@ static void chttp2_init_client_socketpair(grpc_end2end_test_fixture* f,
client_setup_transport(&cs, transport);
GPR_ASSERT(f->client);
grpc_chttp2_transport_start_reading(transport, NULL);
- grpc_exec_ctx_finish();
}
static void chttp2_init_server_socketpair(grpc_end2end_test_fixture* f,
@@ -118,7 +116,6 @@ static void chttp2_init_server_socketpair(grpc_end2end_test_fixture* f,
transport = grpc_create_chttp2_transport(server_args, sfd->server, 0);
server_setup_transport(f, transport);
grpc_chttp2_transport_start_reading(transport, NULL);
- grpc_exec_ctx_finish();
}
static void chttp2_tear_down_socketpair(grpc_end2end_test_fixture* f) {
diff --git a/test/core/end2end/fixtures/h2_ssl.cc b/test/core/end2end/fixtures/h2_ssl.cc
index ac555d9ee8..c137cec8b9 100644
--- a/test/core/end2end/fixtures/h2_ssl.cc
+++ b/test/core/end2end/fixtures/h2_ssl.cc
@@ -112,7 +112,6 @@ static void chttp2_init_client_simple_ssl_secure_fullstack(
{
ExecCtx _local_exec_ctx;
grpc_channel_args_destroy(new_client_args);
- grpc_exec_ctx_finish();
}
}
diff --git a/test/core/end2end/fixtures/h2_ssl_proxy.cc b/test/core/end2end/fixtures/h2_ssl_proxy.cc
index 66c5b167e1..0c130d6ae1 100644
--- a/test/core/end2end/fixtures/h2_ssl_proxy.cc
+++ b/test/core/end2end/fixtures/h2_ssl_proxy.cc
@@ -68,7 +68,6 @@ static grpc_channel* create_proxy_client(const char* target,
{
ExecCtx _local_exec_ctx;
grpc_channel_args_destroy(new_client_args);
- grpc_exec_ctx_finish();
}
return channel;
}
@@ -150,7 +149,6 @@ static void chttp2_init_client_simple_ssl_secure_fullstack(
{
ExecCtx _local_exec_ctx;
grpc_channel_args_destroy(new_client_args);
- grpc_exec_ctx_finish();
}
}
diff --git a/test/core/end2end/fixtures/http_proxy_fixture.cc b/test/core/end2end/fixtures/http_proxy_fixture.cc
index b3ec44d77b..73a3e2c444 100644
--- a/test/core/end2end/fixtures/http_proxy_fixture.cc
+++ b/test/core/end2end/fixtures/http_proxy_fixture.cc
@@ -391,7 +391,7 @@ static void on_read_request_done(void* arg, grpc_error* error) {
GPR_ASSERT(resolved_addresses->naddrs >= 1);
// Connect to requested address.
// The connection callback inherits our reference to conn.
- const grpc_millis deadline = grpc_exec_ctx_now() + 10 * GPR_MS_PER_SEC;
+ const grpc_millis deadline = ExecCtx::Get()->Now() + 10 * GPR_MS_PER_SEC;
grpc_tcp_client_connect(&conn->on_server_connect_done, &conn->server_endpoint,
conn->pollset_set, NULL,
&resolved_addresses->addrs[0], deadline);
@@ -449,13 +449,13 @@ static void thread_main(void* arg) {
gpr_ref(&proxy->users);
grpc_pollset_worker* worker = NULL;
gpr_mu_lock(proxy->mu);
- GRPC_LOG_IF_ERROR("grpc_pollset_work",
- grpc_pollset_work(proxy->pollset, &worker,
- grpc_exec_ctx_now() + GPR_MS_PER_SEC));
+ GRPC_LOG_IF_ERROR(
+ "grpc_pollset_work",
+ grpc_pollset_work(proxy->pollset, &worker,
+ ExecCtx::Get()->Now() + GPR_MS_PER_SEC));
gpr_mu_unlock(proxy->mu);
- grpc_exec_ctx_flush();
+ ExecCtx::Get()->Flush();
} while (!gpr_unref(&proxy->users));
- grpc_exec_ctx_finish();
}
grpc_end2end_http_proxy* grpc_end2end_http_proxy_create(
@@ -489,7 +489,7 @@ grpc_end2end_http_proxy* grpc_end2end_http_proxy_create(
proxy->pollset = (grpc_pollset*)gpr_zalloc(grpc_pollset_size());
grpc_pollset_init(proxy->pollset, &proxy->mu);
grpc_tcp_server_start(proxy->server, &proxy->pollset, 1, on_accept, proxy);
- grpc_exec_ctx_finish();
+
// Start proxy thread.
gpr_thd_options opt = gpr_thd_options_default();
gpr_thd_options_set_joinable(&opt);
@@ -516,7 +516,6 @@ void grpc_end2end_http_proxy_destroy(grpc_end2end_http_proxy* proxy) {
grpc_schedule_on_exec_ctx));
GRPC_COMBINER_UNREF(proxy->combiner, "test");
gpr_free(proxy);
- grpc_exec_ctx_finish();
}
const char* grpc_end2end_http_proxy_get_proxy_name(
diff --git a/test/core/end2end/fuzzers/api_fuzzer.cc b/test/core/end2end/fuzzers/api_fuzzer.cc
index 1d6a40c7e3..1d22ba3a42 100644
--- a/test/core/end2end/fuzzers/api_fuzzer.cc
+++ b/test/core/end2end/fuzzers/api_fuzzer.cc
@@ -411,7 +411,7 @@ void my_resolve_address(const char* addr, const char* default_port,
r->addrs = addresses;
r->lb_addrs = NULL;
grpc_timer_init(
- &r->timer, GPR_MS_PER_SEC + grpc_exec_ctx_now(),
+ &r->timer, GPR_MS_PER_SEC + ExecCtx::Get()->Now(),
GRPC_CLOSURE_CREATE(finish_resolve, r, grpc_schedule_on_exec_ctx));
}
@@ -428,7 +428,7 @@ grpc_ares_request* my_dns_lookup_ares(const char* dns_server, const char* addr,
r->addrs = NULL;
r->lb_addrs = lb_addrs;
grpc_timer_init(
- &r->timer, GPR_MS_PER_SEC + grpc_exec_ctx_now(),
+ &r->timer, GPR_MS_PER_SEC + ExecCtx::Get()->Now(),
GRPC_CLOSURE_CREATE(finish_resolve, r, grpc_schedule_on_exec_ctx));
return NULL;
}
@@ -488,7 +488,7 @@ static void sched_connect(grpc_closure* closure, grpc_endpoint** ep,
fc->ep = ep;
fc->deadline = deadline;
grpc_timer_init(
- &fc->timer, GPR_MS_PER_SEC + grpc_exec_ctx_now(),
+ &fc->timer, GPR_MS_PER_SEC + ExecCtx::Get()->Now(),
GRPC_CLOSURE_CREATE(do_connect, fc, grpc_schedule_on_exec_ctx));
}
@@ -745,7 +745,6 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
{
ExecCtx _local_exec_ctx;
grpc_executor_set_threading(false);
- grpc_exec_ctx_finish();
}
grpc_resolve_address = my_resolve_address;
grpc_dns_lookup_ares = my_dns_lookup_ares;
@@ -840,7 +839,6 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
{
ExecCtx _local_exec_ctx;
grpc_channel_args_destroy(args);
- grpc_exec_ctx_finish();
}
gpr_free(target_uri);
gpr_free(target);
@@ -868,7 +866,6 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
{
ExecCtx _local_exec_ctx;
grpc_channel_args_destroy(args);
- grpc_exec_ctx_finish();
}
grpc_server_register_completion_queue(g_server, cq, NULL);
grpc_server_start(g_server);
@@ -1197,7 +1194,6 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
{
ExecCtx _local_exec_ctx;
grpc_channel_args_destroy(args);
- grpc_exec_ctx_finish();
}
gpr_free(target_uri);
gpr_free(target);
diff --git a/test/core/end2end/fuzzers/client_fuzzer.cc b/test/core/end2end/fuzzers/client_fuzzer.cc
index 219c42847e..95ed2fcdac 100644
--- a/test/core/end2end/fuzzers/client_fuzzer.cc
+++ b/test/core/end2end/fuzzers/client_fuzzer.cc
@@ -111,7 +111,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
grpc_event ev;
while (1) {
- grpc_exec_ctx_flush();
+ ExecCtx::Get()->Flush();
ev = grpc_completion_queue_next(cq, gpr_inf_past(GPR_CLOCK_REALTIME), NULL);
switch (ev.type) {
case GRPC_QUEUE_TIMEOUT:
diff --git a/test/core/end2end/fuzzers/server_fuzzer.cc b/test/core/end2end/fuzzers/server_fuzzer.cc
index d7295f4c83..21778c0a67 100644
--- a/test/core/end2end/fuzzers/server_fuzzer.cc
+++ b/test/core/end2end/fuzzers/server_fuzzer.cc
@@ -78,7 +78,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
grpc_event ev;
while (1) {
- grpc_exec_ctx_flush();
+ ExecCtx::Get()->Flush();
ev = grpc_completion_queue_next(cq, gpr_inf_past(GPR_CLOCK_REALTIME), NULL);
switch (ev.type) {
case GRPC_QUEUE_TIMEOUT:
diff --git a/test/core/end2end/h2_ssl_cert_test.cc b/test/core/end2end/h2_ssl_cert_test.cc
index 850d6516f2..e0da548a75 100644
--- a/test/core/end2end/h2_ssl_cert_test.cc
+++ b/test/core/end2end/h2_ssl_cert_test.cc
@@ -183,7 +183,6 @@ typedef enum { NONE, SELF_SIGNED, SIGNED, BAD_CERT_PAIR } certtype;
{ \
ExecCtx _local_exec_ctx; \
grpc_channel_args_destroy(new_client_args); \
- grpc_exec_ctx_finish(); \
} \
}
diff --git a/test/core/end2end/tests/cancel_after_accept.cc b/test/core/end2end/tests/cancel_after_accept.cc
index fcf30f0cc6..ffafb1f1e9 100644
--- a/test/core/end2end/tests/cancel_after_accept.cc
+++ b/test/core/end2end/tests/cancel_after_accept.cc
@@ -247,7 +247,6 @@ static void test_cancel_after_accept(grpc_end2end_test_config config,
if (args != NULL) {
ExecCtx _local_exec_ctx;
grpc_channel_args_destroy(args);
- grpc_exec_ctx_finish();
}
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 b63491c7d2..7e20487f8b 100644
--- a/test/core/end2end/tests/cancel_after_round_trip.cc
+++ b/test/core/end2end/tests/cancel_after_round_trip.cc
@@ -279,7 +279,6 @@ static void test_cancel_after_round_trip(grpc_end2end_test_config config,
if (args != NULL) {
ExecCtx _local_exec_ctx;
grpc_channel_args_destroy(args);
- grpc_exec_ctx_finish();
}
cq_verifier_destroy(cqv);
diff --git a/test/core/end2end/tests/compressed_payload.cc b/test/core/end2end/tests/compressed_payload.cc
index a85fdf2662..f04addbe9e 100644
--- a/test/core/end2end/tests/compressed_payload.cc
+++ b/test/core/end2end/tests/compressed_payload.cc
@@ -132,7 +132,6 @@ static void request_for_disabled_algorithm(
ExecCtx _local_exec_ctx;
server_args = grpc_channel_args_compression_algorithm_set_state(
&server_args, algorithm_to_disable, false);
- grpc_exec_ctx_finish();
}
f = begin_test(config, test_name, client_args, server_args);
@@ -260,7 +259,6 @@ static void request_for_disabled_algorithm(
ExecCtx _local_exec_ctx;
grpc_channel_args_destroy(client_args);
grpc_channel_args_destroy(server_args);
- grpc_exec_ctx_finish();
}
end_test(&f);
@@ -539,7 +537,6 @@ static void request_with_payload_template(
ExecCtx _local_exec_ctx;
grpc_channel_args_destroy(client_args);
grpc_channel_args_destroy(server_args);
- grpc_exec_ctx_finish();
}
end_test(&f);
diff --git a/test/core/end2end/tests/load_reporting_hook.cc b/test/core/end2end/tests/load_reporting_hook.cc
index 670610f37f..6ce22d77c6 100644
--- a/test/core/end2end/tests/load_reporting_hook.cc
+++ b/test/core/end2end/tests/load_reporting_hook.cc
@@ -302,7 +302,6 @@ static void test_load_reporting_hook(grpc_end2end_test_config config) {
{
ExecCtx _local_exec_ctx;
grpc_channel_args_destroy(lr_server_args);
- grpc_exec_ctx_finish();
}
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 0200517de3..f884d8b11f 100644
--- a/test/core/end2end/tests/max_message_length.cc
+++ b/test/core/end2end/tests/max_message_length.cc
@@ -176,7 +176,6 @@ static void test_max_message_length_on_request(grpc_end2end_test_config config,
ExecCtx _local_exec_ctx;
if (client_args != NULL) grpc_channel_args_destroy(client_args);
if (server_args != NULL) grpc_channel_args_destroy(server_args);
- grpc_exec_ctx_finish();
}
cqv = cq_verifier_create(f.cq);
@@ -367,7 +366,6 @@ static void test_max_message_length_on_response(grpc_end2end_test_config config,
ExecCtx _local_exec_ctx;
if (client_args != NULL) grpc_channel_args_destroy(client_args);
if (server_args != NULL) grpc_channel_args_destroy(server_args);
- grpc_exec_ctx_finish();
}
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 6100d604d2..cec46305bd 100644
--- a/test/core/end2end/tests/stream_compression_compressed_payload.cc
+++ b/test/core/end2end/tests/stream_compression_compressed_payload.cc
@@ -132,7 +132,6 @@ static void request_for_disabled_algorithm(
ExecCtx _local_exec_ctx;
server_args = grpc_channel_args_stream_compression_algorithm_set_state(
&server_args, algorithm_to_disable, false);
- grpc_exec_ctx_finish();
}
f = begin_test(config, test_name, client_args, server_args);
@@ -261,7 +260,6 @@ static void request_for_disabled_algorithm(
ExecCtx _local_exec_ctx;
grpc_channel_args_destroy(client_args);
grpc_channel_args_destroy(server_args);
- grpc_exec_ctx_finish();
}
end_test(&f);
@@ -547,7 +545,6 @@ static void request_with_payload_template(
ExecCtx _local_exec_ctx;
grpc_channel_args_destroy(client_args);
grpc_channel_args_destroy(server_args);
- grpc_exec_ctx_finish();
}
end_test(&f);
diff --git a/test/core/end2end/tests/stream_compression_payload.cc b/test/core/end2end/tests/stream_compression_payload.cc
index 42318ffbc8..c304c990d7 100644
--- a/test/core/end2end/tests/stream_compression_payload.cc
+++ b/test/core/end2end/tests/stream_compression_payload.cc
@@ -280,7 +280,6 @@ static void test_invoke_request_response_with_payload(
ExecCtx _local_exec_ctx;
grpc_channel_args_destroy(client_args);
grpc_channel_args_destroy(server_args);
- grpc_exec_ctx_finish();
}
}
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 5fb6a7e46f..f4b737d7a3 100644
--- a/test/core/end2end/tests/stream_compression_ping_pong_streaming.cc
+++ b/test/core/end2end/tests/stream_compression_ping_pong_streaming.cc
@@ -276,7 +276,6 @@ static void test_pingpong_streaming(grpc_end2end_test_config config,
ExecCtx _local_exec_ctx;
grpc_channel_args_destroy(client_args);
grpc_channel_args_destroy(server_args);
- grpc_exec_ctx_finish();
}
}
diff --git a/test/core/end2end/tests/workaround_cronet_compression.cc b/test/core/end2end/tests/workaround_cronet_compression.cc
index f38a51a5b7..100f393b8e 100644
--- a/test/core/end2end/tests/workaround_cronet_compression.cc
+++ b/test/core/end2end/tests/workaround_cronet_compression.cc
@@ -150,7 +150,6 @@ static void request_with_payload_template(
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_exec_ctx_finish();
}
f = begin_test(config, test_name, client_args, server_args);
@@ -352,7 +351,6 @@ static void request_with_payload_template(
ExecCtx _local_exec_ctx;
grpc_channel_args_destroy(client_args);
grpc_channel_args_destroy(server_args);
- grpc_exec_ctx_finish();
}
end_test(&f);
diff --git a/test/core/http/httpcli_test.cc b/test/core/http/httpcli_test.cc
index 85e4bc8a0e..dfa328360d 100644
--- a/test/core/http/httpcli_test.cc
+++ b/test/core/http/httpcli_test.cc
@@ -88,7 +88,7 @@ static void test_get(int port) {
"pollset_work", grpc_pollset_work(grpc_polling_entity_pollset(&g_pops),
&worker, n_seconds_time(1))));
gpr_mu_unlock(g_mu);
- grpc_exec_ctx_finish();
+
gpr_mu_lock(g_mu);
}
gpr_mu_unlock(g_mu);
@@ -127,7 +127,7 @@ static void test_post(int port) {
"pollset_work", grpc_pollset_work(grpc_polling_entity_pollset(&g_pops),
&worker, n_seconds_time(1))));
gpr_mu_unlock(g_mu);
- grpc_exec_ctx_finish();
+
gpr_mu_lock(g_mu);
}
gpr_mu_unlock(g_mu);
@@ -196,7 +196,7 @@ int main(int argc, char** argv) {
GRPC_CLOSURE_INIT(&destroyed, destroy_pops, &g_pops,
grpc_schedule_on_exec_ctx);
grpc_pollset_shutdown(grpc_polling_entity_pollset(&g_pops), &destroyed);
- grpc_exec_ctx_finish();
+
grpc_shutdown();
gpr_free(grpc_polling_entity_pollset(&g_pops));
diff --git a/test/core/http/httpscli_test.cc b/test/core/http/httpscli_test.cc
index d948bb5e31..ff082e8367 100644
--- a/test/core/http/httpscli_test.cc
+++ b/test/core/http/httpscli_test.cc
@@ -89,7 +89,7 @@ static void test_get(int port) {
"pollset_work", grpc_pollset_work(grpc_polling_entity_pollset(&g_pops),
&worker, n_seconds_time(1))));
gpr_mu_unlock(g_mu);
- grpc_exec_ctx_finish();
+
gpr_mu_lock(g_mu);
}
gpr_mu_unlock(g_mu);
@@ -129,7 +129,7 @@ static void test_post(int port) {
"pollset_work", grpc_pollset_work(grpc_polling_entity_pollset(&g_pops),
&worker, n_seconds_time(1))));
gpr_mu_unlock(g_mu);
- grpc_exec_ctx_finish();
+
gpr_mu_lock(g_mu);
}
gpr_mu_unlock(g_mu);
@@ -199,7 +199,7 @@ int main(int argc, char** argv) {
GRPC_CLOSURE_INIT(&destroyed, destroy_pops, &g_pops,
grpc_schedule_on_exec_ctx);
grpc_pollset_shutdown(grpc_polling_entity_pollset(&g_pops), &destroyed);
- grpc_exec_ctx_finish();
+
grpc_shutdown();
gpr_free(grpc_polling_entity_pollset(&g_pops));
diff --git a/test/core/iomgr/combiner_test.cc b/test/core/iomgr/combiner_test.cc
index 9fc1890c97..df8d55f1f6 100644
--- a/test/core/iomgr/combiner_test.cc
+++ b/test/core/iomgr/combiner_test.cc
@@ -30,7 +30,6 @@ static void test_no_op(void) {
gpr_log(GPR_DEBUG, "test_no_op");
ExecCtx _local_exec_ctx;
GRPC_COMBINER_UNREF(grpc_combiner_create(), "test_no_op");
- grpc_exec_ctx_finish();
}
static void set_event_to_true(void* value, grpc_error* error) {
@@ -47,11 +46,10 @@ static void test_execute_one(void) {
GRPC_CLOSURE_SCHED(GRPC_CLOSURE_CREATE(set_event_to_true, &done,
grpc_combiner_scheduler(lock)),
GRPC_ERROR_NONE);
- grpc_exec_ctx_flush();
+ ExecCtx::Get()->Flush();
GPR_ASSERT(gpr_event_wait(&done, grpc_timeout_seconds_to_deadline(5)) !=
NULL);
GRPC_COMBINER_UNREF(lock, "test_execute_one");
- grpc_exec_ctx_finish();
}
typedef struct {
@@ -84,7 +82,7 @@ static void execute_many_loop(void* a) {
GRPC_CLOSURE_SCHED(GRPC_CLOSURE_CREATE(
check_one, c, grpc_combiner_scheduler(args->lock)),
GRPC_ERROR_NONE);
- grpc_exec_ctx_flush();
+ ExecCtx::Get()->Flush();
}
// sleep for a little bit, to test a combiner draining and another thread
// picking it up
@@ -93,7 +91,6 @@ static void execute_many_loop(void* a) {
GRPC_CLOSURE_SCHED(GRPC_CLOSURE_CREATE(set_event_to_true, &args->done,
grpc_combiner_scheduler(args->lock)),
GRPC_ERROR_NONE);
- grpc_exec_ctx_finish();
}
static void test_execute_many(void) {
@@ -117,7 +114,6 @@ static void test_execute_many(void) {
}
ExecCtx _local_exec_ctx;
GRPC_COMBINER_UNREF(lock, "test_execute_many");
- grpc_exec_ctx_finish();
}
static gpr_event got_in_finally;
@@ -142,11 +138,10 @@ static void test_execute_finally(void) {
GRPC_CLOSURE_SCHED(
GRPC_CLOSURE_CREATE(add_finally, lock, grpc_combiner_scheduler(lock)),
GRPC_ERROR_NONE);
- grpc_exec_ctx_flush();
+ ExecCtx::Get()->Flush();
GPR_ASSERT(gpr_event_wait(&got_in_finally,
grpc_timeout_seconds_to_deadline(5)) != NULL);
GRPC_COMBINER_UNREF(lock, "test_execute_finally");
- grpc_exec_ctx_finish();
}
int main(int argc, char** argv) {
diff --git a/test/core/iomgr/endpoint_pair_test.cc b/test/core/iomgr/endpoint_pair_test.cc
index bddeadd329..72833a8dbe 100644
--- a/test/core/iomgr/endpoint_pair_test.cc
+++ b/test/core/iomgr/endpoint_pair_test.cc
@@ -45,7 +45,6 @@ static grpc_endpoint_test_fixture create_fixture_endpoint_pair(
f.server_ep = p.server;
grpc_endpoint_add_to_pollset(f.client_ep, g_pollset);
grpc_endpoint_add_to_pollset(f.server_ep, g_pollset);
- grpc_exec_ctx_finish();
return f;
}
@@ -69,7 +68,7 @@ int main(int argc, char** argv) {
GRPC_CLOSURE_INIT(&destroyed, destroy_pollset, g_pollset,
grpc_schedule_on_exec_ctx);
grpc_pollset_shutdown(g_pollset, &destroyed);
- grpc_exec_ctx_finish();
+
grpc_shutdown();
gpr_free(g_pollset);
diff --git a/test/core/iomgr/endpoint_tests.cc b/test/core/iomgr/endpoint_tests.cc
index 10e80fc71b..5c156ef524 100644
--- a/test/core/iomgr/endpoint_tests.cc
+++ b/test/core/iomgr/endpoint_tests.cc
@@ -213,7 +213,7 @@ static void read_and_write_test(grpc_endpoint_test_config config,
even when bytes_written is unsigned. */
state.bytes_written -= state.current_write_size;
read_and_write_test_write_handler(&state, GRPC_ERROR_NONE);
- grpc_exec_ctx_flush();
+ ExecCtx::Get()->Flush();
grpc_endpoint_read(state.read_ep, &state.incoming, &state.done_read);
@@ -225,24 +225,23 @@ static void read_and_write_test(grpc_endpoint_test_config config,
grpc_endpoint_shutdown(
state.write_ep, GRPC_ERROR_CREATE_FROM_STATIC_STRING("Test Shutdown"));
}
- grpc_exec_ctx_flush();
+ ExecCtx::Get()->Flush();
gpr_mu_lock(g_mu);
while (!state.read_done || !state.write_done) {
grpc_pollset_worker* worker = NULL;
- GPR_ASSERT(grpc_exec_ctx_now() < deadline);
+ GPR_ASSERT(ExecCtx::Get()->Now() < deadline);
GPR_ASSERT(GRPC_LOG_IF_ERROR(
"pollset_work", grpc_pollset_work(g_pollset, &worker, deadline)));
}
gpr_mu_unlock(g_mu);
- grpc_exec_ctx_flush();
+ ExecCtx::Get()->Flush();
end_test(config);
grpc_slice_buffer_destroy_internal(&state.outgoing);
grpc_slice_buffer_destroy_internal(&state.incoming);
grpc_endpoint_destroy(state.read_ep);
grpc_endpoint_destroy(state.write_ep);
- grpc_exec_ctx_finish();
}
static void inc_on_failure(void* arg, grpc_error* error) {
@@ -253,16 +252,16 @@ static void inc_on_failure(void* arg, grpc_error* error) {
}
static void wait_for_fail_count(int* fail_count, int want_fail_count) {
- grpc_exec_ctx_flush();
+ ExecCtx::Get()->Flush();
gpr_mu_lock(g_mu);
grpc_millis deadline =
grpc_timespec_to_millis_round_up(grpc_timeout_seconds_to_deadline(10));
- while (grpc_exec_ctx_now() < deadline && *fail_count < want_fail_count) {
+ while (ExecCtx::Get()->Now() < deadline && *fail_count < want_fail_count) {
grpc_pollset_worker* worker = NULL;
GPR_ASSERT(GRPC_LOG_IF_ERROR(
"pollset_work", grpc_pollset_work(g_pollset, &worker, deadline)));
gpr_mu_unlock(g_mu);
- grpc_exec_ctx_flush();
+ ExecCtx::Get()->Flush();
gpr_mu_lock(g_mu);
}
GPR_ASSERT(*fail_count == want_fail_count);
@@ -303,7 +302,6 @@ static void multiple_shutdown_test(grpc_endpoint_test_config config) {
grpc_endpoint_destroy(f.client_ep);
grpc_endpoint_destroy(f.server_ep);
- grpc_exec_ctx_finish();
}
void grpc_endpoint_tests(grpc_endpoint_test_config config,
diff --git a/test/core/iomgr/ev_epollsig_linux_test.cc b/test/core/iomgr/ev_epollsig_linux_test.cc
index 5dd28eac9c..5c71bc6152 100644
--- a/test/core/iomgr/ev_epollsig_linux_test.cc
+++ b/test/core/iomgr/ev_epollsig_linux_test.cc
@@ -77,11 +77,11 @@ static void test_fd_cleanup(test_fd* tfds, int num_fds) {
for (i = 0; i < num_fds; i++) {
grpc_fd_shutdown(tfds[i].fd,
GRPC_ERROR_CREATE_FROM_STATIC_STRING("test_fd_cleanup"));
- grpc_exec_ctx_flush();
+ ExecCtx::Get()->Flush();
grpc_fd_orphan(tfds[i].fd, NULL, &release_fd, false /* already_closed */,
"test_fd_cleanup");
- grpc_exec_ctx_flush();
+ ExecCtx::Get()->Flush();
GPR_ASSERT(release_fd == tfds[i].inner_fd);
close(tfds[i].inner_fd);
@@ -110,7 +110,7 @@ static void test_pollset_cleanup(test_pollset* pollsets, int num_pollsets) {
grpc_schedule_on_exec_ctx);
grpc_pollset_shutdown(pollsets[i].pollset, &destroyed);
- grpc_exec_ctx_flush();
+ ExecCtx::Get()->Flush();
gpr_free(pollsets[i].pollset);
}
}
@@ -168,32 +168,32 @@ static void test_add_fd_to_pollset() {
/* == Step 1 == */
for (i = 0; i <= 2; i++) {
grpc_pollset_add_fd(pollsets[0].pollset, tfds[i].fd);
- grpc_exec_ctx_flush();
+ ExecCtx::Get()->Flush();
}
for (i = 3; i <= 4; i++) {
grpc_pollset_add_fd(pollsets[1].pollset, tfds[i].fd);
- grpc_exec_ctx_flush();
+ ExecCtx::Get()->Flush();
}
for (i = 5; i <= 7; i++) {
grpc_pollset_add_fd(pollsets[2].pollset, tfds[i].fd);
- grpc_exec_ctx_flush();
+ ExecCtx::Get()->Flush();
}
/* == Step 2 == */
for (i = 0; i <= 1; i++) {
grpc_pollset_add_fd(pollsets[3].pollset, tfds[i].fd);
- grpc_exec_ctx_flush();
+ ExecCtx::Get()->Flush();
}
/* == Step 3 == */
grpc_pollset_add_fd(pollsets[1].pollset, tfds[0].fd);
- grpc_exec_ctx_flush();
+ ExecCtx::Get()->Flush();
/* == Step 4 == */
grpc_pollset_add_fd(pollsets[2].pollset, tfds[3].fd);
- grpc_exec_ctx_flush();
+ ExecCtx::Get()->Flush();
/* All polling islands are merged at this point */
@@ -212,7 +212,6 @@ static void test_add_fd_to_pollset() {
test_fd_cleanup(tfds, NUM_FDS);
test_pollset_cleanup(pollsets, NUM_POLLSETS);
- grpc_exec_ctx_finish();
}
#undef NUM_FDS
@@ -239,7 +238,6 @@ static void test_threading_loop(void* arg) {
"pollset_work",
grpc_pollset_work(shared->pollset, &worker, GRPC_MILLIS_INF_FUTURE)));
gpr_mu_unlock(shared->mu);
- grpc_exec_ctx_finish();
}
}
@@ -279,7 +277,6 @@ static void test_threading(void) {
shared.wakeup_desc,
GRPC_CLOSURE_INIT(&shared.on_wakeup, test_threading_wakeup, &shared,
grpc_schedule_on_exec_ctx));
- grpc_exec_ctx_finish();
}
GPR_ASSERT(GRPC_LOG_IF_ERROR("wakeup_first",
grpc_wakeup_fd_wakeup(shared.wakeup_fd)));
@@ -296,7 +293,6 @@ static void test_threading(void) {
grpc_pollset_shutdown(shared.pollset,
GRPC_CLOSURE_CREATE(destroy_pollset, shared.pollset,
grpc_schedule_on_exec_ctx));
- grpc_exec_ctx_finish();
}
gpr_free(shared.pollset);
}
@@ -318,7 +314,6 @@ int main(int argc, char** argv) {
poll_strategy);
}
- grpc_exec_ctx_finish();
grpc_shutdown();
return 0;
}
diff --git a/test/core/iomgr/fd_conservation_posix_test.cc b/test/core/iomgr/fd_conservation_posix_test.cc
index a5f6d33998..7f3420269e 100644
--- a/test/core/iomgr/fd_conservation_posix_test.cc
+++ b/test/core/iomgr/fd_conservation_posix_test.cc
@@ -45,12 +45,11 @@ int main(int argc, char** argv) {
p = grpc_iomgr_create_endpoint_pair("test", NULL);
grpc_endpoint_destroy(p.client);
grpc_endpoint_destroy(p.server);
- grpc_exec_ctx_flush();
+ ExecCtx::Get()->Flush();
}
grpc_resource_quota_unref(resource_quota);
- grpc_exec_ctx_finish();
grpc_shutdown();
return 0;
}
diff --git a/test/core/iomgr/fd_posix_test.cc b/test/core/iomgr/fd_posix_test.cc
index 9bf16923cb..d22cb5f4f6 100644
--- a/test/core/iomgr/fd_posix_test.cc
+++ b/test/core/iomgr/fd_posix_test.cc
@@ -252,7 +252,7 @@ static void server_wait_and_shutdown(server* sv) {
"pollset_work",
grpc_pollset_work(g_pollset, &worker, GRPC_MILLIS_INF_FUTURE)));
gpr_mu_unlock(g_mu);
- grpc_exec_ctx_finish();
+
gpr_mu_lock(g_mu);
}
gpr_mu_unlock(g_mu);
@@ -367,7 +367,7 @@ static void client_wait_and_shutdown(client* cl) {
"pollset_work",
grpc_pollset_work(g_pollset, &worker, GRPC_MILLIS_INF_FUTURE)));
gpr_mu_unlock(g_mu);
- grpc_exec_ctx_finish();
+
gpr_mu_lock(g_mu);
}
gpr_mu_unlock(g_mu);
@@ -386,7 +386,7 @@ static void test_grpc_fd(void) {
port = server_start(&sv);
client_init(&cl);
client_start(&cl, port);
- grpc_exec_ctx_finish();
+
client_wait_and_shutdown(&cl);
server_wait_and_shutdown(&sv);
GPR_ASSERT(sv.read_bytes_total == cl.write_bytes_total);
@@ -469,7 +469,7 @@ static void test_grpc_fd_change(void) {
"pollset_work",
grpc_pollset_work(g_pollset, &worker, GRPC_MILLIS_INF_FUTURE)));
gpr_mu_unlock(g_mu);
- grpc_exec_ctx_finish();
+
gpr_mu_lock(g_mu);
}
GPR_ASSERT(a.cb_that_ran == first_read_callback);
@@ -493,7 +493,7 @@ static void test_grpc_fd_change(void) {
"pollset_work",
grpc_pollset_work(g_pollset, &worker, GRPC_MILLIS_INF_FUTURE)));
gpr_mu_unlock(g_mu);
- grpc_exec_ctx_finish();
+
gpr_mu_lock(g_mu);
}
/* Except now we verify that second_read_callback ran instead */
@@ -501,7 +501,7 @@ static void test_grpc_fd_change(void) {
gpr_mu_unlock(g_mu);
grpc_fd_orphan(em_fd, NULL, NULL, false /* already_closed */, "d");
- grpc_exec_ctx_finish();
+
destroy_change_data(&a);
destroy_change_data(&b);
close(sv[1]);
@@ -523,9 +523,9 @@ int main(int argc, char** argv) {
GRPC_CLOSURE_INIT(&destroyed, destroy_pollset, g_pollset,
grpc_schedule_on_exec_ctx);
grpc_pollset_shutdown(g_pollset, &destroyed);
- grpc_exec_ctx_flush();
+ ExecCtx::Get()->Flush();
gpr_free(g_pollset);
- grpc_exec_ctx_finish();
+
grpc_shutdown();
return 0;
}
diff --git a/test/core/iomgr/pollset_set_test.cc b/test/core/iomgr/pollset_set_test.cc
index ba794ca192..e9b46f59e3 100644
--- a/test/core/iomgr/pollset_set_test.cc
+++ b/test/core/iomgr/pollset_set_test.cc
@@ -84,7 +84,7 @@ static void cleanup_test_pollsets(test_pollset* pollsets,
grpc_schedule_on_exec_ctx);
grpc_pollset_shutdown(pollsets[i].ps, &destroyed);
- grpc_exec_ctx_flush();
+ ExecCtx::Get()->Flush();
gpr_free(pollsets[i].ps);
pollsets[i].ps = NULL;
}
@@ -129,7 +129,7 @@ static void cleanup_test_fds(test_fd* tfds, const int num_fds) {
for (int i = 0; i < num_fds; i++) {
grpc_fd_shutdown(tfds[i].fd,
GRPC_ERROR_CREATE_FROM_STATIC_STRING("fd cleanup"));
- grpc_exec_ctx_flush();
+ ExecCtx::Get()->Flush();
/* grpc_fd_orphan frees the memory allocated for grpc_fd. Normally it also
* calls close() on the underlying fd. In our case, we are using
@@ -138,7 +138,7 @@ static void cleanup_test_fds(test_fd* tfds, const int num_fds) {
* underlying fd, call it with a non-NULL 'release_fd' parameter */
grpc_fd_orphan(tfds[i].fd, NULL, &release_fd, false /* already_closed */,
"test_fd_cleanup");
- grpc_exec_ctx_flush();
+ ExecCtx::Get()->Flush();
grpc_wakeup_fd_destroy(&tfds[i].wakeup_fd);
}
@@ -236,7 +236,7 @@ static void pollset_set_test_basic() {
grpc_pollset_add_fd(pollsets[1].ps, tfds[8].fd);
grpc_pollset_add_fd(pollsets[2].ps, tfds[9].fd);
- grpc_exec_ctx_flush();
+ ExecCtx::Get()->Flush();
/* Test that if any FD in the above structure is readable, it is observable by
* doing grpc_pollset_work on any pollset
@@ -259,10 +259,10 @@ static void pollset_set_test_basic() {
grpc_pollset_work(pollsets[i].ps, &worker, deadline));
gpr_mu_unlock(pollsets[i].mu);
- grpc_exec_ctx_flush();
+ ExecCtx::Get()->Flush();
verify_readable_and_reset(tfds, num_fds);
- grpc_exec_ctx_flush();
+ ExecCtx::Get()->Flush();
}
/* Test tear down */
@@ -270,19 +270,18 @@ static void pollset_set_test_basic() {
grpc_pollset_set_del_fd(pollset_sets[0].pss, tfds[5].fd);
grpc_pollset_set_del_fd(pollset_sets[1].pss, tfds[1].fd);
grpc_pollset_set_del_fd(pollset_sets[1].pss, tfds[6].fd);
- grpc_exec_ctx_flush();
+ ExecCtx::Get()->Flush();
grpc_pollset_set_del_pollset(pollset_sets[1].pss, pollsets[0].ps);
grpc_pollset_set_del_pollset(pollset_sets[0].pss, pollsets[1].ps);
grpc_pollset_set_del_pollset(pollset_sets[0].pss, pollsets[2].ps);
grpc_pollset_set_del_pollset_set(pollset_sets[0].pss, pollset_sets[1].pss);
- grpc_exec_ctx_flush();
+ ExecCtx::Get()->Flush();
cleanup_test_fds(tfds, num_fds);
cleanup_test_pollsets(pollsets, num_ps);
cleanup_test_pollset_sets(pollset_sets, num_pss);
- grpc_exec_ctx_finish();
}
/* Same FD added multiple times to the pollset_set tree */
@@ -338,10 +337,10 @@ void pollset_set_test_dup_fds() {
GPR_ASSERT(GRPC_ERROR_NONE ==
grpc_pollset_work(pollset.ps, &worker, deadline));
gpr_mu_unlock(pollset.mu);
- grpc_exec_ctx_flush();
+ ExecCtx::Get()->Flush();
verify_readable_and_reset(tfds, num_fds);
- grpc_exec_ctx_flush();
+ ExecCtx::Get()->Flush();
/* Tear down */
grpc_pollset_set_del_fd(pollset_sets[0].pss, tfds[0].fd);
@@ -350,12 +349,11 @@ void pollset_set_test_dup_fds() {
grpc_pollset_set_del_pollset(pollset_sets[1].pss, pollset.ps);
grpc_pollset_set_del_pollset_set(pollset_sets[0].pss, pollset_sets[1].pss);
- grpc_exec_ctx_flush();
+ ExecCtx::Get()->Flush();
cleanup_test_fds(tfds, num_fds);
cleanup_test_pollsets(&pollset, num_ps);
cleanup_test_pollset_sets(pollset_sets, num_pss);
- grpc_exec_ctx_finish();
}
/* Pollset_set with an empty pollset */
@@ -406,21 +404,20 @@ void pollset_set_test_empty_pollset() {
GPR_ASSERT(GRPC_ERROR_NONE ==
grpc_pollset_work(pollsets[0].ps, &worker, deadline));
gpr_mu_unlock(pollsets[0].mu);
- grpc_exec_ctx_flush();
+ ExecCtx::Get()->Flush();
verify_readable_and_reset(tfds, num_fds);
- grpc_exec_ctx_flush();
+ ExecCtx::Get()->Flush();
/* Tear down */
grpc_pollset_set_del_fd(pollset_set.pss, tfds[0].fd);
grpc_pollset_set_del_pollset(pollset_set.pss, pollsets[0].ps);
grpc_pollset_set_del_pollset(pollset_set.pss, pollsets[1].ps);
- grpc_exec_ctx_flush();
+ ExecCtx::Get()->Flush();
cleanup_test_fds(tfds, num_fds);
cleanup_test_pollsets(pollsets, num_ps);
cleanup_test_pollset_sets(&pollset_set, num_pss);
- grpc_exec_ctx_finish();
}
int main(int argc, char** argv) {
@@ -442,7 +439,6 @@ int main(int argc, char** argv) {
poll_strategy);
}
- grpc_exec_ctx_finish();
grpc_shutdown();
return 0;
}
diff --git a/test/core/iomgr/resolve_address_posix_test.cc b/test/core/iomgr/resolve_address_posix_test.cc
index d06777d86f..9870d7aa73 100644
--- a/test/core/iomgr/resolve_address_posix_test.cc
+++ b/test/core/iomgr/resolve_address_posix_test.cc
@@ -67,7 +67,7 @@ void args_finish(args_struct* args) {
grpc_schedule_on_exec_ctx);
grpc_pollset_shutdown(args->pollset, &do_nothing_cb);
// exec_ctx needs to be flushed before calling grpc_pollset_destroy()
- grpc_exec_ctx_flush();
+ ExecCtx::Get()->Flush();
grpc_pollset_destroy(args->pollset);
gpr_free(args->pollset);
}
@@ -86,7 +86,7 @@ static void actually_poll(void* argsp) {
if (done) {
break;
}
- grpc_millis time_left = deadline - grpc_exec_ctx_now();
+ grpc_millis time_left = deadline - ExecCtx::Get()->Now();
gpr_log(GPR_DEBUG, "done=%d, time_left=%" PRIdPTR, done, time_left);
GPR_ASSERT(time_left >= 0);
grpc_pollset_worker* worker = NULL;
@@ -94,10 +94,9 @@ static void actually_poll(void* argsp) {
GRPC_LOG_IF_ERROR("pollset_work", grpc_pollset_work(args->pollset, &worker,
n_sec_deadline(1)));
gpr_mu_unlock(args->mu);
- grpc_exec_ctx_flush();
+ ExecCtx::Get()->Flush();
}
gpr_event_set(&args->ev, (void*)1);
- grpc_exec_ctx_finish();
}
static void poll_pollset_until_request_done(args_struct* args) {
@@ -130,7 +129,6 @@ static void test_unix_socket(void) {
GRPC_CLOSURE_CREATE(must_succeed, &args, grpc_schedule_on_exec_ctx),
&args.addrs);
args_finish(&args);
- grpc_exec_ctx_finish();
}
static void test_unix_socket_path_name_too_long(void) {
@@ -153,7 +151,6 @@ static void test_unix_socket_path_name_too_long(void) {
&args.addrs);
gpr_free(path_name);
args_finish(&args);
- grpc_exec_ctx_finish();
}
int main(int argc, char** argv) {
@@ -163,7 +160,7 @@ int main(int argc, char** argv) {
test_unix_socket();
test_unix_socket_path_name_too_long();
grpc_executor_shutdown();
- grpc_exec_ctx_finish();
+
grpc_shutdown();
return 0;
}
diff --git a/test/core/iomgr/resolve_address_test.cc b/test/core/iomgr/resolve_address_test.cc
index 1eb753dc85..dbc825884d 100644
--- a/test/core/iomgr/resolve_address_test.cc
+++ b/test/core/iomgr/resolve_address_test.cc
@@ -63,7 +63,7 @@ void args_finish(args_struct* args) {
grpc_pollset_shutdown(args->pollset, &do_nothing_cb);
gpr_mu_unlock(args->mu);
// exec_ctx needs to be flushed before calling grpc_pollset_destroy()
- grpc_exec_ctx_flush();
+ ExecCtx::Get()->Flush();
grpc_pollset_destroy(args->pollset);
gpr_free(args->pollset);
}
@@ -81,7 +81,7 @@ static void poll_pollset_until_request_done(args_struct* args) {
if (done) {
break;
}
- grpc_millis time_left = deadline - grpc_exec_ctx_now();
+ grpc_millis time_left = deadline - ExecCtx::Get()->Now();
gpr_log(GPR_DEBUG, "done=%d, time_left=%" PRIdPTR, done, time_left);
GPR_ASSERT(time_left >= 0);
grpc_pollset_worker* worker = NULL;
@@ -89,10 +89,9 @@ static void poll_pollset_until_request_done(args_struct* args) {
GRPC_LOG_IF_ERROR("pollset_work", grpc_pollset_work(args->pollset, &worker,
n_sec_deadline(1)));
gpr_mu_unlock(args->mu);
- grpc_exec_ctx_flush();
+ ExecCtx::Get()->Flush();
}
gpr_event_set(&args->ev, (void*)1);
- grpc_exec_ctx_finish();
}
static void must_succeed(void* argsp, grpc_error* err) {
@@ -123,10 +122,9 @@ static void test_localhost(void) {
"localhost:1", NULL, args.pollset_set,
GRPC_CLOSURE_CREATE(must_succeed, &args, grpc_schedule_on_exec_ctx),
&args.addrs);
- grpc_exec_ctx_flush();
+ ExecCtx::Get()->Flush();
poll_pollset_until_request_done(&args);
args_finish(&args);
- grpc_exec_ctx_finish();
}
static void test_default_port(void) {
@@ -137,10 +135,9 @@ static void test_default_port(void) {
"localhost", "1", args.pollset_set,
GRPC_CLOSURE_CREATE(must_succeed, &args, grpc_schedule_on_exec_ctx),
&args.addrs);
- grpc_exec_ctx_flush();
+ ExecCtx::Get()->Flush();
poll_pollset_until_request_done(&args);
args_finish(&args);
- grpc_exec_ctx_finish();
}
static void test_non_numeric_default_port(void) {
@@ -151,10 +148,9 @@ static void test_non_numeric_default_port(void) {
"localhost", "https", args.pollset_set,
GRPC_CLOSURE_CREATE(must_succeed, &args, grpc_schedule_on_exec_ctx),
&args.addrs);
- grpc_exec_ctx_flush();
+ ExecCtx::Get()->Flush();
poll_pollset_until_request_done(&args);
args_finish(&args);
- grpc_exec_ctx_finish();
}
static void test_missing_default_port(void) {
@@ -165,10 +161,9 @@ static void test_missing_default_port(void) {
"localhost", NULL, args.pollset_set,
GRPC_CLOSURE_CREATE(must_fail, &args, grpc_schedule_on_exec_ctx),
&args.addrs);
- grpc_exec_ctx_flush();
+ ExecCtx::Get()->Flush();
poll_pollset_until_request_done(&args);
args_finish(&args);
- grpc_exec_ctx_finish();
}
static void test_ipv6_with_port(void) {
@@ -179,10 +174,9 @@ static void test_ipv6_with_port(void) {
"[2001:db8::1]:1", NULL, args.pollset_set,
GRPC_CLOSURE_CREATE(must_succeed, &args, grpc_schedule_on_exec_ctx),
&args.addrs);
- grpc_exec_ctx_flush();
+ ExecCtx::Get()->Flush();
poll_pollset_until_request_done(&args);
args_finish(&args);
- grpc_exec_ctx_finish();
}
static void test_ipv6_without_port(void) {
@@ -200,10 +194,9 @@ static void test_ipv6_without_port(void) {
kCases[i], "80", args.pollset_set,
GRPC_CLOSURE_CREATE(must_succeed, &args, grpc_schedule_on_exec_ctx),
&args.addrs);
- grpc_exec_ctx_flush();
+ ExecCtx::Get()->Flush();
poll_pollset_until_request_done(&args);
args_finish(&args);
- grpc_exec_ctx_finish();
}
}
@@ -221,10 +214,9 @@ static void test_invalid_ip_addresses(void) {
kCases[i], NULL, args.pollset_set,
GRPC_CLOSURE_CREATE(must_fail, &args, grpc_schedule_on_exec_ctx),
&args.addrs);
- grpc_exec_ctx_flush();
+ ExecCtx::Get()->Flush();
poll_pollset_until_request_done(&args);
args_finish(&args);
- grpc_exec_ctx_finish();
}
}
@@ -241,10 +233,9 @@ static void test_unparseable_hostports(void) {
kCases[i], "1", args.pollset_set,
GRPC_CLOSURE_CREATE(must_fail, &args, grpc_schedule_on_exec_ctx),
&args.addrs);
- grpc_exec_ctx_flush();
+ ExecCtx::Get()->Flush();
poll_pollset_until_request_done(&args);
args_finish(&args);
- grpc_exec_ctx_finish();
}
}
@@ -261,7 +252,7 @@ int main(int argc, char** argv) {
test_invalid_ip_addresses();
test_unparseable_hostports();
grpc_executor_shutdown();
- grpc_exec_ctx_finish();
+
grpc_shutdown();
return 0;
}
diff --git a/test/core/iomgr/resource_quota_test.cc b/test/core/iomgr/resource_quota_test.cc
index bee9373ff6..40beadc5d6 100644
--- a/test/core/iomgr/resource_quota_test.cc
+++ b/test/core/iomgr/resource_quota_test.cc
@@ -86,7 +86,6 @@ grpc_closure* make_unused_reclaimer(grpc_closure* then) {
static void destroy_user(grpc_resource_user* usr) {
ExecCtx _local_exec_ctx;
grpc_resource_user_unref(usr);
- grpc_exec_ctx_finish();
}
static void test_no_op(void) {
@@ -120,12 +119,10 @@ static void test_instant_alloc_then_free(void) {
{
ExecCtx _local_exec_ctx;
grpc_resource_user_alloc(usr, 1024, NULL);
- grpc_exec_ctx_finish();
}
{
ExecCtx _local_exec_ctx;
grpc_resource_user_free(usr, 1024);
- grpc_exec_ctx_finish();
}
grpc_resource_quota_unref(q);
destroy_user(usr);
@@ -141,7 +138,6 @@ static void test_instant_alloc_free_pair(void) {
ExecCtx _local_exec_ctx;
grpc_resource_user_alloc(usr, 1024, NULL);
grpc_resource_user_free(usr, 1024);
- grpc_exec_ctx_finish();
}
grpc_resource_quota_unref(q);
destroy_user(usr);
@@ -158,14 +154,13 @@ static void test_simple_async_alloc(void) {
gpr_event_init(&ev);
ExecCtx _local_exec_ctx;
grpc_resource_user_alloc(usr, 1024, set_event(&ev));
- grpc_exec_ctx_finish();
+
GPR_ASSERT(gpr_event_wait(&ev, grpc_timeout_seconds_to_deadline(5)) !=
NULL);
}
{
ExecCtx _local_exec_ctx;
grpc_resource_user_free(usr, 1024);
- grpc_exec_ctx_finish();
}
grpc_resource_quota_unref(q);
destroy_user(usr);
@@ -182,7 +177,7 @@ static void test_async_alloc_blocked_by_size(void) {
{
ExecCtx _local_exec_ctx;
grpc_resource_user_alloc(usr, 1024, set_event(&ev));
- grpc_exec_ctx_finish();
+
GPR_ASSERT(gpr_event_wait(
&ev, grpc_timeout_milliseconds_to_deadline(100)) == NULL);
}
@@ -192,7 +187,6 @@ static void test_async_alloc_blocked_by_size(void) {
{
ExecCtx _local_exec_ctx;
grpc_resource_user_free(usr, 1024);
- grpc_exec_ctx_finish();
}
grpc_resource_quota_unref(q);
destroy_user(usr);
@@ -209,7 +203,7 @@ static void test_scavenge(void) {
gpr_event_init(&ev);
ExecCtx _local_exec_ctx;
grpc_resource_user_alloc(usr1, 1024, set_event(&ev));
- grpc_exec_ctx_finish();
+
GPR_ASSERT(gpr_event_wait(&ev, grpc_timeout_seconds_to_deadline(5)) !=
NULL);
;
@@ -217,14 +211,13 @@ static void test_scavenge(void) {
{
ExecCtx _local_exec_ctx;
grpc_resource_user_free(usr1, 1024);
- grpc_exec_ctx_finish();
}
{
gpr_event ev;
gpr_event_init(&ev);
ExecCtx _local_exec_ctx;
grpc_resource_user_alloc(usr2, 1024, set_event(&ev));
- grpc_exec_ctx_finish();
+
GPR_ASSERT(gpr_event_wait(&ev, grpc_timeout_seconds_to_deadline(5)) !=
NULL);
;
@@ -232,7 +225,6 @@ static void test_scavenge(void) {
{
ExecCtx _local_exec_ctx;
grpc_resource_user_free(usr2, 1024);
- grpc_exec_ctx_finish();
}
grpc_resource_quota_unref(q);
destroy_user(usr1);
@@ -250,7 +242,7 @@ static void test_scavenge_blocked(void) {
gpr_event_init(&ev);
ExecCtx _local_exec_ctx;
grpc_resource_user_alloc(usr1, 1024, set_event(&ev));
- grpc_exec_ctx_finish();
+
GPR_ASSERT(gpr_event_wait(&ev, grpc_timeout_seconds_to_deadline(5)) !=
NULL);
;
@@ -259,14 +251,14 @@ static void test_scavenge_blocked(void) {
gpr_event_init(&ev);
ExecCtx _local_exec_ctx;
grpc_resource_user_alloc(usr2, 1024, set_event(&ev));
- grpc_exec_ctx_finish();
+
GPR_ASSERT(gpr_event_wait(
&ev, grpc_timeout_milliseconds_to_deadline(100)) == NULL);
}
{
ExecCtx _local_exec_ctx;
grpc_resource_user_free(usr1, 1024);
- grpc_exec_ctx_finish();
+
GPR_ASSERT(gpr_event_wait(&ev, grpc_timeout_seconds_to_deadline(5)) !=
NULL);
;
@@ -274,7 +266,6 @@ static void test_scavenge_blocked(void) {
{
ExecCtx _local_exec_ctx;
grpc_resource_user_free(usr2, 1024);
- grpc_exec_ctx_finish();
}
grpc_resource_quota_unref(q);
destroy_user(usr1);
@@ -292,7 +283,7 @@ static void test_blocked_until_scheduled_reclaim(void) {
gpr_event_init(&ev);
ExecCtx _local_exec_ctx;
grpc_resource_user_alloc(usr, 1024, set_event(&ev));
- grpc_exec_ctx_finish();
+
GPR_ASSERT(gpr_event_wait(&ev, grpc_timeout_seconds_to_deadline(5)) !=
NULL);
;
@@ -303,14 +294,13 @@ static void test_blocked_until_scheduled_reclaim(void) {
ExecCtx _local_exec_ctx;
grpc_resource_user_post_reclaimer(
usr, false, make_reclaimer(usr, 1024, set_event(&reclaim_done)));
- grpc_exec_ctx_finish();
}
{
gpr_event ev;
gpr_event_init(&ev);
ExecCtx _local_exec_ctx;
grpc_resource_user_alloc(usr, 1024, set_event(&ev));
- grpc_exec_ctx_finish();
+
GPR_ASSERT(gpr_event_wait(&reclaim_done,
grpc_timeout_seconds_to_deadline(5)) != NULL);
GPR_ASSERT(gpr_event_wait(&ev, grpc_timeout_seconds_to_deadline(5)) !=
@@ -320,7 +310,6 @@ static void test_blocked_until_scheduled_reclaim(void) {
{
ExecCtx _local_exec_ctx;
grpc_resource_user_free(usr, 1024);
- grpc_exec_ctx_finish();
}
grpc_resource_quota_unref(q);
destroy_user(usr);
@@ -338,7 +327,7 @@ static void test_blocked_until_scheduled_reclaim_and_scavenge(void) {
gpr_event_init(&ev);
ExecCtx _local_exec_ctx;
grpc_resource_user_alloc(usr1, 1024, set_event(&ev));
- grpc_exec_ctx_finish();
+
GPR_ASSERT(gpr_event_wait(&ev, grpc_timeout_seconds_to_deadline(5)) !=
NULL);
;
@@ -349,14 +338,13 @@ static void test_blocked_until_scheduled_reclaim_and_scavenge(void) {
ExecCtx _local_exec_ctx;
grpc_resource_user_post_reclaimer(
usr1, false, make_reclaimer(usr1, 1024, set_event(&reclaim_done)));
- grpc_exec_ctx_finish();
}
{
gpr_event ev;
gpr_event_init(&ev);
ExecCtx _local_exec_ctx;
grpc_resource_user_alloc(usr2, 1024, set_event(&ev));
- grpc_exec_ctx_finish();
+
GPR_ASSERT(gpr_event_wait(&reclaim_done,
grpc_timeout_seconds_to_deadline(5)) != NULL);
GPR_ASSERT(gpr_event_wait(&ev, grpc_timeout_seconds_to_deadline(5)) !=
@@ -366,7 +354,6 @@ static void test_blocked_until_scheduled_reclaim_and_scavenge(void) {
{
ExecCtx _local_exec_ctx;
grpc_resource_user_free(usr2, 1024);
- grpc_exec_ctx_finish();
}
grpc_resource_quota_unref(q);
destroy_user(usr1);
@@ -384,7 +371,7 @@ static void test_blocked_until_scheduled_destructive_reclaim(void) {
gpr_event_init(&ev);
ExecCtx _local_exec_ctx;
grpc_resource_user_alloc(usr, 1024, set_event(&ev));
- grpc_exec_ctx_finish();
+
GPR_ASSERT(gpr_event_wait(&ev, grpc_timeout_seconds_to_deadline(5)) !=
NULL);
;
@@ -395,14 +382,13 @@ static void test_blocked_until_scheduled_destructive_reclaim(void) {
ExecCtx _local_exec_ctx;
grpc_resource_user_post_reclaimer(
usr, true, make_reclaimer(usr, 1024, set_event(&reclaim_done)));
- grpc_exec_ctx_finish();
}
{
gpr_event ev;
gpr_event_init(&ev);
ExecCtx _local_exec_ctx;
grpc_resource_user_alloc(usr, 1024, set_event(&ev));
- grpc_exec_ctx_finish();
+
GPR_ASSERT(gpr_event_wait(&reclaim_done,
grpc_timeout_seconds_to_deadline(5)) != NULL);
GPR_ASSERT(gpr_event_wait(&ev, grpc_timeout_seconds_to_deadline(5)) !=
@@ -412,7 +398,6 @@ static void test_blocked_until_scheduled_destructive_reclaim(void) {
{
ExecCtx _local_exec_ctx;
grpc_resource_user_free(usr, 1024);
- grpc_exec_ctx_finish();
}
grpc_resource_quota_unref(q);
destroy_user(usr);
@@ -434,7 +419,7 @@ static void test_unused_reclaim_is_cancelled(void) {
usr, false, make_unused_reclaimer(set_event(&benign_done)));
grpc_resource_user_post_reclaimer(
usr, true, make_unused_reclaimer(set_event(&destructive_done)));
- grpc_exec_ctx_finish();
+
GPR_ASSERT(gpr_event_wait(&benign_done,
grpc_timeout_milliseconds_to_deadline(100)) ==
NULL);
@@ -465,7 +450,7 @@ static void test_benign_reclaim_is_preferred(void) {
gpr_event_init(&ev);
ExecCtx _local_exec_ctx;
grpc_resource_user_alloc(usr, 1024, set_event(&ev));
- grpc_exec_ctx_finish();
+
GPR_ASSERT(gpr_event_wait(&ev, grpc_timeout_seconds_to_deadline(5)) !=
NULL);
;
@@ -476,7 +461,7 @@ static void test_benign_reclaim_is_preferred(void) {
usr, false, make_reclaimer(usr, 1024, set_event(&benign_done)));
grpc_resource_user_post_reclaimer(
usr, true, make_unused_reclaimer(set_event(&destructive_done)));
- grpc_exec_ctx_finish();
+
GPR_ASSERT(gpr_event_wait(&benign_done,
grpc_timeout_milliseconds_to_deadline(100)) ==
NULL);
@@ -489,7 +474,7 @@ static void test_benign_reclaim_is_preferred(void) {
gpr_event_init(&ev);
ExecCtx _local_exec_ctx;
grpc_resource_user_alloc(usr, 1024, set_event(&ev));
- grpc_exec_ctx_finish();
+
GPR_ASSERT(gpr_event_wait(&benign_done,
grpc_timeout_seconds_to_deadline(5)) != NULL);
GPR_ASSERT(gpr_event_wait(&destructive_done,
@@ -501,7 +486,6 @@ static void test_benign_reclaim_is_preferred(void) {
{
ExecCtx _local_exec_ctx;
grpc_resource_user_free(usr, 1024);
- grpc_exec_ctx_finish();
}
grpc_resource_quota_unref(q);
destroy_user(usr);
@@ -526,7 +510,7 @@ static void test_multiple_reclaims_can_be_triggered(void) {
gpr_event_init(&ev);
ExecCtx _local_exec_ctx;
grpc_resource_user_alloc(usr, 1024, set_event(&ev));
- grpc_exec_ctx_finish();
+
GPR_ASSERT(gpr_event_wait(&ev, grpc_timeout_seconds_to_deadline(5)) !=
NULL);
;
@@ -537,7 +521,7 @@ static void test_multiple_reclaims_can_be_triggered(void) {
usr, false, make_reclaimer(usr, 512, set_event(&benign_done)));
grpc_resource_user_post_reclaimer(
usr, true, make_reclaimer(usr, 512, set_event(&destructive_done)));
- grpc_exec_ctx_finish();
+
GPR_ASSERT(gpr_event_wait(&benign_done,
grpc_timeout_milliseconds_to_deadline(100)) ==
NULL);
@@ -550,7 +534,7 @@ static void test_multiple_reclaims_can_be_triggered(void) {
gpr_event_init(&ev);
ExecCtx _local_exec_ctx;
grpc_resource_user_alloc(usr, 1024, set_event(&ev));
- grpc_exec_ctx_finish();
+
GPR_ASSERT(gpr_event_wait(&benign_done,
grpc_timeout_seconds_to_deadline(5)) != NULL);
GPR_ASSERT(gpr_event_wait(&destructive_done,
@@ -562,7 +546,6 @@ static void test_multiple_reclaims_can_be_triggered(void) {
{
ExecCtx _local_exec_ctx;
grpc_resource_user_free(usr, 1024);
- grpc_exec_ctx_finish();
}
grpc_resource_quota_unref(q);
destroy_user(usr);
@@ -582,18 +565,15 @@ static void test_resource_user_stays_allocated_until_memory_released(void) {
{
ExecCtx _local_exec_ctx;
grpc_resource_user_alloc(usr, 1024, NULL);
- grpc_exec_ctx_finish();
}
{
ExecCtx _local_exec_ctx;
grpc_resource_quota_unref(q);
grpc_resource_user_unref(usr);
- grpc_exec_ctx_finish();
}
{
ExecCtx _local_exec_ctx;
grpc_resource_user_free(usr, 1024);
- grpc_exec_ctx_finish();
}
}
@@ -616,7 +596,7 @@ test_resource_user_stays_allocated_and_reclaimers_unrun_until_memory_released(
ExecCtx _local_exec_ctx;
grpc_resource_user_post_reclaimer(
usr, false, make_unused_reclaimer(set_event(&reclaimer_cancelled)));
- grpc_exec_ctx_finish();
+
GPR_ASSERT(gpr_event_wait(&reclaimer_cancelled,
grpc_timeout_milliseconds_to_deadline(100)) ==
NULL);
@@ -626,7 +606,7 @@ test_resource_user_stays_allocated_and_reclaimers_unrun_until_memory_released(
gpr_event_init(&allocated);
ExecCtx _local_exec_ctx;
grpc_resource_user_alloc(usr, 1024, set_event(&allocated));
- grpc_exec_ctx_finish();
+
GPR_ASSERT(gpr_event_wait(&allocated,
grpc_timeout_seconds_to_deadline(5)) != NULL);
GPR_ASSERT(gpr_event_wait(&reclaimer_cancelled,
@@ -636,7 +616,7 @@ test_resource_user_stays_allocated_and_reclaimers_unrun_until_memory_released(
{
ExecCtx _local_exec_ctx;
grpc_resource_user_unref(usr);
- grpc_exec_ctx_finish();
+
GPR_ASSERT(gpr_event_wait(&reclaimer_cancelled,
grpc_timeout_milliseconds_to_deadline(100)) ==
NULL);
@@ -644,7 +624,7 @@ test_resource_user_stays_allocated_and_reclaimers_unrun_until_memory_released(
{
ExecCtx _local_exec_ctx;
grpc_resource_user_free(usr, 1024);
- grpc_exec_ctx_finish();
+
GPR_ASSERT(gpr_event_wait(&reclaimer_cancelled,
grpc_timeout_seconds_to_deadline(5)) != NULL);
}
@@ -663,7 +643,7 @@ static void test_reclaimers_can_be_posted_repeatedly(void) {
gpr_event_init(&allocated);
ExecCtx _local_exec_ctx;
grpc_resource_user_alloc(usr, 1024, set_event(&allocated));
- grpc_exec_ctx_finish();
+
GPR_ASSERT(gpr_event_wait(&allocated,
grpc_timeout_seconds_to_deadline(5)) != NULL);
}
@@ -674,7 +654,7 @@ static void test_reclaimers_can_be_posted_repeatedly(void) {
ExecCtx _local_exec_ctx;
grpc_resource_user_post_reclaimer(
usr, false, make_reclaimer(usr, 1024, set_event(&reclaimer_done)));
- grpc_exec_ctx_finish();
+
GPR_ASSERT(gpr_event_wait(&reclaimer_done,
grpc_timeout_milliseconds_to_deadline(100)) ==
NULL);
@@ -684,7 +664,7 @@ static void test_reclaimers_can_be_posted_repeatedly(void) {
gpr_event_init(&allocated);
ExecCtx _local_exec_ctx;
grpc_resource_user_alloc(usr, 1024, set_event(&allocated));
- grpc_exec_ctx_finish();
+
GPR_ASSERT(gpr_event_wait(&allocated,
grpc_timeout_seconds_to_deadline(5)) != NULL);
GPR_ASSERT(gpr_event_wait(&reclaimer_done,
@@ -694,7 +674,6 @@ static void test_reclaimers_can_be_posted_repeatedly(void) {
{
ExecCtx _local_exec_ctx;
grpc_resource_user_free(usr, 1024);
- grpc_exec_ctx_finish();
}
destroy_user(usr);
grpc_resource_quota_unref(q);
@@ -719,14 +698,13 @@ static void test_one_slice(void) {
const int start_allocs = num_allocs;
ExecCtx _local_exec_ctx;
grpc_resource_user_alloc_slices(&alloc, 1024, 1, &buffer);
- grpc_exec_ctx_finish();
+
assert_counter_becomes(&num_allocs, start_allocs + 1);
}
{
ExecCtx _local_exec_ctx;
grpc_slice_buffer_destroy_internal(&buffer);
- grpc_exec_ctx_finish();
}
destroy_user(usr);
grpc_resource_quota_unref(q);
@@ -752,21 +730,19 @@ static void test_one_slice_deleted_late(void) {
const int start_allocs = num_allocs;
ExecCtx _local_exec_ctx;
grpc_resource_user_alloc_slices(&alloc, 1024, 1, &buffer);
- grpc_exec_ctx_finish();
+
assert_counter_becomes(&num_allocs, start_allocs + 1);
}
{
ExecCtx _local_exec_ctx;
grpc_resource_user_unref(usr);
- grpc_exec_ctx_finish();
}
grpc_resource_quota_unref(q);
{
ExecCtx _local_exec_ctx;
grpc_slice_buffer_destroy_internal(&buffer);
- grpc_exec_ctx_finish();
}
}
@@ -796,7 +772,7 @@ static void test_negative_rq_free_pool(void) {
const int start_allocs = num_allocs;
ExecCtx _local_exec_ctx;
grpc_resource_user_alloc_slices(&alloc, 1024, 1, &buffer);
- grpc_exec_ctx_finish();
+
assert_counter_becomes(&num_allocs, start_allocs + 1);
}
@@ -809,14 +785,12 @@ static void test_negative_rq_free_pool(void) {
{
ExecCtx _local_exec_ctx;
grpc_resource_user_unref(usr);
- grpc_exec_ctx_finish();
}
grpc_resource_quota_unref(q);
{
ExecCtx _local_exec_ctx;
grpc_slice_buffer_destroy_internal(&buffer);
- grpc_exec_ctx_finish();
}
}
diff --git a/test/core/iomgr/tcp_client_posix_test.cc b/test/core/iomgr/tcp_client_posix_test.cc
index 7fad3b08be..abefecba33 100644
--- a/test/core/iomgr/tcp_client_posix_test.cc
+++ b/test/core/iomgr/tcp_client_posix_test.cc
@@ -56,7 +56,7 @@ static void finish_connection() {
ExecCtx _local_exec_ctx;
GPR_ASSERT(
GRPC_LOG_IF_ERROR("pollset_kick", grpc_pollset_kick(g_pollset, NULL)));
- grpc_exec_ctx_finish();
+
gpr_mu_unlock(g_mu);
}
@@ -127,13 +127,11 @@ void test_succeeds(void) {
grpc_timespec_to_millis_round_up(
grpc_timeout_seconds_to_deadline(5)))));
gpr_mu_unlock(g_mu);
- grpc_exec_ctx_flush();
+ ExecCtx::Get()->Flush();
gpr_mu_lock(g_mu);
}
gpr_mu_unlock(g_mu);
-
- grpc_exec_ctx_finish();
}
void test_fails(void) {
@@ -177,12 +175,11 @@ void test_fails(void) {
break;
}
gpr_mu_unlock(g_mu);
- grpc_exec_ctx_flush();
+ ExecCtx::Get()->Flush();
gpr_mu_lock(g_mu);
}
gpr_mu_unlock(g_mu);
- grpc_exec_ctx_finish();
}
static void destroy_pollset(void* p, grpc_error* error) {
@@ -198,7 +195,7 @@ int main(int argc, char** argv) {
g_pollset = static_cast<grpc_pollset*>(gpr_zalloc(grpc_pollset_size()));
grpc_pollset_init(g_pollset, &g_mu);
grpc_pollset_set_add_pollset(g_pollset_set, g_pollset);
- grpc_exec_ctx_finish();
+
test_succeeds();
gpr_log(GPR_ERROR, "End of first test");
test_fails();
@@ -206,7 +203,7 @@ int main(int argc, char** argv) {
GRPC_CLOSURE_INIT(&destroyed, destroy_pollset, g_pollset,
grpc_schedule_on_exec_ctx);
grpc_pollset_shutdown(g_pollset, &destroyed);
- grpc_exec_ctx_finish();
+
grpc_shutdown();
gpr_free(g_pollset);
return 0;
diff --git a/test/core/iomgr/tcp_client_uv_test.cc b/test/core/iomgr/tcp_client_uv_test.cc
index dd98fb2275..0355896b85 100644
--- a/test/core/iomgr/tcp_client_uv_test.cc
+++ b/test/core/iomgr/tcp_client_uv_test.cc
@@ -121,7 +121,7 @@ void test_succeeds(void) {
grpc_timespec_to_millis_round_up(
grpc_timeout_seconds_to_deadline(5)))));
gpr_mu_unlock(g_mu);
- grpc_exec_ctx_flush();
+ ExecCtx::Get()->Flush();
gpr_mu_lock(g_mu);
}
@@ -129,8 +129,6 @@ void test_succeeds(void) {
uv_close((uv_handle_t*)svr_handle, close_cb);
gpr_mu_unlock(g_mu);
-
- grpc_exec_ctx_finish();
}
void test_fails(void) {
@@ -175,12 +173,11 @@ void test_fails(void) {
break;
}
gpr_mu_unlock(g_mu);
- grpc_exec_ctx_flush();
+ ExecCtx::Get()->Flush();
gpr_mu_lock(g_mu);
}
gpr_mu_unlock(g_mu);
- grpc_exec_ctx_finish();
}
static void destroy_pollset(void* p, grpc_error* error) {
@@ -194,14 +191,14 @@ int main(int argc, char** argv) {
grpc_init();
g_pollset = static_cast<grpc_pollset*>(gpr_malloc(grpc_pollset_size()));
grpc_pollset_init(g_pollset, &g_mu);
- grpc_exec_ctx_finish();
+
test_succeeds();
gpr_log(GPR_ERROR, "End of first test");
test_fails();
GRPC_CLOSURE_INIT(&destroyed, destroy_pollset, g_pollset,
grpc_schedule_on_exec_ctx);
grpc_pollset_shutdown(g_pollset, &destroyed);
- grpc_exec_ctx_finish();
+
grpc_shutdown();
gpr_free(g_pollset);
return 0;
diff --git a/test/core/iomgr/tcp_posix_test.cc b/test/core/iomgr/tcp_posix_test.cc
index e4126fb05a..678e1c3638 100644
--- a/test/core/iomgr/tcp_posix_test.cc
+++ b/test/core/iomgr/tcp_posix_test.cc
@@ -193,7 +193,7 @@ static void read_test(size_t num_bytes, size_t slice_size) {
GPR_ASSERT(GRPC_LOG_IF_ERROR(
"pollset_work", grpc_pollset_work(g_pollset, &worker, deadline)));
gpr_mu_unlock(g_mu);
- grpc_exec_ctx_finish();
+
gpr_mu_lock(g_mu);
}
GPR_ASSERT(state.read_bytes == state.target_read_bytes);
@@ -201,7 +201,6 @@ static void read_test(size_t num_bytes, size_t slice_size) {
grpc_slice_buffer_destroy_internal(&state.incoming);
grpc_endpoint_destroy(ep);
- grpc_exec_ctx_finish();
}
/* Write to a socket until it fills up, then read from it using the grpc_tcp
@@ -244,7 +243,7 @@ static void large_read_test(size_t slice_size) {
GPR_ASSERT(GRPC_LOG_IF_ERROR(
"pollset_work", grpc_pollset_work(g_pollset, &worker, deadline)));
gpr_mu_unlock(g_mu);
- grpc_exec_ctx_finish();
+
gpr_mu_lock(g_mu);
}
GPR_ASSERT(state.read_bytes == state.target_read_bytes);
@@ -252,7 +251,6 @@ static void large_read_test(size_t slice_size) {
grpc_slice_buffer_destroy_internal(&state.incoming);
grpc_endpoint_destroy(ep);
- grpc_exec_ctx_finish();
}
struct write_socket_state {
@@ -316,7 +314,7 @@ void drain_socket_blocking(int fd, size_t num_bytes, size_t read_size) {
grpc_timespec_to_millis_round_up(
grpc_timeout_milliseconds_to_deadline(10)))));
gpr_mu_unlock(g_mu);
- grpc_exec_ctx_finish();
+
do {
bytes_read =
read(fd, buf, bytes_left > read_size ? read_size : bytes_left);
@@ -385,7 +383,7 @@ static void write_test(size_t num_bytes, size_t slice_size) {
GPR_ASSERT(GRPC_LOG_IF_ERROR(
"pollset_work", grpc_pollset_work(g_pollset, &worker, deadline)));
gpr_mu_unlock(g_mu);
- grpc_exec_ctx_finish();
+
gpr_mu_lock(g_mu);
}
gpr_mu_unlock(g_mu);
@@ -393,7 +391,6 @@ static void write_test(size_t num_bytes, size_t slice_size) {
grpc_slice_buffer_destroy_internal(&outgoing);
grpc_endpoint_destroy(ep);
gpr_free(slices);
- grpc_exec_ctx_finish();
}
void on_fd_released(void* arg, grpc_error* errors) {
@@ -453,7 +450,7 @@ static void release_fd_test(size_t num_bytes, size_t slice_size) {
gpr_log(GPR_DEBUG, "wakeup: read=%" PRIdPTR " target=%" PRIdPTR,
state.read_bytes, state.target_read_bytes);
gpr_mu_unlock(g_mu);
- grpc_exec_ctx_flush();
+ ExecCtx::Get()->Flush();
gpr_mu_lock(g_mu);
}
GPR_ASSERT(state.read_bytes == state.target_read_bytes);
@@ -461,7 +458,7 @@ static void release_fd_test(size_t num_bytes, size_t slice_size) {
grpc_slice_buffer_destroy_internal(&state.incoming);
grpc_tcp_destroy_and_release_fd(ep, &fd, &fd_released_cb);
- grpc_exec_ctx_flush();
+ ExecCtx::Get()->Flush();
gpr_mu_lock(g_mu);
while (!fd_released_done) {
grpc_pollset_worker* worker = NULL;
@@ -472,7 +469,6 @@ static void release_fd_test(size_t num_bytes, size_t slice_size) {
gpr_mu_unlock(g_mu);
GPR_ASSERT(fd_released_done == 1);
GPR_ASSERT(fd == sv[1]);
- grpc_exec_ctx_finish();
written_bytes = fill_socket_partial(sv[0], num_bytes);
drain_socket_blocking(fd, written_bytes, written_bytes);
@@ -528,8 +524,6 @@ static grpc_endpoint_test_fixture create_fixture_tcp_socketpair(
grpc_endpoint_add_to_pollset(f.client_ep, g_pollset);
grpc_endpoint_add_to_pollset(f.server_ep, g_pollset);
- grpc_exec_ctx_finish();
-
return f;
}
@@ -553,7 +547,7 @@ int main(int argc, char** argv) {
GRPC_CLOSURE_INIT(&destroyed, destroy_pollset, g_pollset,
grpc_schedule_on_exec_ctx);
grpc_pollset_shutdown(g_pollset, &destroyed);
- grpc_exec_ctx_finish();
+
grpc_shutdown();
gpr_free(g_pollset);
diff --git a/test/core/iomgr/tcp_server_posix_test.cc b/test/core/iomgr/tcp_server_posix_test.cc
index 3707634c29..1c3f4490d5 100644
--- a/test/core/iomgr/tcp_server_posix_test.cc
+++ b/test/core/iomgr/tcp_server_posix_test.cc
@@ -167,7 +167,6 @@ static void test_no_op(void) {
grpc_tcp_server* s;
GPR_ASSERT(GRPC_ERROR_NONE == grpc_tcp_server_create(NULL, NULL, &s));
grpc_tcp_server_unref(s);
- grpc_exec_ctx_finish();
}
static void test_no_op_with_start(void) {
@@ -177,7 +176,6 @@ static void test_no_op_with_start(void) {
LOG_TEST("test_no_op_with_start");
grpc_tcp_server_start(s, NULL, 0, on_connect, NULL);
grpc_tcp_server_unref(s);
- grpc_exec_ctx_finish();
}
static void test_no_op_with_port(void) {
@@ -197,7 +195,6 @@ static void test_no_op_with_port(void) {
port > 0);
grpc_tcp_server_unref(s);
- grpc_exec_ctx_finish();
}
static void test_no_op_with_port_and_start(void) {
@@ -219,7 +216,6 @@ static void test_no_op_with_port_and_start(void) {
grpc_tcp_server_start(s, NULL, 0, on_connect, NULL);
grpc_tcp_server_unref(s);
- grpc_exec_ctx_finish();
}
static grpc_error* tcp_connect(const test_addr* remote,
@@ -247,7 +243,7 @@ static grpc_error* tcp_connect(const test_addr* remote,
return GRPC_OS_ERROR(errno, "connect");
}
gpr_log(GPR_DEBUG, "wait");
- while (g_nconnects == nconnects_before && deadline > grpc_exec_ctx_now()) {
+ while (g_nconnects == nconnects_before && deadline > ExecCtx::Get()->Now()) {
grpc_pollset_worker* worker = NULL;
grpc_error* err;
if ((err = grpc_pollset_work(g_pollset, &worker, deadline)) !=
@@ -257,7 +253,7 @@ static grpc_error* tcp_connect(const test_addr* remote,
return err;
}
gpr_mu_unlock(g_mu);
- grpc_exec_ctx_finish();
+
gpr_mu_lock(g_mu);
}
gpr_log(GPR_DEBUG, "wait done");
@@ -413,7 +409,6 @@ static void test_connect(size_t num_connects,
GPR_ASSERT(grpc_tcp_server_port_fd(s, 0, 0) >= 0);
grpc_tcp_server_unref(s);
- grpc_exec_ctx_finish();
/* Weak ref lost. */
GPR_ASSERT(weak_ref.server == NULL);
@@ -489,7 +484,7 @@ int main(int argc, char** argv) {
GRPC_CLOSURE_INIT(&destroyed, destroy_pollset, g_pollset,
grpc_schedule_on_exec_ctx);
grpc_pollset_shutdown(g_pollset, &destroyed);
- grpc_exec_ctx_finish();
+
grpc_shutdown();
gpr_free(dst_addrs);
gpr_free(g_pollset);
diff --git a/test/core/iomgr/tcp_server_uv_test.cc b/test/core/iomgr/tcp_server_uv_test.cc
index 2a0ada225c..50042af37f 100644
--- a/test/core/iomgr/tcp_server_uv_test.cc
+++ b/test/core/iomgr/tcp_server_uv_test.cc
@@ -119,7 +119,6 @@ static void test_no_op(void) {
grpc_tcp_server* s;
GPR_ASSERT(GRPC_ERROR_NONE == grpc_tcp_server_create(NULL, NULL, &s));
grpc_tcp_server_unref(s);
- grpc_exec_ctx_finish();
}
static void test_no_op_with_start(void) {
@@ -129,7 +128,6 @@ static void test_no_op_with_start(void) {
LOG_TEST("test_no_op_with_start");
grpc_tcp_server_start(s, NULL, 0, on_connect, NULL);
grpc_tcp_server_unref(s);
- grpc_exec_ctx_finish();
}
static void test_no_op_with_port(void) {
@@ -149,7 +147,6 @@ static void test_no_op_with_port(void) {
port > 0);
grpc_tcp_server_unref(s);
- grpc_exec_ctx_finish();
}
static void test_no_op_with_port_and_start(void) {
@@ -171,7 +168,6 @@ static void test_no_op_with_port_and_start(void) {
grpc_tcp_server_start(s, NULL, 0, on_connect, NULL);
grpc_tcp_server_unref(s);
- grpc_exec_ctx_finish();
}
static void connect_cb(uv_connect_t* req, int status) {
@@ -205,7 +201,7 @@ static void tcp_connect(const struct sockaddr* remote, socklen_t remote_len,
grpc_pollset_work(g_pollset, &worker,
grpc_timespec_to_millis_round_up(deadline))));
gpr_mu_unlock(g_mu);
- grpc_exec_ctx_finish();
+
gpr_mu_lock(g_mu);
}
gpr_log(GPR_DEBUG, "wait done");
@@ -277,7 +273,6 @@ static void test_connect(unsigned n) {
GPR_ASSERT(weak_ref.server != NULL);
grpc_tcp_server_unref(s);
- grpc_exec_ctx_finish();
/* Weak ref lost. */
GPR_ASSERT(weak_ref.server == NULL);
@@ -305,7 +300,7 @@ int main(int argc, char** argv) {
GRPC_CLOSURE_INIT(&destroyed, destroy_pollset, g_pollset,
grpc_schedule_on_exec_ctx);
grpc_pollset_shutdown(g_pollset, &destroyed);
- grpc_exec_ctx_finish();
+
grpc_shutdown();
gpr_free(g_pollset);
return 0;
diff --git a/test/core/iomgr/timer_list_test.cc b/test/core/iomgr/timer_list_test.cc
index 07dfec168c..7281f55b85 100644
--- a/test/core/iomgr/timer_list_test.cc
+++ b/test/core/iomgr/timer_list_test.cc
@@ -52,7 +52,7 @@ static void add_test(void) {
grpc_timer_check_trace.value = 1;
memset(cb_called, 0, sizeof(cb_called));
- grpc_millis start = grpc_exec_ctx_now();
+ grpc_millis start = ExecCtx::Get()->Now();
/* 10 ms timers. will expire in the current epoch */
for (i = 0; i < 10; i++) {
@@ -69,32 +69,32 @@ static void add_test(void) {
}
/* collect timers. Only the first batch should be ready. */
- exec_ctx->now = start + 500;
+ ExecCtx::Get()->SetNow(start + 500);
GPR_ASSERT(grpc_timer_check(NULL) == GRPC_TIMERS_FIRED);
- grpc_exec_ctx_finish();
+
for (i = 0; i < 20; i++) {
GPR_ASSERT(cb_called[i][1] == (i < 10));
GPR_ASSERT(cb_called[i][0] == 0);
}
- exec_ctx->now = start + 600;
+ ExecCtx::Get()->SetNow(start + 600);
GPR_ASSERT(grpc_timer_check(NULL) == GRPC_TIMERS_CHECKED_AND_EMPTY);
- grpc_exec_ctx_finish();
+
for (i = 0; i < 30; i++) {
GPR_ASSERT(cb_called[i][1] == (i < 10));
GPR_ASSERT(cb_called[i][0] == 0);
}
/* collect the rest of the timers */
- exec_ctx->now = start + 1500;
+ ExecCtx::Get()->SetNow(start + 1500);
GPR_ASSERT(grpc_timer_check(NULL) == GRPC_TIMERS_FIRED);
- grpc_exec_ctx_finish();
+
for (i = 0; i < 30; i++) {
GPR_ASSERT(cb_called[i][1] == (i < 20));
GPR_ASSERT(cb_called[i][0] == 0);
}
- exec_ctx->now = start + 1600;
+ ExecCtx::Get()->SetNow(start + 1600);
GPR_ASSERT(grpc_timer_check(NULL) == GRPC_TIMERS_CHECKED_AND_EMPTY);
for (i = 0; i < 30; i++) {
GPR_ASSERT(cb_called[i][1] == (i < 20));
@@ -102,7 +102,6 @@ static void add_test(void) {
}
grpc_timer_list_shutdown();
- grpc_exec_ctx_finish();
}
/* Cleaning up a list with pending timers. */
@@ -112,8 +111,7 @@ void destruction_test(void) {
gpr_log(GPR_INFO, "destruction_test");
- exec_ctx->now_is_valid = true;
- exec_ctx->now = 0;
+ ExecCtx::Get()->SetNow(0);
grpc_timer_list_init();
grpc_timer_trace.value = 1;
grpc_timer_check_trace.value = 1;
@@ -134,18 +132,18 @@ void destruction_test(void) {
grpc_timer_init(
&timers[4], 1,
GRPC_CLOSURE_CREATE(cb, (void*)(intptr_t)4, grpc_schedule_on_exec_ctx));
- exec_ctx->now = 2;
+ ExecCtx::Get()->SetNow(2);
GPR_ASSERT(grpc_timer_check(NULL) == GRPC_TIMERS_FIRED);
- grpc_exec_ctx_finish();
+
GPR_ASSERT(1 == cb_called[4][1]);
grpc_timer_cancel(&timers[0]);
grpc_timer_cancel(&timers[3]);
- grpc_exec_ctx_finish();
+
GPR_ASSERT(1 == cb_called[0][0]);
GPR_ASSERT(1 == cb_called[3][0]);
grpc_timer_list_shutdown();
- grpc_exec_ctx_finish();
+
GPR_ASSERT(1 == cb_called[1][0]);
GPR_ASSERT(1 == cb_called[2][0]);
}
diff --git a/test/core/iomgr/udp_server_test.cc b/test/core/iomgr/udp_server_test.cc
index c079dbf716..47e5cf0254 100644
--- a/test/core/iomgr/udp_server_test.cc
+++ b/test/core/iomgr/udp_server_test.cc
@@ -130,7 +130,6 @@ static void test_no_op(void) {
ExecCtx _local_exec_ctx;
grpc_udp_server* s = grpc_udp_server_create(NULL);
grpc_udp_server_destroy(s, NULL);
- grpc_exec_ctx_finish();
}
static void test_no_op_with_start(void) {
@@ -139,7 +138,6 @@ static void test_no_op_with_start(void) {
LOG_TEST("test_no_op_with_start");
grpc_udp_server_start(s, NULL, 0, NULL);
grpc_udp_server_destroy(s, NULL);
- grpc_exec_ctx_finish();
}
static void test_no_op_with_port(void) {
@@ -157,7 +155,6 @@ static void test_no_op_with_port(void) {
on_fd_orphaned));
grpc_udp_server_destroy(s, NULL);
- grpc_exec_ctx_finish();
/* The server had a single FD, which should have been orphaned. */
GPR_ASSERT(g_number_of_orphan_calls == 1);
@@ -188,7 +185,7 @@ static void test_no_op_with_port_and_socket_factory(void) {
GPR_ASSERT(socket_factory->number_of_bind_calls == 1);
grpc_udp_server_destroy(s, NULL);
- grpc_exec_ctx_finish();
+
grpc_socket_factory_unref(&socket_factory->base);
/* The server had a single FD, which should have been orphaned. */
@@ -212,7 +209,6 @@ static void test_no_op_with_port_and_start(void) {
grpc_udp_server_start(s, NULL, 0, NULL);
grpc_udp_server_destroy(s, NULL);
- grpc_exec_ctx_finish();
/* The server had a single FD, which is orphaned exactly once in *
* grpc_udp_server_destroy. */
@@ -264,12 +260,12 @@ static void test_receive(int number_of_clients) {
(socklen_t)resolved_addr.len) == 0);
GPR_ASSERT(5 == write(clifd, "hello", 5));
while (g_number_of_reads == number_of_reads_before &&
- deadline > grpc_exec_ctx_now()) {
+ deadline > ExecCtx::Get()->Now()) {
grpc_pollset_worker* worker = NULL;
GPR_ASSERT(GRPC_LOG_IF_ERROR(
"pollset_work", grpc_pollset_work(g_pollset, &worker, deadline)));
gpr_mu_unlock(g_mu);
- grpc_exec_ctx_flush();
+ ExecCtx::Get()->Flush();
gpr_mu_lock(g_mu);
}
GPR_ASSERT(g_number_of_reads == number_of_reads_before + 1);
@@ -280,7 +276,6 @@ static void test_receive(int number_of_clients) {
gpr_mu_unlock(g_mu);
grpc_udp_server_destroy(s, NULL);
- grpc_exec_ctx_finish();
/* The server had a single FD, which is orphaned exactly once in *
* grpc_udp_server_destroy. */
@@ -313,7 +308,7 @@ int main(int argc, char** argv) {
GRPC_CLOSURE_INIT(&destroyed, destroy_pollset, g_pollset,
grpc_schedule_on_exec_ctx);
grpc_pollset_shutdown(g_pollset, &destroyed);
- grpc_exec_ctx_finish();
+
gpr_free(g_pollset);
grpc_shutdown();
return 0;
diff --git a/test/core/security/credentials_test.cc b/test/core/security/credentials_test.cc
index c03ae5c584..029171c931 100644
--- a/test/core/security/credentials_test.cc
+++ b/test/core/security/credentials_test.cc
@@ -154,7 +154,6 @@ static void test_empty_md_array(void) {
GPR_ASSERT(md_array.md == NULL);
GPR_ASSERT(md_array.size == 0);
grpc_credentials_mdelem_array_destroy(&md_array);
- grpc_exec_ctx_finish();
}
static void test_add_to_empty_md_array(void) {
@@ -170,7 +169,6 @@ static void test_add_to_empty_md_array(void) {
GPR_ASSERT(grpc_mdelem_eq(md, md_array.md[0]));
GRPC_MDELEM_UNREF(md);
grpc_credentials_mdelem_array_destroy(&md_array);
- grpc_exec_ctx_finish();
}
static void test_add_abunch_to_md_array(void) {
@@ -190,7 +188,6 @@ static void test_add_abunch_to_md_array(void) {
}
GRPC_MDELEM_UNREF(md);
grpc_credentials_mdelem_array_destroy(&md_array);
- grpc_exec_ctx_finish();
}
static void test_oauth2_token_fetcher_creds_parsing_ok(void) {
@@ -208,7 +205,6 @@ static void test_oauth2_token_fetcher_creds_parsing_ok(void) {
0);
GRPC_MDELEM_UNREF(token_md);
grpc_http_response_destroy(&response);
- grpc_exec_ctx_finish();
}
static void test_oauth2_token_fetcher_creds_parsing_bad_http_status(void) {
@@ -221,7 +217,6 @@ static void test_oauth2_token_fetcher_creds_parsing_bad_http_status(void) {
&response, &token_md, &token_lifetime) ==
GRPC_CREDENTIALS_ERROR);
grpc_http_response_destroy(&response);
- grpc_exec_ctx_finish();
}
static void test_oauth2_token_fetcher_creds_parsing_empty_http_body(void) {
@@ -233,7 +228,6 @@ static void test_oauth2_token_fetcher_creds_parsing_empty_http_body(void) {
&response, &token_md, &token_lifetime) ==
GRPC_CREDENTIALS_ERROR);
grpc_http_response_destroy(&response);
- grpc_exec_ctx_finish();
}
static void test_oauth2_token_fetcher_creds_parsing_invalid_json(void) {
@@ -249,7 +243,6 @@ static void test_oauth2_token_fetcher_creds_parsing_invalid_json(void) {
&response, &token_md, &token_lifetime) ==
GRPC_CREDENTIALS_ERROR);
grpc_http_response_destroy(&response);
- grpc_exec_ctx_finish();
}
static void test_oauth2_token_fetcher_creds_parsing_missing_token(void) {
@@ -264,7 +257,6 @@ static void test_oauth2_token_fetcher_creds_parsing_missing_token(void) {
&response, &token_md, &token_lifetime) ==
GRPC_CREDENTIALS_ERROR);
grpc_http_response_destroy(&response);
- grpc_exec_ctx_finish();
}
static void test_oauth2_token_fetcher_creds_parsing_missing_token_type(void) {
@@ -280,7 +272,6 @@ static void test_oauth2_token_fetcher_creds_parsing_missing_token_type(void) {
&response, &token_md, &token_lifetime) ==
GRPC_CREDENTIALS_ERROR);
grpc_http_response_destroy(&response);
- grpc_exec_ctx_finish();
}
static void test_oauth2_token_fetcher_creds_parsing_missing_token_lifetime(
@@ -296,7 +287,6 @@ static void test_oauth2_token_fetcher_creds_parsing_missing_token_lifetime(
&response, &token_md, &token_lifetime) ==
GRPC_CREDENTIALS_ERROR);
grpc_http_response_destroy(&response);
- grpc_exec_ctx_finish();
}
typedef struct {
@@ -402,7 +392,6 @@ static void test_google_iam_creds(void) {
NULL};
run_request_metadata_test(creds, auth_md_ctx, state);
grpc_call_credentials_unref(creds);
- grpc_exec_ctx_finish();
}
static void test_access_token_creds(void) {
@@ -417,7 +406,6 @@ static void test_access_token_creds(void) {
GPR_ASSERT(strcmp(creds->type, GRPC_CALL_CREDENTIALS_TYPE_OAUTH2) == 0);
run_request_metadata_test(creds, auth_md_ctx, state);
grpc_call_credentials_unref(creds);
- grpc_exec_ctx_finish();
}
static grpc_security_status check_channel_oauth2_create_security_connector(
@@ -448,7 +436,6 @@ static void test_channel_oauth2_composite_creds(void) {
channel_oauth2_creds, NULL, NULL, NULL, &new_args) ==
GRPC_SECURITY_OK);
grpc_channel_credentials_release(channel_oauth2_creds);
- grpc_exec_ctx_finish();
}
static void test_oauth2_google_iam_composite_creds(void) {
@@ -484,7 +471,6 @@ static void test_oauth2_google_iam_composite_creds(void) {
GRPC_CALL_CREDENTIALS_TYPE_IAM) == 0);
run_request_metadata_test(composite_creds, auth_md_ctx, state);
grpc_call_credentials_unref(composite_creds);
- grpc_exec_ctx_finish();
}
static grpc_security_status
@@ -533,7 +519,6 @@ static void test_channel_oauth2_google_iam_composite_creds(void) {
GRPC_SECURITY_OK);
grpc_channel_credentials_release(channel_oauth2_iam_creds);
- grpc_exec_ctx_finish();
}
static void validate_compute_engine_http_request(
@@ -598,7 +583,7 @@ static void test_compute_engine_creds_success(void) {
grpc_httpcli_set_override(compute_engine_httpcli_get_success_override,
httpcli_post_should_not_be_called);
run_request_metadata_test(creds, auth_md_ctx, state);
- grpc_exec_ctx_flush();
+ ExecCtx::Get()->Flush();
/* Second request: the cached token should be served directly. */
state =
@@ -606,11 +591,10 @@ static void test_compute_engine_creds_success(void) {
grpc_httpcli_set_override(httpcli_get_should_not_be_called,
httpcli_post_should_not_be_called);
run_request_metadata_test(creds, auth_md_ctx, state);
- grpc_exec_ctx_flush();
+ ExecCtx::Get()->Flush();
grpc_call_credentials_unref(creds);
grpc_httpcli_set_override(NULL, NULL);
- grpc_exec_ctx_finish();
}
static void test_compute_engine_creds_failure(void) {
@@ -628,7 +612,6 @@ static void test_compute_engine_creds_failure(void) {
run_request_metadata_test(creds, auth_md_ctx, state);
grpc_call_credentials_unref(creds);
grpc_httpcli_set_override(NULL, NULL);
- grpc_exec_ctx_finish();
}
static void validate_refresh_token_http_request(
@@ -689,7 +672,7 @@ static void test_refresh_token_creds_success(void) {
grpc_httpcli_set_override(httpcli_get_should_not_be_called,
refresh_token_httpcli_post_success);
run_request_metadata_test(creds, auth_md_ctx, state);
- grpc_exec_ctx_flush();
+ ExecCtx::Get()->Flush();
/* Second request: the cached token should be served directly. */
state =
@@ -697,11 +680,10 @@ static void test_refresh_token_creds_success(void) {
grpc_httpcli_set_override(httpcli_get_should_not_be_called,
httpcli_post_should_not_be_called);
run_request_metadata_test(creds, auth_md_ctx, state);
- grpc_exec_ctx_flush();
+ ExecCtx::Get()->Flush();
grpc_call_credentials_unref(creds);
grpc_httpcli_set_override(NULL, NULL);
- grpc_exec_ctx_finish();
}
static void test_refresh_token_creds_failure(void) {
@@ -719,7 +701,6 @@ static void test_refresh_token_creds_failure(void) {
run_request_metadata_test(creds, auth_md_ctx, state);
grpc_call_credentials_unref(creds);
grpc_httpcli_set_override(NULL, NULL);
- grpc_exec_ctx_finish();
}
static void validate_jwt_encode_and_sign_params(
@@ -824,7 +805,7 @@ static void test_jwt_creds_success(void) {
make_request_metadata_state(GRPC_ERROR_NONE, emd, GPR_ARRAY_SIZE(emd));
grpc_jwt_encode_and_sign_set_override(encode_and_sign_jwt_success);
run_request_metadata_test(creds, auth_md_ctx, state);
- grpc_exec_ctx_flush();
+ ExecCtx::Get()->Flush();
/* Second request: the cached token should be served directly. */
state =
@@ -832,7 +813,7 @@ static void test_jwt_creds_success(void) {
grpc_jwt_encode_and_sign_set_override(
encode_and_sign_jwt_should_not_be_called);
run_request_metadata_test(creds, auth_md_ctx, state);
- grpc_exec_ctx_flush();
+ ExecCtx::Get()->Flush();
/* Third request: Different service url so jwt_encode_and_sign should be
called again (no caching). */
@@ -841,13 +822,12 @@ static void test_jwt_creds_success(void) {
auth_md_ctx.service_url = other_test_service_url;
grpc_jwt_encode_and_sign_set_override(encode_and_sign_jwt_success);
run_request_metadata_test(creds, auth_md_ctx, state);
- grpc_exec_ctx_flush();
+ ExecCtx::Get()->Flush();
grpc_call_credentials_unref(creds);
gpr_free(json_key_string);
gpr_free(expected_md_value);
grpc_jwt_encode_and_sign_set_override(NULL);
- grpc_exec_ctx_finish();
}
static void test_jwt_creds_signing_failure(void) {
@@ -867,7 +847,6 @@ static void test_jwt_creds_signing_failure(void) {
gpr_free(json_key_string);
grpc_call_credentials_unref(creds);
grpc_jwt_encode_and_sign_set_override(NULL);
- grpc_exec_ctx_finish();
}
static void set_google_default_creds_env_var_with_file_contents(
@@ -902,7 +881,6 @@ static void test_google_default_creds_auth_key(void) {
0);
grpc_channel_credentials_unref(&creds->base);
gpr_setenv(GRPC_GOOGLE_CREDENTIALS_ENV_VAR, ""); /* Reset. */
- grpc_exec_ctx_finish();
}
static void test_google_default_creds_refresh_token(void) {
@@ -920,7 +898,6 @@ static void test_google_default_creds_refresh_token(void) {
"32555999999.apps.googleusercontent.com") == 0);
grpc_channel_credentials_unref(&creds->base);
gpr_setenv(GRPC_GOOGLE_CREDENTIALS_ENV_VAR, ""); /* Reset. */
- grpc_exec_ctx_finish();
}
static int default_creds_gce_detection_httpcli_get_success_override(
@@ -968,7 +945,7 @@ static void test_google_default_creds_gce(void) {
grpc_httpcli_set_override(compute_engine_httpcli_get_success_override,
httpcli_post_should_not_be_called);
run_request_metadata_test(creds->call_creds, auth_md_ctx, state);
- grpc_exec_ctx_flush();
+ ExecCtx::Get()->Flush();
/* Check that we get a cached creds if we call
grpc_google_default_credentials_create again.
@@ -984,7 +961,6 @@ static void test_google_default_creds_gce(void) {
grpc_channel_credentials_unref(&creds->base);
grpc_httpcli_set_override(NULL, NULL);
grpc_override_well_known_credentials_path_getter(NULL);
- grpc_exec_ctx_finish();
}
static int default_creds_gce_detection_httpcli_get_failure_override(
@@ -1094,7 +1070,7 @@ static void test_metadata_plugin_success(void) {
run_request_metadata_test(creds, auth_md_ctx, md_state);
GPR_ASSERT(state == PLUGIN_GET_METADATA_CALLED_STATE);
grpc_call_credentials_unref(creds);
- grpc_exec_ctx_finish();
+
GPR_ASSERT(state == PLUGIN_DESTROY_CALLED_STATE);
}
@@ -1122,7 +1098,7 @@ static void test_metadata_plugin_failure(void) {
run_request_metadata_test(creds, auth_md_ctx, md_state);
GPR_ASSERT(state == PLUGIN_GET_METADATA_CALLED_STATE);
grpc_call_credentials_unref(creds);
- grpc_exec_ctx_finish();
+
GPR_ASSERT(state == PLUGIN_DESTROY_CALLED_STATE);
}
@@ -1167,8 +1143,6 @@ static void test_channel_creds_duplicate_without_call_creds(void) {
grpc_channel_credentials_unref(channel_creds);
grpc_channel_credentials_unref(composite_creds);
-
- grpc_exec_ctx_finish();
}
typedef struct {
diff --git a/test/core/security/json_token_test.cc b/test/core/security/json_token_test.cc
index 7052925944..9eac2b9254 100644
--- a/test/core/security/json_token_test.cc
+++ b/test/core/security/json_token_test.cc
@@ -224,7 +224,7 @@ static grpc_json* parse_json_part_from_jwt(const char* str, size_t len,
gpr_free(b64);
*scratchpad = decoded;
grpc_slice_unref(slice);
- grpc_exec_ctx_finish();
+
return json;
}
@@ -348,8 +348,6 @@ static void check_jwt_signature(const char* b64_signature, RSA* rsa_key,
grpc_slice_unref_internal(sig);
if (key != NULL) EVP_PKEY_free(key);
if (md_ctx != NULL) EVP_MD_CTX_destroy(md_ctx);
-
- grpc_exec_ctx_finish();
}
static char* service_account_creds_jwt_encode_and_sign(
diff --git a/test/core/security/jwt_verifier_test.cc b/test/core/security/jwt_verifier_test.cc
index 16fad9d45e..7485aa10b4 100644
--- a/test/core/security/jwt_verifier_test.cc
+++ b/test/core/security/jwt_verifier_test.cc
@@ -220,7 +220,6 @@ static void test_claims_success(void) {
GPR_ASSERT(grpc_jwt_claims_check(claims, "https://foo.com") ==
GRPC_JWT_VERIFIER_OK);
grpc_jwt_claims_destroy(claims);
- grpc_exec_ctx_finish();
}
static void test_expired_claims_failure(void) {
@@ -247,7 +246,6 @@ static void test_expired_claims_failure(void) {
GPR_ASSERT(grpc_jwt_claims_check(claims, "https://foo.com") ==
GRPC_JWT_VERIFIER_TIME_CONSTRAINT_FAILURE);
grpc_jwt_claims_destroy(claims);
- grpc_exec_ctx_finish();
}
static void test_invalid_claims_failure(void) {
@@ -256,7 +254,6 @@ static void test_invalid_claims_failure(void) {
(char*)GRPC_SLICE_START_PTR(s), GRPC_SLICE_LENGTH(s));
ExecCtx _local_exec_ctx;
GPR_ASSERT(grpc_jwt_claims_from_json(json, s) == NULL);
- grpc_exec_ctx_finish();
}
static void test_bad_audience_claims_failure(void) {
@@ -271,7 +268,6 @@ static void test_bad_audience_claims_failure(void) {
GPR_ASSERT(grpc_jwt_claims_check(claims, "https://bar.com") ==
GRPC_JWT_VERIFIER_BAD_AUDIENCE);
grpc_jwt_claims_destroy(claims);
- grpc_exec_ctx_finish();
}
static void test_bad_subject_claims_failure(void) {
@@ -286,7 +282,6 @@ static void test_bad_subject_claims_failure(void) {
GPR_ASSERT(grpc_jwt_claims_check(claims, "https://foo.com") ==
GRPC_JWT_VERIFIER_BAD_SUBJECT);
grpc_jwt_claims_destroy(claims);
- grpc_exec_ctx_finish();
}
static char* json_key_str(const char* last_part) {
@@ -371,7 +366,7 @@ static void test_jwt_verifier_google_email_issuer_success(void) {
grpc_jwt_verifier_verify(verifier, NULL, jwt, expected_audience,
on_verification_success, (void*)expected_user_data);
grpc_jwt_verifier_destroy(verifier);
- grpc_exec_ctx_finish();
+
gpr_free(jwt);
grpc_httpcli_set_override(NULL, NULL);
}
@@ -404,7 +399,7 @@ static void test_jwt_verifier_custom_email_issuer_success(void) {
grpc_jwt_verifier_verify(verifier, NULL, jwt, expected_audience,
on_verification_success, (void*)expected_user_data);
grpc_jwt_verifier_destroy(verifier);
- grpc_exec_ctx_finish();
+
gpr_free(jwt);
grpc_httpcli_set_override(NULL, NULL);
}
@@ -451,7 +446,7 @@ static void test_jwt_verifier_url_issuer_success(void) {
grpc_jwt_verifier_verify(verifier, NULL, jwt, expected_audience,
on_verification_success, (void*)expected_user_data);
grpc_jwt_verifier_destroy(verifier);
- grpc_exec_ctx_finish();
+
gpr_free(jwt);
grpc_httpcli_set_override(NULL, NULL);
}
@@ -491,7 +486,7 @@ static void test_jwt_verifier_url_issuer_bad_config(void) {
on_verification_key_retrieval_error,
(void*)expected_user_data);
grpc_jwt_verifier_destroy(verifier);
- grpc_exec_ctx_finish();
+
gpr_free(jwt);
grpc_httpcli_set_override(NULL, NULL);
}
@@ -514,7 +509,7 @@ static void test_jwt_verifier_bad_json_key(void) {
on_verification_key_retrieval_error,
(void*)expected_user_data);
grpc_jwt_verifier_destroy(verifier);
- grpc_exec_ctx_finish();
+
gpr_free(jwt);
grpc_httpcli_set_override(NULL, NULL);
}
@@ -528,7 +523,6 @@ static void corrupt_jwt_sig(char* jwt) {
{
ExecCtx _local_exec_ctx;
sig = grpc_base64_decode(last_dot + 1, 1);
- grpc_exec_ctx_finish();
}
GPR_ASSERT(!GRPC_SLICE_IS_EMPTY(sig));
sig_bytes = GRPC_SLICE_START_PTR(sig);
@@ -568,7 +562,7 @@ static void test_jwt_verifier_bad_signature(void) {
(void*)expected_user_data);
gpr_free(jwt);
grpc_jwt_verifier_destroy(verifier);
- grpc_exec_ctx_finish();
+
grpc_httpcli_set_override(NULL, NULL);
}
@@ -597,7 +591,7 @@ static void test_jwt_verifier_bad_format(void) {
on_verification_bad_format,
(void*)expected_user_data);
grpc_jwt_verifier_destroy(verifier);
- grpc_exec_ctx_finish();
+
grpc_httpcli_set_override(NULL, NULL);
}
diff --git a/test/core/security/oauth2_utils.cc b/test/core/security/oauth2_utils.cc
index 6104c7e9dd..f4a52aaba0 100644
--- a/test/core/security/oauth2_utils.cc
+++ b/test/core/security/oauth2_utils.cc
@@ -92,7 +92,7 @@ char* grpc_test_fetch_oauth2_token_with_credentials(
on_oauth2_response(&request, error);
GRPC_ERROR_UNREF(error);
}
- grpc_exec_ctx_flush();
+ ExecCtx::Get()->Flush();
gpr_mu_lock(request.mu);
while (!request.is_done) {
@@ -108,7 +108,7 @@ char* grpc_test_fetch_oauth2_token_with_credentials(
grpc_pollset_shutdown(grpc_polling_entity_pollset(&request.pops),
&do_nothing_closure);
- grpc_exec_ctx_finish();
+
gpr_free(grpc_polling_entity_pollset(&request.pops));
return request.token;
}
diff --git a/test/core/security/print_google_default_creds_token.cc b/test/core/security/print_google_default_creds_token.cc
index 6ea51658e1..6153e8a9cb 100644
--- a/test/core/security/print_google_default_creds_token.cc
+++ b/test/core/security/print_google_default_creds_token.cc
@@ -111,13 +111,11 @@ int main(int argc, char** argv) {
GRPC_MILLIS_INF_FUTURE)))
sync.is_done = true;
gpr_mu_unlock(sync.mu);
- grpc_exec_ctx_flush();
+ ExecCtx::Get()->Flush();
gpr_mu_lock(sync.mu);
}
gpr_mu_unlock(sync.mu);
- grpc_exec_ctx_finish();
-
grpc_channel_credentials_release(creds);
gpr_free(grpc_polling_entity_pollset(&sync.pops));
diff --git a/test/core/security/secure_endpoint_test.cc b/test/core/security/secure_endpoint_test.cc
index a72329d504..a49bf1a0b4 100644
--- a/test/core/security/secure_endpoint_test.cc
+++ b/test/core/security/secure_endpoint_test.cc
@@ -115,7 +115,7 @@ static grpc_endpoint_test_fixture secure_endpoint_create_fixture_tcp_socketpair(
f.server_ep = grpc_secure_endpoint_create(fake_write_protector,
fake_write_zero_copy_protector,
tcp.server, NULL, 0);
- grpc_exec_ctx_finish();
+
return f;
}
@@ -178,7 +178,7 @@ static void test_leftover(grpc_endpoint_test_config config, size_t slice_size) {
grpc_slice_buffer_init(&incoming);
GRPC_CLOSURE_INIT(&done_closure, inc_call_ctr, &n, grpc_schedule_on_exec_ctx);
grpc_endpoint_read(f.client_ep, &incoming, &done_closure);
- grpc_exec_ctx_finish();
+
GPR_ASSERT(n == 1);
GPR_ASSERT(incoming.count == 1);
GPR_ASSERT(grpc_slice_eq(s, incoming.slices[0]));
@@ -189,7 +189,7 @@ static void test_leftover(grpc_endpoint_test_config config, size_t slice_size) {
f.server_ep, GRPC_ERROR_CREATE_FROM_STATIC_STRING("test_leftover end"));
grpc_endpoint_destroy(f.client_ep);
grpc_endpoint_destroy(f.server_ep);
- grpc_exec_ctx_finish();
+
grpc_slice_unref_internal(s);
grpc_slice_buffer_destroy_internal(&incoming);
@@ -215,7 +215,7 @@ int main(int argc, char** argv) {
GRPC_CLOSURE_INIT(&destroyed, destroy_pollset, g_pollset,
grpc_schedule_on_exec_ctx);
grpc_pollset_shutdown(g_pollset, &destroyed);
- grpc_exec_ctx_finish();
+
grpc_shutdown();
gpr_free(g_pollset);
diff --git a/test/core/security/ssl_server_fuzzer.cc b/test/core/security/ssl_server_fuzzer.cc
index 3ee7738ea8..84a42546c6 100644
--- a/test/core/security/ssl_server_fuzzer.cc
+++ b/test/core/security/ssl_server_fuzzer.cc
@@ -83,7 +83,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
grpc_security_status status =
grpc_server_credentials_create_security_connector(creds, &sc);
GPR_ASSERT(status == GRPC_SECURITY_OK);
- grpc_millis deadline = GPR_MS_PER_SEC + grpc_exec_ctx_now();
+ grpc_millis deadline = GPR_MS_PER_SEC + ExecCtx::Get()->Now();
struct handshake_state state;
state.done_callback_called = false;
@@ -92,7 +92,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
grpc_handshake_manager_do_handshake(
handshake_mgr, mock_endpoint, NULL /* channel_args */, deadline,
NULL /* acceptor */, on_handshake_done, &state);
- grpc_exec_ctx_flush();
+ ExecCtx::Get()->Flush();
// If the given string happens to be part of the correct client hello, the
// server will wait for more data. Explicitly fail the server by shutting down
@@ -100,7 +100,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
if (!state.done_callback_called) {
grpc_endpoint_shutdown(
mock_endpoint, GRPC_ERROR_CREATE_FROM_STATIC_STRING("Explicit close"));
- grpc_exec_ctx_flush();
+ ExecCtx::Get()->Flush();
}
GPR_ASSERT(state.done_callback_called);
@@ -111,7 +111,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
grpc_slice_unref(cert_slice);
grpc_slice_unref(key_slice);
grpc_slice_unref(ca_slice);
- grpc_exec_ctx_flush();
+ ExecCtx::Get()->Flush();
grpc_shutdown();
if (leak_check) {
diff --git a/test/core/security/verify_jwt.cc b/test/core/security/verify_jwt.cc
index fce1e9d8de..f3e8966625 100644
--- a/test/core/security/verify_jwt.cc
+++ b/test/core/security/verify_jwt.cc
@@ -106,7 +106,7 @@ int main(int argc, char** argv) {
grpc_pollset_work(sync.pollset, &worker, GRPC_MILLIS_INF_FUTURE)))
sync.is_done = true;
gpr_mu_unlock(sync.mu);
- grpc_exec_ctx_flush();
+ ExecCtx::Get()->Flush();
gpr_mu_lock(sync.mu);
}
gpr_mu_unlock(sync.mu);
@@ -114,7 +114,7 @@ int main(int argc, char** argv) {
gpr_free(sync.pollset);
grpc_jwt_verifier_destroy(verifier);
- grpc_exec_ctx_finish();
+
gpr_cmdline_destroy(cl);
grpc_shutdown();
return !sync.success;
diff --git a/test/core/slice/b64_test.cc b/test/core/slice/b64_test.cc
index 3f1de9bc12..5ed9910740 100644
--- a/test/core/slice/b64_test.cc
+++ b/test/core/slice/b64_test.cc
@@ -51,7 +51,7 @@ static void test_simple_encode_decode_b64(int url_safe, int multiline) {
GRPC_SLICE_LENGTH(hello_slice)) == 0);
grpc_slice_unref_internal(hello_slice);
- grpc_exec_ctx_finish();
+
gpr_free(hello_b64);
}
@@ -72,7 +72,6 @@ static void test_full_range_encode_decode_b64(int url_safe, int multiline) {
sizeof(orig) - i));
grpc_slice_unref_internal(orig_decoded);
gpr_free(b64);
- grpc_exec_ctx_finish();
}
}
@@ -128,7 +127,6 @@ static void test_url_safe_unsafe_mismatch_failure(void) {
GPR_ASSERT(GRPC_SLICE_IS_EMPTY(orig_decoded));
gpr_free(b64);
grpc_slice_unref_internal(orig_decoded);
- grpc_exec_ctx_finish();
}
static void test_rfc4648_test_vectors(void) {
@@ -199,7 +197,6 @@ static void test_unpadded_decode(void) {
decoded = grpc_base64_decode("", 0);
GPR_ASSERT(GRPC_SLICE_IS_EMPTY(decoded));
- grpc_exec_ctx_finish();
}
int main(int argc, char** argv) {
diff --git a/test/core/slice/slice_hash_table_test.cc b/test/core/slice/slice_hash_table_test.cc
index b5b9c1bb73..89fc33a7bf 100644
--- a/test/core/slice/slice_hash_table_test.cc
+++ b/test/core/slice/slice_hash_table_test.cc
@@ -121,7 +121,6 @@ static void test_slice_hash_table() {
// Clean up.
ExecCtx _local_exec_ctx;
grpc_slice_hash_table_unref(table);
- grpc_exec_ctx_finish();
}
static int value_cmp_fn(void* a, void* b) {
@@ -150,7 +149,6 @@ static void test_slice_hash_table_eq() {
ExecCtx _local_exec_ctx;
grpc_slice_hash_table_unref(table_a);
grpc_slice_hash_table_unref(table_b);
- grpc_exec_ctx_finish();
}
static void test_slice_hash_table_not_eq() {
@@ -229,7 +227,6 @@ static void test_slice_hash_table_not_eq() {
grpc_slice_hash_table_unref(table_f);
grpc_slice_hash_table_unref(table_g);
grpc_slice_hash_table_unref(table_h);
- grpc_exec_ctx_finish();
}
int main(int argc, char** argv) {
diff --git a/test/core/surface/byte_buffer_reader_test.cc b/test/core/surface/byte_buffer_reader_test.cc
index 0ac4018a9e..1f3a83efe6 100644
--- a/test/core/surface/byte_buffer_reader_test.cc
+++ b/test/core/surface/byte_buffer_reader_test.cc
@@ -134,7 +134,6 @@ static void read_compressed_slice(grpc_compression_algorithm algorithm,
{
ExecCtx _local_exec_ctx;
GPR_ASSERT(grpc_msg_compress(algorithm, &sliceb_in, &sliceb_out));
- grpc_exec_ctx_finish();
}
buffer = grpc_raw_compressed_byte_buffer_create(sliceb_out.slices,
diff --git a/test/core/surface/channel_create_test.cc b/test/core/surface/channel_create_test.cc
index 516a55275a..ece06e4968 100644
--- a/test/core/surface/channel_create_test.cc
+++ b/test/core/surface/channel_create_test.cc
@@ -39,7 +39,6 @@ void test_unknown_scheme_target(void) {
grpc_channel_element* elem =
grpc_channel_stack_element(grpc_channel_get_channel_stack(chan), 0);
GPR_ASSERT(0 == strcmp(elem->filter->name, "lame-client"));
- grpc_exec_ctx_finish();
grpc_channel_destroy(chan);
}
diff --git a/test/core/surface/completion_queue_test.cc b/test/core/surface/completion_queue_test.cc
index f014738f4c..39aedeba02 100644
--- a/test/core/surface/completion_queue_test.cc
+++ b/test/core/surface/completion_queue_test.cc
@@ -151,7 +151,6 @@ static void test_cq_end_op(void) {
GPR_ASSERT(ev.success);
shutdown_and_destroy(cc);
- grpc_exec_ctx_finish();
}
}
@@ -193,7 +192,6 @@ static void test_cq_tls_cache_full(void) {
GPR_ASSERT(ev.type == GRPC_QUEUE_TIMEOUT);
shutdown_and_destroy(cc);
- grpc_exec_ctx_finish();
}
}
@@ -221,7 +219,6 @@ static void test_cq_tls_cache_empty(void) {
GPR_ASSERT(
grpc_completion_queue_thread_local_cache_flush(cc, &res_tag, &ok) == 0);
shutdown_and_destroy(cc);
- grpc_exec_ctx_finish();
}
}
@@ -322,7 +319,6 @@ static void test_pluck(void) {
}
shutdown_and_destroy(cc);
- grpc_exec_ctx_finish();
}
}
diff --git a/test/core/surface/completion_queue_threading_test.cc b/test/core/surface/completion_queue_threading_test.cc
index 43e90029bc..6625e7e09f 100644
--- a/test/core/surface/completion_queue_threading_test.cc
+++ b/test/core/surface/completion_queue_threading_test.cc
@@ -116,7 +116,6 @@ static void test_too_many_plucks(void) {
}
shutdown_and_destroy(cc);
- grpc_exec_ctx_finish();
}
#define TEST_THREAD_EVENTS 10000
@@ -165,12 +164,10 @@ static void producer_thread(void* arg) {
static_cast<grpc_cq_completion*>(
gpr_malloc(sizeof(grpc_cq_completion))));
opt->events_triggered++;
- grpc_exec_ctx_finish();
}
gpr_log(GPR_INFO, "producer %d phase 2 done", opt->id);
gpr_event_set(&opt->on_finished, (void*)(intptr_t)1);
- grpc_exec_ctx_finish();
}
static void consumer_thread(void* arg) {
diff --git a/test/core/surface/concurrent_connectivity_test.cc b/test/core/surface/concurrent_connectivity_test.cc
index 62fb58dcbc..b3999b481f 100644
--- a/test/core/surface/concurrent_connectivity_test.cc
+++ b/test/core/surface/concurrent_connectivity_test.cc
@@ -134,7 +134,7 @@ void bad_server_thread(void* vargs) {
gpr_mu_lock(args->mu);
while (gpr_atm_acq_load(&args->stop) == 0) {
- grpc_millis deadline = grpc_exec_ctx_now() + 100;
+ grpc_millis deadline = ExecCtx::Get()->Now() + 100;
grpc_pollset_worker* worker = NULL;
if (!GRPC_LOG_IF_ERROR(
@@ -143,15 +143,13 @@ void bad_server_thread(void* vargs) {
gpr_atm_rel_store(&args->stop, 1);
}
gpr_mu_unlock(args->mu);
- grpc_exec_ctx_finish();
+
gpr_mu_lock(args->mu);
}
gpr_mu_unlock(args->mu);
grpc_tcp_server_unref(s);
- grpc_exec_ctx_finish();
-
gpr_free(args->addr);
}
@@ -228,7 +226,6 @@ int run_concurrent_connectivity_test() {
grpc_pollset_shutdown(args.pollset,
GRPC_CLOSURE_CREATE(done_pollset_shutdown, args.pollset,
grpc_schedule_on_exec_ctx));
- grpc_exec_ctx_finish();
grpc_shutdown();
return 0;
diff --git a/test/core/surface/lame_client_test.cc b/test/core/surface/lame_client_test.cc
index 7104d2e30a..dd14a03577 100644
--- a/test/core/surface/lame_client_test.cc
+++ b/test/core/surface/lame_client_test.cc
@@ -54,13 +54,11 @@ void test_transport_op(grpc_channel* channel) {
op->connectivity_state = &state;
elem = grpc_channel_stack_element(grpc_channel_get_channel_stack(channel), 0);
elem->filter->start_transport_op(elem, op);
- grpc_exec_ctx_finish();
GRPC_CLOSURE_INIT(&transport_op_cb, do_nothing, NULL,
grpc_schedule_on_exec_ctx);
op = grpc_make_transport_op(&transport_op_cb);
elem->filter->start_transport_op(elem, op);
- grpc_exec_ctx_finish();
}
int main(int argc, char** argv) {
diff --git a/test/core/surface/num_external_connectivity_watchers_test.cc b/test/core/surface/num_external_connectivity_watchers_test.cc
index e7cde7e39b..bf51dac6dd 100644
--- a/test/core/surface/num_external_connectivity_watchers_test.cc
+++ b/test/core/surface/num_external_connectivity_watchers_test.cc
@@ -180,7 +180,6 @@ static grpc_channel* secure_test_create_channel(const char* addr) {
{
ExecCtx _local_exec_ctx;
grpc_channel_args_destroy(new_client_args);
- grpc_exec_ctx_finish();
}
grpc_channel_credentials_release(ssl_creds);
return channel;
diff --git a/test/core/surface/secure_channel_create_test.cc b/test/core/surface/secure_channel_create_test.cc
index 9a4ac1f0bd..dd9f907652 100644
--- a/test/core/surface/secure_channel_create_test.cc
+++ b/test/core/surface/secure_channel_create_test.cc
@@ -40,7 +40,6 @@ void test_unknown_scheme_target(void) {
ExecCtx _local_exec_ctx;
GRPC_CHANNEL_INTERNAL_UNREF(chan, "test");
grpc_channel_credentials_unref(creds);
- grpc_exec_ctx_finish();
}
void test_security_connector_already_in_arg(void) {
@@ -57,7 +56,6 @@ void test_security_connector_already_in_arg(void) {
GPR_ASSERT(0 == strcmp(elem->filter->name, "lame-client"));
ExecCtx _local_exec_ctx;
GRPC_CHANNEL_INTERNAL_UNREF(chan, "test");
- grpc_exec_ctx_finish();
}
void test_null_creds(void) {
@@ -67,7 +65,6 @@ void test_null_creds(void) {
GPR_ASSERT(0 == strcmp(elem->filter->name, "lame-client"));
ExecCtx _local_exec_ctx;
GRPC_CHANNEL_INTERNAL_UNREF(chan, "test");
- grpc_exec_ctx_finish();
}
int main(int argc, char** argv) {
diff --git a/test/core/surface/sequential_connectivity_test.cc b/test/core/surface/sequential_connectivity_test.cc
index f88124e4ae..aae418cedb 100644
--- a/test/core/surface/sequential_connectivity_test.cc
+++ b/test/core/surface/sequential_connectivity_test.cc
@@ -158,7 +158,6 @@ static grpc_channel* secure_test_create_channel(const char* addr) {
{
ExecCtx _local_exec_ctx;
grpc_channel_args_destroy(new_client_args);
- grpc_exec_ctx_finish();
}
grpc_channel_credentials_release(ssl_creds);
return channel;
diff --git a/test/core/transport/bdp_estimator_test.cc b/test/core/transport/bdp_estimator_test.cc
index ca29b82616..4d41ece875 100644
--- a/test/core/transport/bdp_estimator_test.cc
+++ b/test/core/transport/bdp_estimator_test.cc
@@ -66,9 +66,8 @@ void AddSamples(BdpEstimator* estimator, int64_t* samples, size_t n) {
}
gpr_sleep_until(gpr_time_add(gpr_now(GPR_CLOCK_REALTIME),
gpr_time_from_millis(1, GPR_TIMESPAN)));
- grpc_exec_ctx_invalidate_now();
+ ExecCtx::Get()->InvalidateNow();
estimator->CompletePing();
- grpc_exec_ctx_finish();
}
void AddSample(BdpEstimator* estimator, int64_t sample) {
diff --git a/test/core/transport/byte_stream_test.cc b/test/core/transport/byte_stream_test.cc
index af6abaeeed..12a933f332 100644
--- a/test/core/transport/byte_stream_test.cc
+++ b/test/core/transport/byte_stream_test.cc
@@ -66,7 +66,6 @@ static void test_slice_buffer_stream_basic(void) {
// Clean up.
grpc_byte_stream_destroy(&stream.base);
grpc_slice_buffer_destroy_internal(&buffer);
- grpc_exec_ctx_finish();
}
static void test_slice_buffer_stream_shutdown(void) {
@@ -109,7 +108,6 @@ static void test_slice_buffer_stream_shutdown(void) {
// Clean up.
grpc_byte_stream_destroy(&stream.base);
grpc_slice_buffer_destroy_internal(&buffer);
- grpc_exec_ctx_finish();
}
//
@@ -153,7 +151,6 @@ static void test_caching_byte_stream_basic(void) {
grpc_byte_stream_destroy(&stream.base);
grpc_byte_stream_cache_destroy(&cache);
grpc_slice_buffer_destroy_internal(&buffer);
- grpc_exec_ctx_finish();
}
static void test_caching_byte_stream_reset(void) {
@@ -200,7 +197,6 @@ static void test_caching_byte_stream_reset(void) {
grpc_byte_stream_destroy(&stream.base);
grpc_byte_stream_cache_destroy(&cache);
grpc_slice_buffer_destroy_internal(&buffer);
- grpc_exec_ctx_finish();
}
static void test_caching_byte_stream_shared_cache(void) {
@@ -254,7 +250,6 @@ static void test_caching_byte_stream_shared_cache(void) {
grpc_byte_stream_destroy(&stream2.base);
grpc_byte_stream_cache_destroy(&cache);
grpc_slice_buffer_destroy_internal(&buffer);
- grpc_exec_ctx_finish();
}
int main(int argc, char** argv) {
diff --git a/test/core/transport/chttp2/bin_decoder_test.cc b/test/core/transport/chttp2/bin_decoder_test.cc
index 663ccf189b..3d463c40a5 100644
--- a/test/core/transport/chttp2/bin_decoder_test.cc
+++ b/test/core/transport/chttp2/bin_decoder_test.cc
@@ -129,7 +129,5 @@ int main(int argc, char** argv) {
EXPECT_SLICE_EQ("", base64_decode_with_length("Zm:v", 3));
EXPECT_SLICE_EQ("", base64_decode_with_length("Zm=v", 3));
- grpc_exec_ctx_finish();
-
return all_ok ? 0 : 1;
}
diff --git a/test/core/transport/chttp2/hpack_encoder_test.cc b/test/core/transport/chttp2/hpack_encoder_test.cc
index e1bfcc5b37..fe4538339e 100644
--- a/test/core/transport/chttp2/hpack_encoder_test.cc
+++ b/test/core/transport/chttp2/hpack_encoder_test.cc
@@ -261,7 +261,6 @@ static void run_test(void (*test)(), const char* name) {
grpc_chttp2_hpack_compressor_init(&g_compressor);
test();
grpc_chttp2_hpack_compressor_destroy(&g_compressor);
- grpc_exec_ctx_finish();
}
int main(int argc, char** argv) {
diff --git a/test/core/transport/chttp2/hpack_parser_fuzzer_test.cc b/test/core/transport/chttp2/hpack_parser_fuzzer_test.cc
index d2199ca706..feb27fc0ff 100644
--- a/test/core/transport/chttp2/hpack_parser_fuzzer_test.cc
+++ b/test/core/transport/chttp2/hpack_parser_fuzzer_test.cc
@@ -43,7 +43,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
GRPC_ERROR_UNREF(grpc_chttp2_hpack_parser_parse(
&parser, grpc_slice_from_static_buffer(data, size)));
grpc_chttp2_hpack_parser_destroy(&parser);
- grpc_exec_ctx_finish();
+
grpc_shutdown();
return 0;
}
diff --git a/test/core/transport/chttp2/hpack_parser_test.cc b/test/core/transport/chttp2/hpack_parser_test.cc
index 0a3cbf84ad..69a13108f9 100644
--- a/test/core/transport/chttp2/hpack_parser_test.cc
+++ b/test/core/transport/chttp2/hpack_parser_test.cc
@@ -65,7 +65,6 @@ static void test_vector(grpc_chttp2_hpack_parser* parser,
ExecCtx _local_exec_ctx;
GPR_ASSERT(grpc_chttp2_hpack_parser_parse(parser, slices[i]) ==
GRPC_ERROR_NONE);
- grpc_exec_ctx_finish();
}
for (i = 0; i < nslices; i++) {
@@ -204,8 +203,6 @@ static void test_vectors(grpc_slice_split_mode mode) {
"set-cookie",
"foo=ASDJKHQKBZXOQWEOPIUAXQWEOIU; max-age=3600; version=1", NULL);
grpc_chttp2_hpack_parser_destroy(&parser);
-
- grpc_exec_ctx_finish();
}
int main(int argc, char** argv) {
diff --git a/test/core/transport/chttp2/hpack_table_test.cc b/test/core/transport/chttp2/hpack_table_test.cc
index 68682f1991..fd5604d857 100644
--- a/test/core/transport/chttp2/hpack_table_test.cc
+++ b/test/core/transport/chttp2/hpack_table_test.cc
@@ -113,7 +113,6 @@ static void test_static_lookup(void) {
assert_index(&tbl, 61, "www-authenticate", "");
grpc_chttp2_hptbl_destroy(&tbl);
- grpc_exec_ctx_finish();
}
static void test_many_additions(void) {
@@ -148,7 +147,6 @@ static void test_many_additions(void) {
}
grpc_chttp2_hptbl_destroy(&tbl);
- grpc_exec_ctx_finish();
}
static grpc_chttp2_hptbl_find_result find_simple(grpc_chttp2_hptbl* tbl,
@@ -159,7 +157,7 @@ static grpc_chttp2_hptbl_find_result find_simple(grpc_chttp2_hptbl* tbl,
grpc_slice_from_copied_string(key), grpc_slice_from_copied_string(value));
grpc_chttp2_hptbl_find_result r = grpc_chttp2_hptbl_find(tbl, md);
GRPC_MDELEM_UNREF(md);
- grpc_exec_ctx_finish();
+
return r;
}
@@ -266,7 +264,6 @@ static void test_find(void) {
GPR_ASSERT(r.has_value == 0);
grpc_chttp2_hptbl_destroy(&tbl);
- grpc_exec_ctx_finish();
}
int main(int argc, char** argv) {
diff --git a/test/core/transport/connectivity_state_test.cc b/test/core/transport/connectivity_state_test.cc
index 92bf1ba903..8ddd8bb2df 100644
--- a/test/core/transport/connectivity_state_test.cc
+++ b/test/core/transport/connectivity_state_test.cc
@@ -66,7 +66,6 @@ static void test_check(void) {
GPR_ASSERT(grpc_connectivity_state_check(&tracker) == GRPC_CHANNEL_IDLE);
GPR_ASSERT(error == GRPC_ERROR_NONE);
grpc_connectivity_state_destroy(&tracker);
- grpc_exec_ctx_finish();
}
static void test_subscribe_then_unsubscribe(void) {
@@ -80,16 +79,15 @@ static void test_subscribe_then_unsubscribe(void) {
grpc_connectivity_state_init(&tracker, GRPC_CHANNEL_IDLE, "xxx");
GPR_ASSERT(grpc_connectivity_state_notify_on_state_change(&tracker, &state,
closure));
- grpc_exec_ctx_flush();
+ ExecCtx::Get()->Flush();
GPR_ASSERT(state == GRPC_CHANNEL_IDLE);
GPR_ASSERT(g_counter == 0);
grpc_connectivity_state_notify_on_state_change(&tracker, NULL, closure);
- grpc_exec_ctx_flush();
+ ExecCtx::Get()->Flush();
GPR_ASSERT(state == GRPC_CHANNEL_IDLE);
GPR_ASSERT(g_counter == 1);
grpc_connectivity_state_destroy(&tracker);
- grpc_exec_ctx_finish();
}
static void test_subscribe_then_destroy(void) {
@@ -103,11 +101,11 @@ static void test_subscribe_then_destroy(void) {
grpc_connectivity_state_init(&tracker, GRPC_CHANNEL_IDLE, "xxx");
GPR_ASSERT(grpc_connectivity_state_notify_on_state_change(&tracker, &state,
closure));
- grpc_exec_ctx_flush();
+ ExecCtx::Get()->Flush();
GPR_ASSERT(state == GRPC_CHANNEL_IDLE);
GPR_ASSERT(g_counter == 0);
grpc_connectivity_state_destroy(&tracker);
- grpc_exec_ctx_finish();
+
GPR_ASSERT(state == GRPC_CHANNEL_SHUTDOWN);
GPR_ASSERT(g_counter == 1);
}
@@ -123,11 +121,11 @@ static void test_subscribe_with_failure_then_destroy(void) {
grpc_connectivity_state_init(&tracker, GRPC_CHANNEL_SHUTDOWN, "xxx");
GPR_ASSERT(0 == grpc_connectivity_state_notify_on_state_change(
&tracker, &state, closure));
- grpc_exec_ctx_flush();
+ ExecCtx::Get()->Flush();
GPR_ASSERT(state == GRPC_CHANNEL_SHUTDOWN);
GPR_ASSERT(g_counter == 0);
grpc_connectivity_state_destroy(&tracker);
- grpc_exec_ctx_finish();
+
GPR_ASSERT(state == GRPC_CHANNEL_SHUTDOWN);
GPR_ASSERT(g_counter == 1);
}
diff --git a/test/core/transport/metadata_test.cc b/test/core/transport/metadata_test.cc
index 4bc5672958..3d7034e4ce 100644
--- a/test/core/transport/metadata_test.cc
+++ b/test/core/transport/metadata_test.cc
@@ -80,7 +80,7 @@ static void test_create_metadata(bool intern_keys, bool intern_values) {
GRPC_MDELEM_UNREF(m1);
GRPC_MDELEM_UNREF(m2);
GRPC_MDELEM_UNREF(m3);
- grpc_exec_ctx_finish();
+
grpc_shutdown();
}
@@ -103,7 +103,7 @@ static void test_create_many_ephemeral_metadata(bool intern_keys,
maybe_intern(grpc_slice_from_static_string("a"), intern_keys),
maybe_intern(grpc_slice_from_copied_string(buffer), intern_values)));
}
- grpc_exec_ctx_finish();
+
grpc_shutdown();
}
@@ -138,7 +138,7 @@ static void test_create_many_persistant_metadata(void) {
for (i = 0; i < MANY; i++) {
GRPC_MDELEM_UNREF(created[i]);
}
- grpc_exec_ctx_finish();
+
grpc_shutdown();
gpr_free(created);
@@ -169,7 +169,7 @@ static void test_spin_creating_the_same_thing(bool intern_keys,
GPR_ASSERT(a.payload == b.payload);
GPR_ASSERT(a.payload == c.payload);
}
- grpc_exec_ctx_finish();
+
grpc_shutdown();
}
@@ -209,7 +209,7 @@ static void test_identity_laws(bool intern_keys, bool intern_values) {
GRPC_MDELEM_UNREF(a);
GRPC_MDELEM_UNREF(b);
GRPC_MDELEM_UNREF(c);
- grpc_exec_ctx_finish();
+
grpc_shutdown();
}
@@ -259,7 +259,6 @@ static void test_things_stick_around(void) {
}
}
- grpc_exec_ctx_finish();
grpc_shutdown();
gpr_free(strs);
gpr_free(shuf);
@@ -284,7 +283,7 @@ static void test_user_data_works(void) {
grpc_mdelem_set_user_data(md, gpr_free, ud2);
GPR_ASSERT(grpc_mdelem_get_user_data(md, gpr_free) == ud1);
GRPC_MDELEM_UNREF(md);
- grpc_exec_ctx_finish();
+
grpc_shutdown();
}
@@ -340,7 +339,6 @@ static void test_mdelem_sizes_in_hpack(bool intern_key, bool intern_value) {
intern_value);
}
- grpc_exec_ctx_finish();
grpc_shutdown();
}
@@ -366,7 +364,6 @@ static void test_copied_static_metadata(bool dup_key, bool dup_value) {
GRPC_MDELEM_UNREF(q);
}
- grpc_exec_ctx_finish();
grpc_shutdown();
}
diff --git a/test/core/transport/status_conversion_test.cc b/test/core/transport/status_conversion_test.cc
index 44e961310a..16ecd076a3 100644
--- a/test/core/transport/status_conversion_test.cc
+++ b/test/core/transport/status_conversion_test.cc
@@ -26,7 +26,7 @@
do { \
ExecCtx _local_exec_ctx; \
GPR_ASSERT(grpc_http2_error_to_grpc_status(a, deadline) == (b)); \
- grpc_exec_ctx_finish(); \
+ \
} while (0)
#define GRPC_STATUS_TO_HTTP2_STATUS(a, b) \
GPR_ASSERT(grpc_status_to_http2_status(a) == (b))
diff --git a/test/core/util/port_server_client.cc b/test/core/util/port_server_client.cc
index 2cabd560ee..4e68ee3744 100644
--- a/test/core/util/port_server_client.cc
+++ b/test/core/util/port_server_client.cc
@@ -85,19 +85,19 @@ void grpc_free_port_using_server(int port) {
grpc_resource_quota* resource_quota =
grpc_resource_quota_create("port_server_client/free");
grpc_httpcli_get(&context, &pr.pops, resource_quota, &req,
- grpc_exec_ctx_now() + 30 * GPR_MS_PER_SEC,
+ ExecCtx::Get()->Now() + 30 * GPR_MS_PER_SEC,
GRPC_CLOSURE_CREATE(freed_port_from_server, &pr,
grpc_schedule_on_exec_ctx),
&rsp);
grpc_resource_quota_unref_internal(resource_quota);
- grpc_exec_ctx_flush();
+ ExecCtx::Get()->Flush();
gpr_mu_lock(pr.mu);
while (!pr.done) {
grpc_pollset_worker* worker = NULL;
if (!GRPC_LOG_IF_ERROR(
"pollset_work",
grpc_pollset_work(grpc_polling_entity_pollset(&pr.pops), &worker,
- grpc_exec_ctx_now() + GPR_MS_PER_SEC))) {
+ ExecCtx::Get()->Now() + GPR_MS_PER_SEC))) {
pr.done = 1;
}
}
@@ -106,7 +106,7 @@ void grpc_free_port_using_server(int port) {
grpc_httpcli_context_destroy(&context);
grpc_pollset_shutdown(grpc_polling_entity_pollset(&pr.pops),
shutdown_closure);
- grpc_exec_ctx_finish();
+
gpr_free(path);
grpc_http_response_destroy(&rsp);
@@ -167,7 +167,7 @@ static void got_port_from_server(void* arg, grpc_error* error) {
grpc_resource_quota* resource_quota =
grpc_resource_quota_create("port_server_client/pick_retry");
grpc_httpcli_get(pr->ctx, &pr->pops, resource_quota, &req,
- grpc_exec_ctx_now() + 30 * GPR_MS_PER_SEC,
+ ExecCtx::Get()->Now() + 30 * GPR_MS_PER_SEC,
GRPC_CLOSURE_CREATE(got_port_from_server, pr,
grpc_schedule_on_exec_ctx),
&pr->response);
@@ -217,18 +217,18 @@ int grpc_pick_port_using_server(void) {
grpc_resource_quota_create("port_server_client/pick");
grpc_httpcli_get(
&context, &pr.pops, resource_quota, &req,
- grpc_exec_ctx_now() + 30 * GPR_MS_PER_SEC,
+ ExecCtx::Get()->Now() + 30 * GPR_MS_PER_SEC,
GRPC_CLOSURE_CREATE(got_port_from_server, &pr, grpc_schedule_on_exec_ctx),
&pr.response);
grpc_resource_quota_unref_internal(resource_quota);
- grpc_exec_ctx_flush();
+ ExecCtx::Get()->Flush();
gpr_mu_lock(pr.mu);
while (pr.port == -1) {
grpc_pollset_worker* worker = NULL;
if (!GRPC_LOG_IF_ERROR(
"pollset_work",
grpc_pollset_work(grpc_polling_entity_pollset(&pr.pops), &worker,
- grpc_exec_ctx_now() + GPR_MS_PER_SEC))) {
+ ExecCtx::Get()->Now() + GPR_MS_PER_SEC))) {
pr.port = 0;
}
}
@@ -238,7 +238,7 @@ int grpc_pick_port_using_server(void) {
grpc_httpcli_context_destroy(&context);
grpc_pollset_shutdown(grpc_polling_entity_pollset(&pr.pops),
shutdown_closure);
- grpc_exec_ctx_finish();
+
grpc_shutdown();
return pr.port;
diff --git a/test/core/util/test_tcp_server.cc b/test/core/util/test_tcp_server.cc
index 79178a7cbd..7e17ff1f53 100644
--- a/test/core/util/test_tcp_server.cc
+++ b/test/core/util/test_tcp_server.cc
@@ -72,8 +72,6 @@ void test_tcp_server_start(test_tcp_server* server, int port) {
grpc_tcp_server_start(server->tcp_server, &server->pollset, 1,
server->on_connect, server->cb_data);
gpr_log(GPR_INFO, "test tcp server listening on 0.0.0.0:%d", port);
-
- grpc_exec_ctx_finish();
}
void test_tcp_server_poll(test_tcp_server* server, int seconds) {
@@ -85,7 +83,6 @@ void test_tcp_server_poll(test_tcp_server* server, int seconds) {
GRPC_LOG_IF_ERROR("pollset_work",
grpc_pollset_work(server->pollset, &worker, deadline));
gpr_mu_unlock(server->mu);
- grpc_exec_ctx_finish();
}
static void do_nothing(void* arg, grpc_error* error) {}
@@ -109,7 +106,7 @@ void test_tcp_server_destroy(test_tcp_server* server) {
grpc_pollset_shutdown(server->pollset,
GRPC_CLOSURE_CREATE(finish_pollset, server->pollset,
grpc_schedule_on_exec_ctx));
- grpc_exec_ctx_finish();
+
gpr_free(server->pollset);
grpc_shutdown();
}