aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/core
diff options
context:
space:
mode:
authorGravatar Yash Tibrewal <yashkt@google.com>2017-10-13 16:07:13 -0700
committerGravatar Yash Tibrewal <yashkt@google.com>2017-10-18 17:12:19 -0700
commit0ee7574732a06e8cace4e099a678f4bd5dbff679 (patch)
treee43d5de442fdcc3d39cd5af687f319fa39612d3f /test/core
parent6bf5f833efe2cb9e2ecc14358dd9699cd5d05263 (diff)
Removing instances of exec_ctx being passed around in functions in
src/core. exec_ctx is now a thread_local pointer of type ExecCtx instead of grpc_exec_ctx which is initialized whenever ExecCtx is instantiated. ExecCtx also keeps track of the previous exec_ctx so that nesting of exec_ctx is allowed. This means that there is only one exec_ctx being used at any time. Also, grpc_exec_ctx_finish is called in the destructor of the object, and the previous exec_ctx is restored to avoid breaking current functionality. The code still explicitly calls grpc_exec_ctx_finish because removing all such instances causes the code to break.
Diffstat (limited to 'test/core')
-rw-r--r--test/core/backoff/backoff_test.c60
-rw-r--r--test/core/backoff/backoff_test.cc147
-rw-r--r--test/core/bad_client/bad_client.cc (renamed from test/core/bad_client/bad_client.c)51
-rw-r--r--test/core/bad_client/bad_client.h8
-rwxr-xr-xtest/core/bad_client/gen_build_yaml.py2
-rwxr-xr-xtest/core/bad_client/generate_tests.bzl2
-rw-r--r--test/core/channel/channel_args_test.c30
-rw-r--r--test/core/channel/channel_stack_builder_test.c24
-rw-r--r--test/core/channel/channel_stack_test.c45
-rw-r--r--test/core/channel/minimal_stack_is_minimal_test.c17
-rw-r--r--test/core/client_channel/lb_policies_test.c16
-rw-r--r--test/core/client_channel/parse_address_test.c18
-rw-r--r--test/core/client_channel/resolvers/dns_resolver_connectivity_test.c64
-rw-r--r--test/core/client_channel/resolvers/dns_resolver_test.c24
-rw-r--r--test/core/client_channel/resolvers/fake_resolver_test.c54
-rw-r--r--test/core/client_channel/resolvers/sockaddr_resolver_test.c30
-rw-r--r--test/core/client_channel/uri_fuzzer_test.c6
-rw-r--r--test/core/client_channel/uri_parser_test.c30
-rw-r--r--test/core/compression/algorithm_test.c14
-rw-r--r--test/core/compression/message_compress_test.c67
-rw-r--r--test/core/debug/stats_test.cc16
-rw-r--r--test/core/end2end/bad_server_response_test.cc (renamed from test/core/end2end/bad_server_response_test.c)35
-rw-r--r--test/core/end2end/connection_refused_test.c6
-rw-r--r--test/core/end2end/fixtures/h2_census.c12
-rw-r--r--test/core/end2end/fixtures/h2_compress.c20
-rw-r--r--test/core/end2end/fixtures/h2_fd.c8
-rw-r--r--test/core/end2end/fixtures/h2_full+workarounds.c6
-rw-r--r--test/core/end2end/fixtures/h2_load_reporting.c6
-rw-r--r--test/core/end2end/fixtures/h2_oauth2.c8
-rw-r--r--test/core/end2end/fixtures/h2_sockpair+trace.c40
-rw-r--r--test/core/end2end/fixtures/h2_sockpair.c36
-rw-r--r--test/core/end2end/fixtures/h2_sockpair_1byte.c36
-rw-r--r--test/core/end2end/fixtures/h2_ssl.c6
-rw-r--r--test/core/end2end/fixtures/h2_ssl_proxy.c12
-rw-r--r--test/core/end2end/fixtures/http_proxy_fixture.cc (renamed from test/core/end2end/fixtures/http_proxy_fixture.c)183
-rw-r--r--test/core/end2end/fuzzers/api_fuzzer.c86
-rw-r--r--test/core/end2end/fuzzers/client_fuzzer.c17
-rw-r--r--test/core/end2end/fuzzers/server_fuzzer.c17
-rw-r--r--test/core/end2end/goaway_server_test.c28
-rw-r--r--test/core/end2end/h2_ssl_cert_test.cc6
-rw-r--r--test/core/end2end/tests/cancel_after_accept.cc (renamed from test/core/end2end/tests/cancel_after_accept.c)10
-rw-r--r--test/core/end2end/tests/cancel_after_round_trip.cc (renamed from test/core/end2end/tests/cancel_after_round_trip.c)10
-rw-r--r--test/core/end2end/tests/compressed_payload.cc (renamed from test/core/end2end/tests/compressed_payload.c)22
-rw-r--r--test/core/end2end/tests/filter_call_init_fails.cc (renamed from test/core/end2end/tests/filter_call_init_fails.c)19
-rw-r--r--test/core/end2end/tests/filter_causes_close.cc (renamed from test/core/end2end/tests/filter_causes_close.c)24
-rw-r--r--test/core/end2end/tests/filter_latency.cc (renamed from test/core/end2end/tests/filter_latency.c)18
-rw-r--r--test/core/end2end/tests/keepalive_timeout.c2
-rw-r--r--test/core/end2end/tests/load_reporting_hook.cc (renamed from test/core/end2end/tests/load_reporting_hook.c)6
-rw-r--r--test/core/end2end/tests/max_message_length.cc (renamed from test/core/end2end/tests/max_message_length.c)102
-rw-r--r--test/core/end2end/tests/request_with_flags.cc (renamed from test/core/end2end/tests/request_with_flags.c)0
-rw-r--r--test/core/end2end/tests/stream_compression_compressed_payload.cc (renamed from test/core/end2end/tests/stream_compression_compressed_payload.c)22
-rw-r--r--test/core/end2end/tests/stream_compression_payload.cc (renamed from test/core/end2end/tests/stream_compression_payload.c)8
-rw-r--r--test/core/end2end/tests/stream_compression_ping_pong_streaming.cc (renamed from test/core/end2end/tests/stream_compression_ping_pong_streaming.c)8
-rw-r--r--test/core/end2end/tests/workaround_cronet_compression.cc (renamed from test/core/end2end/tests/workaround_cronet_compression.c)22
-rw-r--r--test/core/http/httpcli_test.c44
-rw-r--r--test/core/http/httpscli_test.c44
-rw-r--r--test/core/iomgr/combiner_test.c56
-rw-r--r--test/core/iomgr/endpoint_pair_test.c19
-rw-r--r--test/core/iomgr/endpoint_tests.cc (renamed from test/core/iomgr/endpoint_tests.c)102
-rw-r--r--test/core/iomgr/ev_epollsig_linux_test.c94
-rw-r--r--test/core/iomgr/fd_conservation_posix_test.c10
-rw-r--r--test/core/iomgr/fd_posix_test.c140
-rw-r--r--test/core/iomgr/pollset_set_test.c226
-rw-r--r--test/core/iomgr/resolve_address_posix_test.cc (renamed from test/core/iomgr/resolve_address_posix_test.c)62
-rw-r--r--test/core/iomgr/resolve_address_test.c144
-rw-r--r--test/core/iomgr/resource_quota_test.c372
-rw-r--r--test/core/iomgr/tcp_client_posix_test.c61
-rw-r--r--test/core/iomgr/tcp_client_uv_test.c63
-rw-r--r--test/core/iomgr/tcp_posix_test.c141
-rw-r--r--test/core/iomgr/tcp_server_posix_test.c93
-rw-r--r--test/core/iomgr/tcp_server_uv_test.c95
-rw-r--r--test/core/iomgr/timer_list_test.c60
-rw-r--r--test/core/iomgr/udp_server_test.c78
-rw-r--r--test/core/security/credentials_test.c329
-rw-r--r--test/core/security/json_token_test.c14
-rw-r--r--test/core/security/jwt_verifier_test.c152
-rw-r--r--test/core/security/oauth2_utils.cc (renamed from test/core/security/oauth2_utils.c)30
-rw-r--r--test/core/security/print_google_default_creds_token.c22
-rw-r--r--test/core/security/secure_endpoint_test.c46
-rw-r--r--test/core/security/ssl_server_fuzzer.c33
-rw-r--r--test/core/security/verify_jwt.cc (renamed from test/core/security/verify_jwt.c)23
-rw-r--r--test/core/slice/b64_test.c46
-rw-r--r--test/core/slice/slice_hash_table_test.c40
-rw-r--r--test/core/surface/byte_buffer_reader_test.c7
-rw-r--r--test/core/surface/channel_create_test.c4
-rw-r--r--test/core/surface/completion_queue_test.c25
-rw-r--r--test/core/surface/completion_queue_threading_test.cc (renamed from test/core/surface/completion_queue_threading_test.c)22
-rw-r--r--test/core/surface/concurrent_connectivity_test.c36
-rw-r--r--test/core/surface/lame_client_test.c15
-rw-r--r--test/core/surface/num_external_connectivity_watchers_test.c6
-rw-r--r--test/core/surface/secure_channel_create_test.c20
-rw-r--r--test/core/surface/sequential_connectivity_test.c6
-rw-r--r--test/core/transport/bdp_estimator_test.cc149
-rw-r--r--test/core/transport/byte_stream_test.c115
-rw-r--r--test/core/transport/chttp2/bin_decoder_test.c102
-rw-r--r--test/core/transport/chttp2/bin_decoder_test.cc135
-rw-r--r--test/core/transport/chttp2/hpack_encoder_test.c82
-rw-r--r--test/core/transport/chttp2/hpack_parser_fuzzer_test.c14
-rw-r--r--test/core/transport/chttp2/hpack_parser_test.c42
-rw-r--r--test/core/transport/chttp2/hpack_table_test.c75
-rw-r--r--test/core/transport/connectivity_state_test.c50
-rw-r--r--test/core/transport/metadata_test.c138
-rw-r--r--test/core/transport/status_conversion_test.c9
-rw-r--r--test/core/transport/stream_owned_slice_test.c2
-rw-r--r--test/core/util/mock_endpoint.cc (renamed from test/core/util/mock_endpoint.c)33
-rw-r--r--test/core/util/mock_endpoint.h3
-rw-r--r--test/core/util/passthru_endpoint.cc (renamed from test/core/util/passthru_endpoint.c)40
-rw-r--r--test/core/util/passthru_endpoint.h8
-rw-r--r--test/core/util/port.cc (renamed from test/core/util/port.c)0
-rw-r--r--test/core/util/port_server_client.cc (renamed from test/core/util/port_server_client.c)78
-rw-r--r--test/core/util/port_server_client.h8
-rw-r--r--test/core/util/reconnect_server.c6
-rw-r--r--test/core/util/test_tcp_server.cc (renamed from test/core/util/test_tcp_server.c)41
-rw-r--r--test/core/util/trickle_endpoint.cc (renamed from test/core/util/trickle_endpoint.c)51
-rw-r--r--test/core/util/trickle_endpoint.h3
115 files changed, 2758 insertions, 2772 deletions
diff --git a/test/core/backoff/backoff_test.c b/test/core/backoff/backoff_test.c
index a29cce6cc7..93952f3d10 100644
--- a/test/core/backoff/backoff_test.c
+++ b/test/core/backoff/backoff_test.c
@@ -28,15 +28,15 @@ static void test_constant_backoff(void) {
0.0 /* jitter */, 100 /* min timeout */,
1000 /* max timeout */);
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_millis next = grpc_backoff_begin(&exec_ctx, &backoff);
- GPR_ASSERT(next - grpc_exec_ctx_now(&exec_ctx) == 200);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_millis next = grpc_backoff_begin(&backoff);
+ GPR_ASSERT(next - grpc_exec_ctx_now() == 200);
for (int i = 0; i < 10000; i++) {
- next = grpc_backoff_step(&exec_ctx, &backoff);
- GPR_ASSERT(next - grpc_exec_ctx_now(&exec_ctx) == 200);
+ next = grpc_backoff_step(&backoff);
+ GPR_ASSERT(next - grpc_exec_ctx_now() == 200);
exec_ctx.now = next;
}
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_exec_ctx_finish();
}
static void test_min_connect(void) {
@@ -45,10 +45,10 @@ static void test_min_connect(void) {
0.0 /* jitter */, 200 /* min timeout */,
1000 /* max timeout */);
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_millis next = grpc_backoff_begin(&exec_ctx, &backoff);
- GPR_ASSERT(next - grpc_exec_ctx_now(&exec_ctx) == 200);
- grpc_exec_ctx_finish(&exec_ctx);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_millis next = grpc_backoff_begin(&backoff);
+ GPR_ASSERT(next - grpc_exec_ctx_now() == 200);
+ grpc_exec_ctx_finish();
}
static void test_no_jitter_backoff(void) {
@@ -58,47 +58,47 @@ static void test_no_jitter_backoff(void) {
513 /* max timeout */);
// x_1 = 2
// x_n = 2**i + x_{i-1} ( = 2**(n+1) - 2 )
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
exec_ctx.now = 0;
exec_ctx.now_is_valid = true;
- grpc_millis next = grpc_backoff_begin(&exec_ctx, &backoff);
+ grpc_millis next = grpc_backoff_begin(&backoff);
GPR_ASSERT(next == 2);
exec_ctx.now = next;
- next = grpc_backoff_step(&exec_ctx, &backoff);
+ next = grpc_backoff_step(&backoff);
GPR_ASSERT(next == 6);
exec_ctx.now = next;
- next = grpc_backoff_step(&exec_ctx, &backoff);
+ next = grpc_backoff_step(&backoff);
GPR_ASSERT(next == 14);
exec_ctx.now = next;
- next = grpc_backoff_step(&exec_ctx, &backoff);
+ next = grpc_backoff_step(&backoff);
GPR_ASSERT(next == 30);
exec_ctx.now = next;
- next = grpc_backoff_step(&exec_ctx, &backoff);
+ next = grpc_backoff_step(&backoff);
GPR_ASSERT(next == 62);
exec_ctx.now = next;
- next = grpc_backoff_step(&exec_ctx, &backoff);
+ next = grpc_backoff_step(&backoff);
GPR_ASSERT(next == 126);
exec_ctx.now = next;
- next = grpc_backoff_step(&exec_ctx, &backoff);
+ next = grpc_backoff_step(&backoff);
GPR_ASSERT(next == 254);
exec_ctx.now = next;
- next = grpc_backoff_step(&exec_ctx, &backoff);
+ next = grpc_backoff_step(&backoff);
GPR_ASSERT(next == 510);
exec_ctx.now = next;
- next = grpc_backoff_step(&exec_ctx, &backoff);
+ next = grpc_backoff_step(&backoff);
GPR_ASSERT(next == 1022);
exec_ctx.now = next;
- next = grpc_backoff_step(&exec_ctx, &backoff);
+ next = grpc_backoff_step(&backoff);
// Hit the maximum timeout. From this point onwards, retries will increase
// only by max timeout.
GPR_ASSERT(next == 1535);
exec_ctx.now = next;
- next = grpc_backoff_step(&exec_ctx, &backoff);
+ next = grpc_backoff_step(&backoff);
GPR_ASSERT(next == 2048);
exec_ctx.now = next;
- next = grpc_backoff_step(&exec_ctx, &backoff);
+ next = grpc_backoff_step(&backoff);
GPR_ASSERT(next == 2561);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_exec_ctx_finish();
}
static void test_jitter_backoff(void) {
@@ -111,9 +111,9 @@ static void test_jitter_backoff(void) {
backoff.rng_state = 0; // force consistent PRNG
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_millis next = grpc_backoff_begin(&exec_ctx, &backoff);
- GPR_ASSERT(next - grpc_exec_ctx_now(&exec_ctx) == 500);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_millis next = grpc_backoff_begin(&backoff);
+ GPR_ASSERT(next - grpc_exec_ctx_now() == 500);
int64_t expected_next_lower_bound =
(int64_t)((double)initial_timeout * (1 - jitter));
@@ -121,10 +121,10 @@ static void test_jitter_backoff(void) {
(int64_t)((double)initial_timeout * (1 + jitter));
for (int i = 0; i < 10000; i++) {
- next = grpc_backoff_step(&exec_ctx, &backoff);
+ next = grpc_backoff_step(&backoff);
// next-now must be within (jitter*100)% of the previous timeout.
- const int64_t timeout_millis = next - grpc_exec_ctx_now(&exec_ctx);
+ const int64_t timeout_millis = next - grpc_exec_ctx_now();
GPR_ASSERT(timeout_millis >= expected_next_lower_bound);
GPR_ASSERT(timeout_millis <= expected_next_upper_bound);
@@ -134,7 +134,7 @@ static void test_jitter_backoff(void) {
(int64_t)((double)timeout_millis * (1 + jitter));
exec_ctx.now = next;
}
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_exec_ctx_finish();
}
int main(int argc, char **argv) {
diff --git a/test/core/backoff/backoff_test.cc b/test/core/backoff/backoff_test.cc
new file mode 100644
index 0000000000..ea27f7547f
--- /dev/null
+++ b/test/core/backoff/backoff_test.cc
@@ -0,0 +1,147 @@
+/*
+ *
+ * Copyright 2016 gRPC authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include "src/core/lib/backoff/backoff.h"
+
+#include <grpc/support/log.h>
+
+#include "test/core/util/test_config.h"
+
+static void test_constant_backoff(void) {
+ grpc_backoff backoff;
+ grpc_backoff_init(&backoff, 200 /* initial timeout */, 1.0 /* multiplier */,
+ 0.0 /* jitter */, 100 /* min timeout */,
+ 1000 /* max timeout */);
+
+ grpc_millis next = grpc_backoff_begin(&backoff);
+ GPR_ASSERT(next - grpc_exec_ctx_now() == 200);
+ for (int i = 0; i < 10000; i++) {
+ next = grpc_backoff_step(&backoff);
+ GPR_ASSERT(next - grpc_exec_ctx_now() == 200);
+ exec_ctx.now = next;
+ }
+ grpc_exec_ctx_finish();
+}
+
+static void test_min_connect(void) {
+ grpc_backoff backoff;
+ grpc_backoff_init(&backoff, 100 /* initial timeout */, 1.0 /* multiplier */,
+ 0.0 /* jitter */, 200 /* min timeout */,
+ 1000 /* max timeout */);
+
+ grpc_millis next = grpc_backoff_begin(&backoff);
+ GPR_ASSERT(next - grpc_exec_ctx_now() == 200);
+ grpc_exec_ctx_finish();
+}
+
+static void test_no_jitter_backoff(void) {
+ grpc_backoff backoff;
+ grpc_backoff_init(&backoff, 2 /* initial timeout */, 2.0 /* multiplier */,
+ 0.0 /* jitter */, 1 /* min timeout */,
+ 513 /* max timeout */);
+ // x_1 = 2
+ // x_n = 2**i + x_{i-1} ( = 2**(n+1) - 2 )
+
+ exec_ctx.now = 0;
+ exec_ctx.now_is_valid = true;
+ grpc_millis next = grpc_backoff_begin(&backoff);
+ GPR_ASSERT(next == 2);
+ exec_ctx.now = next;
+ next = grpc_backoff_step(&backoff);
+ GPR_ASSERT(next == 6);
+ exec_ctx.now = next;
+ next = grpc_backoff_step(&backoff);
+ GPR_ASSERT(next == 14);
+ exec_ctx.now = next;
+ next = grpc_backoff_step(&backoff);
+ GPR_ASSERT(next == 30);
+ exec_ctx.now = next;
+ next = grpc_backoff_step(&backoff);
+ GPR_ASSERT(next == 62);
+ exec_ctx.now = next;
+ next = grpc_backoff_step(&backoff);
+ GPR_ASSERT(next == 126);
+ exec_ctx.now = next;
+ next = grpc_backoff_step(&backoff);
+ GPR_ASSERT(next == 254);
+ exec_ctx.now = next;
+ next = grpc_backoff_step(&backoff);
+ GPR_ASSERT(next == 510);
+ exec_ctx.now = next;
+ next = grpc_backoff_step(&backoff);
+ GPR_ASSERT(next == 1022);
+ exec_ctx.now = next;
+ next = grpc_backoff_step(&backoff);
+ // Hit the maximum timeout. From this point onwards, retries will increase
+ // only by max timeout.
+ GPR_ASSERT(next == 1535);
+ exec_ctx.now = next;
+ next = grpc_backoff_step(&backoff);
+ GPR_ASSERT(next == 2048);
+ exec_ctx.now = next;
+ next = grpc_backoff_step(&backoff);
+ GPR_ASSERT(next == 2561);
+ grpc_exec_ctx_finish();
+}
+
+static void test_jitter_backoff(void) {
+ const int64_t initial_timeout = 500;
+ const double jitter = 0.1;
+ grpc_backoff backoff;
+ grpc_backoff_init(&backoff, (grpc_millis)initial_timeout,
+ 1.0 /* multiplier */, jitter, 100 /* min timeout */,
+ 1000 /* max timeout */);
+
+ backoff.rng_state = 0; // force consistent PRNG
+
+ grpc_millis next = grpc_backoff_begin(&backoff);
+ GPR_ASSERT(next - grpc_exec_ctx_now() == 500);
+
+ int64_t expected_next_lower_bound =
+ (int64_t)((double)initial_timeout * (1 - jitter));
+ int64_t expected_next_upper_bound =
+ (int64_t)((double)initial_timeout * (1 + jitter));
+
+ for (int i = 0; i < 10000; i++) {
+ next = grpc_backoff_step(&backoff);
+
+ // next-now must be within (jitter*100)% of the previous timeout.
+ const int64_t timeout_millis = next - grpc_exec_ctx_now();
+ GPR_ASSERT(timeout_millis >= expected_next_lower_bound);
+ GPR_ASSERT(timeout_millis <= expected_next_upper_bound);
+
+ expected_next_lower_bound =
+ (int64_t)((double)timeout_millis * (1 - jitter));
+ expected_next_upper_bound =
+ (int64_t)((double)timeout_millis * (1 + jitter));
+ exec_ctx.now = next;
+ }
+ grpc_exec_ctx_finish();
+}
+
+int main(int argc, char **argv) {
+ grpc_test_init(argc, argv);
+ gpr_time_init();
+
+ test_constant_backoff();
+ test_min_connect();
+ test_no_jitter_backoff();
+ test_jitter_backoff();
+
+ return 0;
+}
diff --git a/test/core/bad_client/bad_client.c b/test/core/bad_client/bad_client.cc
index b7b28a9ac4..99006c2866 100644
--- a/test/core/bad_client/bad_client.c
+++ b/test/core/bad_client/bad_client.cc
@@ -50,20 +50,20 @@ static void thd_func(void *arg) {
gpr_event_set(&a->done_thd, (void *)1);
}
-static void done_write(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) {
+static void done_write(void *arg, grpc_error *error) {
thd_args *a = (thd_args *)arg;
gpr_event_set(&a->done_write, (void *)1);
}
static void server_setup_transport(void *ts, grpc_transport *transport) {
thd_args *a = (thd_args *)ts;
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_server_setup_transport(&exec_ctx, a->server, transport, NULL,
+ ExecCtx _local_exec_ctx;
+ grpc_server_setup_transport(a->server, transport, NULL,
grpc_server_get_channel_args(a->server));
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_exec_ctx_finish();
}
-static void read_done(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) {
+static void read_done(void *arg, grpc_error *error) {
gpr_event *read_done = (gpr_event *)arg;
gpr_event_set(read_done, (void *)1);
}
@@ -81,7 +81,7 @@ void grpc_run_bad_client_test(
grpc_slice_from_copied_buffer(client_payload, client_payload_length);
grpc_slice_buffer outgoing;
grpc_closure done_write_closure;
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ ExecCtx _local_exec_ctx;
grpc_completion_queue *shutdown_cq;
if (client_payload_length < 4 * 1024) {
@@ -115,14 +115,14 @@ void grpc_run_bad_client_test(
GRPC_BAD_CLIENT_REGISTERED_HOST,
GRPC_SRM_PAYLOAD_READ_INITIAL_BYTE_BUFFER, 0);
grpc_server_start(a.server);
- transport = grpc_create_chttp2_transport(&exec_ctx, NULL, sfd.server, 0);
+ transport = grpc_create_chttp2_transport(NULL, sfd.server, 0);
server_setup_transport(&a, transport);
- grpc_chttp2_transport_start_reading(&exec_ctx, transport, NULL);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_chttp2_transport_start_reading(transport, NULL);
+ grpc_exec_ctx_finish();
/* Bind everything into the same pollset */
- grpc_endpoint_add_to_pollset(&exec_ctx, sfd.client, grpc_cq_pollset(a.cq));
- grpc_endpoint_add_to_pollset(&exec_ctx, sfd.server, grpc_cq_pollset(a.cq));
+ grpc_endpoint_add_to_pollset(sfd.client, grpc_cq_pollset(a.cq));
+ grpc_endpoint_add_to_pollset(sfd.server, grpc_cq_pollset(a.cq));
/* Check a ground truth */
GPR_ASSERT(grpc_server_has_open_connections(a.server));
@@ -136,8 +136,8 @@ void grpc_run_bad_client_test(
grpc_schedule_on_exec_ctx);
/* Write data */
- grpc_endpoint_write(&exec_ctx, sfd.client, &outgoing, &done_write_closure);
- grpc_exec_ctx_finish(&exec_ctx);
+ 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. */
@@ -148,10 +148,9 @@ void grpc_run_bad_client_test(
if (flags & GRPC_BAD_CLIENT_DISCONNECT) {
grpc_endpoint_shutdown(
- &exec_ctx, sfd.client,
- GRPC_ERROR_CREATE_FROM_STATIC_STRING("Forced Disconnect"));
- grpc_endpoint_destroy(&exec_ctx, sfd.client);
- grpc_exec_ctx_finish(&exec_ctx);
+ sfd.client, GRPC_ERROR_CREATE_FROM_STATIC_STRING("Forced Disconnect"));
+ grpc_endpoint_destroy(sfd.client);
+ grpc_exec_ctx_finish();
sfd.client = NULL;
}
@@ -170,9 +169,8 @@ void grpc_run_bad_client_test(
grpc_closure read_done_closure;
GRPC_CLOSURE_INIT(&read_done_closure, read_done, &read_done_event,
grpc_schedule_on_exec_ctx);
- grpc_endpoint_read(&exec_ctx, sfd.client, &incoming,
- &read_done_closure);
- grpc_exec_ctx_finish(&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(
@@ -184,14 +182,13 @@ void grpc_run_bad_client_test(
"client validator failed; trying additional read "
"in case we didn't get all the data");
}
- grpc_slice_buffer_destroy_internal(&exec_ctx, &incoming);
+ grpc_slice_buffer_destroy_internal(&incoming);
}
// Shutdown.
grpc_endpoint_shutdown(
- &exec_ctx, sfd.client,
- GRPC_ERROR_CREATE_FROM_STATIC_STRING("Test Shutdown"));
- grpc_endpoint_destroy(&exec_ctx, sfd.client);
- grpc_exec_ctx_finish(&exec_ctx);
+ sfd.client, GRPC_ERROR_CREATE_FROM_STATIC_STRING("Test Shutdown"));
+ grpc_endpoint_destroy(sfd.client);
+ grpc_exec_ctx_finish();
}
GPR_ASSERT(
@@ -204,8 +201,8 @@ void grpc_run_bad_client_test(
grpc_completion_queue_destroy(shutdown_cq);
grpc_server_destroy(a.server);
grpc_completion_queue_destroy(a.cq);
- grpc_slice_buffer_destroy_internal(&exec_ctx, &outgoing);
+ grpc_slice_buffer_destroy_internal(&outgoing);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_exec_ctx_finish();
grpc_shutdown();
}
diff --git a/test/core/bad_client/bad_client.h b/test/core/bad_client/bad_client.h
index a5b01f7f2c..0b77a3f869 100644
--- a/test/core/bad_client/bad_client.h
+++ b/test/core/bad_client/bad_client.h
@@ -28,6 +28,10 @@
#define GRPC_BAD_CLIENT_REGISTERED_METHOD "/registered/bar"
#define GRPC_BAD_CLIENT_REGISTERED_HOST "localhost"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
typedef void (*grpc_bad_client_server_side_validator)(grpc_server *server,
grpc_completion_queue *cq,
void *registered_method);
@@ -54,4 +58,8 @@ void grpc_run_bad_client_test(
grpc_run_bad_client_test(server_validator, client_validator, payload, \
sizeof(payload) - 1, flags)
+#ifdef __cplusplus
+}
+#endif
+
#endif /* GRPC_TEST_CORE_BAD_CLIENT_BAD_CLIENT_H */
diff --git a/test/core/bad_client/gen_build_yaml.py b/test/core/bad_client/gen_build_yaml.py
index dbd52777e1..22e8aae488 100755
--- a/test/core/bad_client/gen_build_yaml.py
+++ b/test/core/bad_client/gen_build_yaml.py
@@ -46,7 +46,7 @@ def main():
'build': 'private',
'language': 'c',
'src': [
- 'test/core/bad_client/bad_client.c'
+ 'test/core/bad_client/bad_client.cc'
],
'headers': [
'test/core/bad_client/bad_client.h'
diff --git a/test/core/bad_client/generate_tests.bzl b/test/core/bad_client/generate_tests.bzl
index 1aeb81c00d..0ac3e7fdfd 100755
--- a/test/core/bad_client/generate_tests.bzl
+++ b/test/core/bad_client/generate_tests.bzl
@@ -38,7 +38,7 @@ BAD_CLIENT_TESTS = {
def grpc_bad_client_tests():
native.cc_library(
name = 'bad_client_test',
- srcs = ['bad_client.c'],
+ srcs = ['bad_client.cc'],
hdrs = ['bad_client.h'],
copts = ['-std=c99'],
deps = ['//test/core/util:grpc_test_util', '//:grpc', '//:gpr', '//test/core/end2end:cq_verifier']
diff --git a/test/core/channel/channel_args_test.c b/test/core/channel/channel_args_test.c
index deaf2933ec..541c53ddf1 100644
--- a/test/core/channel/channel_args_test.c
+++ b/test/core/channel/channel_args_test.c
@@ -26,7 +26,7 @@
#include "test/core/util/test_config.h"
static void test_create(void) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_arg arg_int;
grpc_arg arg_string;
@@ -55,12 +55,12 @@ static void test_create(void) {
GPR_ASSERT(strcmp(ch_args->args[1].value.string, arg_string.value.string) ==
0);
- grpc_channel_args_destroy(&exec_ctx, ch_args);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_channel_args_destroy(ch_args);
+ grpc_exec_ctx_finish();
}
static void test_set_compression_algorithm(void) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_channel_args *ch_args;
ch_args =
@@ -70,12 +70,12 @@ static void test_set_compression_algorithm(void) {
GRPC_COMPRESSION_CHANNEL_DEFAULT_ALGORITHM) == 0);
GPR_ASSERT(ch_args->args[0].type == GRPC_ARG_INTEGER);
- grpc_channel_args_destroy(&exec_ctx, ch_args);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_channel_args_destroy(ch_args);
+ grpc_exec_ctx_finish();
}
static void test_compression_algorithm_states(void) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_channel_args *ch_args, *ch_args_wo_gzip, *ch_args_wo_gzip_deflate;
unsigned states_bitset;
size_t i;
@@ -91,10 +91,10 @@ static void test_compression_algorithm_states(void) {
/* disable gzip and deflate */
ch_args_wo_gzip = grpc_channel_args_compression_algorithm_set_state(
- &exec_ctx, &ch_args, GRPC_COMPRESS_GZIP, 0);
+ &ch_args, GRPC_COMPRESS_GZIP, 0);
GPR_ASSERT(ch_args == ch_args_wo_gzip);
ch_args_wo_gzip_deflate = grpc_channel_args_compression_algorithm_set_state(
- &exec_ctx, &ch_args_wo_gzip, GRPC_COMPRESS_DEFLATE, 0);
+ &ch_args_wo_gzip, GRPC_COMPRESS_DEFLATE, 0);
GPR_ASSERT(ch_args_wo_gzip == ch_args_wo_gzip_deflate);
states_bitset = (unsigned)grpc_channel_args_compression_algorithm_get_states(
@@ -109,7 +109,7 @@ static void test_compression_algorithm_states(void) {
/* re-enabled gzip only */
ch_args_wo_gzip = grpc_channel_args_compression_algorithm_set_state(
- &exec_ctx, &ch_args_wo_gzip_deflate, GRPC_COMPRESS_GZIP, 1);
+ &ch_args_wo_gzip_deflate, GRPC_COMPRESS_GZIP, 1);
GPR_ASSERT(ch_args_wo_gzip == ch_args_wo_gzip_deflate);
states_bitset = (unsigned)grpc_channel_args_compression_algorithm_get_states(
@@ -122,8 +122,8 @@ static void test_compression_algorithm_states(void) {
}
}
- grpc_channel_args_destroy(&exec_ctx, ch_args);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_channel_args_destroy(ch_args);
+ grpc_exec_ctx_finish();
}
static void test_set_socket_mutator(void) {
@@ -137,9 +137,9 @@ static void test_set_socket_mutator(void) {
GPR_ASSERT(ch_args->args[0].type == GRPC_ARG_POINTER);
{
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_channel_args_destroy(&exec_ctx, ch_args);
- grpc_exec_ctx_finish(&exec_ctx);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_channel_args_destroy(ch_args);
+ grpc_exec_ctx_finish();
}
}
diff --git a/test/core/channel/channel_stack_builder_test.c b/test/core/channel/channel_stack_builder_test.c
index 682efd1438..b745def232 100644
--- a/test/core/channel/channel_stack_builder_test.c
+++ b/test/core/channel/channel_stack_builder_test.c
@@ -29,34 +29,30 @@
#include "src/core/lib/surface/channel_init.h"
#include "test/core/util/test_config.h"
-static grpc_error *channel_init_func(grpc_exec_ctx *exec_ctx,
- grpc_channel_element *elem,
+static grpc_error *channel_init_func(grpc_channel_element *elem,
grpc_channel_element_args *args) {
return GRPC_ERROR_NONE;
}
-static grpc_error *call_init_func(grpc_exec_ctx *exec_ctx,
- grpc_call_element *elem,
+static grpc_error *call_init_func(grpc_call_element *elem,
const grpc_call_element_args *args) {
return GRPC_ERROR_NONE;
}
-static void channel_destroy_func(grpc_exec_ctx *exec_ctx,
- grpc_channel_element *elem) {}
+static void channel_destroy_func(grpc_channel_element *elem) {}
-static void call_destroy_func(grpc_exec_ctx *exec_ctx, grpc_call_element *elem,
+static void call_destroy_func(grpc_call_element *elem,
const grpc_call_final_info *final_info,
grpc_closure *ignored) {}
-static void call_func(grpc_exec_ctx *exec_ctx, grpc_call_element *elem,
+static void call_func(grpc_call_element *elem,
grpc_transport_stream_op_batch *op) {}
-static void channel_func(grpc_exec_ctx *exec_ctx, grpc_channel_element *elem,
- grpc_transport_op *op) {
+static void channel_func(grpc_channel_element *elem, grpc_transport_op *op) {
if (op->disconnect_with_error != GRPC_ERROR_NONE) {
GRPC_ERROR_UNREF(op->disconnect_with_error);
}
- GRPC_CLOSURE_SCHED(exec_ctx, op->on_consumed, GRPC_ERROR_NONE);
+ GRPC_CLOSURE_SCHED(op->on_consumed, GRPC_ERROR_NONE);
}
bool g_replacement_fn_called = false;
@@ -106,8 +102,7 @@ const grpc_channel_filter original_filter = {
grpc_channel_next_get_info,
"filter_name"};
-static bool add_replacement_filter(grpc_exec_ctx *exec_ctx,
- grpc_channel_stack_builder *builder,
+static bool add_replacement_filter(grpc_channel_stack_builder *builder,
void *arg) {
const grpc_channel_filter *filter = arg;
// Get rid of any other version of the filter, as determined by having the
@@ -117,8 +112,7 @@ static bool add_replacement_filter(grpc_exec_ctx *exec_ctx,
builder, filter, set_arg_once_fn, &g_replacement_fn_called);
}
-static bool add_original_filter(grpc_exec_ctx *exec_ctx,
- grpc_channel_stack_builder *builder,
+static bool add_original_filter(grpc_channel_stack_builder *builder,
void *arg) {
return grpc_channel_stack_builder_prepend_filter(
builder, (const grpc_channel_filter *)arg, set_arg_once_fn,
diff --git a/test/core/channel/channel_stack_test.c b/test/core/channel/channel_stack_test.c
index a07ef89ba8..ef1a2ac319 100644
--- a/test/core/channel/channel_stack_test.c
+++ b/test/core/channel/channel_stack_test.c
@@ -27,8 +27,7 @@
#include "src/core/lib/slice/slice_internal.h"
#include "test/core/util/test_config.h"
-static grpc_error *channel_init_func(grpc_exec_ctx *exec_ctx,
- grpc_channel_element *elem,
+static grpc_error *channel_init_func(grpc_channel_element *elem,
grpc_channel_element_args *args) {
GPR_ASSERT(args->channel_args->num_args == 1);
GPR_ASSERT(args->channel_args->args[0].type == GRPC_ARG_INTEGER);
@@ -40,41 +39,37 @@ static grpc_error *channel_init_func(grpc_exec_ctx *exec_ctx,
return GRPC_ERROR_NONE;
}
-static grpc_error *call_init_func(grpc_exec_ctx *exec_ctx,
- grpc_call_element *elem,
+static grpc_error *call_init_func(grpc_call_element *elem,
const grpc_call_element_args *args) {
++*(int *)(elem->channel_data);
*(int *)(elem->call_data) = 0;
return GRPC_ERROR_NONE;
}
-static void channel_destroy_func(grpc_exec_ctx *exec_ctx,
- grpc_channel_element *elem) {}
+static void channel_destroy_func(grpc_channel_element *elem) {}
-static void call_destroy_func(grpc_exec_ctx *exec_ctx, grpc_call_element *elem,
+static void call_destroy_func(grpc_call_element *elem,
const grpc_call_final_info *final_info,
grpc_closure *ignored) {
++*(int *)(elem->channel_data);
}
-static void call_func(grpc_exec_ctx *exec_ctx, grpc_call_element *elem,
+static void call_func(grpc_call_element *elem,
grpc_transport_stream_op_batch *op) {
++*(int *)(elem->call_data);
}
-static void channel_func(grpc_exec_ctx *exec_ctx, grpc_channel_element *elem,
- grpc_transport_op *op) {
+static void channel_func(grpc_channel_element *elem, grpc_transport_op *op) {
++*(int *)(elem->channel_data);
}
-static void free_channel(grpc_exec_ctx *exec_ctx, void *arg,
- grpc_error *error) {
- grpc_channel_stack_destroy(exec_ctx, arg);
+static void free_channel(void *arg, grpc_error *error) {
+ grpc_channel_stack_destroy(arg);
gpr_free(arg);
}
-static void free_call(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) {
- grpc_call_stack_destroy(exec_ctx, arg, NULL, NULL);
+static void free_call(void *arg, grpc_error *error) {
+ grpc_call_stack_destroy(arg, NULL, NULL);
gpr_free(arg);
}
@@ -100,7 +95,7 @@ static void test_create_channel_stack(void) {
grpc_channel_args chan_args;
int *channel_data;
int *call_data;
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_slice path = grpc_slice_from_static_string("/service/method");
arg.type = GRPC_ARG_INTEGER;
@@ -111,8 +106,8 @@ static void test_create_channel_stack(void) {
chan_args.args = &arg;
channel_stack = gpr_malloc(grpc_channel_stack_size(&filters, 1));
- grpc_channel_stack_init(&exec_ctx, 1, free_channel, channel_stack, &filters,
- 1, &chan_args, NULL, "test", channel_stack);
+ grpc_channel_stack_init(1, free_channel, channel_stack, &filters, 1,
+ &chan_args, NULL, "test", channel_stack);
GPR_ASSERT(channel_stack->count == 1);
channel_elem = grpc_channel_stack_element(channel_stack, 0);
channel_data = (int *)channel_elem->channel_data;
@@ -127,8 +122,8 @@ static void test_create_channel_stack(void) {
.start_time = gpr_now(GPR_CLOCK_MONOTONIC),
.deadline = GRPC_MILLIS_INF_FUTURE,
.arena = NULL};
- grpc_error *error = grpc_call_stack_init(&exec_ctx, channel_stack, 1,
- free_call, call_stack, &args);
+ grpc_error *error =
+ grpc_call_stack_init(channel_stack, 1, free_call, call_stack, &args);
GPR_ASSERT(error == GRPC_ERROR_NONE);
GPR_ASSERT(call_stack->count == 1);
call_elem = grpc_call_stack_element(call_stack, 0);
@@ -138,14 +133,14 @@ static void test_create_channel_stack(void) {
GPR_ASSERT(*call_data == 0);
GPR_ASSERT(*channel_data == 1);
- GRPC_CALL_STACK_UNREF(&exec_ctx, call_stack, "done");
- grpc_exec_ctx_flush(&exec_ctx);
+ GRPC_CALL_STACK_UNREF(call_stack, "done");
+ grpc_exec_ctx_flush();
GPR_ASSERT(*channel_data == 2);
- GRPC_CHANNEL_STACK_UNREF(&exec_ctx, channel_stack, "done");
+ GRPC_CHANNEL_STACK_UNREF(channel_stack, "done");
- grpc_slice_unref_internal(&exec_ctx, path);
- grpc_exec_ctx_finish(&exec_ctx);
+ 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.c b/test/core/channel/minimal_stack_is_minimal_test.c
index b4528346f7..2f6a991a11 100644
--- a/test/core/channel/minimal_stack_is_minimal_test.c
+++ b/test/core/channel/minimal_stack_is_minimal_test.c
@@ -122,12 +122,11 @@ static int check_stack(const char *file, int line, const char *transport_name,
grpc_channel_stack_builder_set_transport(builder, &fake_transport);
}
{
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_channel_stack_builder_set_channel_arguments(&exec_ctx, builder,
- channel_args);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_channel_stack_builder_set_channel_arguments(builder, channel_args);
GPR_ASSERT(grpc_channel_init_create_stack(
- &exec_ctx, builder, (grpc_channel_stack_type)channel_stack_type));
- grpc_exec_ctx_finish(&exec_ctx);
+ builder, (grpc_channel_stack_type)channel_stack_type));
+ grpc_exec_ctx_finish();
}
// build up our expectation list
@@ -207,10 +206,10 @@ static int check_stack(const char *file, int line, const char *transport_name,
gpr_free(expect);
{
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_channel_stack_builder_destroy(&exec_ctx, builder);
- grpc_channel_args_destroy(&exec_ctx, channel_args);
- grpc_exec_ctx_finish(&exec_ctx);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ 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.c b/test/core/client_channel/lb_policies_test.c
index ba37cd673f..446e5ef9d6 100644
--- a/test/core/client_channel/lb_policies_test.c
+++ b/test/core/client_channel/lb_policies_test.c
@@ -639,9 +639,9 @@ static void test_get_channel_info() {
grpc_channel_args *args = grpc_channel_args_copy_and_add(NULL, &arg, 1);
channel = grpc_insecure_channel_create("ipv4:127.0.0.1:1234", args, NULL);
{
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_channel_args_destroy(&exec_ctx, args);
- grpc_exec_ctx_finish(&exec_ctx);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_channel_args_destroy(args);
+ grpc_exec_ctx_finish();
}
// Ensures that resolver returns.
grpc_channel_check_connectivity_state(channel, true /* try_to_connect */);
@@ -937,7 +937,7 @@ static void verify_rebirth_round_robin(const servers_fixture *f,
}
int main(int argc, char **argv) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
test_spec *spec;
size_t i;
const size_t NUM_ITERS = 10;
@@ -947,9 +947,9 @@ int main(int argc, char **argv) {
grpc_test_init(argc, argv);
grpc_tracer_set_enabled("round_robin", 1);
- GPR_ASSERT(grpc_lb_policy_create(&exec_ctx, "this-lb-policy-does-not-exist",
- NULL) == NULL);
- GPR_ASSERT(grpc_lb_policy_create(&exec_ctx, NULL, NULL) == NULL);
+ GPR_ASSERT(grpc_lb_policy_create("this-lb-policy-does-not-exist", NULL) ==
+ NULL);
+ GPR_ASSERT(grpc_lb_policy_create(NULL, NULL) == NULL);
spec = test_spec_create(NUM_ITERS, NUM_SERVERS);
/* everything is fine, all servers stay up the whole time and life's peachy
@@ -1003,7 +1003,7 @@ int main(int argc, char **argv) {
test_ping();
test_get_channel_info();
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_exec_ctx_finish();
grpc_shutdown();
return 0;
}
diff --git a/test/core/client_channel/parse_address_test.c b/test/core/client_channel/parse_address_test.c
index d011176869..6e1a69a581 100644
--- a/test/core/client_channel/parse_address_test.c
+++ b/test/core/client_channel/parse_address_test.c
@@ -33,8 +33,8 @@
#ifdef GRPC_HAVE_UNIX_SOCKET
static void test_grpc_parse_unix(const char *uri_text, const char *pathname) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_uri *uri = grpc_uri_parse(&exec_ctx, uri_text, 0);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_uri *uri = grpc_uri_parse(uri_text, 0);
grpc_resolved_address addr;
GPR_ASSERT(1 == grpc_parse_unix(uri, &addr));
@@ -43,7 +43,7 @@ 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(&exec_ctx);
+ grpc_exec_ctx_finish();
}
#else /* GRPC_HAVE_UNIX_SOCKET */
@@ -54,8 +54,8 @@ static void test_grpc_parse_unix(const char *uri_text, const char *pathname) {}
static void test_grpc_parse_ipv4(const char *uri_text, const char *host,
unsigned short port) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_uri *uri = grpc_uri_parse(&exec_ctx, uri_text, 0);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_uri *uri = grpc_uri_parse(uri_text, 0);
grpc_resolved_address addr;
char ntop_buf[INET_ADDRSTRLEN];
@@ -68,13 +68,13 @@ 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(&exec_ctx);
+ grpc_exec_ctx_finish();
}
static void test_grpc_parse_ipv6(const char *uri_text, const char *host,
unsigned short port, uint32_t scope_id) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_uri *uri = grpc_uri_parse(&exec_ctx, uri_text, 0);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_uri *uri = grpc_uri_parse(uri_text, 0);
grpc_resolved_address addr;
char ntop_buf[INET6_ADDRSTRLEN];
@@ -88,7 +88,7 @@ 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(&exec_ctx);
+ grpc_exec_ctx_finish();
}
int main(int argc, char **argv) {
diff --git a/test/core/client_channel/resolvers/dns_resolver_connectivity_test.c b/test/core/client_channel/resolvers/dns_resolver_connectivity_test.c
index 4597285063..3715fbdc02 100644
--- a/test/core/client_channel/resolvers/dns_resolver_connectivity_test.c
+++ b/test/core/client_channel/resolvers/dns_resolver_connectivity_test.c
@@ -35,8 +35,7 @@ static gpr_mu g_mu;
static bool g_fail_resolution = true;
static grpc_combiner *g_combiner;
-static void my_resolve_address(grpc_exec_ctx *exec_ctx, const char *addr,
- const char *default_port,
+static void my_resolve_address(const char *addr, const char *default_port,
grpc_pollset_set *interested_parties,
grpc_closure *on_done,
grpc_resolved_addresses **addrs) {
@@ -54,13 +53,13 @@ static void my_resolve_address(grpc_exec_ctx *exec_ctx, const char *addr,
(*addrs)->addrs = gpr_malloc(sizeof(*(*addrs)->addrs));
(*addrs)->addrs[0].len = 123;
}
- GRPC_CLOSURE_SCHED(exec_ctx, on_done, error);
+ GRPC_CLOSURE_SCHED(on_done, error);
}
static grpc_ares_request *my_dns_lookup_ares(
- grpc_exec_ctx *exec_ctx, const char *dns_server, const char *addr,
- const char *default_port, grpc_pollset_set *interested_parties,
- grpc_closure *on_done, grpc_lb_addresses **lb_addrs, bool check_grpclb,
+ const char *dns_server, const char *addr, const char *default_port,
+ grpc_pollset_set *interested_parties, grpc_closure *on_done,
+ grpc_lb_addresses **lb_addrs, bool check_grpclb,
char **service_config_json) {
gpr_mu_lock(&g_mu);
GPR_ASSERT(0 == strcmp("test", addr));
@@ -74,27 +73,26 @@ static grpc_ares_request *my_dns_lookup_ares(
*lb_addrs = grpc_lb_addresses_create(1, NULL);
grpc_lb_addresses_set_address(*lb_addrs, 0, NULL, 0, false, NULL, NULL);
}
- GRPC_CLOSURE_SCHED(exec_ctx, on_done, error);
+ GRPC_CLOSURE_SCHED(on_done, error);
return NULL;
}
-static grpc_resolver *create_resolver(grpc_exec_ctx *exec_ctx,
- const char *name) {
+static grpc_resolver *create_resolver(const char *name) {
grpc_resolver_factory *factory = grpc_resolver_factory_lookup("dns");
- grpc_uri *uri = grpc_uri_parse(exec_ctx, name, 0);
+ grpc_uri *uri = grpc_uri_parse(name, 0);
GPR_ASSERT(uri);
grpc_resolver_args args;
memset(&args, 0, sizeof(args));
args.uri = uri;
args.combiner = g_combiner;
grpc_resolver *resolver =
- grpc_resolver_factory_create_resolver(exec_ctx, factory, &args);
+ grpc_resolver_factory_create_resolver(factory, &args);
grpc_resolver_factory_unref(factory);
grpc_uri_destroy(uri);
return resolver;
}
-static void on_done(grpc_exec_ctx *exec_ctx, void *ev, grpc_error *error) {
+static void on_done(void *ev, grpc_error *error) {
gpr_event_set(ev, (void *)1);
}
@@ -105,9 +103,9 @@ static bool wait_loop(int deadline_seconds, gpr_event *ev) {
if (gpr_event_wait(ev, grpc_timeout_seconds_to_deadline(1))) return true;
deadline_seconds--;
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_timer_check(&exec_ctx, NULL);
- grpc_exec_ctx_finish(&exec_ctx);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_timer_check(NULL);
+ grpc_exec_ctx_finish();
}
return false;
}
@@ -118,26 +116,24 @@ typedef struct next_args {
grpc_closure *on_complete;
} next_args;
-static void call_resolver_next_now_lock_taken(grpc_exec_ctx *exec_ctx,
- void *arg,
+static void call_resolver_next_now_lock_taken(void *arg,
grpc_error *error_unused) {
next_args *a = arg;
- grpc_resolver_next_locked(exec_ctx, a->resolver, a->result, a->on_complete);
+ grpc_resolver_next_locked(a->resolver, a->result, a->on_complete);
gpr_free(a);
}
-static void call_resolver_next_after_locking(grpc_exec_ctx *exec_ctx,
- grpc_resolver *resolver,
+static void call_resolver_next_after_locking(grpc_resolver *resolver,
grpc_channel_args **result,
grpc_closure *on_complete) {
next_args *a = gpr_malloc(sizeof(*a));
a->resolver = resolver;
a->result = result;
a->on_complete = on_complete;
- GRPC_CLOSURE_SCHED(exec_ctx, GRPC_CLOSURE_CREATE(
- call_resolver_next_now_lock_taken, a,
- grpc_combiner_scheduler(resolver->combiner)),
- GRPC_ERROR_NONE);
+ GRPC_CLOSURE_SCHED(
+ GRPC_CLOSURE_CREATE(call_resolver_next_now_lock_taken, a,
+ grpc_combiner_scheduler(resolver->combiner)),
+ GRPC_ERROR_NONE);
}
int main(int argc, char **argv) {
@@ -150,30 +146,30 @@ int main(int argc, char **argv) {
grpc_dns_lookup_ares = my_dns_lookup_ares;
grpc_channel_args *result = (grpc_channel_args *)1;
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_resolver *resolver = create_resolver(&exec_ctx, "dns:test");
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_resolver *resolver = create_resolver("dns:test");
gpr_event ev1;
gpr_event_init(&ev1);
call_resolver_next_after_locking(
- &exec_ctx, resolver, &result,
+ resolver, &result,
GRPC_CLOSURE_CREATE(on_done, &ev1, grpc_schedule_on_exec_ctx));
- grpc_exec_ctx_flush(&exec_ctx);
+ grpc_exec_ctx_flush();
GPR_ASSERT(wait_loop(5, &ev1));
GPR_ASSERT(result == NULL);
gpr_event ev2;
gpr_event_init(&ev2);
call_resolver_next_after_locking(
- &exec_ctx, resolver, &result,
+ resolver, &result,
GRPC_CLOSURE_CREATE(on_done, &ev2, grpc_schedule_on_exec_ctx));
- grpc_exec_ctx_flush(&exec_ctx);
+ grpc_exec_ctx_flush();
GPR_ASSERT(wait_loop(30, &ev2));
GPR_ASSERT(result != NULL);
- grpc_channel_args_destroy(&exec_ctx, result);
- GRPC_RESOLVER_UNREF(&exec_ctx, resolver, "test");
- GRPC_COMBINER_UNREF(&exec_ctx, g_combiner, "test");
- grpc_exec_ctx_finish(&exec_ctx);
+ 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.c b/test/core/client_channel/resolvers/dns_resolver_test.c
index a14926f173..3717d0efd7 100644
--- a/test/core/client_channel/resolvers/dns_resolver_test.c
+++ b/test/core/client_channel/resolvers/dns_resolver_test.c
@@ -28,8 +28,8 @@
static grpc_combiner *g_combiner;
static void test_succeeds(grpc_resolver_factory *factory, const char *string) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_uri *uri = grpc_uri_parse(&exec_ctx, string, 0);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_uri *uri = grpc_uri_parse(string, 0);
grpc_resolver_args args;
grpc_resolver *resolver;
gpr_log(GPR_DEBUG, "test: '%s' should be valid for '%s'", string,
@@ -38,16 +38,16 @@ static void test_succeeds(grpc_resolver_factory *factory, const char *string) {
memset(&args, 0, sizeof(args));
args.uri = uri;
args.combiner = g_combiner;
- resolver = grpc_resolver_factory_create_resolver(&exec_ctx, factory, &args);
+ resolver = grpc_resolver_factory_create_resolver(factory, &args);
GPR_ASSERT(resolver != NULL);
- GRPC_RESOLVER_UNREF(&exec_ctx, resolver, "test_succeeds");
+ GRPC_RESOLVER_UNREF(resolver, "test_succeeds");
grpc_uri_destroy(uri);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_exec_ctx_finish();
}
static void test_fails(grpc_resolver_factory *factory, const char *string) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_uri *uri = grpc_uri_parse(&exec_ctx, string, 0);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_uri *uri = grpc_uri_parse(string, 0);
grpc_resolver_args args;
grpc_resolver *resolver;
gpr_log(GPR_DEBUG, "test: '%s' should be invalid for '%s'", string,
@@ -56,10 +56,10 @@ static void test_fails(grpc_resolver_factory *factory, const char *string) {
memset(&args, 0, sizeof(args));
args.uri = uri;
args.combiner = g_combiner;
- resolver = grpc_resolver_factory_create_resolver(&exec_ctx, factory, &args);
+ resolver = grpc_resolver_factory_create_resolver(factory, &args);
GPR_ASSERT(resolver == NULL);
grpc_uri_destroy(uri);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_exec_ctx_finish();
}
int main(int argc, char **argv) {
@@ -82,9 +82,9 @@ int main(int argc, char **argv) {
grpc_resolver_factory_unref(dns);
{
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- GRPC_COMBINER_UNREF(&exec_ctx, g_combiner, "test");
- grpc_exec_ctx_finish(&exec_ctx);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ GRPC_COMBINER_UNREF(g_combiner, "test");
+ grpc_exec_ctx_finish();
}
grpc_shutdown();
diff --git a/test/core/client_channel/resolvers/fake_resolver_test.c b/test/core/client_channel/resolvers/fake_resolver_test.c
index 9b0854d6d8..8cc5fc6ce5 100644
--- a/test/core/client_channel/resolvers/fake_resolver_test.c
+++ b/test/core/client_channel/resolvers/fake_resolver_test.c
@@ -33,7 +33,7 @@
#include "test/core/util/test_config.h"
static grpc_resolver *build_fake_resolver(
- grpc_exec_ctx *exec_ctx, grpc_combiner *combiner,
+ grpc_combiner *combiner,
grpc_fake_resolver_response_generator *response_generator) {
grpc_resolver_factory *factory = grpc_resolver_factory_lookup("fake");
grpc_arg generator_arg =
@@ -44,7 +44,7 @@ static grpc_resolver *build_fake_resolver(
args.args = &channel_args;
args.combiner = combiner;
grpc_resolver *resolver =
- grpc_resolver_factory_create_resolver(exec_ctx, factory, &args);
+ grpc_resolver_factory_create_resolver(factory, &args);
grpc_resolver_factory_unref(factory);
return resolver;
}
@@ -55,7 +55,7 @@ typedef struct on_resolution_arg {
gpr_event ev;
} on_resolution_arg;
-void on_resolution_cb(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) {
+void on_resolution_cb(void *arg, grpc_error *error) {
on_resolution_arg *res = arg;
// We only check the addresses channel arg because that's the only one
// explicitly set by the test via
@@ -66,24 +66,23 @@ void on_resolution_cb(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) {
grpc_lb_addresses_find_channel_arg(res->expected_resolver_result);
GPR_ASSERT(
grpc_lb_addresses_cmp(actual_lb_addresses, expected_lb_addresses) == 0);
- grpc_channel_args_destroy(exec_ctx, res->resolver_result);
- grpc_channel_args_destroy(exec_ctx, res->expected_resolver_result);
+ grpc_channel_args_destroy(res->resolver_result);
+ grpc_channel_args_destroy(res->expected_resolver_result);
gpr_event_set(&res->ev, (void *)1);
}
static void test_fake_resolver() {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_combiner *combiner = grpc_combiner_create();
// Create resolver.
grpc_fake_resolver_response_generator *response_generator =
grpc_fake_resolver_response_generator_create();
- grpc_resolver *resolver =
- build_fake_resolver(&exec_ctx, combiner, response_generator);
+ grpc_resolver *resolver = build_fake_resolver(combiner, response_generator);
GPR_ASSERT(resolver != NULL);
// Setup expectations.
- grpc_uri *uris[] = {grpc_uri_parse(&exec_ctx, "ipv4:10.2.1.1:1234", true),
- grpc_uri_parse(&exec_ctx, "ipv4:127.0.0.1:4321", true)};
+ grpc_uri *uris[] = {grpc_uri_parse("ipv4:10.2.1.1:1234", true),
+ grpc_uri_parse("ipv4:127.0.0.1:4321", true)};
char *balancer_names[] = {"name1", "name2"};
const bool is_balancer[] = {true, false};
grpc_lb_addresses *addresses = grpc_lb_addresses_create(3, NULL);
@@ -96,7 +95,7 @@ static void test_fake_resolver() {
grpc_lb_addresses_create_channel_arg(addresses);
grpc_channel_args *results =
grpc_channel_args_copy_and_add(NULL, &addresses_arg, 1);
- grpc_lb_addresses_destroy(&exec_ctx, addresses);
+ grpc_lb_addresses_destroy(addresses);
on_resolution_arg on_res_arg;
memset(&on_res_arg, 0, sizeof(on_res_arg));
on_res_arg.expected_resolver_result = results;
@@ -106,17 +105,16 @@ static void test_fake_resolver() {
// Set resolver results and trigger first resolution. on_resolution_cb
// performs the checks.
- grpc_fake_resolver_response_generator_set_response(
- &exec_ctx, response_generator, results);
- grpc_resolver_next_locked(&exec_ctx, resolver, &on_res_arg.resolver_result,
+ grpc_fake_resolver_response_generator_set_response(response_generator,
+ results);
+ grpc_resolver_next_locked(resolver, &on_res_arg.resolver_result,
on_resolution);
- grpc_exec_ctx_flush(&exec_ctx);
+ grpc_exec_ctx_flush();
GPR_ASSERT(gpr_event_wait(&on_res_arg.ev,
grpc_timeout_seconds_to_deadline(5)) != NULL);
// Setup update.
- grpc_uri *uris_update[] = {
- grpc_uri_parse(&exec_ctx, "ipv4:192.168.1.0:31416", true)};
+ grpc_uri *uris_update[] = {grpc_uri_parse("ipv4:192.168.1.0:31416", true)};
char *balancer_names_update[] = {"name3"};
const bool is_balancer_update[] = {false};
grpc_lb_addresses *addresses_update = grpc_lb_addresses_create(1, NULL);
@@ -131,7 +129,7 @@ static void test_fake_resolver() {
grpc_lb_addresses_create_channel_arg(addresses_update);
grpc_channel_args *results_update =
grpc_channel_args_copy_and_add(NULL, &addresses_update_arg, 1);
- grpc_lb_addresses_destroy(&exec_ctx, addresses_update);
+ grpc_lb_addresses_destroy(addresses_update);
// Setup expectations for the update.
on_resolution_arg on_res_arg_update;
@@ -142,27 +140,27 @@ static void test_fake_resolver() {
grpc_combiner_scheduler(combiner));
// Set updated resolver results and trigger a second resolution.
- grpc_fake_resolver_response_generator_set_response(
- &exec_ctx, response_generator, results_update);
- grpc_resolver_next_locked(&exec_ctx, resolver,
- &on_res_arg_update.resolver_result, on_resolution);
- grpc_exec_ctx_flush(&exec_ctx);
+ grpc_fake_resolver_response_generator_set_response(response_generator,
+ results_update);
+ grpc_resolver_next_locked(resolver, &on_res_arg_update.resolver_result,
+ on_resolution);
+ grpc_exec_ctx_flush();
GPR_ASSERT(gpr_event_wait(&on_res_arg_update.ev,
grpc_timeout_seconds_to_deadline(5)) != NULL);
// Requesting a new resolution without re-senting the response shouldn't
// trigger the resolution callback.
memset(&on_res_arg, 0, sizeof(on_res_arg));
- grpc_resolver_next_locked(&exec_ctx, resolver, &on_res_arg.resolver_result,
+ grpc_resolver_next_locked(resolver, &on_res_arg.resolver_result,
on_resolution);
- grpc_exec_ctx_flush(&exec_ctx);
+ grpc_exec_ctx_flush();
GPR_ASSERT(gpr_event_wait(&on_res_arg.ev,
grpc_timeout_milliseconds_to_deadline(100)) ==
NULL);
- GRPC_COMBINER_UNREF(&exec_ctx, combiner, "test_fake_resolver");
- GRPC_RESOLVER_UNREF(&exec_ctx, resolver, "test_fake_resolver");
- grpc_exec_ctx_finish(&exec_ctx);
+ 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.c b/test/core/client_channel/resolvers/sockaddr_resolver_test.c
index 8b88619164..e69c68141b 100644
--- a/test/core/client_channel/resolvers/sockaddr_resolver_test.c
+++ b/test/core/client_channel/resolvers/sockaddr_resolver_test.c
@@ -35,14 +35,14 @@ typedef struct on_resolution_arg {
grpc_channel_args *resolver_result;
} on_resolution_arg;
-void on_resolution_cb(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) {
+void on_resolution_cb(void *arg, grpc_error *error) {
on_resolution_arg *res = arg;
- grpc_channel_args_destroy(exec_ctx, res->resolver_result);
+ grpc_channel_args_destroy(res->resolver_result);
}
static void test_succeeds(grpc_resolver_factory *factory, const char *string) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_uri *uri = grpc_uri_parse(&exec_ctx, string, 0);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_uri *uri = grpc_uri_parse(string, 0);
grpc_resolver_args args;
grpc_resolver *resolver;
gpr_log(GPR_DEBUG, "test: '%s' should be valid for '%s'", string,
@@ -51,7 +51,7 @@ static void test_succeeds(grpc_resolver_factory *factory, const char *string) {
memset(&args, 0, sizeof(args));
args.uri = uri;
args.combiner = g_combiner;
- resolver = grpc_resolver_factory_create_resolver(&exec_ctx, factory, &args);
+ resolver = grpc_resolver_factory_create_resolver(factory, &args);
GPR_ASSERT(resolver != NULL);
on_resolution_arg on_res_arg;
@@ -60,16 +60,16 @@ static void test_succeeds(grpc_resolver_factory *factory, const char *string) {
grpc_closure *on_resolution = GRPC_CLOSURE_CREATE(
on_resolution_cb, &on_res_arg, grpc_schedule_on_exec_ctx);
- grpc_resolver_next_locked(&exec_ctx, resolver, &on_res_arg.resolver_result,
+ grpc_resolver_next_locked(resolver, &on_res_arg.resolver_result,
on_resolution);
- GRPC_RESOLVER_UNREF(&exec_ctx, resolver, "test_succeeds");
- grpc_exec_ctx_finish(&exec_ctx);
+ GRPC_RESOLVER_UNREF(resolver, "test_succeeds");
+ grpc_exec_ctx_finish();
grpc_uri_destroy(uri);
}
static void test_fails(grpc_resolver_factory *factory, const char *string) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_uri *uri = grpc_uri_parse(&exec_ctx, string, 0);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_uri *uri = grpc_uri_parse(string, 0);
grpc_resolver_args args;
grpc_resolver *resolver;
gpr_log(GPR_DEBUG, "test: '%s' should be invalid for '%s'", string,
@@ -78,10 +78,10 @@ static void test_fails(grpc_resolver_factory *factory, const char *string) {
memset(&args, 0, sizeof(args));
args.uri = uri;
args.combiner = g_combiner;
- resolver = grpc_resolver_factory_create_resolver(&exec_ctx, factory, &args);
+ resolver = grpc_resolver_factory_create_resolver(factory, &args);
GPR_ASSERT(resolver == NULL);
grpc_uri_destroy(uri);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_exec_ctx_finish();
}
int main(int argc, char **argv) {
@@ -112,9 +112,9 @@ int main(int argc, char **argv) {
grpc_resolver_factory_unref(ipv6);
{
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- GRPC_COMBINER_UNREF(&exec_ctx, g_combiner, "test");
- grpc_exec_ctx_finish(&exec_ctx);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ GRPC_COMBINER_UNREF(g_combiner, "test");
+ grpc_exec_ctx_finish();
}
grpc_shutdown();
diff --git a/test/core/client_channel/uri_fuzzer_test.c b/test/core/client_channel/uri_fuzzer_test.c
index e51d0031ec..2d91b92925 100644
--- a/test/core/client_channel/uri_fuzzer_test.c
+++ b/test/core/client_channel/uri_fuzzer_test.c
@@ -33,12 +33,12 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
memcpy(s, data, size);
s[size] = 0;
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_uri *x;
- if ((x = grpc_uri_parse(&exec_ctx, s, 1))) {
+ if ((x = grpc_uri_parse(s, 1))) {
grpc_uri_destroy(x);
}
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_exec_ctx_finish();
gpr_free(s);
return 0;
}
diff --git a/test/core/client_channel/uri_parser_test.c b/test/core/client_channel/uri_parser_test.c
index f53cae196b..643035d9eb 100644
--- a/test/core/client_channel/uri_parser_test.c
+++ b/test/core/client_channel/uri_parser_test.c
@@ -28,29 +28,29 @@
static void test_succeeds(const char *uri_text, const char *scheme,
const char *authority, const char *path,
const char *query, const char *fragment) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_uri *uri = grpc_uri_parse(&exec_ctx, uri_text, 0);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_uri *uri = grpc_uri_parse(uri_text, 0);
GPR_ASSERT(uri);
GPR_ASSERT(0 == strcmp(scheme, uri->scheme));
GPR_ASSERT(0 == strcmp(authority, uri->authority));
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(&exec_ctx);
+ grpc_exec_ctx_finish();
grpc_uri_destroy(uri);
}
static void test_fails(const char *uri_text) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- GPR_ASSERT(NULL == grpc_uri_parse(&exec_ctx, uri_text, 0));
- grpc_exec_ctx_finish(&exec_ctx);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ GPR_ASSERT(NULL == grpc_uri_parse(uri_text, 0));
+ grpc_exec_ctx_finish();
}
static void test_query_parts() {
{
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
const char *uri_text = "http://foo/path?a&b=B&c=&#frag";
- grpc_uri *uri = grpc_uri_parse(&exec_ctx, uri_text, 0);
+ grpc_uri *uri = grpc_uri_parse(uri_text, 0);
GPR_ASSERT(uri);
GPR_ASSERT(0 == strcmp("http", uri->scheme));
@@ -77,14 +77,14 @@ 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(&exec_ctx);
+ grpc_exec_ctx_finish();
grpc_uri_destroy(uri);
}
{
/* test the current behavior of multiple query part values */
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
const char *uri_text = "http://auth/path?foo=bar=baz&foobar==";
- grpc_uri *uri = grpc_uri_parse(&exec_ctx, uri_text, 0);
+ grpc_uri *uri = grpc_uri_parse(uri_text, 0);
GPR_ASSERT(uri);
GPR_ASSERT(0 == strcmp("http", uri->scheme));
@@ -96,14 +96,14 @@ 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(&exec_ctx);
+ grpc_exec_ctx_finish();
grpc_uri_destroy(uri);
}
{
/* empty query */
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
const char *uri_text = "http://foo/path";
- grpc_uri *uri = grpc_uri_parse(&exec_ctx, uri_text, 0);
+ grpc_uri *uri = grpc_uri_parse(uri_text, 0);
GPR_ASSERT(uri);
GPR_ASSERT(0 == strcmp("http", uri->scheme));
@@ -114,7 +114,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(&exec_ctx);
+ grpc_exec_ctx_finish();
grpc_uri_destroy(uri);
}
}
diff --git a/test/core/compression/algorithm_test.c b/test/core/compression/algorithm_test.c
index a11e6e90ac..9a771d9494 100644
--- a/test/core/compression/algorithm_test.c
+++ b/test/core/compression/algorithm_test.c
@@ -39,7 +39,7 @@ static void test_algorithm_mesh(void) {
grpc_compression_algorithm parsed;
grpc_slice mdstr;
grpc_mdelem mdelem;
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
GPR_ASSERT(
grpc_compression_algorithm_name((grpc_compression_algorithm)i, &name));
GPR_ASSERT(grpc_compression_algorithm_parse(
@@ -51,9 +51,9 @@ static void test_algorithm_mesh(void) {
mdelem = grpc_compression_encoding_mdelem(parsed);
GPR_ASSERT(grpc_slice_eq(GRPC_MDVALUE(mdelem), mdstr));
GPR_ASSERT(grpc_slice_eq(GRPC_MDKEY(mdelem), GRPC_MDSTR_GRPC_ENCODING));
- grpc_slice_unref_internal(&exec_ctx, mdstr);
- GRPC_MDELEM_UNREF(&exec_ctx, mdelem);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_slice_unref_internal(mdstr);
+ GRPC_MDELEM_UNREF(mdelem);
+ grpc_exec_ctx_finish();
}
/* test failure */
@@ -62,7 +62,7 @@ static void test_algorithm_mesh(void) {
}
static void test_algorithm_failure(void) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_slice mdstr;
gpr_log(GPR_DEBUG, "test_algorithm_failure");
@@ -80,8 +80,8 @@ static void test_algorithm_failure(void) {
GPR_ASSERT(grpc_slice_eq(
grpc_compression_algorithm_slice(GRPC_COMPRESS_ALGORITHMS_COUNT + 1),
grpc_empty_slice()));
- grpc_slice_unref_internal(&exec_ctx, mdstr);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_slice_unref_internal(mdstr);
+ grpc_exec_ctx_finish();
}
int main(int argc, char **argv) {
diff --git a/test/core/compression/message_compress_test.c b/test/core/compression/message_compress_test.c
index f7f4893dee..641e8f8900 100644
--- a/test/core/compression/message_compress_test.c
+++ b/test/core/compression/message_compress_test.c
@@ -69,10 +69,9 @@ static void assert_passthrough(grpc_slice value,
grpc_split_slices_to_buffer(uncompressed_split_mode, &value, 1, &input);
{
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- was_compressed =
- grpc_msg_compress(&exec_ctx, algorithm, &input, &compressed_raw);
- grpc_exec_ctx_finish(&exec_ctx);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ was_compressed = grpc_msg_compress(algorithm, &input, &compressed_raw);
+ grpc_exec_ctx_finish();
}
GPR_ASSERT(input.count > 0);
@@ -91,11 +90,10 @@ static void assert_passthrough(grpc_slice value,
grpc_split_slice_buffer(compressed_split_mode, &compressed_raw, &compressed);
{
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
GPR_ASSERT(grpc_msg_decompress(
- &exec_ctx, was_compressed ? algorithm : GRPC_COMPRESS_NONE, &compressed,
- &output));
- grpc_exec_ctx_finish(&exec_ctx);
+ was_compressed ? algorithm : GRPC_COMPRESS_NONE, &compressed, &output));
+ grpc_exec_ctx_finish();
}
final = grpc_slice_merge(output.slices, output.count);
@@ -156,9 +154,9 @@ static void test_tiny_data_compress(void) {
for (i = 0; i < GRPC_COMPRESS_ALGORITHMS_COUNT; i++) {
if (i == GRPC_COMPRESS_NONE) continue;
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- GPR_ASSERT(0 == grpc_msg_compress(&exec_ctx, i, &input, &output));
- grpc_exec_ctx_finish(&exec_ctx);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ GPR_ASSERT(0 == grpc_msg_compress(i, &input, &output));
+ grpc_exec_ctx_finish();
GPR_ASSERT(1 == output.count);
}
@@ -178,9 +176,9 @@ static void test_bad_decompression_data_crc(void) {
grpc_slice_buffer_init(&output);
grpc_slice_buffer_add(&input, create_test_value(ONE_MB_A));
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
/* compress it */
- grpc_msg_compress(&exec_ctx, GRPC_COMPRESS_GZIP, &input, &corrupted);
+ grpc_msg_compress(GRPC_COMPRESS_GZIP, &input, &corrupted);
/* corrupt the output by smashing the CRC */
GPR_ASSERT(corrupted.count > 1);
GPR_ASSERT(GRPC_SLICE_LENGTH(corrupted.slices[1]) > 8);
@@ -188,9 +186,8 @@ static void test_bad_decompression_data_crc(void) {
memcpy(GRPC_SLICE_START_PTR(corrupted.slices[1]) + idx, &bad, 4);
/* try (and fail) to decompress the corrupted compresed buffer */
- GPR_ASSERT(0 == grpc_msg_decompress(&exec_ctx, GRPC_COMPRESS_GZIP, &corrupted,
- &output));
- grpc_exec_ctx_finish(&exec_ctx);
+ 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);
@@ -209,10 +206,9 @@ static void test_bad_decompression_data_trailing_garbage(void) {
"\x78\xda\x63\x60\x60\x60\x00\x00\x00\x04\x00\x01\x99", 13));
/* try (and fail) to decompress the invalid compresed buffer */
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- GPR_ASSERT(0 == grpc_msg_decompress(&exec_ctx, GRPC_COMPRESS_DEFLATE, &input,
- &output));
- grpc_exec_ctx_finish(&exec_ctx);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ 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,10 +224,9 @@ static void test_bad_decompression_data_stream(void) {
grpc_slice_from_copied_buffer("\x78\xda\xff\xff", 4));
/* try (and fail) to decompress the invalid compresed buffer */
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- GPR_ASSERT(0 == grpc_msg_decompress(&exec_ctx, GRPC_COMPRESS_DEFLATE, &input,
- &output));
- grpc_exec_ctx_finish(&exec_ctx);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ 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);
@@ -247,15 +242,15 @@ static void test_bad_compression_algorithm(void) {
grpc_slice_buffer_add(
&input, grpc_slice_from_copied_string("Never gonna give you up"));
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- was_compressed = grpc_msg_compress(&exec_ctx, GRPC_COMPRESS_ALGORITHMS_COUNT,
- &input, &output);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ was_compressed =
+ grpc_msg_compress(GRPC_COMPRESS_ALGORITHMS_COUNT, &input, &output);
GPR_ASSERT(0 == was_compressed);
- was_compressed = grpc_msg_compress(
- &exec_ctx, GRPC_COMPRESS_ALGORITHMS_COUNT + 123, &input, &output);
+ was_compressed =
+ grpc_msg_compress(GRPC_COMPRESS_ALGORITHMS_COUNT + 123, &input, &output);
GPR_ASSERT(0 == was_compressed);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_exec_ctx_finish();
grpc_slice_buffer_destroy(&input);
grpc_slice_buffer_destroy(&output);
@@ -271,15 +266,15 @@ static void test_bad_decompression_algorithm(void) {
grpc_slice_buffer_add(&input,
grpc_slice_from_copied_string(
"I'm not really compressed but it doesn't matter"));
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- was_decompressed = grpc_msg_decompress(
- &exec_ctx, GRPC_COMPRESS_ALGORITHMS_COUNT, &input, &output);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ was_decompressed =
+ grpc_msg_decompress(GRPC_COMPRESS_ALGORITHMS_COUNT, &input, &output);
GPR_ASSERT(0 == was_decompressed);
- was_decompressed = grpc_msg_decompress(
- &exec_ctx, GRPC_COMPRESS_ALGORITHMS_COUNT + 123, &input, &output);
+ was_decompressed = grpc_msg_decompress(GRPC_COMPRESS_ALGORITHMS_COUNT + 123,
+ &input, &output);
GPR_ASSERT(0 == was_decompressed);
- grpc_exec_ctx_finish(&exec_ctx);
+ 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 c85ab3598a..ac7c3af8a4 100644
--- a/test/core/debug/stats_test.cc
+++ b/test/core/debug/stats_test.cc
@@ -47,9 +47,9 @@ TEST(StatsTest, IncCounters) {
for (int i = 0; i < GRPC_STATS_COUNTER_COUNT; i++) {
Snapshot snapshot;
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- GRPC_STATS_INC_COUNTER(&exec_ctx, (grpc_stats_counters)i);
- grpc_exec_ctx_finish(&exec_ctx);
+ ExecCtx _local_exec_ctx;
+ GRPC_STATS_INC_COUNTER((grpc_stats_counters)i);
+ grpc_exec_ctx_finish();
EXPECT_EQ(snapshot.delta().counters[i], 1);
}
@@ -58,9 +58,9 @@ TEST(StatsTest, IncCounters) {
TEST(StatsTest, IncSpecificCounter) {
Snapshot snapshot;
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- GRPC_STATS_INC_SYSCALL_POLL(&exec_ctx);
- grpc_exec_ctx_finish(&exec_ctx);
+ ExecCtx _local_exec_ctx;
+ GRPC_STATS_INC_SYSCALL_POLL();
+ grpc_exec_ctx_finish();
EXPECT_EQ(snapshot.delta().counters[GRPC_STATS_COUNTER_SYSCALL_POLL], 1);
}
@@ -99,9 +99,9 @@ TEST(StatsTest, IncHistogram) {
int expected_bucket = FindExpectedBucket(i, j);
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ ExecCtx _local_exec_ctx;
grpc_stats_inc_histogram[i](&exec_ctx, j);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_exec_ctx_finish();
auto delta = snapshot.delta();
diff --git a/test/core/end2end/bad_server_response_test.c b/test/core/end2end/bad_server_response_test.cc
index 2070fa5b02..aa4f0e13d7 100644
--- a/test/core/end2end/bad_server_response_test.c
+++ b/test/core/end2end/bad_server_response_test.cc
@@ -91,22 +91,22 @@ static grpc_closure on_write;
static void *tag(intptr_t t) { return (void *)t; }
-static void done_write(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) {
+static void done_write(void *arg, grpc_error *error) {
GPR_ASSERT(error == GRPC_ERROR_NONE);
gpr_atm_rel_store(&state.done_atm, 1);
}
-static void handle_write(grpc_exec_ctx *exec_ctx) {
+static void handle_write() {
grpc_slice slice = grpc_slice_from_copied_buffer(
state.response_payload, state.response_payload_length);
grpc_slice_buffer_reset_and_unref(&state.outgoing_buffer);
grpc_slice_buffer_add(&state.outgoing_buffer, slice);
- grpc_endpoint_write(exec_ctx, state.tcp, &state.outgoing_buffer, &on_write);
+ grpc_endpoint_write(state.tcp, &state.outgoing_buffer, &on_write);
}
-static void handle_read(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) {
+static void handle_read(void *arg, grpc_error *error) {
GPR_ASSERT(error == GRPC_ERROR_NONE);
state.incoming_data_length += state.temp_incoming_buffer.length;
@@ -123,14 +123,13 @@ static void handle_read(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) {
SERVER_INCOMING_DATA_LENGTH_LOWER_THRESHOLD);
if (state.incoming_data_length >=
SERVER_INCOMING_DATA_LENGTH_LOWER_THRESHOLD) {
- handle_write(exec_ctx);
+ handle_write();
} else {
- grpc_endpoint_read(exec_ctx, state.tcp, &state.temp_incoming_buffer,
- &on_read);
+ grpc_endpoint_read(state.tcp, &state.temp_incoming_buffer, &on_read);
}
}
-static void on_connect(grpc_exec_ctx *exec_ctx, void *arg, grpc_endpoint *tcp,
+static void on_connect(void *arg, grpc_endpoint *tcp,
grpc_pollset *accepting_pollset,
grpc_tcp_server_acceptor *acceptor) {
gpr_free(acceptor);
@@ -141,8 +140,8 @@ static void on_connect(grpc_exec_ctx *exec_ctx, void *arg, grpc_endpoint *tcp,
grpc_slice_buffer_init(&state.outgoing_buffer);
state.tcp = tcp;
state.incoming_data_length = 0;
- grpc_endpoint_add_to_pollset(exec_ctx, tcp, server->pollset);
- grpc_endpoint_read(exec_ctx, tcp, &state.temp_incoming_buffer, &on_read);
+ grpc_endpoint_add_to_pollset(tcp, server->pollset);
+ grpc_endpoint_read(tcp, &state.temp_incoming_buffer, &on_read);
}
static gpr_timespec n_sec_deadline(int seconds) {
@@ -217,10 +216,10 @@ static void start_rpc(int target_port, grpc_status_code expected_status,
cq_verifier_destroy(cqv);
}
-static void cleanup_rpc(grpc_exec_ctx *exec_ctx) {
+static void cleanup_rpc() {
grpc_event ev;
- grpc_slice_buffer_destroy_internal(exec_ctx, &state.temp_incoming_buffer);
- grpc_slice_buffer_destroy_internal(exec_ctx, &state.outgoing_buffer);
+ grpc_slice_buffer_destroy_internal(&state.temp_incoming_buffer);
+ grpc_slice_buffer_destroy_internal(&state.outgoing_buffer);
grpc_call_unref(state.call);
grpc_completion_queue_shutdown(state.cq);
do {
@@ -270,7 +269,7 @@ static void run_test(const char *response_payload,
grpc_status_code expected_status,
const char *expected_detail) {
test_tcp_server test_server;
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ ExecCtx _local_exec_ctx;
gpr_event ev;
grpc_init();
@@ -287,11 +286,11 @@ static void run_test(const char *response_payload,
gpr_event_wait(&ev, gpr_inf_future(GPR_CLOCK_REALTIME));
/* clean up */
- grpc_endpoint_shutdown(&exec_ctx, state.tcp,
+ grpc_endpoint_shutdown(state.tcp,
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Test Shutdown"));
- grpc_endpoint_destroy(&exec_ctx, state.tcp);
- cleanup_rpc(&exec_ctx);
- grpc_exec_ctx_finish(&exec_ctx);
+ 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.c b/test/core/end2end/connection_refused_test.c
index 40227dece4..c851271e44 100644
--- a/test/core/end2end/connection_refused_test.c
+++ b/test/core/end2end/connection_refused_test.c
@@ -131,9 +131,9 @@ static void run_test(bool wait_for_ready, bool use_service_config) {
grpc_metadata_array_destroy(&trailing_metadata_recv);
{
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- if (args != NULL) grpc_channel_args_destroy(&exec_ctx, args);
- grpc_exec_ctx_finish(&exec_ctx);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ if (args != NULL) grpc_channel_args_destroy(args);
+ grpc_exec_ctx_finish();
}
grpc_shutdown();
diff --git a/test/core/end2end/fixtures/h2_census.c b/test/core/end2end/fixtures/h2_census.c
index 9870ccb34a..325615c835 100644
--- a/test/core/end2end/fixtures/h2_census.c
+++ b/test/core/end2end/fixtures/h2_census.c
@@ -72,9 +72,9 @@ void chttp2_init_client_fullstack(grpc_end2end_test_fixture *f,
f->client = grpc_insecure_channel_create(ffd->localaddr, client_args, NULL);
GPR_ASSERT(f->client);
{
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_channel_args_destroy(&exec_ctx, client_args);
- grpc_exec_ctx_finish(&exec_ctx);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_channel_args_destroy(client_args);
+ grpc_exec_ctx_finish();
}
}
@@ -88,9 +88,9 @@ void chttp2_init_server_fullstack(grpc_end2end_test_fixture *f,
server_args = grpc_channel_args_copy_and_add(server_args, &arg, 1);
f->server = grpc_server_create(server_args, NULL);
{
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_channel_args_destroy(&exec_ctx, server_args);
- grpc_exec_ctx_finish(&exec_ctx);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ 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.c b/test/core/end2end/fixtures/h2_compress.c
index 9866dea7eb..1476224af0 100644
--- a/test/core/end2end/fixtures/h2_compress.c
+++ b/test/core/end2end/fixtures/h2_compress.c
@@ -64,9 +64,9 @@ void chttp2_init_client_fullstack_compression(grpc_end2end_test_fixture *f,
grpc_channel_args *client_args) {
fullstack_compression_fixture_data *ffd = f->fixture_data;
if (ffd->client_args_compression != NULL) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_channel_args_destroy(&exec_ctx, ffd->client_args_compression);
- grpc_exec_ctx_finish(&exec_ctx);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ 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);
@@ -78,9 +78,9 @@ void chttp2_init_server_fullstack_compression(grpc_end2end_test_fixture *f,
grpc_channel_args *server_args) {
fullstack_compression_fixture_data *ffd = f->fixture_data;
if (ffd->server_args_compression != NULL) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_channel_args_destroy(&exec_ctx, ffd->server_args_compression);
- grpc_exec_ctx_finish(&exec_ctx);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ 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);
@@ -94,13 +94,13 @@ void chttp2_init_server_fullstack_compression(grpc_end2end_test_fixture *f,
}
void chttp2_tear_down_fullstack_compression(grpc_end2end_test_fixture *f) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
fullstack_compression_fixture_data *ffd = f->fixture_data;
- grpc_channel_args_destroy(&exec_ctx, ffd->client_args_compression);
- grpc_channel_args_destroy(&exec_ctx, ffd->server_args_compression);
+ grpc_channel_args_destroy(ffd->client_args_compression);
+ grpc_channel_args_destroy(ffd->server_args_compression);
gpr_free(ffd->localaddr);
gpr_free(ffd);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_exec_ctx_finish();
}
/* All test configurations */
diff --git a/test/core/end2end/fixtures/h2_fd.c b/test/core/end2end/fixtures/h2_fd.c
index e82c120221..cc7ec7ac6e 100644
--- a/test/core/end2end/fixtures/h2_fd.c
+++ b/test/core/end2end/fixtures/h2_fd.c
@@ -65,7 +65,7 @@ static grpc_end2end_test_fixture chttp2_create_fixture_socketpair(
static void chttp2_init_client_socketpair(grpc_end2end_test_fixture *f,
grpc_channel_args *client_args) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
sp_fixture_data *sfd = f->fixture_data;
GPR_ASSERT(!f->client);
@@ -73,12 +73,12 @@ static void chttp2_init_client_socketpair(grpc_end2end_test_fixture *f,
"fixture_client", sfd->fd_pair[0], client_args);
GPR_ASSERT(f->client);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_exec_ctx_finish();
}
static void chttp2_init_server_socketpair(grpc_end2end_test_fixture *f,
grpc_channel_args *server_args) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
sp_fixture_data *sfd = f->fixture_data;
GPR_ASSERT(!f->server);
f->server = grpc_server_create(server_args, NULL);
@@ -88,7 +88,7 @@ static void chttp2_init_server_socketpair(grpc_end2end_test_fixture *f,
grpc_server_add_insecure_channel_from_fd(f->server, NULL, sfd->fd_pair[1]);
- grpc_exec_ctx_finish(&exec_ctx);
+ 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.c b/test/core/end2end/fixtures/h2_full+workarounds.c
index a98e5ad57f..f9d2f033cb 100644
--- a/test/core/end2end/fixtures/h2_full+workarounds.c
+++ b/test/core/end2end/fixtures/h2_full+workarounds.c
@@ -69,7 +69,7 @@ void chttp2_init_client_fullstack(grpc_end2end_test_fixture *f,
void chttp2_init_server_fullstack(grpc_end2end_test_fixture *f,
grpc_channel_args *server_args) {
int i;
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
fullstack_fixture_data *ffd = f->fixture_data;
grpc_arg args[GRPC_MAX_WORKAROUND_ID];
for (i = 0; i < GRPC_MAX_WORKAROUND_ID; i++) {
@@ -86,8 +86,8 @@ void chttp2_init_server_fullstack(grpc_end2end_test_fixture *f,
grpc_server_register_completion_queue(f->server, f->cq, NULL);
GPR_ASSERT(grpc_server_add_insecure_http2_port(f->server, ffd->localaddr));
grpc_server_start(f->server);
- grpc_channel_args_destroy(&exec_ctx, server_args_new);
- grpc_exec_ctx_finish(&exec_ctx);
+ 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.c b/test/core/end2end/fixtures/h2_load_reporting.c
index 8a05bb722a..5218b38e6a 100644
--- a/test/core/end2end/fixtures/h2_load_reporting.c
+++ b/test/core/end2end/fixtures/h2_load_reporting.c
@@ -75,9 +75,9 @@ void chttp2_init_server_load_reporting(grpc_end2end_test_fixture *f,
server_args = grpc_channel_args_copy_and_add(server_args, &arg, 1);
f->server = grpc_server_create(server_args, NULL);
{
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_channel_args_destroy(&exec_ctx, server_args);
- grpc_exec_ctx_finish(&exec_ctx);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ 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.c b/test/core/end2end/fixtures/h2_oauth2.c
index ee1d0b1416..d3660b26b4 100644
--- a/test/core/end2end/fixtures/h2_oauth2.c
+++ b/test/core/end2end/fixtures/h2_oauth2.c
@@ -137,11 +137,11 @@ void chttp2_tear_down_secure_fullstack(grpc_end2end_test_fixture *f) {
static void chttp2_init_client_simple_ssl_with_oauth2_secure_fullstack(
grpc_end2end_test_fixture *f, grpc_channel_args *client_args) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_channel_credentials *ssl_creds =
grpc_ssl_credentials_create(test_root_cert, NULL, NULL);
grpc_call_credentials *oauth2_creds = grpc_md_only_test_credentials_create(
- &exec_ctx, "authorization", oauth2_md, true /* is_async */);
+ "authorization", oauth2_md, true /* is_async */);
grpc_channel_credentials *ssl_oauth2_creds =
grpc_composite_channel_credentials_create(ssl_creds, oauth2_creds, NULL);
grpc_arg ssl_name_override = {GRPC_ARG_STRING,
@@ -150,10 +150,10 @@ static void chttp2_init_client_simple_ssl_with_oauth2_secure_fullstack(
grpc_channel_args *new_client_args =
grpc_channel_args_copy_and_add(client_args, &ssl_name_override, 1);
chttp2_init_client_secure_fullstack(f, new_client_args, ssl_oauth2_creds);
- grpc_channel_args_destroy(&exec_ctx, new_client_args);
+ grpc_channel_args_destroy(new_client_args);
grpc_channel_credentials_release(ssl_creds);
grpc_call_credentials_release(oauth2_creds);
- grpc_exec_ctx_finish(&exec_ctx);
+ 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.c b/test/core/end2end/fixtures/h2_sockpair+trace.c
index 39ccb84b52..e34f45a573 100644
--- a/test/core/end2end/fixtures/h2_sockpair+trace.c
+++ b/test/core/end2end/fixtures/h2_sockpair+trace.c
@@ -50,12 +50,12 @@
static void server_setup_transport(void *ts, grpc_transport *transport) {
grpc_end2end_test_fixture *f = ts;
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_endpoint_pair *sfd = f->fixture_data;
- grpc_endpoint_add_to_pollset(&exec_ctx, sfd->server, grpc_cq_pollset(f->cq));
- grpc_server_setup_transport(&exec_ctx, f->server, transport, NULL,
+ grpc_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(&exec_ctx);
+ grpc_exec_ctx_finish();
}
typedef struct {
@@ -63,13 +63,11 @@ typedef struct {
grpc_channel_args *client_args;
} sp_client_setup;
-static void client_setup_transport(grpc_exec_ctx *exec_ctx, void *ts,
- grpc_transport *transport) {
+static void client_setup_transport(void *ts, grpc_transport *transport) {
sp_client_setup *cs = ts;
- cs->f->client =
- grpc_channel_create(exec_ctx, "socketpair-target", cs->client_args,
- GRPC_CLIENT_DIRECT_CHANNEL, transport);
+ cs->f->client = grpc_channel_create("socketpair-target", cs->client_args,
+ GRPC_CLIENT_DIRECT_CHANNEL, transport);
}
static grpc_end2end_test_fixture chttp2_create_fixture_socketpair(
@@ -89,34 +87,32 @@ static grpc_end2end_test_fixture chttp2_create_fixture_socketpair(
static void chttp2_init_client_socketpair(grpc_end2end_test_fixture *f,
grpc_channel_args *client_args) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_endpoint_pair *sfd = f->fixture_data;
grpc_transport *transport;
sp_client_setup cs;
cs.client_args = client_args;
cs.f = f;
- transport =
- grpc_create_chttp2_transport(&exec_ctx, client_args, sfd->client, 1);
- client_setup_transport(&exec_ctx, &cs, transport);
+ transport = grpc_create_chttp2_transport(client_args, sfd->client, 1);
+ client_setup_transport(&cs, transport);
GPR_ASSERT(f->client);
- grpc_chttp2_transport_start_reading(&exec_ctx, transport, NULL);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_chttp2_transport_start_reading(transport, NULL);
+ grpc_exec_ctx_finish();
}
static void chttp2_init_server_socketpair(grpc_end2end_test_fixture *f,
grpc_channel_args *server_args) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_endpoint_pair *sfd = f->fixture_data;
grpc_transport *transport;
GPR_ASSERT(!f->server);
f->server = grpc_server_create(server_args, NULL);
grpc_server_register_completion_queue(f->server, f->cq, NULL);
grpc_server_start(f->server);
- transport =
- grpc_create_chttp2_transport(&exec_ctx, server_args, sfd->server, 0);
+ transport = grpc_create_chttp2_transport(server_args, sfd->server, 0);
server_setup_transport(f, transport);
- grpc_chttp2_transport_start_reading(&exec_ctx, transport, NULL);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_chttp2_transport_start_reading(transport, NULL);
+ grpc_exec_ctx_finish();
}
static void chttp2_tear_down_socketpair(grpc_end2end_test_fixture *f) {
@@ -132,7 +128,7 @@ static grpc_end2end_test_config configs[] = {
int main(int argc, char **argv) {
size_t i;
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
/* force tracing on, with a value to force many
code paths in trace.c to be taken */
@@ -146,7 +142,7 @@ int main(int argc, char **argv) {
grpc_test_init(argc, argv);
grpc_end2end_tests_pre_init();
grpc_init();
- grpc_exec_ctx_finish(&exec_ctx);
+ 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.c b/test/core/end2end/fixtures/h2_sockpair.c
index 03566ead9b..37bda654cf 100644
--- a/test/core/end2end/fixtures/h2_sockpair.c
+++ b/test/core/end2end/fixtures/h2_sockpair.c
@@ -44,12 +44,12 @@
static void server_setup_transport(void *ts, grpc_transport *transport) {
grpc_end2end_test_fixture *f = ts;
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_endpoint_pair *sfd = f->fixture_data;
- grpc_endpoint_add_to_pollset(&exec_ctx, sfd->server, grpc_cq_pollset(f->cq));
- grpc_server_setup_transport(&exec_ctx, f->server, transport, NULL,
+ grpc_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(&exec_ctx);
+ grpc_exec_ctx_finish();
}
typedef struct {
@@ -57,13 +57,11 @@ typedef struct {
grpc_channel_args *client_args;
} sp_client_setup;
-static void client_setup_transport(grpc_exec_ctx *exec_ctx, void *ts,
- grpc_transport *transport) {
+static void client_setup_transport(void *ts, grpc_transport *transport) {
sp_client_setup *cs = ts;
- cs->f->client =
- grpc_channel_create(exec_ctx, "socketpair-target", cs->client_args,
- GRPC_CLIENT_DIRECT_CHANNEL, transport);
+ cs->f->client = grpc_channel_create("socketpair-target", cs->client_args,
+ GRPC_CLIENT_DIRECT_CHANNEL, transport);
}
static grpc_end2end_test_fixture chttp2_create_fixture_socketpair(
@@ -83,34 +81,32 @@ static grpc_end2end_test_fixture chttp2_create_fixture_socketpair(
static void chttp2_init_client_socketpair(grpc_end2end_test_fixture *f,
grpc_channel_args *client_args) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_endpoint_pair *sfd = f->fixture_data;
grpc_transport *transport;
sp_client_setup cs;
cs.client_args = client_args;
cs.f = f;
- transport =
- grpc_create_chttp2_transport(&exec_ctx, client_args, sfd->client, 1);
- client_setup_transport(&exec_ctx, &cs, transport);
+ transport = grpc_create_chttp2_transport(client_args, sfd->client, 1);
+ client_setup_transport(&cs, transport);
GPR_ASSERT(f->client);
- grpc_chttp2_transport_start_reading(&exec_ctx, transport, NULL);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_chttp2_transport_start_reading(transport, NULL);
+ grpc_exec_ctx_finish();
}
static void chttp2_init_server_socketpair(grpc_end2end_test_fixture *f,
grpc_channel_args *server_args) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_endpoint_pair *sfd = f->fixture_data;
grpc_transport *transport;
GPR_ASSERT(!f->server);
f->server = grpc_server_create(server_args, NULL);
grpc_server_register_completion_queue(f->server, f->cq, NULL);
grpc_server_start(f->server);
- transport =
- grpc_create_chttp2_transport(&exec_ctx, server_args, sfd->server, 0);
+ transport = grpc_create_chttp2_transport(server_args, sfd->server, 0);
server_setup_transport(f, transport);
- grpc_chttp2_transport_start_reading(&exec_ctx, transport, NULL);
- grpc_exec_ctx_finish(&exec_ctx);
+ 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.c b/test/core/end2end/fixtures/h2_sockpair_1byte.c
index c75a3876d5..fc58dad59f 100644
--- a/test/core/end2end/fixtures/h2_sockpair_1byte.c
+++ b/test/core/end2end/fixtures/h2_sockpair_1byte.c
@@ -44,12 +44,12 @@
static void server_setup_transport(void *ts, grpc_transport *transport) {
grpc_end2end_test_fixture *f = ts;
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_endpoint_pair *sfd = f->fixture_data;
- grpc_endpoint_add_to_pollset(&exec_ctx, sfd->server, grpc_cq_pollset(f->cq));
- grpc_server_setup_transport(&exec_ctx, f->server, transport, NULL,
+ grpc_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(&exec_ctx);
+ grpc_exec_ctx_finish();
}
typedef struct {
@@ -57,13 +57,11 @@ typedef struct {
grpc_channel_args *client_args;
} sp_client_setup;
-static void client_setup_transport(grpc_exec_ctx *exec_ctx, void *ts,
- grpc_transport *transport) {
+static void client_setup_transport(void *ts, grpc_transport *transport) {
sp_client_setup *cs = ts;
- cs->f->client =
- grpc_channel_create(exec_ctx, "socketpair-target", cs->client_args,
- GRPC_CLIENT_DIRECT_CHANNEL, transport);
+ cs->f->client = grpc_channel_create("socketpair-target", cs->client_args,
+ GRPC_CLIENT_DIRECT_CHANNEL, transport);
}
static grpc_end2end_test_fixture chttp2_create_fixture_socketpair(
@@ -93,34 +91,32 @@ static grpc_end2end_test_fixture chttp2_create_fixture_socketpair(
static void chttp2_init_client_socketpair(grpc_end2end_test_fixture *f,
grpc_channel_args *client_args) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_endpoint_pair *sfd = f->fixture_data;
grpc_transport *transport;
sp_client_setup cs;
cs.client_args = client_args;
cs.f = f;
- transport =
- grpc_create_chttp2_transport(&exec_ctx, client_args, sfd->client, 1);
- client_setup_transport(&exec_ctx, &cs, transport);
+ transport = grpc_create_chttp2_transport(client_args, sfd->client, 1);
+ client_setup_transport(&cs, transport);
GPR_ASSERT(f->client);
- grpc_chttp2_transport_start_reading(&exec_ctx, transport, NULL);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_chttp2_transport_start_reading(transport, NULL);
+ grpc_exec_ctx_finish();
}
static void chttp2_init_server_socketpair(grpc_end2end_test_fixture *f,
grpc_channel_args *server_args) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_endpoint_pair *sfd = f->fixture_data;
grpc_transport *transport;
GPR_ASSERT(!f->server);
f->server = grpc_server_create(server_args, NULL);
grpc_server_register_completion_queue(f->server, f->cq, NULL);
grpc_server_start(f->server);
- transport =
- grpc_create_chttp2_transport(&exec_ctx, server_args, sfd->server, 0);
+ transport = grpc_create_chttp2_transport(server_args, sfd->server, 0);
server_setup_transport(f, transport);
- grpc_chttp2_transport_start_reading(&exec_ctx, transport, NULL);
- grpc_exec_ctx_finish(&exec_ctx);
+ 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.c b/test/core/end2end/fixtures/h2_ssl.c
index 0bac464e69..3262a588c2 100644
--- a/test/core/end2end/fixtures/h2_ssl.c
+++ b/test/core/end2end/fixtures/h2_ssl.c
@@ -105,9 +105,9 @@ static void chttp2_init_client_simple_ssl_secure_fullstack(
grpc_channel_args_copy_and_add(client_args, &ssl_name_override, 1);
chttp2_init_client_secure_fullstack(f, new_client_args, ssl_creds);
{
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_channel_args_destroy(&exec_ctx, new_client_args);
- grpc_exec_ctx_finish(&exec_ctx);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_channel_args_destroy(new_client_args);
+ grpc_exec_ctx_finish();
}
}
diff --git a/test/core/end2end/fixtures/h2_ssl_proxy.c b/test/core/end2end/fixtures/h2_ssl_proxy.c
index 8bc7183510..21de427c5e 100644
--- a/test/core/end2end/fixtures/h2_ssl_proxy.c
+++ b/test/core/end2end/fixtures/h2_ssl_proxy.c
@@ -65,9 +65,9 @@ static grpc_channel *create_proxy_client(const char *target,
grpc_secure_channel_create(ssl_creds, target, new_client_args, NULL);
grpc_channel_credentials_release(ssl_creds);
{
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_channel_args_destroy(&exec_ctx, new_client_args);
- grpc_exec_ctx_finish(&exec_ctx);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_channel_args_destroy(new_client_args);
+ grpc_exec_ctx_finish();
}
return channel;
}
@@ -142,9 +142,9 @@ static void chttp2_init_client_simple_ssl_secure_fullstack(
grpc_channel_args_copy_and_add(client_args, &ssl_name_override, 1);
chttp2_init_client_secure_fullstack(f, new_client_args, ssl_creds);
{
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_channel_args_destroy(&exec_ctx, new_client_args);
- grpc_exec_ctx_finish(&exec_ctx);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_channel_args_destroy(new_client_args);
+ grpc_exec_ctx_finish();
}
}
diff --git a/test/core/end2end/fixtures/http_proxy_fixture.c b/test/core/end2end/fixtures/http_proxy_fixture.cc
index d29401fdc3..b3ec44d77b 100644
--- a/test/core/end2end/fixtures/http_proxy_fixture.c
+++ b/test/core/end2end/fixtures/http_proxy_fixture.cc
@@ -102,24 +102,21 @@ static void proxy_connection_ref(proxy_connection* conn, const char* reason) {
}
// Helper function to destroy the proxy connection.
-static void proxy_connection_unref(grpc_exec_ctx* exec_ctx,
- proxy_connection* conn, const char* reason) {
+static void proxy_connection_unref(proxy_connection* conn, const char* reason) {
if (gpr_unref(&conn->refcount)) {
gpr_log(GPR_DEBUG, "endpoints: %p %p", conn->client_endpoint,
conn->server_endpoint);
- grpc_endpoint_destroy(exec_ctx, conn->client_endpoint);
+ grpc_endpoint_destroy(conn->client_endpoint);
if (conn->server_endpoint != NULL) {
- grpc_endpoint_destroy(exec_ctx, conn->server_endpoint);
+ grpc_endpoint_destroy(conn->server_endpoint);
}
- grpc_pollset_set_destroy(exec_ctx, conn->pollset_set);
- grpc_slice_buffer_destroy_internal(exec_ctx, &conn->client_read_buffer);
- grpc_slice_buffer_destroy_internal(exec_ctx,
- &conn->client_deferred_write_buffer);
- grpc_slice_buffer_destroy_internal(exec_ctx, &conn->client_write_buffer);
- grpc_slice_buffer_destroy_internal(exec_ctx, &conn->server_read_buffer);
- grpc_slice_buffer_destroy_internal(exec_ctx,
- &conn->server_deferred_write_buffer);
- grpc_slice_buffer_destroy_internal(exec_ctx, &conn->server_write_buffer);
+ grpc_pollset_set_destroy(conn->pollset_set);
+ grpc_slice_buffer_destroy_internal(&conn->client_read_buffer);
+ grpc_slice_buffer_destroy_internal(&conn->client_deferred_write_buffer);
+ grpc_slice_buffer_destroy_internal(&conn->client_write_buffer);
+ grpc_slice_buffer_destroy_internal(&conn->server_read_buffer);
+ grpc_slice_buffer_destroy_internal(&conn->server_deferred_write_buffer);
+ grpc_slice_buffer_destroy_internal(&conn->server_write_buffer);
grpc_http_parser_destroy(&conn->http_parser);
grpc_http_request_destroy(&conn->http_request);
gpr_unref(&conn->proxy->users);
@@ -129,27 +126,23 @@ static void proxy_connection_unref(grpc_exec_ctx* exec_ctx,
// Helper function to shut down the proxy connection.
// Does NOT take ownership of a reference to error.
-static void proxy_connection_failed(grpc_exec_ctx* exec_ctx,
- proxy_connection* conn, bool is_client,
+static void proxy_connection_failed(proxy_connection* conn, bool is_client,
const char* prefix, grpc_error* error) {
const char* msg = grpc_error_string(error);
gpr_log(GPR_INFO, "%s: %s", prefix, msg);
- grpc_endpoint_shutdown(exec_ctx, conn->client_endpoint,
- GRPC_ERROR_REF(error));
+ grpc_endpoint_shutdown(conn->client_endpoint, GRPC_ERROR_REF(error));
if (conn->server_endpoint != NULL) {
- grpc_endpoint_shutdown(exec_ctx, conn->server_endpoint,
- GRPC_ERROR_REF(error));
+ grpc_endpoint_shutdown(conn->server_endpoint, GRPC_ERROR_REF(error));
}
- proxy_connection_unref(exec_ctx, conn, "conn_failed");
+ proxy_connection_unref(conn, "conn_failed");
}
// Callback for writing proxy data to the client.
-static void on_client_write_done(grpc_exec_ctx* exec_ctx, void* arg,
- grpc_error* error) {
+static void on_client_write_done(void* arg, grpc_error* error) {
proxy_connection* conn = (proxy_connection*)arg;
if (error != GRPC_ERROR_NONE) {
- proxy_connection_failed(exec_ctx, conn, true /* is_client */,
+ proxy_connection_failed(conn, true /* is_client */,
"HTTP proxy client write", error);
return;
}
@@ -160,21 +153,19 @@ static void on_client_write_done(grpc_exec_ctx* exec_ctx, void* arg,
if (conn->client_deferred_write_buffer.length > 0) {
grpc_slice_buffer_move_into(&conn->client_deferred_write_buffer,
&conn->client_write_buffer);
- grpc_endpoint_write(exec_ctx, conn->client_endpoint,
- &conn->client_write_buffer,
+ grpc_endpoint_write(conn->client_endpoint, &conn->client_write_buffer,
&conn->on_client_write_done);
} else {
// No more writes. Unref the connection.
- proxy_connection_unref(exec_ctx, conn, "write_done");
+ proxy_connection_unref(conn, "write_done");
}
}
// Callback for writing proxy data to the backend server.
-static void on_server_write_done(grpc_exec_ctx* exec_ctx, void* arg,
- grpc_error* error) {
+static void on_server_write_done(void* arg, grpc_error* error) {
proxy_connection* conn = (proxy_connection*)arg;
if (error != GRPC_ERROR_NONE) {
- proxy_connection_failed(exec_ctx, conn, false /* is_client */,
+ proxy_connection_failed(conn, false /* is_client */,
"HTTP proxy server write", error);
return;
}
@@ -185,22 +176,20 @@ static void on_server_write_done(grpc_exec_ctx* exec_ctx, void* arg,
if (conn->server_deferred_write_buffer.length > 0) {
grpc_slice_buffer_move_into(&conn->server_deferred_write_buffer,
&conn->server_write_buffer);
- grpc_endpoint_write(exec_ctx, conn->server_endpoint,
- &conn->server_write_buffer,
+ grpc_endpoint_write(conn->server_endpoint, &conn->server_write_buffer,
&conn->on_server_write_done);
} else {
// No more writes. Unref the connection.
- proxy_connection_unref(exec_ctx, conn, "server_write");
+ proxy_connection_unref(conn, "server_write");
}
}
// Callback for reading data from the client, which will be proxied to
// the backend server.
-static void on_client_read_done(grpc_exec_ctx* exec_ctx, void* arg,
- grpc_error* error) {
+static void on_client_read_done(void* arg, grpc_error* error) {
proxy_connection* conn = (proxy_connection*)arg;
if (error != GRPC_ERROR_NONE) {
- proxy_connection_failed(exec_ctx, conn, true /* is_client */,
+ proxy_connection_failed(conn, true /* is_client */,
"HTTP proxy client read", error);
return;
}
@@ -217,22 +206,20 @@ static void on_client_read_done(grpc_exec_ctx* exec_ctx, void* arg,
grpc_slice_buffer_move_into(&conn->client_read_buffer,
&conn->server_write_buffer);
proxy_connection_ref(conn, "client_read");
- grpc_endpoint_write(exec_ctx, conn->server_endpoint,
- &conn->server_write_buffer,
+ grpc_endpoint_write(conn->server_endpoint, &conn->server_write_buffer,
&conn->on_server_write_done);
}
// Read more data.
- grpc_endpoint_read(exec_ctx, conn->client_endpoint, &conn->client_read_buffer,
+ grpc_endpoint_read(conn->client_endpoint, &conn->client_read_buffer,
&conn->on_client_read_done);
}
// Callback for reading data from the backend server, which will be
// proxied to the client.
-static void on_server_read_done(grpc_exec_ctx* exec_ctx, void* arg,
- grpc_error* error) {
+static void on_server_read_done(void* arg, grpc_error* error) {
proxy_connection* conn = (proxy_connection*)arg;
if (error != GRPC_ERROR_NONE) {
- proxy_connection_failed(exec_ctx, conn, false /* is_client */,
+ proxy_connection_failed(conn, false /* is_client */,
"HTTP proxy server read", error);
return;
}
@@ -249,21 +236,19 @@ static void on_server_read_done(grpc_exec_ctx* exec_ctx, void* arg,
grpc_slice_buffer_move_into(&conn->server_read_buffer,
&conn->client_write_buffer);
proxy_connection_ref(conn, "server_read");
- grpc_endpoint_write(exec_ctx, conn->client_endpoint,
- &conn->client_write_buffer,
+ grpc_endpoint_write(conn->client_endpoint, &conn->client_write_buffer,
&conn->on_client_write_done);
}
// Read more data.
- grpc_endpoint_read(exec_ctx, conn->server_endpoint, &conn->server_read_buffer,
+ grpc_endpoint_read(conn->server_endpoint, &conn->server_read_buffer,
&conn->on_server_read_done);
}
// Callback to write the HTTP response for the CONNECT request.
-static void on_write_response_done(grpc_exec_ctx* exec_ctx, void* arg,
- grpc_error* error) {
+static void on_write_response_done(void* arg, grpc_error* error) {
proxy_connection* conn = (proxy_connection*)arg;
if (error != GRPC_ERROR_NONE) {
- proxy_connection_failed(exec_ctx, conn, true /* is_client */,
+ proxy_connection_failed(conn, true /* is_client */,
"HTTP proxy write response", error);
return;
}
@@ -274,17 +259,16 @@ static void on_write_response_done(grpc_exec_ctx* exec_ctx, void* arg,
// for the other one.
proxy_connection_ref(conn, "client_read");
proxy_connection_ref(conn, "server_read");
- proxy_connection_unref(exec_ctx, conn, "write_response");
- grpc_endpoint_read(exec_ctx, conn->client_endpoint, &conn->client_read_buffer,
+ proxy_connection_unref(conn, "write_response");
+ grpc_endpoint_read(conn->client_endpoint, &conn->client_read_buffer,
&conn->on_client_read_done);
- grpc_endpoint_read(exec_ctx, conn->server_endpoint, &conn->server_read_buffer,
+ grpc_endpoint_read(conn->server_endpoint, &conn->server_read_buffer,
&conn->on_server_read_done);
}
// Callback to connect to the backend server specified by the HTTP
// CONNECT request.
-static void on_server_connect_done(grpc_exec_ctx* exec_ctx, void* arg,
- grpc_error* error) {
+static void on_server_connect_done(void* arg, grpc_error* error) {
proxy_connection* conn = (proxy_connection*)arg;
if (error != GRPC_ERROR_NONE) {
// TODO(roth): Technically, in this case, we should handle the error
@@ -292,7 +276,7 @@ static void on_server_connect_done(grpc_exec_ctx* exec_ctx, void* arg,
// connection failed. However, for the purposes of this test code,
// it's fine to pretend this is a client-side error, which will
// cause the client connection to be dropped.
- proxy_connection_failed(exec_ctx, conn, true /* is_client */,
+ proxy_connection_failed(conn, true /* is_client */,
"HTTP proxy server connect", error);
return;
}
@@ -302,8 +286,7 @@ static void on_server_connect_done(grpc_exec_ctx* exec_ctx, void* arg,
grpc_slice slice =
grpc_slice_from_copied_string("HTTP/1.0 200 connected\r\n\r\n");
grpc_slice_buffer_add(&conn->client_write_buffer, slice);
- grpc_endpoint_write(exec_ctx, conn->client_endpoint,
- &conn->client_write_buffer,
+ grpc_endpoint_write(conn->client_endpoint, &conn->client_write_buffer,
&conn->on_write_response_done);
}
@@ -312,8 +295,7 @@ static void on_server_connect_done(grpc_exec_ctx* exec_ctx, void* arg,
* Basic <base64_encoded_expected_cred>
* Returns true if it matches, false otherwise
*/
-static bool proxy_auth_header_matches(grpc_exec_ctx* exec_ctx,
- char* proxy_auth_header_val,
+static bool proxy_auth_header_matches(char* proxy_auth_header_val,
char* expected_cred) {
GPR_ASSERT(proxy_auth_header_val != NULL);
GPR_ASSERT(expected_cred != NULL);
@@ -321,11 +303,10 @@ static bool proxy_auth_header_matches(grpc_exec_ctx* exec_ctx,
return false;
}
proxy_auth_header_val += 6;
- grpc_slice decoded_slice =
- grpc_base64_decode(exec_ctx, proxy_auth_header_val, 0);
+ grpc_slice decoded_slice = grpc_base64_decode(proxy_auth_header_val, 0);
const bool header_matches =
grpc_slice_str_cmp(decoded_slice, expected_cred) == 0;
- grpc_slice_unref_internal(exec_ctx, decoded_slice);
+ grpc_slice_unref_internal(decoded_slice);
return header_matches;
}
@@ -335,13 +316,12 @@ static bool proxy_auth_header_matches(grpc_exec_ctx* exec_ctx,
// the client indicating that the request failed. However, for the purposes
// of this test code, it's fine to pretend this is a client-side error,
// which will cause the client connection to be dropped.
-static void on_read_request_done(grpc_exec_ctx* exec_ctx, void* arg,
- grpc_error* error) {
+static void on_read_request_done(void* arg, grpc_error* error) {
proxy_connection* conn = (proxy_connection*)arg;
gpr_log(GPR_DEBUG, "on_read_request_done: %p %s", conn,
grpc_error_string(error));
if (error != GRPC_ERROR_NONE) {
- proxy_connection_failed(exec_ctx, conn, true /* is_client */,
+ proxy_connection_failed(conn, true /* is_client */,
"HTTP proxy read request", error);
return;
}
@@ -351,7 +331,7 @@ static void on_read_request_done(grpc_exec_ctx* exec_ctx, void* arg,
error = grpc_http_parser_parse(&conn->http_parser,
conn->client_read_buffer.slices[i], NULL);
if (error != GRPC_ERROR_NONE) {
- proxy_connection_failed(exec_ctx, conn, true /* is_client */,
+ proxy_connection_failed(conn, true /* is_client */,
"HTTP proxy request parse", error);
GRPC_ERROR_UNREF(error);
return;
@@ -361,8 +341,8 @@ static void on_read_request_done(grpc_exec_ctx* exec_ctx, void* arg,
grpc_slice_buffer_reset_and_unref(&conn->client_read_buffer);
// If we're not done reading the request, read more data.
if (conn->http_parser.state != GRPC_HTTP_BODY) {
- grpc_endpoint_read(exec_ctx, conn->client_endpoint,
- &conn->client_read_buffer, &conn->on_read_request_done);
+ grpc_endpoint_read(conn->client_endpoint, &conn->client_read_buffer,
+ &conn->on_read_request_done);
return;
}
// Make sure we got a CONNECT request.
@@ -372,7 +352,7 @@ static void on_read_request_done(grpc_exec_ctx* exec_ctx, void* arg,
conn->http_request.method);
error = GRPC_ERROR_CREATE_FROM_COPIED_STRING(msg);
gpr_free(msg);
- proxy_connection_failed(exec_ctx, conn, true /* is_client */,
+ proxy_connection_failed(conn, true /* is_client */,
"HTTP proxy read request", error);
GRPC_ERROR_UNREF(error);
return;
@@ -385,15 +365,14 @@ static void on_read_request_done(grpc_exec_ctx* exec_ctx, void* arg,
for (size_t i = 0; i < conn->http_request.hdr_count; i++) {
if (strcmp(conn->http_request.hdrs[i].key, "Proxy-Authorization") == 0) {
client_authenticated = proxy_auth_header_matches(
- exec_ctx, conn->http_request.hdrs[i].value,
- proxy_auth_arg->value.string);
+ conn->http_request.hdrs[i].value, proxy_auth_arg->value.string);
break;
}
}
if (!client_authenticated) {
const char* msg = "HTTP Connect could not verify authentication";
error = GRPC_ERROR_CREATE_FROM_STATIC_STRING(msg);
- proxy_connection_failed(exec_ctx, conn, true /* is_client */,
+ proxy_connection_failed(conn, true /* is_client */,
"HTTP proxy read request", error);
GRPC_ERROR_UNREF(error);
return;
@@ -404,24 +383,23 @@ static void on_read_request_done(grpc_exec_ctx* exec_ctx, void* arg,
error = grpc_blocking_resolve_address(conn->http_request.path, "80",
&resolved_addresses);
if (error != GRPC_ERROR_NONE) {
- proxy_connection_failed(exec_ctx, conn, true /* is_client */,
- "HTTP proxy DNS lookup", error);
+ proxy_connection_failed(conn, true /* is_client */, "HTTP proxy DNS lookup",
+ error);
GRPC_ERROR_UNREF(error);
return;
}
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(exec_ctx) + 10 * GPR_MS_PER_SEC;
- grpc_tcp_client_connect(exec_ctx, &conn->on_server_connect_done,
- &conn->server_endpoint, conn->pollset_set, NULL,
+ const grpc_millis deadline = grpc_exec_ctx_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);
grpc_resolved_addresses_destroy(resolved_addresses);
}
-static void on_accept(grpc_exec_ctx* exec_ctx, void* arg,
- grpc_endpoint* endpoint, grpc_pollset* accepting_pollset,
+static void on_accept(void* arg, grpc_endpoint* endpoint,
+ grpc_pollset* accepting_pollset,
grpc_tcp_server_acceptor* acceptor) {
gpr_free(acceptor);
grpc_end2end_http_proxy* proxy = (grpc_end2end_http_proxy*)arg;
@@ -432,8 +410,8 @@ static void on_accept(grpc_exec_ctx* exec_ctx, void* arg,
conn->proxy = proxy;
gpr_ref_init(&conn->refcount, 1);
conn->pollset_set = grpc_pollset_set_create();
- grpc_pollset_set_add_pollset(exec_ctx, conn->pollset_set, proxy->pollset);
- grpc_endpoint_add_to_pollset_set(exec_ctx, endpoint, conn->pollset_set);
+ grpc_pollset_set_add_pollset(conn->pollset_set, proxy->pollset);
+ grpc_endpoint_add_to_pollset_set(endpoint, conn->pollset_set);
GRPC_CLOSURE_INIT(&conn->on_read_request_done, on_read_request_done, conn,
grpc_combiner_scheduler(conn->proxy->combiner));
GRPC_CLOSURE_INIT(&conn->on_server_connect_done, on_server_connect_done, conn,
@@ -456,7 +434,7 @@ static void on_accept(grpc_exec_ctx* exec_ctx, void* arg,
grpc_slice_buffer_init(&conn->server_write_buffer);
grpc_http_parser_init(&conn->http_parser, GRPC_HTTP_REQUEST,
&conn->http_request);
- grpc_endpoint_read(exec_ctx, conn->client_endpoint, &conn->client_read_buffer,
+ grpc_endpoint_read(conn->client_endpoint, &conn->client_read_buffer,
&conn->on_read_request_done);
}
@@ -466,24 +444,23 @@ static void on_accept(grpc_exec_ctx* exec_ctx, void* arg,
static void thread_main(void* arg) {
grpc_end2end_http_proxy* proxy = (grpc_end2end_http_proxy*)arg;
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ ExecCtx _local_exec_ctx;
do {
gpr_ref(&proxy->users);
grpc_pollset_worker* worker = NULL;
gpr_mu_lock(proxy->mu);
- GRPC_LOG_IF_ERROR(
- "grpc_pollset_work",
- grpc_pollset_work(&exec_ctx, proxy->pollset, &worker,
- grpc_exec_ctx_now(&exec_ctx) + GPR_MS_PER_SEC));
+ GRPC_LOG_IF_ERROR("grpc_pollset_work",
+ grpc_pollset_work(proxy->pollset, &worker,
+ grpc_exec_ctx_now() + GPR_MS_PER_SEC));
gpr_mu_unlock(proxy->mu);
- grpc_exec_ctx_flush(&exec_ctx);
+ grpc_exec_ctx_flush();
} while (!gpr_unref(&proxy->users));
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_exec_ctx_finish();
}
grpc_end2end_http_proxy* grpc_end2end_http_proxy_create(
grpc_channel_args* args) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ ExecCtx _local_exec_ctx;
grpc_end2end_http_proxy* proxy =
(grpc_end2end_http_proxy*)gpr_malloc(sizeof(*proxy));
memset(proxy, 0, sizeof(*proxy));
@@ -495,8 +472,8 @@ grpc_end2end_http_proxy* grpc_end2end_http_proxy_create(
gpr_log(GPR_INFO, "Proxy address: %s", proxy->proxy_name);
// Create TCP server.
proxy->channel_args = grpc_channel_args_copy(args);
- grpc_error* error = grpc_tcp_server_create(
- &exec_ctx, NULL, proxy->channel_args, &proxy->server);
+ grpc_error* error =
+ grpc_tcp_server_create(NULL, proxy->channel_args, &proxy->server);
GPR_ASSERT(error == GRPC_ERROR_NONE);
// Bind to port.
grpc_resolved_address resolved_addr;
@@ -511,9 +488,8 @@ grpc_end2end_http_proxy* grpc_end2end_http_proxy_create(
// Start server.
proxy->pollset = (grpc_pollset*)gpr_zalloc(grpc_pollset_size());
grpc_pollset_init(proxy->pollset, &proxy->mu);
- grpc_tcp_server_start(&exec_ctx, proxy->server, &proxy->pollset, 1, on_accept,
- proxy);
- grpc_exec_ctx_finish(&exec_ctx);
+ 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);
@@ -521,27 +497,26 @@ grpc_end2end_http_proxy* grpc_end2end_http_proxy_create(
return proxy;
}
-static void destroy_pollset(grpc_exec_ctx* exec_ctx, void* arg,
- grpc_error* error) {
+static void destroy_pollset(void* arg, grpc_error* error) {
grpc_pollset* pollset = (grpc_pollset*)arg;
- grpc_pollset_destroy(exec_ctx, pollset);
+ grpc_pollset_destroy(pollset);
gpr_free(pollset);
}
void grpc_end2end_http_proxy_destroy(grpc_end2end_http_proxy* proxy) {
gpr_unref(&proxy->users); // Signal proxy thread to shutdown.
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ ExecCtx _local_exec_ctx;
gpr_thd_join(proxy->thd);
- grpc_tcp_server_shutdown_listeners(&exec_ctx, proxy->server);
- grpc_tcp_server_unref(&exec_ctx, proxy->server);
+ grpc_tcp_server_shutdown_listeners(proxy->server);
+ grpc_tcp_server_unref(proxy->server);
gpr_free(proxy->proxy_name);
- grpc_channel_args_destroy(&exec_ctx, proxy->channel_args);
- grpc_pollset_shutdown(&exec_ctx, proxy->pollset,
+ grpc_channel_args_destroy(proxy->channel_args);
+ grpc_pollset_shutdown(proxy->pollset,
GRPC_CLOSURE_CREATE(destroy_pollset, proxy->pollset,
grpc_schedule_on_exec_ctx));
- GRPC_COMBINER_UNREF(&exec_ctx, proxy->combiner, "test");
+ GRPC_COMBINER_UNREF(proxy->combiner, "test");
gpr_free(proxy);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_exec_ctx_finish();
}
const char* grpc_end2end_http_proxy_get_proxy_name(
diff --git a/test/core/end2end/fuzzers/api_fuzzer.c b/test/core/end2end/fuzzers/api_fuzzer.c
index 0a787bbf30..5ca8bfccf8 100644
--- a/test/core/end2end/fuzzers/api_fuzzer.c
+++ b/test/core/end2end/fuzzers/api_fuzzer.c
@@ -371,8 +371,7 @@ typedef struct addr_req {
grpc_lb_addresses **lb_addrs;
} addr_req;
-static void finish_resolve(grpc_exec_ctx *exec_ctx, void *arg,
- grpc_error *error) {
+static void finish_resolve(void *arg, grpc_error *error) {
addr_req *r = arg;
if (error == GRPC_ERROR_NONE && 0 == strcmp(r->addr, "server")) {
@@ -387,9 +386,9 @@ static void finish_resolve(grpc_exec_ctx *exec_ctx, void *arg,
grpc_lb_addresses_set_address(lb_addrs, 0, NULL, 0, NULL, NULL, NULL);
*r->lb_addrs = lb_addrs;
}
- GRPC_CLOSURE_SCHED(exec_ctx, r->on_done, GRPC_ERROR_NONE);
+ GRPC_CLOSURE_SCHED(r->on_done, GRPC_ERROR_NONE);
} else {
- GRPC_CLOSURE_SCHED(exec_ctx, r->on_done,
+ GRPC_CLOSURE_SCHED(r->on_done,
GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING(
"Resolution failed", &error, 1));
}
@@ -398,8 +397,7 @@ static void finish_resolve(grpc_exec_ctx *exec_ctx, void *arg,
gpr_free(r);
}
-void my_resolve_address(grpc_exec_ctx *exec_ctx, const char *addr,
- const char *default_port,
+void my_resolve_address(const char *addr, const char *default_port,
grpc_pollset_set *interested_parties,
grpc_closure *on_done,
grpc_resolved_addresses **addresses) {
@@ -409,22 +407,24 @@ void my_resolve_address(grpc_exec_ctx *exec_ctx, const char *addr,
r->addrs = addresses;
r->lb_addrs = NULL;
grpc_timer_init(
- exec_ctx, &r->timer, GPR_MS_PER_SEC + grpc_exec_ctx_now(exec_ctx),
+ &r->timer, GPR_MS_PER_SEC + grpc_exec_ctx_now(),
GRPC_CLOSURE_CREATE(finish_resolve, r, grpc_schedule_on_exec_ctx));
}
-grpc_ares_request *my_dns_lookup_ares(
- grpc_exec_ctx *exec_ctx, const char *dns_server, const char *addr,
- const char *default_port, grpc_pollset_set *interested_parties,
- grpc_closure *on_done, grpc_lb_addresses **lb_addrs, bool check_grpclb,
- char **service_config_json) {
+grpc_ares_request *my_dns_lookup_ares(const char *dns_server, const char *addr,
+ const char *default_port,
+ grpc_pollset_set *interested_parties,
+ grpc_closure *on_done,
+ grpc_lb_addresses **lb_addrs,
+ bool check_grpclb,
+ char **service_config_json) {
addr_req *r = gpr_malloc(sizeof(*r));
r->addr = gpr_strdup(addr);
r->on_done = on_done;
r->addrs = NULL;
r->lb_addrs = lb_addrs;
grpc_timer_init(
- exec_ctx, &r->timer, GPR_MS_PER_SEC + grpc_exec_ctx_now(exec_ctx),
+ &r->timer, GPR_MS_PER_SEC + grpc_exec_ctx_now(),
GRPC_CLOSURE_CREATE(finish_resolve, r, grpc_schedule_on_exec_ctx));
return NULL;
}
@@ -434,12 +434,12 @@ grpc_ares_request *my_dns_lookup_ares(
// defined in tcp_client_posix.c
extern void (*grpc_tcp_client_connect_impl)(
- grpc_exec_ctx *exec_ctx, grpc_closure *closure, grpc_endpoint **ep,
+ grpc_closure *closure, grpc_endpoint **ep,
grpc_pollset_set *interested_parties, const grpc_channel_args *channel_args,
const grpc_resolved_address *addr, gpr_timespec deadline);
-static void sched_connect(grpc_exec_ctx *exec_ctx, grpc_closure *closure,
- grpc_endpoint **ep, gpr_timespec deadline);
+static void sched_connect(grpc_closure *closure, grpc_endpoint **ep,
+ gpr_timespec deadline);
typedef struct {
grpc_timer timer;
@@ -448,35 +448,34 @@ typedef struct {
gpr_timespec deadline;
} future_connect;
-static void do_connect(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) {
+static void do_connect(void *arg, grpc_error *error) {
future_connect *fc = arg;
if (error != GRPC_ERROR_NONE) {
*fc->ep = NULL;
- GRPC_CLOSURE_SCHED(exec_ctx, fc->closure, GRPC_ERROR_REF(error));
+ GRPC_CLOSURE_SCHED(fc->closure, GRPC_ERROR_REF(error));
} else if (g_server != NULL) {
grpc_endpoint *client;
grpc_endpoint *server;
grpc_passthru_endpoint_create(&client, &server, g_resource_quota, NULL);
*fc->ep = client;
- grpc_transport *transport =
- grpc_create_chttp2_transport(exec_ctx, NULL, server, 0);
- grpc_server_setup_transport(exec_ctx, g_server, transport, NULL, NULL);
- grpc_chttp2_transport_start_reading(exec_ctx, transport, NULL);
+ grpc_transport *transport = grpc_create_chttp2_transport(NULL, server, 0);
+ grpc_server_setup_transport(g_server, transport, NULL, NULL);
+ grpc_chttp2_transport_start_reading(transport, NULL);
- GRPC_CLOSURE_SCHED(exec_ctx, fc->closure, GRPC_ERROR_NONE);
+ GRPC_CLOSURE_SCHED(fc->closure, GRPC_ERROR_NONE);
} else {
- sched_connect(exec_ctx, fc->closure, fc->ep, fc->deadline);
+ sched_connect(fc->closure, fc->ep, fc->deadline);
}
gpr_free(fc);
}
-static void sched_connect(grpc_exec_ctx *exec_ctx, grpc_closure *closure,
- grpc_endpoint **ep, gpr_timespec deadline) {
+static void sched_connect(grpc_closure *closure, grpc_endpoint **ep,
+ gpr_timespec deadline) {
if (gpr_time_cmp(deadline, gpr_now(deadline.clock_type)) < 0) {
*ep = NULL;
- GRPC_CLOSURE_SCHED(exec_ctx, closure, GRPC_ERROR_CREATE_FROM_STATIC_STRING(
- "Connect deadline exceeded"));
+ GRPC_CLOSURE_SCHED(closure, GRPC_ERROR_CREATE_FROM_STATIC_STRING(
+ "Connect deadline exceeded"));
return;
}
@@ -485,17 +484,16 @@ static void sched_connect(grpc_exec_ctx *exec_ctx, grpc_closure *closure,
fc->ep = ep;
fc->deadline = deadline;
grpc_timer_init(
- exec_ctx, &fc->timer, GPR_MS_PER_SEC + grpc_exec_ctx_now(exec_ctx),
+ &fc->timer, GPR_MS_PER_SEC + grpc_exec_ctx_now(),
GRPC_CLOSURE_CREATE(do_connect, fc, grpc_schedule_on_exec_ctx));
}
-static void my_tcp_client_connect(grpc_exec_ctx *exec_ctx,
- grpc_closure *closure, grpc_endpoint **ep,
+static void my_tcp_client_connect(grpc_closure *closure, grpc_endpoint **ep,
grpc_pollset_set *interested_parties,
const grpc_channel_args *channel_args,
const grpc_resolved_address *addr,
gpr_timespec deadline) {
- sched_connect(exec_ctx, closure, ep, deadline);
+ sched_connect(closure, ep, deadline);
}
////////////////////////////////////////////////////////////////////////////////
@@ -738,9 +736,9 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
grpc_init();
grpc_timer_manager_set_threading(false);
{
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_executor_set_threading(&exec_ctx, false);
- grpc_exec_ctx_finish(&exec_ctx);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_executor_set_threading(false);
+ grpc_exec_ctx_finish();
}
grpc_resolve_address = my_resolve_address;
grpc_dns_lookup_ares = my_dns_lookup_ares;
@@ -832,9 +830,9 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
g_channel = grpc_insecure_channel_create(target_uri, args, NULL);
GPR_ASSERT(g_channel != NULL);
{
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_channel_args_destroy(&exec_ctx, args);
- grpc_exec_ctx_finish(&exec_ctx);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_channel_args_destroy(args);
+ grpc_exec_ctx_finish();
}
gpr_free(target_uri);
gpr_free(target);
@@ -860,9 +858,9 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
g_server = grpc_server_create(args, NULL);
GPR_ASSERT(g_server != NULL);
{
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_channel_args_destroy(&exec_ctx, args);
- grpc_exec_ctx_finish(&exec_ctx);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_channel_args_destroy(args);
+ grpc_exec_ctx_finish();
}
grpc_server_register_completion_queue(g_server, cq, NULL);
grpc_server_start(g_server);
@@ -1186,9 +1184,9 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
g_channel = grpc_secure_channel_create(creds, target_uri, args, NULL);
GPR_ASSERT(g_channel != NULL);
{
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_channel_args_destroy(&exec_ctx, args);
- grpc_exec_ctx_finish(&exec_ctx);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ 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.c b/test/core/end2end/fuzzers/client_fuzzer.c
index 88ba6bad83..1aca2ee758 100644
--- a/test/core/end2end/fuzzers/client_fuzzer.c
+++ b/test/core/end2end/fuzzers/client_fuzzer.c
@@ -43,22 +43,22 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
if (squelch) gpr_set_log_function(dont_log);
if (leak_check) grpc_memory_counters_init();
grpc_init();
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_executor_set_threading(&exec_ctx, false);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_executor_set_threading(false);
grpc_resource_quota *resource_quota =
grpc_resource_quota_create("client_fuzzer");
grpc_endpoint *mock_endpoint =
grpc_mock_endpoint_create(discard_write, resource_quota);
- grpc_resource_quota_unref_internal(&exec_ctx, resource_quota);
+ grpc_resource_quota_unref_internal(resource_quota);
grpc_completion_queue *cq = grpc_completion_queue_create_for_next(NULL);
grpc_transport *transport =
- grpc_create_chttp2_transport(&exec_ctx, NULL, mock_endpoint, 1);
- grpc_chttp2_transport_start_reading(&exec_ctx, transport, NULL);
+ grpc_create_chttp2_transport(NULL, mock_endpoint, 1);
+ grpc_chttp2_transport_start_reading(transport, NULL);
grpc_channel *channel = grpc_channel_create(
- &exec_ctx, "test-target", NULL, GRPC_CLIENT_DIRECT_CHANNEL, transport);
+ "test-target", NULL, GRPC_CLIENT_DIRECT_CHANNEL, transport);
grpc_slice host = grpc_slice_from_static_string("localhost");
grpc_call *call = grpc_channel_create_call(
channel, NULL, 0, cq, grpc_slice_from_static_string("/foo"), &host,
@@ -107,12 +107,11 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
GPR_ASSERT(GRPC_CALL_OK == error);
grpc_mock_endpoint_put_read(
- &exec_ctx, mock_endpoint,
- grpc_slice_from_copied_buffer((const char *)data, size));
+ mock_endpoint, grpc_slice_from_copied_buffer((const char *)data, size));
grpc_event ev;
while (1) {
- grpc_exec_ctx_flush(&exec_ctx);
+ grpc_exec_ctx_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.c b/test/core/end2end/fuzzers/server_fuzzer.c
index ef4c0a4bfd..bbeeba8550 100644
--- a/test/core/end2end/fuzzers/server_fuzzer.c
+++ b/test/core/end2end/fuzzers/server_fuzzer.c
@@ -41,17 +41,16 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
if (squelch) gpr_set_log_function(dont_log);
if (leak_check) grpc_memory_counters_init();
grpc_init();
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_executor_set_threading(&exec_ctx, false);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_executor_set_threading(false);
grpc_resource_quota *resource_quota =
grpc_resource_quota_create("server_fuzzer");
grpc_endpoint *mock_endpoint =
grpc_mock_endpoint_create(discard_write, resource_quota);
- grpc_resource_quota_unref_internal(&exec_ctx, resource_quota);
+ grpc_resource_quota_unref_internal(resource_quota);
grpc_mock_endpoint_put_read(
- &exec_ctx, mock_endpoint,
- grpc_slice_from_copied_buffer((const char *)data, size));
+ mock_endpoint, grpc_slice_from_copied_buffer((const char *)data, size));
grpc_server *server = grpc_server_create(NULL, NULL);
grpc_completion_queue *cq = grpc_completion_queue_create_for_next(NULL);
@@ -61,9 +60,9 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
// grpc_server_register_method(server, "/reg", NULL, 0);
grpc_server_start(server);
grpc_transport *transport =
- grpc_create_chttp2_transport(&exec_ctx, NULL, mock_endpoint, 0);
- grpc_server_setup_transport(&exec_ctx, server, transport, NULL, NULL);
- grpc_chttp2_transport_start_reading(&exec_ctx, transport, NULL);
+ grpc_create_chttp2_transport(NULL, mock_endpoint, 0);
+ grpc_server_setup_transport(server, transport, NULL, NULL);
+ grpc_chttp2_transport_start_reading(transport, NULL);
grpc_call *call1 = NULL;
grpc_call_details call_details1;
@@ -79,7 +78,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
grpc_event ev;
while (1) {
- grpc_exec_ctx_flush(&exec_ctx);
+ grpc_exec_ctx_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/goaway_server_test.c b/test/core/end2end/goaway_server_test.c
index c3aca13249..8deeda7c83 100644
--- a/test/core/end2end/goaway_server_test.c
+++ b/test/core/end2end/goaway_server_test.c
@@ -39,16 +39,15 @@ static void *tag(intptr_t i) { return (void *)i; }
static gpr_mu g_mu;
static int g_resolve_port = -1;
-static void (*iomgr_resolve_address)(grpc_exec_ctx *exec_ctx, const char *addr,
- const char *default_port,
+static void (*iomgr_resolve_address)(const char *addr, const char *default_port,
grpc_pollset_set *interested_parties,
grpc_closure *on_done,
grpc_resolved_addresses **addresses);
static grpc_ares_request *(*iomgr_dns_lookup_ares)(
- grpc_exec_ctx *exec_ctx, const char *dns_server, const char *addr,
- const char *default_port, grpc_pollset_set *interested_parties,
- grpc_closure *on_done, grpc_lb_addresses **addresses, bool check_grpclb,
+ const char *dns_server, const char *addr, const char *default_port,
+ grpc_pollset_set *interested_parties, grpc_closure *on_done,
+ grpc_lb_addresses **addresses, bool check_grpclb,
char **service_config_json);
static void set_resolve_port(int port) {
@@ -57,14 +56,13 @@ static void set_resolve_port(int port) {
gpr_mu_unlock(&g_mu);
}
-static void my_resolve_address(grpc_exec_ctx *exec_ctx, const char *addr,
- const char *default_port,
+static void my_resolve_address(const char *addr, const char *default_port,
grpc_pollset_set *interested_parties,
grpc_closure *on_done,
grpc_resolved_addresses **addrs) {
if (0 != strcmp(addr, "test")) {
- iomgr_resolve_address(exec_ctx, addr, default_port, interested_parties,
- on_done, addrs);
+ iomgr_resolve_address(addr, default_port, interested_parties, on_done,
+ addrs);
return;
}
@@ -85,16 +83,16 @@ static void my_resolve_address(grpc_exec_ctx *exec_ctx, const char *addr,
(*addrs)->addrs[0].len = sizeof(*sa);
gpr_mu_unlock(&g_mu);
}
- GRPC_CLOSURE_SCHED(exec_ctx, on_done, error);
+ GRPC_CLOSURE_SCHED(on_done, error);
}
static grpc_ares_request *my_dns_lookup_ares(
- grpc_exec_ctx *exec_ctx, const char *dns_server, const char *addr,
- const char *default_port, grpc_pollset_set *interested_parties,
- grpc_closure *on_done, grpc_lb_addresses **lb_addrs, bool check_grpclb,
+ const char *dns_server, const char *addr, const char *default_port,
+ grpc_pollset_set *interested_parties, grpc_closure *on_done,
+ grpc_lb_addresses **lb_addrs, bool check_grpclb,
char **service_config_json) {
if (0 != strcmp(addr, "test")) {
- return iomgr_dns_lookup_ares(exec_ctx, dns_server, addr, default_port,
+ return iomgr_dns_lookup_ares(dns_server, addr, default_port,
interested_parties, on_done, lb_addrs,
check_grpclb, service_config_json);
}
@@ -115,7 +113,7 @@ static grpc_ares_request *my_dns_lookup_ares(
gpr_free(sa);
gpr_mu_unlock(&g_mu);
}
- GRPC_CLOSURE_SCHED(exec_ctx, on_done, error);
+ GRPC_CLOSURE_SCHED(on_done, error);
return NULL;
}
diff --git a/test/core/end2end/h2_ssl_cert_test.cc b/test/core/end2end/h2_ssl_cert_test.cc
index 6da5e8396e..fa9f5cc40c 100644
--- a/test/core/end2end/h2_ssl_cert_test.cc
+++ b/test/core/end2end/h2_ssl_cert_test.cc
@@ -185,9 +185,9 @@ typedef enum { NONE, SELF_SIGNED, SIGNED, BAD_CERT_PAIR } certtype;
grpc_channel_args_copy_and_add(client_args, &ssl_name_override, 1); \
chttp2_init_client_secure_fullstack(f, new_client_args, ssl_creds); \
{ \
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; \
- grpc_channel_args_destroy(&exec_ctx, new_client_args); \
- grpc_exec_ctx_finish(&exec_ctx); \
+ 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.c b/test/core/end2end/tests/cancel_after_accept.cc
index c3ac0c3201..042353b95a 100644
--- a/test/core/end2end/tests/cancel_after_accept.c
+++ b/test/core/end2end/tests/cancel_after_accept.cc
@@ -125,8 +125,8 @@ static void test_cancel_after_accept(grpc_end2end_test_config config,
if (use_service_config) {
grpc_arg arg;
arg.type = GRPC_ARG_STRING;
- arg.key = GRPC_ARG_SERVICE_CONFIG;
- arg.value.string =
+ arg.key = (char *)GRPC_ARG_SERVICE_CONFIG;
+ arg.value.string = (char *)
"{\n"
" \"methodConfig\": [ {\n"
" \"name\": [\n"
@@ -244,9 +244,9 @@ static void test_cancel_after_accept(grpc_end2end_test_config config,
grpc_call_unref(s);
if (args != NULL) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_channel_args_destroy(&exec_ctx, args);
- grpc_exec_ctx_finish(&exec_ctx);
+ 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.c b/test/core/end2end/tests/cancel_after_round_trip.cc
index bc41bd3a6d..d45461b9f3 100644
--- a/test/core/end2end/tests/cancel_after_round_trip.c
+++ b/test/core/end2end/tests/cancel_after_round_trip.cc
@@ -127,8 +127,8 @@ static void test_cancel_after_round_trip(grpc_end2end_test_config config,
if (use_service_config) {
grpc_arg arg;
arg.type = GRPC_ARG_STRING;
- arg.key = GRPC_ARG_SERVICE_CONFIG;
- arg.value.string =
+ arg.key = (char *)GRPC_ARG_SERVICE_CONFIG;
+ arg.value.string = (char *)
"{\n"
" \"methodConfig\": [ {\n"
" \"name\": [\n"
@@ -277,9 +277,9 @@ static void test_cancel_after_round_trip(grpc_end2end_test_config config,
grpc_call_unref(s);
if (args != NULL) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_channel_args_destroy(&exec_ctx, args);
- grpc_exec_ctx_finish(&exec_ctx);
+ 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.c b/test/core/end2end/tests/compressed_payload.cc
index ba03773036..a80ac779e3 100644
--- a/test/core/end2end/tests/compressed_payload.c
+++ b/test/core/end2end/tests/compressed_payload.cc
@@ -129,10 +129,10 @@ static void request_for_disabled_algorithm(
server_args =
grpc_channel_args_set_compression_algorithm(NULL, GRPC_COMPRESS_NONE);
{
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ ExecCtx _local_exec_ctx;
server_args = grpc_channel_args_compression_algorithm_set_state(
- &exec_ctx, &server_args, algorithm_to_disable, false);
- grpc_exec_ctx_finish(&exec_ctx);
+ &server_args, algorithm_to_disable, false);
+ grpc_exec_ctx_finish();
}
f = begin_test(config, test_name, client_args, server_args);
@@ -257,10 +257,10 @@ static void request_for_disabled_algorithm(
grpc_byte_buffer_destroy(request_payload_recv);
{
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_channel_args_destroy(&exec_ctx, client_args);
- grpc_channel_args_destroy(&exec_ctx, server_args);
- grpc_exec_ctx_finish(&exec_ctx);
+ ExecCtx _local_exec_ctx;
+ grpc_channel_args_destroy(client_args);
+ grpc_channel_args_destroy(server_args);
+ grpc_exec_ctx_finish();
}
end_test(&f);
@@ -536,10 +536,10 @@ static void request_with_payload_template(
cq_verifier_destroy(cqv);
{
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_channel_args_destroy(&exec_ctx, client_args);
- grpc_channel_args_destroy(&exec_ctx, server_args);
- grpc_exec_ctx_finish(&exec_ctx);
+ 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/filter_call_init_fails.c b/test/core/end2end/tests/filter_call_init_fails.cc
index 09e9dbcd7b..7595ccb72e 100644
--- a/test/core/end2end/tests/filter_call_init_fails.c
+++ b/test/core/end2end/tests/filter_call_init_fails.cc
@@ -399,26 +399,23 @@ static void test_client_subchannel_filter(grpc_end2end_test_config config) {
* Test filter - always fails to initialize a call
*/
-static grpc_error *init_call_elem(grpc_exec_ctx *exec_ctx,
- grpc_call_element *elem,
+static grpc_error *init_call_elem(grpc_call_element *elem,
const grpc_call_element_args *args) {
return grpc_error_set_int(
GRPC_ERROR_CREATE_FROM_STATIC_STRING("access denied"),
GRPC_ERROR_INT_GRPC_STATUS, GRPC_STATUS_PERMISSION_DENIED);
}
-static void destroy_call_elem(grpc_exec_ctx *exec_ctx, grpc_call_element *elem,
+static void destroy_call_elem(grpc_call_element *elem,
const grpc_call_final_info *final_info,
grpc_closure *ignored) {}
-static grpc_error *init_channel_elem(grpc_exec_ctx *exec_ctx,
- grpc_channel_element *elem,
+static grpc_error *init_channel_elem(grpc_channel_element *elem,
grpc_channel_element_args *args) {
return GRPC_ERROR_NONE;
}
-static void destroy_channel_elem(grpc_exec_ctx *exec_ctx,
- grpc_channel_element *elem) {}
+static void destroy_channel_elem(grpc_channel_element *elem) {}
static const grpc_channel_filter test_filter = {
grpc_call_next_op,
@@ -437,8 +434,7 @@ static const grpc_channel_filter test_filter = {
* Registration
*/
-static bool maybe_add_server_channel_filter(grpc_exec_ctx *exec_ctx,
- grpc_channel_stack_builder *builder,
+static bool maybe_add_server_channel_filter(grpc_channel_stack_builder *builder,
void *arg) {
if (g_enable_server_channel_filter) {
// Want to add the filter as close to the end as possible, to make
@@ -457,8 +453,7 @@ static bool maybe_add_server_channel_filter(grpc_exec_ctx *exec_ctx,
}
}
-static bool maybe_add_client_channel_filter(grpc_exec_ctx *exec_ctx,
- grpc_channel_stack_builder *builder,
+static bool maybe_add_client_channel_filter(grpc_channel_stack_builder *builder,
void *arg) {
if (g_enable_client_channel_filter) {
// Want to add the filter as close to the end as possible, to make
@@ -478,7 +473,7 @@ static bool maybe_add_client_channel_filter(grpc_exec_ctx *exec_ctx,
}
static bool maybe_add_client_subchannel_filter(
- grpc_exec_ctx *exec_ctx, grpc_channel_stack_builder *builder, void *arg) {
+ grpc_channel_stack_builder *builder, void *arg) {
if (g_enable_client_subchannel_filter) {
// Want to add the filter as close to the end as possible, to make
// sure that all of the filters work well together. However, we
diff --git a/test/core/end2end/tests/filter_causes_close.c b/test/core/end2end/tests/filter_causes_close.cc
index ee7aeb3f33..cf84cbb279 100644
--- a/test/core/end2end/tests/filter_causes_close.c
+++ b/test/core/end2end/tests/filter_causes_close.cc
@@ -193,12 +193,11 @@ typedef struct { grpc_closure *recv_im_ready; } call_data;
typedef struct { uint8_t unused; } channel_data;
-static void recv_im_ready(grpc_exec_ctx *exec_ctx, void *arg,
- grpc_error *error) {
+static void recv_im_ready(void *arg, grpc_error *error) {
grpc_call_element *elem = (grpc_call_element *)arg;
call_data *calld = (call_data *)elem->call_data;
GRPC_CLOSURE_RUN(
- exec_ctx, calld->recv_im_ready,
+ calld->recv_im_ready,
grpc_error_set_int(GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING(
"Failure that's not preventable.", &error, 1),
GRPC_ERROR_INT_GRPC_STATUS,
@@ -206,8 +205,7 @@ static void recv_im_ready(grpc_exec_ctx *exec_ctx, void *arg,
}
static void start_transport_stream_op_batch(
- grpc_exec_ctx *exec_ctx, grpc_call_element *elem,
- grpc_transport_stream_op_batch *op) {
+ grpc_call_element *elem, grpc_transport_stream_op_batch *op) {
call_data *calld = (call_data *)elem->call_data;
if (op->recv_initial_metadata) {
calld->recv_im_ready =
@@ -215,27 +213,24 @@ static void start_transport_stream_op_batch(
op->payload->recv_initial_metadata.recv_initial_metadata_ready =
GRPC_CLOSURE_CREATE(recv_im_ready, elem, grpc_schedule_on_exec_ctx);
}
- grpc_call_next_op(exec_ctx, elem, op);
+ grpc_call_next_op(elem, op);
}
-static grpc_error *init_call_elem(grpc_exec_ctx *exec_ctx,
- grpc_call_element *elem,
+static grpc_error *init_call_elem(grpc_call_element *elem,
const grpc_call_element_args *args) {
return GRPC_ERROR_NONE;
}
-static void destroy_call_elem(grpc_exec_ctx *exec_ctx, grpc_call_element *elem,
+static void destroy_call_elem(grpc_call_element *elem,
const grpc_call_final_info *final_info,
grpc_closure *ignored) {}
-static grpc_error *init_channel_elem(grpc_exec_ctx *exec_ctx,
- grpc_channel_element *elem,
+static grpc_error *init_channel_elem(grpc_channel_element *elem,
grpc_channel_element_args *args) {
return GRPC_ERROR_NONE;
}
-static void destroy_channel_elem(grpc_exec_ctx *exec_ctx,
- grpc_channel_element *elem) {}
+static void destroy_channel_elem(grpc_channel_element *elem) {}
static const grpc_channel_filter test_filter = {
start_transport_stream_op_batch,
@@ -254,8 +249,7 @@ static const grpc_channel_filter test_filter = {
* Registration
*/
-static bool maybe_add_filter(grpc_exec_ctx *exec_ctx,
- grpc_channel_stack_builder *builder, void *arg) {
+static bool maybe_add_filter(grpc_channel_stack_builder *builder, void *arg) {
if (g_enable_filter) {
return grpc_channel_stack_builder_prepend_filter(builder, &test_filter,
NULL, NULL);
diff --git a/test/core/end2end/tests/filter_latency.c b/test/core/end2end/tests/filter_latency.cc
index c24934f05d..693c400e43 100644
--- a/test/core/end2end/tests/filter_latency.c
+++ b/test/core/end2end/tests/filter_latency.cc
@@ -247,14 +247,12 @@ static void test_request(grpc_end2end_test_config config) {
* Test latency filter
*/
-static grpc_error *init_call_elem(grpc_exec_ctx *exec_ctx,
- grpc_call_element *elem,
+static grpc_error *init_call_elem(grpc_call_element *elem,
const grpc_call_element_args *args) {
return GRPC_ERROR_NONE;
}
-static void client_destroy_call_elem(grpc_exec_ctx *exec_ctx,
- grpc_call_element *elem,
+static void client_destroy_call_elem(grpc_call_element *elem,
const grpc_call_final_info *final_info,
grpc_closure *ignored) {
gpr_mu_lock(&g_mu);
@@ -262,8 +260,7 @@ static void client_destroy_call_elem(grpc_exec_ctx *exec_ctx,
gpr_mu_unlock(&g_mu);
}
-static void server_destroy_call_elem(grpc_exec_ctx *exec_ctx,
- grpc_call_element *elem,
+static void server_destroy_call_elem(grpc_call_element *elem,
const grpc_call_final_info *final_info,
grpc_closure *ignored) {
gpr_mu_lock(&g_mu);
@@ -271,14 +268,12 @@ static void server_destroy_call_elem(grpc_exec_ctx *exec_ctx,
gpr_mu_unlock(&g_mu);
}
-static grpc_error *init_channel_elem(grpc_exec_ctx *exec_ctx,
- grpc_channel_element *elem,
+static grpc_error *init_channel_elem(grpc_channel_element *elem,
grpc_channel_element_args *args) {
return GRPC_ERROR_NONE;
}
-static void destroy_channel_elem(grpc_exec_ctx *exec_ctx,
- grpc_channel_element *elem) {}
+static void destroy_channel_elem(grpc_channel_element *elem) {}
static const grpc_channel_filter test_client_filter = {
grpc_call_next_op,
@@ -310,8 +305,7 @@ static const grpc_channel_filter test_server_filter = {
* Registration
*/
-static bool maybe_add_filter(grpc_exec_ctx *exec_ctx,
- grpc_channel_stack_builder *builder, void *arg) {
+static bool maybe_add_filter(grpc_channel_stack_builder *builder, void *arg) {
grpc_channel_filter *filter = (grpc_channel_filter *)arg;
if (g_enable_filter) {
// Want to add the filter as close to the end as possible, to make
diff --git a/test/core/end2end/tests/keepalive_timeout.c b/test/core/end2end/tests/keepalive_timeout.c
index 0053368ecc..b6e5776d12 100644
--- a/test/core/end2end/tests/keepalive_timeout.c
+++ b/test/core/end2end/tests/keepalive_timeout.c
@@ -28,7 +28,7 @@
#include <grpc/support/useful.h>
#include "src/core/ext/transport/chttp2/transport/frame_ping.h"
#include "src/core/lib/channel/channel_args.h"
-#include "src/core/lib/iomgr/exec_ctx.h"
+//#include "src/core/lib/iomgr/exec_ctx.h"
#include "src/core/lib/support/env.h"
#include "test/core/end2end/cq_verifier.h"
diff --git a/test/core/end2end/tests/load_reporting_hook.c b/test/core/end2end/tests/load_reporting_hook.cc
index 7b503790db..d9f7549fa3 100644
--- a/test/core/end2end/tests/load_reporting_hook.c
+++ b/test/core/end2end/tests/load_reporting_hook.cc
@@ -300,9 +300,9 @@ static void test_load_reporting_hook(grpc_end2end_test_config config) {
&trailing_lr_metadata);
end_test(&f);
{
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_channel_args_destroy(&exec_ctx, lr_server_args);
- grpc_exec_ctx_finish(&exec_ctx);
+ 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.c b/test/core/end2end/tests/max_message_length.cc
index 01eb8d365e..508ce8bdcd 100644
--- a/test/core/end2end/tests/max_message_length.c
+++ b/test/core/end2end/tests/max_message_length.cc
@@ -132,31 +132,32 @@ static void test_max_message_length_on_request(grpc_end2end_test_config config,
GPR_ASSERT(send_limit);
grpc_arg arg;
arg.type = GRPC_ARG_STRING;
- arg.key = GRPC_ARG_SERVICE_CONFIG;
- arg.value.string =
- use_string_json_value
- ? "{\n"
- " \"methodConfig\": [ {\n"
- " \"name\": [\n"
- " { \"service\": \"service\", \"method\": \"method\" }\n"
- " ],\n"
- " \"maxRequestMessageBytes\": \"5\"\n"
- " } ]\n"
- "}"
- : "{\n"
- " \"methodConfig\": [ {\n"
- " \"name\": [\n"
- " { \"service\": \"service\", \"method\": \"method\" }\n"
- " ],\n"
- " \"maxRequestMessageBytes\": 5\n"
- " } ]\n"
- "}";
+ arg.key = (char *)GRPC_ARG_SERVICE_CONFIG;
+ arg.value.string = (char *)(use_string_json_value
+ ? "{\n"
+ " \"methodConfig\": [ {\n"
+ " \"name\": [\n"
+ " { \"service\": \"service\", "
+ "\"method\": \"method\" }\n"
+ " ],\n"
+ " \"maxRequestMessageBytes\": \"5\"\n"
+ " } ]\n"
+ "}"
+ : "{\n"
+ " \"methodConfig\": [ {\n"
+ " \"name\": [\n"
+ " { \"service\": \"service\", "
+ "\"method\": \"method\" }\n"
+ " ],\n"
+ " \"maxRequestMessageBytes\": 5\n"
+ " } ]\n"
+ "}");
client_args = grpc_channel_args_copy_and_add(NULL, &arg, 1);
} else {
// Set limit via channel args.
grpc_arg arg;
- arg.key = send_limit ? GRPC_ARG_MAX_SEND_MESSAGE_LENGTH
- : GRPC_ARG_MAX_RECEIVE_MESSAGE_LENGTH;
+ arg.key = (char *)(send_limit ? GRPC_ARG_MAX_SEND_MESSAGE_LENGTH
+ : GRPC_ARG_MAX_RECEIVE_MESSAGE_LENGTH);
arg.type = GRPC_ARG_INTEGER;
arg.value.integer = 5;
grpc_channel_args *args = grpc_channel_args_copy_and_add(NULL, &arg, 1);
@@ -170,10 +171,10 @@ static void test_max_message_length_on_request(grpc_end2end_test_config config,
f = begin_test(config, "test_max_request_message_length", client_args,
server_args);
{
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- if (client_args != NULL) grpc_channel_args_destroy(&exec_ctx, client_args);
- if (server_args != NULL) grpc_channel_args_destroy(&exec_ctx, server_args);
- grpc_exec_ctx_finish(&exec_ctx);
+ 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);
@@ -322,31 +323,32 @@ static void test_max_message_length_on_response(grpc_end2end_test_config config,
GPR_ASSERT(!send_limit);
grpc_arg arg;
arg.type = GRPC_ARG_STRING;
- arg.key = GRPC_ARG_SERVICE_CONFIG;
- arg.value.string =
- use_string_json_value
- ? "{\n"
- " \"methodConfig\": [ {\n"
- " \"name\": [\n"
- " { \"service\": \"service\", \"method\": \"method\" }\n"
- " ],\n"
- " \"maxResponseMessageBytes\": \"5\"\n"
- " } ]\n"
- "}"
- : "{\n"
- " \"methodConfig\": [ {\n"
- " \"name\": [\n"
- " { \"service\": \"service\", \"method\": \"method\" }\n"
- " ],\n"
- " \"maxResponseMessageBytes\": 5\n"
- " } ]\n"
- "}";
+ arg.key = (char *)GRPC_ARG_SERVICE_CONFIG;
+ arg.value.string = (char *)(use_string_json_value
+ ? "{\n"
+ " \"methodConfig\": [ {\n"
+ " \"name\": [\n"
+ " { \"service\": \"service\", "
+ "\"method\": \"method\" }\n"
+ " ],\n"
+ " \"maxResponseMessageBytes\": \"5\"\n"
+ " } ]\n"
+ "}"
+ : "{\n"
+ " \"methodConfig\": [ {\n"
+ " \"name\": [\n"
+ " { \"service\": \"service\", "
+ "\"method\": \"method\" }\n"
+ " ],\n"
+ " \"maxResponseMessageBytes\": 5\n"
+ " } ]\n"
+ "}");
client_args = grpc_channel_args_copy_and_add(NULL, &arg, 1);
} else {
// Set limit via channel args.
grpc_arg arg;
- arg.key = send_limit ? GRPC_ARG_MAX_SEND_MESSAGE_LENGTH
- : GRPC_ARG_MAX_RECEIVE_MESSAGE_LENGTH;
+ arg.key = (char *)(send_limit ? GRPC_ARG_MAX_SEND_MESSAGE_LENGTH
+ : GRPC_ARG_MAX_RECEIVE_MESSAGE_LENGTH);
arg.type = GRPC_ARG_INTEGER;
arg.value.integer = 5;
grpc_channel_args *args = grpc_channel_args_copy_and_add(NULL, &arg, 1);
@@ -360,10 +362,10 @@ static void test_max_message_length_on_response(grpc_end2end_test_config config,
f = begin_test(config, "test_max_response_message_length", client_args,
server_args);
{
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- if (client_args != NULL) grpc_channel_args_destroy(&exec_ctx, client_args);
- if (server_args != NULL) grpc_channel_args_destroy(&exec_ctx, server_args);
- grpc_exec_ctx_finish(&exec_ctx);
+ 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/request_with_flags.c b/test/core/end2end/tests/request_with_flags.cc
index dfb7d58743..dfb7d58743 100644
--- a/test/core/end2end/tests/request_with_flags.c
+++ b/test/core/end2end/tests/request_with_flags.cc
diff --git a/test/core/end2end/tests/stream_compression_compressed_payload.c b/test/core/end2end/tests/stream_compression_compressed_payload.cc
index 8b47741cd4..e79bb95d95 100644
--- a/test/core/end2end/tests/stream_compression_compressed_payload.c
+++ b/test/core/end2end/tests/stream_compression_compressed_payload.cc
@@ -129,10 +129,10 @@ static void request_for_disabled_algorithm(
server_args = grpc_channel_args_set_stream_compression_algorithm(
NULL, GRPC_STREAM_COMPRESS_NONE);
{
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ ExecCtx _local_exec_ctx;
server_args = grpc_channel_args_stream_compression_algorithm_set_state(
- &exec_ctx, &server_args, algorithm_to_disable, false);
- grpc_exec_ctx_finish(&exec_ctx);
+ &server_args, algorithm_to_disable, false);
+ grpc_exec_ctx_finish();
}
f = begin_test(config, test_name, client_args, server_args);
@@ -258,10 +258,10 @@ static void request_for_disabled_algorithm(
grpc_byte_buffer_destroy(request_payload_recv);
{
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_channel_args_destroy(&exec_ctx, client_args);
- grpc_channel_args_destroy(&exec_ctx, server_args);
- grpc_exec_ctx_finish(&exec_ctx);
+ ExecCtx _local_exec_ctx;
+ grpc_channel_args_destroy(client_args);
+ grpc_channel_args_destroy(server_args);
+ grpc_exec_ctx_finish();
}
end_test(&f);
@@ -544,10 +544,10 @@ static void request_with_payload_template(
cq_verifier_destroy(cqv);
{
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_channel_args_destroy(&exec_ctx, client_args);
- grpc_channel_args_destroy(&exec_ctx, server_args);
- grpc_exec_ctx_finish(&exec_ctx);
+ 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.c b/test/core/end2end/tests/stream_compression_payload.cc
index e47d2aa93c..bcde2a04c9 100644
--- a/test/core/end2end/tests/stream_compression_payload.c
+++ b/test/core/end2end/tests/stream_compression_payload.cc
@@ -278,10 +278,10 @@ static void test_invoke_request_response_with_payload(
end_test(&f);
config.tear_down_data(&f);
{
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_channel_args_destroy(&exec_ctx, client_args);
- grpc_channel_args_destroy(&exec_ctx, server_args);
- grpc_exec_ctx_finish(&exec_ctx);
+ 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.c b/test/core/end2end/tests/stream_compression_ping_pong_streaming.cc
index 4c1a34cc64..2c42b593e2 100644
--- a/test/core/end2end/tests/stream_compression_ping_pong_streaming.c
+++ b/test/core/end2end/tests/stream_compression_ping_pong_streaming.cc
@@ -273,10 +273,10 @@ static void test_pingpong_streaming(grpc_end2end_test_config config,
end_test(&f);
config.tear_down_data(&f);
{
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_channel_args_destroy(&exec_ctx, client_args);
- grpc_channel_args_destroy(&exec_ctx, server_args);
- grpc_exec_ctx_finish(&exec_ctx);
+ 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.c b/test/core/end2end/tests/workaround_cronet_compression.cc
index 44e8e04643..246ccfb3f9 100644
--- a/test/core/end2end/tests/workaround_cronet_compression.c
+++ b/test/core/end2end/tests/workaround_cronet_compression.cc
@@ -142,15 +142,15 @@ static void request_with_payload_template(
NULL, default_server_channel_compression_algorithm);
if (user_agent_override) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ ExecCtx _local_exec_ctx;
grpc_channel_args *client_args_old = client_args;
grpc_arg arg;
- arg.key = GRPC_ARG_PRIMARY_USER_AGENT_STRING;
+ arg.key = (char *)GRPC_ARG_PRIMARY_USER_AGENT_STRING;
arg.type = GRPC_ARG_STRING;
arg.value.string = user_agent_override;
client_args = grpc_channel_args_copy_and_add(client_args_old, &arg, 1);
- grpc_channel_args_destroy(&exec_ctx, client_args_old);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_channel_args_destroy(client_args_old);
+ grpc_exec_ctx_finish();
}
f = begin_test(config, test_name, client_args, server_args);
@@ -349,10 +349,10 @@ static void request_with_payload_template(
cq_verifier_destroy(cqv);
{
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_channel_args_destroy(&exec_ctx, client_args);
- grpc_channel_args_destroy(&exec_ctx, server_args);
- grpc_exec_ctx_finish(&exec_ctx);
+ ExecCtx _local_exec_ctx;
+ grpc_channel_args_destroy(client_args);
+ grpc_channel_args_destroy(server_args);
+ grpc_exec_ctx_finish();
}
end_test(&f);
@@ -366,11 +366,11 @@ typedef struct workaround_cronet_compression_config {
static workaround_cronet_compression_config workaround_configs[] = {
{NULL, GRPC_COMPRESS_GZIP},
- {"grpc-objc/1.3.0-dev grpc-c/3.0.0-dev (ios; cronet_http; gentle)",
+ {(char *)"grpc-objc/1.3.0-dev grpc-c/3.0.0-dev (ios; cronet_http; gentle)",
GRPC_COMPRESS_NONE},
- {"grpc-objc/1.3.0-dev grpc-c/3.0.0-dev (ios; chttp2; gentle)",
+ {(char *)"grpc-objc/1.3.0-dev grpc-c/3.0.0-dev (ios; chttp2; gentle)",
GRPC_COMPRESS_GZIP},
- {"grpc-objc/1.4.0 grpc-c/3.0.0-dev (ios; cronet_http; gentle)",
+ {(char *)"grpc-objc/1.4.0 grpc-c/3.0.0-dev (ios; cronet_http; gentle)",
GRPC_COMPRESS_GZIP}};
static const size_t workaround_configs_num =
sizeof(workaround_configs) / sizeof(*workaround_configs);
diff --git a/test/core/http/httpcli_test.c b/test/core/http/httpcli_test.c
index cc1c16d695..de339304d9 100644
--- a/test/core/http/httpcli_test.c
+++ b/test/core/http/httpcli_test.c
@@ -40,7 +40,7 @@ static grpc_millis n_seconds_time(int seconds) {
grpc_timeout_seconds_to_deadline(seconds));
}
-static void on_finish(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) {
+static void on_finish(void *arg, grpc_error *error) {
const char *expect =
"<html><head><title>Hello world!</title></head>"
"<body><p>This is a test</p></body></html>";
@@ -53,14 +53,14 @@ static void on_finish(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) {
g_done = 1;
GPR_ASSERT(GRPC_LOG_IF_ERROR(
"pollset_kick",
- grpc_pollset_kick(exec_ctx, grpc_polling_entity_pollset(&g_pops), NULL)));
+ grpc_pollset_kick(grpc_polling_entity_pollset(&g_pops), NULL)));
gpr_mu_unlock(g_mu);
}
static void test_get(int port) {
grpc_httpcli_request req;
char *host;
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
g_done = 0;
gpr_log(GPR_INFO, "test_get");
@@ -77,19 +77,18 @@ static void test_get(int port) {
memset(&response, 0, sizeof(response));
grpc_resource_quota *resource_quota = grpc_resource_quota_create("test_get");
grpc_httpcli_get(
- &exec_ctx, &g_context, &g_pops, resource_quota, &req, n_seconds_time(15),
+ &g_context, &g_pops, resource_quota, &req, n_seconds_time(15),
GRPC_CLOSURE_CREATE(on_finish, &response, grpc_schedule_on_exec_ctx),
&response);
- grpc_resource_quota_unref_internal(&exec_ctx, resource_quota);
+ grpc_resource_quota_unref_internal(resource_quota);
gpr_mu_lock(g_mu);
while (!g_done) {
grpc_pollset_worker *worker = NULL;
GPR_ASSERT(GRPC_LOG_IF_ERROR(
- "pollset_work",
- grpc_pollset_work(&exec_ctx, grpc_polling_entity_pollset(&g_pops),
- &worker, n_seconds_time(1))));
+ "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(&exec_ctx);
+ grpc_exec_ctx_finish();
gpr_mu_lock(g_mu);
}
gpr_mu_unlock(g_mu);
@@ -100,7 +99,7 @@ static void test_get(int port) {
static void test_post(int port) {
grpc_httpcli_request req;
char *host;
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
g_done = 0;
gpr_log(GPR_INFO, "test_post");
@@ -117,20 +116,18 @@ static void test_post(int port) {
memset(&response, 0, sizeof(response));
grpc_resource_quota *resource_quota = grpc_resource_quota_create("test_post");
grpc_httpcli_post(
- &exec_ctx, &g_context, &g_pops, resource_quota, &req, "hello", 5,
- n_seconds_time(15),
+ &g_context, &g_pops, resource_quota, &req, "hello", 5, n_seconds_time(15),
GRPC_CLOSURE_CREATE(on_finish, &response, grpc_schedule_on_exec_ctx),
&response);
- grpc_resource_quota_unref_internal(&exec_ctx, resource_quota);
+ grpc_resource_quota_unref_internal(resource_quota);
gpr_mu_lock(g_mu);
while (!g_done) {
grpc_pollset_worker *worker = NULL;
GPR_ASSERT(GRPC_LOG_IF_ERROR(
- "pollset_work",
- grpc_pollset_work(&exec_ctx, grpc_polling_entity_pollset(&g_pops),
- &worker, n_seconds_time(1))));
+ "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(&exec_ctx);
+ grpc_exec_ctx_finish();
gpr_mu_lock(g_mu);
}
gpr_mu_unlock(g_mu);
@@ -138,13 +135,13 @@ static void test_post(int port) {
grpc_http_response_destroy(&response);
}
-static void destroy_pops(grpc_exec_ctx *exec_ctx, void *p, grpc_error *error) {
- grpc_pollset_destroy(exec_ctx, grpc_polling_entity_pollset(p));
+static void destroy_pops(void *p, grpc_error *error) {
+ grpc_pollset_destroy(grpc_polling_entity_pollset(p));
}
int main(int argc, char **argv) {
grpc_closure destroyed;
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
gpr_subprocess *server;
char *me = argv[0];
char *lslash = strrchr(me, '/');
@@ -193,12 +190,11 @@ int main(int argc, char **argv) {
test_get(port);
test_post(port);
- grpc_httpcli_context_destroy(&exec_ctx, &g_context);
+ grpc_httpcli_context_destroy(&g_context);
GRPC_CLOSURE_INIT(&destroyed, destroy_pops, &g_pops,
grpc_schedule_on_exec_ctx);
- grpc_pollset_shutdown(&exec_ctx, grpc_polling_entity_pollset(&g_pops),
- &destroyed);
- grpc_exec_ctx_finish(&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.c b/test/core/http/httpscli_test.c
index f8a3cfdd76..dde2fbfd66 100644
--- a/test/core/http/httpscli_test.c
+++ b/test/core/http/httpscli_test.c
@@ -40,7 +40,7 @@ static grpc_millis n_seconds_time(int seconds) {
grpc_timeout_seconds_to_deadline(seconds));
}
-static void on_finish(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) {
+static void on_finish(void *arg, grpc_error *error) {
const char *expect =
"<html><head><title>Hello world!</title></head>"
"<body><p>This is a test</p></body></html>";
@@ -53,14 +53,14 @@ static void on_finish(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) {
g_done = 1;
GPR_ASSERT(GRPC_LOG_IF_ERROR(
"pollset_kick",
- grpc_pollset_kick(exec_ctx, grpc_polling_entity_pollset(&g_pops), NULL)));
+ grpc_pollset_kick(grpc_polling_entity_pollset(&g_pops), NULL)));
gpr_mu_unlock(g_mu);
}
static void test_get(int port) {
grpc_httpcli_request req;
char *host;
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
g_done = 0;
gpr_log(GPR_INFO, "test_get");
@@ -78,19 +78,18 @@ static void test_get(int port) {
memset(&response, 0, sizeof(response));
grpc_resource_quota *resource_quota = grpc_resource_quota_create("test_get");
grpc_httpcli_get(
- &exec_ctx, &g_context, &g_pops, resource_quota, &req, n_seconds_time(15),
+ &g_context, &g_pops, resource_quota, &req, n_seconds_time(15),
GRPC_CLOSURE_CREATE(on_finish, &response, grpc_schedule_on_exec_ctx),
&response);
- grpc_resource_quota_unref_internal(&exec_ctx, resource_quota);
+ grpc_resource_quota_unref_internal(resource_quota);
gpr_mu_lock(g_mu);
while (!g_done) {
grpc_pollset_worker *worker = NULL;
GPR_ASSERT(GRPC_LOG_IF_ERROR(
- "pollset_work",
- grpc_pollset_work(&exec_ctx, grpc_polling_entity_pollset(&g_pops),
- &worker, n_seconds_time(1))));
+ "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(&exec_ctx);
+ grpc_exec_ctx_finish();
gpr_mu_lock(g_mu);
}
gpr_mu_unlock(g_mu);
@@ -101,7 +100,7 @@ static void test_get(int port) {
static void test_post(int port) {
grpc_httpcli_request req;
char *host;
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
g_done = 0;
gpr_log(GPR_INFO, "test_post");
@@ -119,20 +118,18 @@ static void test_post(int port) {
memset(&response, 0, sizeof(response));
grpc_resource_quota *resource_quota = grpc_resource_quota_create("test_post");
grpc_httpcli_post(
- &exec_ctx, &g_context, &g_pops, resource_quota, &req, "hello", 5,
- n_seconds_time(15),
+ &g_context, &g_pops, resource_quota, &req, "hello", 5, n_seconds_time(15),
GRPC_CLOSURE_CREATE(on_finish, &response, grpc_schedule_on_exec_ctx),
&response);
- grpc_resource_quota_unref_internal(&exec_ctx, resource_quota);
+ grpc_resource_quota_unref_internal(resource_quota);
gpr_mu_lock(g_mu);
while (!g_done) {
grpc_pollset_worker *worker = NULL;
GPR_ASSERT(GRPC_LOG_IF_ERROR(
- "pollset_work",
- grpc_pollset_work(&exec_ctx, grpc_polling_entity_pollset(&g_pops),
- &worker, n_seconds_time(1))));
+ "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(&exec_ctx);
+ grpc_exec_ctx_finish();
gpr_mu_lock(g_mu);
}
gpr_mu_unlock(g_mu);
@@ -140,13 +137,13 @@ static void test_post(int port) {
grpc_http_response_destroy(&response);
}
-static void destroy_pops(grpc_exec_ctx *exec_ctx, void *p, grpc_error *error) {
- grpc_pollset_destroy(exec_ctx, grpc_polling_entity_pollset(p));
+static void destroy_pops(void *p, grpc_error *error) {
+ grpc_pollset_destroy(grpc_polling_entity_pollset(p));
}
int main(int argc, char **argv) {
grpc_closure destroyed;
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
gpr_subprocess *server;
char *me = argv[0];
char *lslash = strrchr(me, '/');
@@ -196,12 +193,11 @@ int main(int argc, char **argv) {
test_get(port);
test_post(port);
- grpc_httpcli_context_destroy(&exec_ctx, &g_context);
+ grpc_httpcli_context_destroy(&g_context);
GRPC_CLOSURE_INIT(&destroyed, destroy_pops, &g_pops,
grpc_schedule_on_exec_ctx);
- grpc_pollset_shutdown(&exec_ctx, grpc_polling_entity_pollset(&g_pops),
- &destroyed);
- grpc_exec_ctx_finish(&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.c b/test/core/iomgr/combiner_test.c
index 38f512de0e..121cbfe41a 100644
--- a/test/core/iomgr/combiner_test.c
+++ b/test/core/iomgr/combiner_test.c
@@ -28,13 +28,12 @@
static void test_no_op(void) {
gpr_log(GPR_DEBUG, "test_no_op");
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- GRPC_COMBINER_UNREF(&exec_ctx, grpc_combiner_create(), "test_no_op");
- grpc_exec_ctx_finish(&exec_ctx);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ GRPC_COMBINER_UNREF(grpc_combiner_create(), "test_no_op");
+ grpc_exec_ctx_finish();
}
-static void set_event_to_true(grpc_exec_ctx *exec_ctx, void *value,
- grpc_error *error) {
+static void set_event_to_true(void *value, grpc_error *error) {
gpr_event_set(value, (void *)1);
}
@@ -44,16 +43,15 @@ static void test_execute_one(void) {
grpc_combiner *lock = grpc_combiner_create();
gpr_event done;
gpr_event_init(&done);
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- GRPC_CLOSURE_SCHED(&exec_ctx,
- GRPC_CLOSURE_CREATE(set_event_to_true, &done,
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ GRPC_CLOSURE_SCHED(GRPC_CLOSURE_CREATE(set_event_to_true, &done,
grpc_combiner_scheduler(lock)),
GRPC_ERROR_NONE);
- grpc_exec_ctx_flush(&exec_ctx);
+ grpc_exec_ctx_flush();
GPR_ASSERT(gpr_event_wait(&done, grpc_timeout_seconds_to_deadline(5)) !=
NULL);
- GRPC_COMBINER_UNREF(&exec_ctx, lock, "test_execute_one");
- grpc_exec_ctx_finish(&exec_ctx);
+ GRPC_COMBINER_UNREF(lock, "test_execute_one");
+ grpc_exec_ctx_finish();
}
typedef struct {
@@ -67,7 +65,7 @@ typedef struct {
size_t value;
} ex_args;
-static void check_one(grpc_exec_ctx *exec_ctx, void *a, grpc_error *error) {
+static void check_one(void *a, grpc_error *error) {
ex_args *args = a;
GPR_ASSERT(*args->ctr == args->value - 1);
*args->ctr = args->value;
@@ -76,28 +74,26 @@ static void check_one(grpc_exec_ctx *exec_ctx, void *a, grpc_error *error) {
static void execute_many_loop(void *a) {
thd_args *args = a;
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
size_t n = 1;
for (size_t i = 0; i < 10; i++) {
for (size_t j = 0; j < 10000; j++) {
ex_args *c = gpr_malloc(sizeof(*c));
c->ctr = &args->ctr;
c->value = n++;
- GRPC_CLOSURE_SCHED(&exec_ctx,
- GRPC_CLOSURE_CREATE(
+ GRPC_CLOSURE_SCHED(GRPC_CLOSURE_CREATE(
check_one, c, grpc_combiner_scheduler(args->lock)),
GRPC_ERROR_NONE);
- grpc_exec_ctx_flush(&exec_ctx);
+ grpc_exec_ctx_flush();
}
// sleep for a little bit, to test a combiner draining and another thread
// picking it up
gpr_sleep_until(grpc_timeout_milliseconds_to_deadline(100));
}
- GRPC_CLOSURE_SCHED(&exec_ctx,
- GRPC_CLOSURE_CREATE(set_event_to_true, &args->done,
+ GRPC_CLOSURE_SCHED(GRPC_CLOSURE_CREATE(set_event_to_true, &args->done,
grpc_combiner_scheduler(args->lock)),
GRPC_ERROR_NONE);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_exec_ctx_finish();
}
static void test_execute_many(void) {
@@ -119,20 +115,19 @@ static void test_execute_many(void) {
gpr_inf_future(GPR_CLOCK_REALTIME)) != NULL);
gpr_thd_join(thds[i]);
}
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- GRPC_COMBINER_UNREF(&exec_ctx, lock, "test_execute_many");
- grpc_exec_ctx_finish(&exec_ctx);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ GRPC_COMBINER_UNREF(lock, "test_execute_many");
+ grpc_exec_ctx_finish();
}
static gpr_event got_in_finally;
-static void in_finally(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) {
+static void in_finally(void *arg, grpc_error *error) {
gpr_event_set(&got_in_finally, (void *)1);
}
-static void add_finally(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) {
- GRPC_CLOSURE_SCHED(exec_ctx,
- GRPC_CLOSURE_CREATE(in_finally, arg,
+static void add_finally(void *arg, grpc_error *error) {
+ GRPC_CLOSURE_SCHED(GRPC_CLOSURE_CREATE(in_finally, arg,
grpc_combiner_finally_scheduler(arg)),
GRPC_ERROR_NONE);
}
@@ -141,17 +136,16 @@ static void test_execute_finally(void) {
gpr_log(GPR_DEBUG, "test_execute_finally");
grpc_combiner *lock = grpc_combiner_create();
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
gpr_event_init(&got_in_finally);
GRPC_CLOSURE_SCHED(
- &exec_ctx,
GRPC_CLOSURE_CREATE(add_finally, lock, grpc_combiner_scheduler(lock)),
GRPC_ERROR_NONE);
- grpc_exec_ctx_flush(&exec_ctx);
+ grpc_exec_ctx_flush();
GPR_ASSERT(gpr_event_wait(&got_in_finally,
grpc_timeout_seconds_to_deadline(5)) != NULL);
- GRPC_COMBINER_UNREF(&exec_ctx, lock, "test_execute_finally");
- grpc_exec_ctx_finish(&exec_ctx);
+ 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.c b/test/core/iomgr/endpoint_pair_test.c
index f2ce3d0d12..989cc80016 100644
--- a/test/core/iomgr/endpoint_pair_test.c
+++ b/test/core/iomgr/endpoint_pair_test.c
@@ -32,7 +32,7 @@ static void clean_up(void) {}
static grpc_endpoint_test_fixture create_fixture_endpoint_pair(
size_t slice_size) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_endpoint_test_fixture f;
grpc_arg a[] = {{.key = GRPC_ARG_TCP_READ_CHUNK_SIZE,
.type = GRPC_ARG_INTEGER,
@@ -42,9 +42,9 @@ static grpc_endpoint_test_fixture create_fixture_endpoint_pair(
f.client_ep = p.client;
f.server_ep = p.server;
- grpc_endpoint_add_to_pollset(&exec_ctx, f.client_ep, g_pollset);
- grpc_endpoint_add_to_pollset(&exec_ctx, f.server_ep, g_pollset);
- grpc_exec_ctx_finish(&exec_ctx);
+ 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;
}
@@ -53,14 +53,13 @@ static grpc_endpoint_test_config configs[] = {
{"tcp/tcp_socketpair", create_fixture_endpoint_pair, clean_up},
};
-static void destroy_pollset(grpc_exec_ctx *exec_ctx, void *p,
- grpc_error *error) {
- grpc_pollset_destroy(exec_ctx, p);
+static void destroy_pollset(void *p, grpc_error *error) {
+ grpc_pollset_destroy(p);
}
int main(int argc, char **argv) {
grpc_closure destroyed;
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_test_init(argc, argv);
grpc_init();
g_pollset = gpr_zalloc(grpc_pollset_size());
@@ -68,8 +67,8 @@ int main(int argc, char **argv) {
grpc_endpoint_tests(configs[0], g_pollset, g_mu);
GRPC_CLOSURE_INIT(&destroyed, destroy_pollset, g_pollset,
grpc_schedule_on_exec_ctx);
- grpc_pollset_shutdown(&exec_ctx, g_pollset, &destroyed);
- grpc_exec_ctx_finish(&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.c b/test/core/iomgr/endpoint_tests.cc
index 61e901f645..a6ac24a261 100644
--- a/test/core/iomgr/endpoint_tests.c
+++ b/test/core/iomgr/endpoint_tests.cc
@@ -115,8 +115,7 @@ struct read_and_write_test_state {
grpc_closure done_write;
};
-static void read_and_write_test_read_handler(grpc_exec_ctx *exec_ctx,
- void *data, grpc_error *error) {
+static void read_and_write_test_read_handler(void *data, grpc_error *error) {
struct read_and_write_test_state *state =
(struct read_and_write_test_state *)data;
@@ -126,17 +125,14 @@ static void read_and_write_test_read_handler(grpc_exec_ctx *exec_ctx,
gpr_log(GPR_INFO, "Read handler done");
gpr_mu_lock(g_mu);
state->read_done = 1 + (error == GRPC_ERROR_NONE);
- GRPC_LOG_IF_ERROR("pollset_kick",
- grpc_pollset_kick(exec_ctx, g_pollset, NULL));
+ GRPC_LOG_IF_ERROR("pollset_kick", grpc_pollset_kick(g_pollset, NULL));
gpr_mu_unlock(g_mu);
} else if (error == GRPC_ERROR_NONE) {
- grpc_endpoint_read(exec_ctx, state->read_ep, &state->incoming,
- &state->done_read);
+ grpc_endpoint_read(state->read_ep, &state->incoming, &state->done_read);
}
}
-static void read_and_write_test_write_handler(grpc_exec_ctx *exec_ctx,
- void *data, grpc_error *error) {
+static void read_and_write_test_write_handler(void *data, grpc_error *error) {
struct read_and_write_test_state *state =
(struct read_and_write_test_state *)data;
grpc_slice *slices = NULL;
@@ -153,7 +149,7 @@ static void read_and_write_test_write_handler(grpc_exec_ctx *exec_ctx,
&state->current_write_data);
grpc_slice_buffer_reset_and_unref(&state->outgoing);
grpc_slice_buffer_addn(&state->outgoing, slices, nslices);
- grpc_endpoint_write(exec_ctx, state->write_ep, &state->outgoing,
+ grpc_endpoint_write(state->write_ep, &state->outgoing,
&state->done_write);
gpr_free(slices);
return;
@@ -163,8 +159,7 @@ static void read_and_write_test_write_handler(grpc_exec_ctx *exec_ctx,
gpr_log(GPR_INFO, "Write handler done");
gpr_mu_lock(g_mu);
state->write_done = 1 + (error == GRPC_ERROR_NONE);
- GRPC_LOG_IF_ERROR("pollset_kick",
- grpc_pollset_kick(exec_ctx, g_pollset, NULL));
+ GRPC_LOG_IF_ERROR("pollset_kick", grpc_pollset_kick(g_pollset, NULL));
gpr_mu_unlock(g_mu);
}
@@ -178,7 +173,7 @@ static void read_and_write_test(grpc_endpoint_test_config config,
struct read_and_write_test_state state;
grpc_endpoint_test_fixture f =
begin_test(config, "read_and_write_test", slice_size);
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ ExecCtx _local_exec_ctx;
grpc_millis deadline =
grpc_timespec_to_millis_round_up(grpc_timeout_seconds_to_deadline(20));
gpr_log(GPR_DEBUG, "num_bytes=%" PRIuPTR " write_size=%" PRIuPTR
@@ -215,66 +210,57 @@ static void read_and_write_test(grpc_endpoint_test_config config,
for the first iteration as for later iterations. It does the right thing
even when bytes_written is unsigned. */
state.bytes_written -= state.current_write_size;
- read_and_write_test_write_handler(&exec_ctx, &state, GRPC_ERROR_NONE);
- grpc_exec_ctx_flush(&exec_ctx);
+ read_and_write_test_write_handler(&state, GRPC_ERROR_NONE);
+ grpc_exec_ctx_flush();
- grpc_endpoint_read(&exec_ctx, state.read_ep, &state.incoming,
- &state.done_read);
+ grpc_endpoint_read(state.read_ep, &state.incoming, &state.done_read);
if (shutdown) {
gpr_log(GPR_DEBUG, "shutdown read");
grpc_endpoint_shutdown(
- &exec_ctx, state.read_ep,
- GRPC_ERROR_CREATE_FROM_STATIC_STRING("Test Shutdown"));
+ state.read_ep, GRPC_ERROR_CREATE_FROM_STATIC_STRING("Test Shutdown"));
gpr_log(GPR_DEBUG, "shutdown write");
grpc_endpoint_shutdown(
- &exec_ctx, state.write_ep,
- GRPC_ERROR_CREATE_FROM_STATIC_STRING("Test Shutdown"));
+ state.write_ep, GRPC_ERROR_CREATE_FROM_STATIC_STRING("Test Shutdown"));
}
- grpc_exec_ctx_flush(&exec_ctx);
+ grpc_exec_ctx_flush();
gpr_mu_lock(g_mu);
while (!state.read_done || !state.write_done) {
grpc_pollset_worker *worker = NULL;
- GPR_ASSERT(grpc_exec_ctx_now(&exec_ctx) < deadline);
+ GPR_ASSERT(grpc_exec_ctx_now() < deadline);
GPR_ASSERT(GRPC_LOG_IF_ERROR(
- "pollset_work",
- grpc_pollset_work(&exec_ctx, g_pollset, &worker, deadline)));
+ "pollset_work", grpc_pollset_work(g_pollset, &worker, deadline)));
}
gpr_mu_unlock(g_mu);
- grpc_exec_ctx_flush(&exec_ctx);
+ grpc_exec_ctx_flush();
end_test(config);
- grpc_slice_buffer_destroy_internal(&exec_ctx, &state.outgoing);
- grpc_slice_buffer_destroy_internal(&exec_ctx, &state.incoming);
- grpc_endpoint_destroy(&exec_ctx, state.read_ep);
- grpc_endpoint_destroy(&exec_ctx, state.write_ep);
- grpc_exec_ctx_finish(&exec_ctx);
+ 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(grpc_exec_ctx *exec_ctx, void *arg,
- grpc_error *error) {
+static void inc_on_failure(void *arg, grpc_error *error) {
gpr_mu_lock(g_mu);
*(int *)arg += (error != GRPC_ERROR_NONE);
- GPR_ASSERT(
- GRPC_LOG_IF_ERROR("kick", grpc_pollset_kick(exec_ctx, g_pollset, NULL)));
+ GPR_ASSERT(GRPC_LOG_IF_ERROR("kick", grpc_pollset_kick(g_pollset, NULL)));
gpr_mu_unlock(g_mu);
}
-static void wait_for_fail_count(grpc_exec_ctx *exec_ctx, int *fail_count,
- int want_fail_count) {
- grpc_exec_ctx_flush(exec_ctx);
+static void wait_for_fail_count(int *fail_count, int want_fail_count) {
+ grpc_exec_ctx_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(exec_ctx) < deadline &&
- *fail_count < want_fail_count) {
+ while (grpc_exec_ctx_now() < deadline && *fail_count < want_fail_count) {
grpc_pollset_worker *worker = NULL;
GPR_ASSERT(GRPC_LOG_IF_ERROR(
- "pollset_work",
- grpc_pollset_work(exec_ctx, g_pollset, &worker, deadline)));
+ "pollset_work", grpc_pollset_work(g_pollset, &worker, deadline)));
gpr_mu_unlock(g_mu);
- grpc_exec_ctx_flush(exec_ctx);
+ grpc_exec_ctx_flush();
gpr_mu_lock(g_mu);
}
GPR_ASSERT(*fail_count == want_fail_count);
@@ -289,33 +275,33 @@ static void multiple_shutdown_test(grpc_endpoint_test_config config) {
grpc_slice_buffer slice_buffer;
grpc_slice_buffer_init(&slice_buffer);
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_endpoint_add_to_pollset(&exec_ctx, f.client_ep, g_pollset);
- grpc_endpoint_read(&exec_ctx, f.client_ep, &slice_buffer,
+ ExecCtx _local_exec_ctx;
+ grpc_endpoint_add_to_pollset(f.client_ep, g_pollset);
+ grpc_endpoint_read(f.client_ep, &slice_buffer,
GRPC_CLOSURE_CREATE(inc_on_failure, &fail_count,
grpc_schedule_on_exec_ctx));
- wait_for_fail_count(&exec_ctx, &fail_count, 0);
- grpc_endpoint_shutdown(&exec_ctx, f.client_ep,
+ wait_for_fail_count(&fail_count, 0);
+ grpc_endpoint_shutdown(f.client_ep,
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Test Shutdown"));
- wait_for_fail_count(&exec_ctx, &fail_count, 1);
- grpc_endpoint_read(&exec_ctx, f.client_ep, &slice_buffer,
+ wait_for_fail_count(&fail_count, 1);
+ grpc_endpoint_read(f.client_ep, &slice_buffer,
GRPC_CLOSURE_CREATE(inc_on_failure, &fail_count,
grpc_schedule_on_exec_ctx));
- wait_for_fail_count(&exec_ctx, &fail_count, 2);
+ wait_for_fail_count(&fail_count, 2);
grpc_slice_buffer_add(&slice_buffer, grpc_slice_from_copied_string("a"));
- grpc_endpoint_write(&exec_ctx, f.client_ep, &slice_buffer,
+ grpc_endpoint_write(f.client_ep, &slice_buffer,
GRPC_CLOSURE_CREATE(inc_on_failure, &fail_count,
grpc_schedule_on_exec_ctx));
- wait_for_fail_count(&exec_ctx, &fail_count, 3);
- grpc_endpoint_shutdown(&exec_ctx, f.client_ep,
+ wait_for_fail_count(&fail_count, 3);
+ grpc_endpoint_shutdown(f.client_ep,
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Test Shutdown"));
- wait_for_fail_count(&exec_ctx, &fail_count, 3);
+ wait_for_fail_count(&fail_count, 3);
- grpc_slice_buffer_destroy_internal(&exec_ctx, &slice_buffer);
+ grpc_slice_buffer_destroy_internal(&slice_buffer);
- grpc_endpoint_destroy(&exec_ctx, f.client_ep);
- grpc_endpoint_destroy(&exec_ctx, f.server_ep);
- grpc_exec_ctx_finish(&exec_ctx);
+ 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.c b/test/core/iomgr/ev_epollsig_linux_test.c
index 37aadacd49..e6f9f59bd3 100644
--- a/test/core/iomgr/ev_epollsig_linux_test.c
+++ b/test/core/iomgr/ev_epollsig_linux_test.c
@@ -70,19 +70,18 @@ static void test_fd_init(test_fd *tfds, int *fds, int num_fds) {
}
}
-static void test_fd_cleanup(grpc_exec_ctx *exec_ctx, test_fd *tfds,
- int num_fds) {
+static void test_fd_cleanup(test_fd *tfds, int num_fds) {
int release_fd;
int i;
for (i = 0; i < num_fds; i++) {
- grpc_fd_shutdown(exec_ctx, tfds[i].fd,
+ grpc_fd_shutdown(tfds[i].fd,
GRPC_ERROR_CREATE_FROM_STATIC_STRING("test_fd_cleanup"));
- grpc_exec_ctx_flush(exec_ctx);
+ grpc_exec_ctx_flush();
- grpc_fd_orphan(exec_ctx, tfds[i].fd, NULL, &release_fd,
- false /* already_closed */, "test_fd_cleanup");
- grpc_exec_ctx_flush(exec_ctx);
+ grpc_fd_orphan(tfds[i].fd, NULL, &release_fd, false /* already_closed */,
+ "test_fd_cleanup");
+ grpc_exec_ctx_flush();
GPR_ASSERT(release_fd == tfds[i].inner_fd);
close(tfds[i].inner_fd);
@@ -97,22 +96,20 @@ static void test_pollset_init(test_pollset *pollsets, int num_pollsets) {
}
}
-static void destroy_pollset(grpc_exec_ctx *exec_ctx, void *p,
- grpc_error *error) {
- grpc_pollset_destroy(exec_ctx, p);
+static void destroy_pollset(void *p, grpc_error *error) {
+ grpc_pollset_destroy(p);
}
-static void test_pollset_cleanup(grpc_exec_ctx *exec_ctx,
- test_pollset *pollsets, int num_pollsets) {
+static void test_pollset_cleanup(test_pollset *pollsets, int num_pollsets) {
grpc_closure destroyed;
int i;
for (i = 0; i < num_pollsets; i++) {
GRPC_CLOSURE_INIT(&destroyed, destroy_pollset, pollsets[i].pollset,
grpc_schedule_on_exec_ctx);
- grpc_pollset_shutdown(exec_ctx, pollsets[i].pollset, &destroyed);
+ grpc_pollset_shutdown(pollsets[i].pollset, &destroyed);
- grpc_exec_ctx_flush(exec_ctx);
+ grpc_exec_ctx_flush();
gpr_free(pollsets[i].pollset);
}
}
@@ -132,7 +129,7 @@ static void test_pollset_cleanup(grpc_exec_ctx *exec_ctx,
#define NUM_POLLSETS 4
static void test_add_fd_to_pollset() {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
test_fd tfds[NUM_FDS];
int fds[NUM_FDS];
test_pollset pollsets[NUM_POLLSETS];
@@ -169,33 +166,33 @@ static void test_add_fd_to_pollset() {
/* == Step 1 == */
for (i = 0; i <= 2; i++) {
- grpc_pollset_add_fd(&exec_ctx, pollsets[0].pollset, tfds[i].fd);
- grpc_exec_ctx_flush(&exec_ctx);
+ grpc_pollset_add_fd(pollsets[0].pollset, tfds[i].fd);
+ grpc_exec_ctx_flush();
}
for (i = 3; i <= 4; i++) {
- grpc_pollset_add_fd(&exec_ctx, pollsets[1].pollset, tfds[i].fd);
- grpc_exec_ctx_flush(&exec_ctx);
+ grpc_pollset_add_fd(pollsets[1].pollset, tfds[i].fd);
+ grpc_exec_ctx_flush();
}
for (i = 5; i <= 7; i++) {
- grpc_pollset_add_fd(&exec_ctx, pollsets[2].pollset, tfds[i].fd);
- grpc_exec_ctx_flush(&exec_ctx);
+ grpc_pollset_add_fd(pollsets[2].pollset, tfds[i].fd);
+ grpc_exec_ctx_flush();
}
/* == Step 2 == */
for (i = 0; i <= 1; i++) {
- grpc_pollset_add_fd(&exec_ctx, pollsets[3].pollset, tfds[i].fd);
- grpc_exec_ctx_flush(&exec_ctx);
+ grpc_pollset_add_fd(pollsets[3].pollset, tfds[i].fd);
+ grpc_exec_ctx_flush();
}
/* == Step 3 == */
- grpc_pollset_add_fd(&exec_ctx, pollsets[1].pollset, tfds[0].fd);
- grpc_exec_ctx_flush(&exec_ctx);
+ grpc_pollset_add_fd(pollsets[1].pollset, tfds[0].fd);
+ grpc_exec_ctx_flush();
/* == Step 4 == */
- grpc_pollset_add_fd(&exec_ctx, pollsets[2].pollset, tfds[3].fd);
- grpc_exec_ctx_flush(&exec_ctx);
+ grpc_pollset_add_fd(pollsets[2].pollset, tfds[3].fd);
+ grpc_exec_ctx_flush();
/* All polling islands are merged at this point */
@@ -212,9 +209,9 @@ static void test_add_fd_to_pollset() {
expected_pi, grpc_pollset_get_polling_island(pollsets[i].pollset)));
}
- test_fd_cleanup(&exec_ctx, tfds, NUM_FDS);
- test_pollset_cleanup(&exec_ctx, pollsets, NUM_POLLSETS);
- grpc_exec_ctx_finish(&exec_ctx);
+ test_fd_cleanup(tfds, NUM_FDS);
+ test_pollset_cleanup(pollsets, NUM_POLLSETS);
+ grpc_exec_ctx_finish();
}
#undef NUM_FDS
@@ -234,26 +231,25 @@ static __thread int thread_wakeups = 0;
static void test_threading_loop(void *arg) {
threading_shared *shared = arg;
while (thread_wakeups < 1000000) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_pollset_worker *worker;
gpr_mu_lock(shared->mu);
GPR_ASSERT(GRPC_LOG_IF_ERROR(
- "pollset_work", grpc_pollset_work(&exec_ctx, shared->pollset, &worker,
- GRPC_MILLIS_INF_FUTURE)));
+ "pollset_work",
+ grpc_pollset_work(shared->pollset, &worker, GRPC_MILLIS_INF_FUTURE)));
gpr_mu_unlock(shared->mu);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_exec_ctx_finish();
}
}
-static void test_threading_wakeup(grpc_exec_ctx *exec_ctx, void *arg,
- grpc_error *error) {
+static void test_threading_wakeup(void *arg, grpc_error *error) {
threading_shared *shared = arg;
++shared->wakeups;
++thread_wakeups;
if (error == GRPC_ERROR_NONE) {
GPR_ASSERT(GRPC_LOG_IF_ERROR(
"consume_wakeup", grpc_wakeup_fd_consume_wakeup(shared->wakeup_fd)));
- grpc_fd_notify_on_read(exec_ctx, shared->wakeup_desc, &shared->on_wakeup);
+ grpc_fd_notify_on_read(shared->wakeup_desc, &shared->on_wakeup);
GPR_ASSERT(GRPC_LOG_IF_ERROR("wakeup_next",
grpc_wakeup_fd_wakeup(shared->wakeup_fd)));
}
@@ -276,13 +272,13 @@ static void test_threading(void) {
shared.wakeup_desc = grpc_fd_create(fd.read_fd, "wakeup");
shared.wakeups = 0;
{
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_pollset_add_fd(&exec_ctx, shared.pollset, shared.wakeup_desc);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_pollset_add_fd(shared.pollset, shared.wakeup_desc);
grpc_fd_notify_on_read(
- &exec_ctx, shared.wakeup_desc,
+ shared.wakeup_desc,
GRPC_CLOSURE_INIT(&shared.on_wakeup, test_threading_wakeup, &shared,
grpc_schedule_on_exec_ctx));
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_exec_ctx_finish();
}
GPR_ASSERT(GRPC_LOG_IF_ERROR("wakeup_first",
grpc_wakeup_fd_wakeup(shared.wakeup_fd)));
@@ -292,14 +288,14 @@ static void test_threading(void) {
fd.read_fd = 0;
grpc_wakeup_fd_destroy(&fd);
{
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_fd_shutdown(&exec_ctx, shared.wakeup_desc, GRPC_ERROR_CANCELLED);
- grpc_fd_orphan(&exec_ctx, shared.wakeup_desc, NULL, NULL,
- false /* already_closed */, "done");
- grpc_pollset_shutdown(&exec_ctx, shared.pollset,
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_fd_shutdown(shared.wakeup_desc, GRPC_ERROR_CANCELLED);
+ grpc_fd_orphan(shared.wakeup_desc, NULL, NULL, false /* already_closed */,
+ "done");
+ grpc_pollset_shutdown(shared.pollset,
GRPC_CLOSURE_CREATE(destroy_pollset, shared.pollset,
grpc_schedule_on_exec_ctx));
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_exec_ctx_finish();
}
gpr_free(shared.pollset);
}
@@ -308,7 +304,7 @@ int main(int argc, char **argv) {
const char *poll_strategy = NULL;
grpc_test_init(argc, argv);
grpc_init();
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
poll_strategy = grpc_get_poll_strategy_name();
if (poll_strategy != NULL && strcmp(poll_strategy, "epollsig") == 0) {
@@ -321,7 +317,7 @@ int main(int argc, char **argv) {
poll_strategy);
}
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_exec_ctx_finish();
grpc_shutdown();
return 0;
}
diff --git a/test/core/iomgr/fd_conservation_posix_test.c b/test/core/iomgr/fd_conservation_posix_test.c
index d29b1e8e41..8fcb01efd8 100644
--- a/test/core/iomgr/fd_conservation_posix_test.c
+++ b/test/core/iomgr/fd_conservation_posix_test.c
@@ -31,7 +31,7 @@ int main(int argc, char **argv) {
grpc_test_init(argc, argv);
grpc_init();
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
/* set max # of file descriptors to a low value, and
verify we can create and destroy many more than this number
@@ -43,14 +43,14 @@ int main(int argc, char **argv) {
for (i = 0; i < 100; i++) {
p = grpc_iomgr_create_endpoint_pair("test", NULL);
- grpc_endpoint_destroy(&exec_ctx, p.client);
- grpc_endpoint_destroy(&exec_ctx, p.server);
- grpc_exec_ctx_flush(&exec_ctx);
+ grpc_endpoint_destroy(p.client);
+ grpc_endpoint_destroy(p.server);
+ grpc_exec_ctx_flush();
}
grpc_resource_quota_unref(resource_quota);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_exec_ctx_finish();
grpc_shutdown();
return 0;
}
diff --git a/test/core/iomgr/fd_posix_test.c b/test/core/iomgr/fd_posix_test.c
index 1c62f34d3e..d16b556768 100644
--- a/test/core/iomgr/fd_posix_test.c
+++ b/test/core/iomgr/fd_posix_test.c
@@ -111,20 +111,19 @@ typedef struct {
/* Called when an upload session can be safely shutdown.
Close session FD and start to shutdown listen FD. */
-static void session_shutdown_cb(grpc_exec_ctx *exec_ctx, void *arg, /*session */
+static void session_shutdown_cb(void *arg, /*session */
bool success) {
session *se = arg;
server *sv = se->sv;
- grpc_fd_orphan(exec_ctx, se->em_fd, NULL, NULL, false /* already_closed */,
- "a");
+ grpc_fd_orphan(se->em_fd, NULL, NULL, false /* already_closed */, "a");
gpr_free(se);
/* Start to shutdown listen fd. */
- grpc_fd_shutdown(exec_ctx, sv->em_fd,
+ grpc_fd_shutdown(sv->em_fd,
GRPC_ERROR_CREATE_FROM_STATIC_STRING("session_shutdown_cb"));
}
/* Called when data become readable in a session. */
-static void session_read_cb(grpc_exec_ctx *exec_ctx, void *arg, /*session */
+static void session_read_cb(void *arg, /*session */
grpc_error *error) {
session *se = arg;
int fd = grpc_fd_wrapped_fd(se->em_fd);
@@ -133,7 +132,7 @@ static void session_read_cb(grpc_exec_ctx *exec_ctx, void *arg, /*session */
ssize_t read_total = 0;
if (error != GRPC_ERROR_NONE) {
- session_shutdown_cb(exec_ctx, arg, 1);
+ session_shutdown_cb(arg, 1);
return;
}
@@ -148,7 +147,7 @@ static void session_read_cb(grpc_exec_ctx *exec_ctx, void *arg, /*session */
It is possible to read nothing due to spurious edge event or data has
been drained, In such a case, read() returns -1 and set errno to EAGAIN. */
if (read_once == 0) {
- session_shutdown_cb(exec_ctx, arg, 1);
+ session_shutdown_cb(arg, 1);
} else if (read_once == -1) {
if (errno == EAGAIN) {
/* An edge triggered event is cached in the kernel until next poll.
@@ -159,7 +158,7 @@ static void session_read_cb(grpc_exec_ctx *exec_ctx, void *arg, /*session */
TODO(chenw): in multi-threaded version, callback and polling can be
run in different threads. polling may catch a persist read edge event
before notify_on_read is called. */
- grpc_fd_notify_on_read(exec_ctx, se->em_fd, &se->session_read_closure);
+ grpc_fd_notify_on_read(se->em_fd, &se->session_read_closure);
} else {
gpr_log(GPR_ERROR, "Unhandled read error %s", strerror(errno));
abort();
@@ -169,22 +168,20 @@ static void session_read_cb(grpc_exec_ctx *exec_ctx, void *arg, /*session */
/* Called when the listen FD can be safely shutdown.
Close listen FD and signal that server can be shutdown. */
-static void listen_shutdown_cb(grpc_exec_ctx *exec_ctx, void *arg /*server */,
- int success) {
+static void listen_shutdown_cb(void *arg /*server */, int success) {
server *sv = arg;
- grpc_fd_orphan(exec_ctx, sv->em_fd, NULL, NULL, false /* already_closed */,
- "b");
+ grpc_fd_orphan(sv->em_fd, NULL, NULL, false /* already_closed */, "b");
gpr_mu_lock(g_mu);
sv->done = 1;
- GPR_ASSERT(GRPC_LOG_IF_ERROR("pollset_kick",
- grpc_pollset_kick(exec_ctx, g_pollset, NULL)));
+ GPR_ASSERT(
+ GRPC_LOG_IF_ERROR("pollset_kick", grpc_pollset_kick(g_pollset, NULL)));
gpr_mu_unlock(g_mu);
}
/* Called when a new TCP connection request arrives in the listening port. */
-static void listen_cb(grpc_exec_ctx *exec_ctx, void *arg, /*=sv_arg*/
+static void listen_cb(void *arg, /*=sv_arg*/
grpc_error *error) {
server *sv = arg;
int fd;
@@ -195,7 +192,7 @@ static void listen_cb(grpc_exec_ctx *exec_ctx, void *arg, /*=sv_arg*/
grpc_fd *listen_em_fd = sv->em_fd;
if (error != GRPC_ERROR_NONE) {
- listen_shutdown_cb(exec_ctx, arg, 1);
+ listen_shutdown_cb(arg, 1);
return;
}
@@ -207,12 +204,12 @@ static void listen_cb(grpc_exec_ctx *exec_ctx, void *arg, /*=sv_arg*/
se = gpr_malloc(sizeof(*se));
se->sv = sv;
se->em_fd = grpc_fd_create(fd, "listener");
- grpc_pollset_add_fd(exec_ctx, g_pollset, se->em_fd);
+ grpc_pollset_add_fd(g_pollset, se->em_fd);
GRPC_CLOSURE_INIT(&se->session_read_closure, session_read_cb, se,
grpc_schedule_on_exec_ctx);
- grpc_fd_notify_on_read(exec_ctx, se->em_fd, &se->session_read_closure);
+ grpc_fd_notify_on_read(se->em_fd, &se->session_read_closure);
- grpc_fd_notify_on_read(exec_ctx, listen_em_fd, &sv->listen_closure);
+ grpc_fd_notify_on_read(listen_em_fd, &sv->listen_closure);
}
/* Max number of connections pending to be accepted by listen(). */
@@ -222,7 +219,7 @@ static void listen_cb(grpc_exec_ctx *exec_ctx, void *arg, /*=sv_arg*/
listen_cb() is registered to be interested in reading from listen_fd.
When connection request arrives, listen_cb() is called to accept the
connection request. */
-static int server_start(grpc_exec_ctx *exec_ctx, server *sv) {
+static int server_start(server *sv) {
int port = 0;
int fd;
struct sockaddr_in sin;
@@ -236,11 +233,11 @@ static int server_start(grpc_exec_ctx *exec_ctx, server *sv) {
GPR_ASSERT(listen(fd, MAX_NUM_FD) == 0);
sv->em_fd = grpc_fd_create(fd, "server");
- grpc_pollset_add_fd(exec_ctx, g_pollset, sv->em_fd);
+ grpc_pollset_add_fd(g_pollset, sv->em_fd);
/* Register to be interested in reading from listen_fd. */
GRPC_CLOSURE_INIT(&sv->listen_closure, listen_cb, sv,
grpc_schedule_on_exec_ctx);
- grpc_fd_notify_on_read(exec_ctx, sv->em_fd, &sv->listen_closure);
+ grpc_fd_notify_on_read(sv->em_fd, &sv->listen_closure);
return port;
}
@@ -249,13 +246,13 @@ static int server_start(grpc_exec_ctx *exec_ctx, server *sv) {
static void server_wait_and_shutdown(server *sv) {
gpr_mu_lock(g_mu);
while (!sv->done) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_pollset_worker *worker = NULL;
GPR_ASSERT(GRPC_LOG_IF_ERROR(
- "pollset_work", grpc_pollset_work(&exec_ctx, g_pollset, &worker,
- GRPC_MILLIS_INF_FUTURE)));
+ "pollset_work",
+ grpc_pollset_work(g_pollset, &worker, GRPC_MILLIS_INF_FUTURE)));
gpr_mu_unlock(g_mu);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_exec_ctx_finish();
gpr_mu_lock(g_mu);
}
gpr_mu_unlock(g_mu);
@@ -289,18 +286,16 @@ static void client_init(client *cl) {
}
/* Called when a client upload session is ready to shutdown. */
-static void client_session_shutdown_cb(grpc_exec_ctx *exec_ctx,
- void *arg /*client */, int success) {
+static void client_session_shutdown_cb(void *arg /*client */, int success) {
client *cl = arg;
- grpc_fd_orphan(exec_ctx, cl->em_fd, NULL, NULL, false /* already_closed */,
- "c");
+ grpc_fd_orphan(cl->em_fd, NULL, NULL, false /* already_closed */, "c");
cl->done = 1;
- GPR_ASSERT(GRPC_LOG_IF_ERROR("pollset_kick",
- grpc_pollset_kick(exec_ctx, g_pollset, NULL)));
+ GPR_ASSERT(
+ GRPC_LOG_IF_ERROR("pollset_kick", grpc_pollset_kick(g_pollset, NULL)));
}
/* Write as much as possible, then register notify_on_write. */
-static void client_session_write(grpc_exec_ctx *exec_ctx, void *arg, /*client */
+static void client_session_write(void *arg, /*client */
grpc_error *error) {
client *cl = arg;
int fd = grpc_fd_wrapped_fd(cl->em_fd);
@@ -308,7 +303,7 @@ static void client_session_write(grpc_exec_ctx *exec_ctx, void *arg, /*client */
if (error != GRPC_ERROR_NONE) {
gpr_mu_lock(g_mu);
- client_session_shutdown_cb(exec_ctx, arg, 1);
+ client_session_shutdown_cb(arg, 1);
gpr_mu_unlock(g_mu);
return;
}
@@ -323,10 +318,10 @@ static void client_session_write(grpc_exec_ctx *exec_ctx, void *arg, /*client */
if (cl->client_write_cnt < CLIENT_TOTAL_WRITE_CNT) {
GRPC_CLOSURE_INIT(&cl->write_closure, client_session_write, cl,
grpc_schedule_on_exec_ctx);
- grpc_fd_notify_on_write(exec_ctx, cl->em_fd, &cl->write_closure);
+ grpc_fd_notify_on_write(cl->em_fd, &cl->write_closure);
cl->client_write_cnt++;
} else {
- client_session_shutdown_cb(exec_ctx, arg, 1);
+ client_session_shutdown_cb(arg, 1);
}
gpr_mu_unlock(g_mu);
} else {
@@ -336,7 +331,7 @@ static void client_session_write(grpc_exec_ctx *exec_ctx, void *arg, /*client */
}
/* Start a client to send a stream of bytes. */
-static void client_start(grpc_exec_ctx *exec_ctx, client *cl, int port) {
+static void client_start(client *cl, int port) {
int fd;
struct sockaddr_in sin;
create_test_socket(port, &fd, &sin);
@@ -357,9 +352,9 @@ static void client_start(grpc_exec_ctx *exec_ctx, client *cl, int port) {
}
cl->em_fd = grpc_fd_create(fd, "client");
- grpc_pollset_add_fd(exec_ctx, g_pollset, cl->em_fd);
+ grpc_pollset_add_fd(g_pollset, cl->em_fd);
- client_session_write(exec_ctx, cl, GRPC_ERROR_NONE);
+ client_session_write(cl, GRPC_ERROR_NONE);
}
/* Wait for the signal to shutdown a client. */
@@ -367,12 +362,12 @@ static void client_wait_and_shutdown(client *cl) {
gpr_mu_lock(g_mu);
while (!cl->done) {
grpc_pollset_worker *worker = NULL;
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
GPR_ASSERT(GRPC_LOG_IF_ERROR(
- "pollset_work", grpc_pollset_work(&exec_ctx, g_pollset, &worker,
- GRPC_MILLIS_INF_FUTURE)));
+ "pollset_work",
+ grpc_pollset_work(g_pollset, &worker, GRPC_MILLIS_INF_FUTURE)));
gpr_mu_unlock(g_mu);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_exec_ctx_finish();
gpr_mu_lock(g_mu);
}
gpr_mu_unlock(g_mu);
@@ -385,13 +380,13 @@ static void test_grpc_fd(void) {
server sv;
client cl;
int port;
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
server_init(&sv);
- port = server_start(&exec_ctx, &sv);
+ port = server_start(&sv);
client_init(&cl);
- client_start(&exec_ctx, &cl, port);
- grpc_exec_ctx_finish(&exec_ctx);
+ 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);
@@ -406,27 +401,25 @@ void init_change_data(fd_change_data *fdc) { fdc->cb_that_ran = NULL; }
void destroy_change_data(fd_change_data *fdc) {}
-static void first_read_callback(grpc_exec_ctx *exec_ctx,
- void *arg /* fd_change_data */,
+static void first_read_callback(void *arg /* fd_change_data */,
grpc_error *error) {
fd_change_data *fdc = arg;
gpr_mu_lock(g_mu);
fdc->cb_that_ran = first_read_callback;
- GPR_ASSERT(GRPC_LOG_IF_ERROR("pollset_kick",
- grpc_pollset_kick(exec_ctx, g_pollset, NULL)));
+ GPR_ASSERT(
+ GRPC_LOG_IF_ERROR("pollset_kick", grpc_pollset_kick(g_pollset, NULL)));
gpr_mu_unlock(g_mu);
}
-static void second_read_callback(grpc_exec_ctx *exec_ctx,
- void *arg /* fd_change_data */,
+static void second_read_callback(void *arg /* fd_change_data */,
grpc_error *error) {
fd_change_data *fdc = arg;
gpr_mu_lock(g_mu);
fdc->cb_that_ran = second_read_callback;
- GPR_ASSERT(GRPC_LOG_IF_ERROR("pollset_kick",
- grpc_pollset_kick(exec_ctx, g_pollset, NULL)));
+ GPR_ASSERT(
+ GRPC_LOG_IF_ERROR("pollset_kick", grpc_pollset_kick(g_pollset, NULL)));
gpr_mu_unlock(g_mu);
}
@@ -443,7 +436,7 @@ static void test_grpc_fd_change(void) {
ssize_t result;
grpc_closure first_closure;
grpc_closure second_closure;
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
GRPC_CLOSURE_INIT(&first_closure, first_read_callback, &a,
grpc_schedule_on_exec_ctx);
@@ -460,10 +453,10 @@ static void test_grpc_fd_change(void) {
GPR_ASSERT(fcntl(sv[1], F_SETFL, flags | O_NONBLOCK) == 0);
em_fd = grpc_fd_create(sv[0], "test_grpc_fd_change");
- grpc_pollset_add_fd(&exec_ctx, g_pollset, em_fd);
+ grpc_pollset_add_fd(g_pollset, em_fd);
/* Register the first callback, then make its FD readable */
- grpc_fd_notify_on_read(&exec_ctx, em_fd, &first_closure);
+ grpc_fd_notify_on_read(em_fd, &first_closure);
data = 0;
result = write(sv[1], &data, 1);
GPR_ASSERT(result == 1);
@@ -473,10 +466,10 @@ static void test_grpc_fd_change(void) {
while (a.cb_that_ran == NULL) {
grpc_pollset_worker *worker = NULL;
GPR_ASSERT(GRPC_LOG_IF_ERROR(
- "pollset_work", grpc_pollset_work(&exec_ctx, g_pollset, &worker,
- GRPC_MILLIS_INF_FUTURE)));
+ "pollset_work",
+ grpc_pollset_work(g_pollset, &worker, GRPC_MILLIS_INF_FUTURE)));
gpr_mu_unlock(g_mu);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_exec_ctx_finish();
gpr_mu_lock(g_mu);
}
GPR_ASSERT(a.cb_that_ran == first_read_callback);
@@ -488,7 +481,7 @@ static void test_grpc_fd_change(void) {
/* Now register a second callback with distinct change data, and do the same
thing again. */
- grpc_fd_notify_on_read(&exec_ctx, em_fd, &second_closure);
+ grpc_fd_notify_on_read(em_fd, &second_closure);
data = 0;
result = write(sv[1], &data, 1);
GPR_ASSERT(result == 1);
@@ -497,31 +490,30 @@ static void test_grpc_fd_change(void) {
while (b.cb_that_ran == NULL) {
grpc_pollset_worker *worker = NULL;
GPR_ASSERT(GRPC_LOG_IF_ERROR(
- "pollset_work", grpc_pollset_work(&exec_ctx, g_pollset, &worker,
- GRPC_MILLIS_INF_FUTURE)));
+ "pollset_work",
+ grpc_pollset_work(g_pollset, &worker, GRPC_MILLIS_INF_FUTURE)));
gpr_mu_unlock(g_mu);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_exec_ctx_finish();
gpr_mu_lock(g_mu);
}
/* Except now we verify that second_read_callback ran instead */
GPR_ASSERT(b.cb_that_ran == second_read_callback);
gpr_mu_unlock(g_mu);
- grpc_fd_orphan(&exec_ctx, em_fd, NULL, NULL, false /* already_closed */, "d");
- grpc_exec_ctx_finish(&exec_ctx);
+ 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]);
}
-static void destroy_pollset(grpc_exec_ctx *exec_ctx, void *p,
- grpc_error *error) {
- grpc_pollset_destroy(exec_ctx, p);
+static void destroy_pollset(void *p, grpc_error *error) {
+ grpc_pollset_destroy(p);
}
int main(int argc, char **argv) {
grpc_closure destroyed;
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_test_init(argc, argv);
grpc_init();
g_pollset = gpr_zalloc(grpc_pollset_size());
@@ -530,10 +522,10 @@ int main(int argc, char **argv) {
test_grpc_fd_change();
GRPC_CLOSURE_INIT(&destroyed, destroy_pollset, g_pollset,
grpc_schedule_on_exec_ctx);
- grpc_pollset_shutdown(&exec_ctx, g_pollset, &destroyed);
- grpc_exec_ctx_flush(&exec_ctx);
+ grpc_pollset_shutdown(g_pollset, &destroyed);
+ grpc_exec_ctx_flush();
gpr_free(g_pollset);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_exec_ctx_finish();
grpc_shutdown();
return 0;
}
diff --git a/test/core/iomgr/pollset_set_test.c b/test/core/iomgr/pollset_set_test.c
index 3dd4bc887c..7ab31e0006 100644
--- a/test/core/iomgr/pollset_set_test.c
+++ b/test/core/iomgr/pollset_set_test.c
@@ -44,11 +44,10 @@ void init_test_pollset_sets(test_pollset_set *pollset_sets, const int num_pss) {
}
}
-void cleanup_test_pollset_sets(grpc_exec_ctx *exec_ctx,
- test_pollset_set *pollset_sets,
+void cleanup_test_pollset_sets(test_pollset_set *pollset_sets,
const int num_pss) {
for (int i = 0; i < num_pss; i++) {
- grpc_pollset_set_destroy(exec_ctx, pollset_sets[i].pss);
+ grpc_pollset_set_destroy(pollset_sets[i].pss);
pollset_sets[i].pss = NULL;
}
}
@@ -69,21 +68,19 @@ static void init_test_pollsets(test_pollset *pollsets, const int num_pollsets) {
}
}
-static void destroy_pollset(grpc_exec_ctx *exec_ctx, void *p,
- grpc_error *error) {
- grpc_pollset_destroy(exec_ctx, p);
+static void destroy_pollset(void *p, grpc_error *error) {
+ grpc_pollset_destroy(p);
}
-static void cleanup_test_pollsets(grpc_exec_ctx *exec_ctx,
- test_pollset *pollsets,
+static void cleanup_test_pollsets(test_pollset *pollsets,
const int num_pollsets) {
grpc_closure destroyed;
for (int i = 0; i < num_pollsets; i++) {
GRPC_CLOSURE_INIT(&destroyed, destroy_pollset, pollsets[i].ps,
grpc_schedule_on_exec_ctx);
- grpc_pollset_shutdown(exec_ctx, pollsets[i].ps, &destroyed);
+ grpc_pollset_shutdown(pollsets[i].ps, &destroyed);
- grpc_exec_ctx_flush(exec_ctx);
+ grpc_exec_ctx_flush();
gpr_free(pollsets[i].ps);
pollsets[i].ps = NULL;
}
@@ -101,45 +98,43 @@ typedef struct test_fd {
grpc_closure on_readable; /* Closure to call when this fd is readable */
} test_fd;
-void on_readable(grpc_exec_ctx *exec_ctx, void *tfd, grpc_error *error) {
+void on_readable(void *tfd, grpc_error *error) {
((test_fd *)tfd)->is_on_readable_called = true;
}
-static void reset_test_fd(grpc_exec_ctx *exec_ctx, test_fd *tfd) {
+static void reset_test_fd(test_fd *tfd) {
tfd->is_on_readable_called = false;
GRPC_CLOSURE_INIT(&tfd->on_readable, on_readable, tfd,
grpc_schedule_on_exec_ctx);
- grpc_fd_notify_on_read(exec_ctx, tfd->fd, &tfd->on_readable);
+ grpc_fd_notify_on_read(tfd->fd, &tfd->on_readable);
}
-static void init_test_fds(grpc_exec_ctx *exec_ctx, test_fd *tfds,
- const int num_fds) {
+static void init_test_fds(test_fd *tfds, const int num_fds) {
for (int i = 0; i < num_fds; i++) {
GPR_ASSERT(GRPC_ERROR_NONE == grpc_wakeup_fd_init(&tfds[i].wakeup_fd));
tfds[i].fd = grpc_fd_create(GRPC_WAKEUP_FD_GET_READ_FD(&tfds[i].wakeup_fd),
"test_fd");
- reset_test_fd(exec_ctx, &tfds[i]);
+ reset_test_fd(&tfds[i]);
}
}
-static void cleanup_test_fds(grpc_exec_ctx *exec_ctx, test_fd *tfds,
- const int num_fds) {
+static void cleanup_test_fds(test_fd *tfds, const int num_fds) {
int release_fd;
for (int i = 0; i < num_fds; i++) {
- grpc_fd_shutdown(exec_ctx, tfds[i].fd,
+ grpc_fd_shutdown(tfds[i].fd,
GRPC_ERROR_CREATE_FROM_STATIC_STRING("fd cleanup"));
- grpc_exec_ctx_flush(exec_ctx);
+ grpc_exec_ctx_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
* grpc_wakeup_fd and we would like to destroy it ourselves (by calling
* grpc_wakeup_fd_destroy). To prevent grpc_fd from calling close() on the
* underlying fd, call it with a non-NULL 'release_fd' parameter */
- grpc_fd_orphan(exec_ctx, tfds[i].fd, NULL, &release_fd,
- false /* already_closed */, "test_fd_cleanup");
- grpc_exec_ctx_flush(exec_ctx);
+ grpc_fd_orphan(tfds[i].fd, NULL, &release_fd, false /* already_closed */,
+ "test_fd_cleanup");
+ grpc_exec_ctx_flush();
grpc_wakeup_fd_destroy(&tfds[i].wakeup_fd);
}
@@ -151,8 +146,7 @@ static void make_test_fds_readable(test_fd *tfds, const int num_fds) {
}
}
-static void verify_readable_and_reset(grpc_exec_ctx *exec_ctx, test_fd *tfds,
- const int num_fds) {
+static void verify_readable_and_reset(test_fd *tfds, const int num_fds) {
for (int i = 0; i < num_fds; i++) {
/* Verify that the on_readable callback was called */
GPR_ASSERT(tfds[i].is_on_readable_called);
@@ -160,7 +154,7 @@ static void verify_readable_and_reset(grpc_exec_ctx *exec_ctx, test_fd *tfds,
/* Reset the tfd[i] structure */
GPR_ASSERT(GRPC_ERROR_NONE ==
grpc_wakeup_fd_consume_wakeup(&tfds[i].wakeup_fd));
- reset_test_fd(exec_ctx, &tfds[i]);
+ reset_test_fd(&tfds[i]);
}
}
@@ -201,7 +195,7 @@ static void pollset_set_test_basic() {
* |
* +---> FD9 (Added after PS2 is added to PSS0)
*/
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_pollset_worker *worker;
grpc_millis deadline;
@@ -212,34 +206,33 @@ static void pollset_set_test_basic() {
const int num_ps = GPR_ARRAY_SIZE(pollsets);
const int num_pss = GPR_ARRAY_SIZE(pollset_sets);
- init_test_fds(&exec_ctx, tfds, num_fds);
+ init_test_fds(tfds, num_fds);
init_test_pollsets(pollsets, num_ps);
init_test_pollset_sets(pollset_sets, num_pss);
/* Construct the pollset_set/pollset/fd tree (see diagram above) */
- grpc_pollset_set_add_fd(&exec_ctx, pollset_sets[0].pss, tfds[0].fd);
- grpc_pollset_set_add_fd(&exec_ctx, pollset_sets[1].pss, tfds[1].fd);
+ grpc_pollset_set_add_fd(pollset_sets[0].pss, tfds[0].fd);
+ grpc_pollset_set_add_fd(pollset_sets[1].pss, tfds[1].fd);
- grpc_pollset_add_fd(&exec_ctx, pollsets[0].ps, tfds[2].fd);
- grpc_pollset_add_fd(&exec_ctx, pollsets[1].ps, tfds[3].fd);
- grpc_pollset_add_fd(&exec_ctx, pollsets[2].ps, tfds[4].fd);
+ grpc_pollset_add_fd(pollsets[0].ps, tfds[2].fd);
+ grpc_pollset_add_fd(pollsets[1].ps, tfds[3].fd);
+ grpc_pollset_add_fd(pollsets[2].ps, tfds[4].fd);
- grpc_pollset_set_add_pollset_set(&exec_ctx, pollset_sets[0].pss,
- pollset_sets[1].pss);
+ grpc_pollset_set_add_pollset_set(pollset_sets[0].pss, pollset_sets[1].pss);
- grpc_pollset_set_add_pollset(&exec_ctx, pollset_sets[1].pss, pollsets[0].ps);
- grpc_pollset_set_add_pollset(&exec_ctx, pollset_sets[0].pss, pollsets[1].ps);
- grpc_pollset_set_add_pollset(&exec_ctx, pollset_sets[0].pss, pollsets[2].ps);
+ grpc_pollset_set_add_pollset(pollset_sets[1].pss, pollsets[0].ps);
+ grpc_pollset_set_add_pollset(pollset_sets[0].pss, pollsets[1].ps);
+ grpc_pollset_set_add_pollset(pollset_sets[0].pss, pollsets[2].ps);
- grpc_pollset_set_add_fd(&exec_ctx, pollset_sets[0].pss, tfds[5].fd);
- grpc_pollset_set_add_fd(&exec_ctx, pollset_sets[1].pss, tfds[6].fd);
+ grpc_pollset_set_add_fd(pollset_sets[0].pss, tfds[5].fd);
+ grpc_pollset_set_add_fd(pollset_sets[1].pss, tfds[6].fd);
- grpc_pollset_add_fd(&exec_ctx, pollsets[0].ps, tfds[7].fd);
- grpc_pollset_add_fd(&exec_ctx, pollsets[1].ps, tfds[8].fd);
- grpc_pollset_add_fd(&exec_ctx, pollsets[2].ps, tfds[9].fd);
+ grpc_pollset_add_fd(pollsets[0].ps, tfds[7].fd);
+ grpc_pollset_add_fd(pollsets[1].ps, tfds[8].fd);
+ grpc_pollset_add_fd(pollsets[2].ps, tfds[9].fd);
- grpc_exec_ctx_flush(&exec_ctx);
+ grpc_exec_ctx_flush();
/* Test that if any FD in the above structure is readable, it is observable by
* doing grpc_pollset_work on any pollset
@@ -259,34 +252,33 @@ static void pollset_set_test_basic() {
deadline = grpc_timespec_to_millis_round_up(
grpc_timeout_milliseconds_to_deadline(2));
GPR_ASSERT(GRPC_ERROR_NONE ==
- grpc_pollset_work(&exec_ctx, pollsets[i].ps, &worker, deadline));
+ grpc_pollset_work(pollsets[i].ps, &worker, deadline));
gpr_mu_unlock(pollsets[i].mu);
- grpc_exec_ctx_flush(&exec_ctx);
+ grpc_exec_ctx_flush();
- verify_readable_and_reset(&exec_ctx, tfds, num_fds);
- grpc_exec_ctx_flush(&exec_ctx);
+ verify_readable_and_reset(tfds, num_fds);
+ grpc_exec_ctx_flush();
}
/* Test tear down */
- grpc_pollset_set_del_fd(&exec_ctx, pollset_sets[0].pss, tfds[0].fd);
- grpc_pollset_set_del_fd(&exec_ctx, pollset_sets[0].pss, tfds[5].fd);
- grpc_pollset_set_del_fd(&exec_ctx, pollset_sets[1].pss, tfds[1].fd);
- grpc_pollset_set_del_fd(&exec_ctx, pollset_sets[1].pss, tfds[6].fd);
- grpc_exec_ctx_flush(&exec_ctx);
-
- grpc_pollset_set_del_pollset(&exec_ctx, pollset_sets[1].pss, pollsets[0].ps);
- grpc_pollset_set_del_pollset(&exec_ctx, pollset_sets[0].pss, pollsets[1].ps);
- grpc_pollset_set_del_pollset(&exec_ctx, pollset_sets[0].pss, pollsets[2].ps);
-
- grpc_pollset_set_del_pollset_set(&exec_ctx, pollset_sets[0].pss,
- pollset_sets[1].pss);
- grpc_exec_ctx_flush(&exec_ctx);
-
- cleanup_test_fds(&exec_ctx, tfds, num_fds);
- cleanup_test_pollsets(&exec_ctx, pollsets, num_ps);
- cleanup_test_pollset_sets(&exec_ctx, pollset_sets, num_pss);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_pollset_set_del_fd(pollset_sets[0].pss, tfds[0].fd);
+ 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();
+
+ 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();
+
+ 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 */
@@ -306,7 +298,7 @@ void pollset_set_test_dup_fds() {
* | +--> FD2
* +---> FD1
*/
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_pollset_worker *worker;
grpc_millis deadline;
@@ -317,21 +309,20 @@ void pollset_set_test_dup_fds() {
const int num_ps = 1;
const int num_pss = GPR_ARRAY_SIZE(pollset_sets);
- init_test_fds(&exec_ctx, tfds, num_fds);
+ init_test_fds(tfds, num_fds);
init_test_pollsets(&pollset, num_ps);
init_test_pollset_sets(pollset_sets, num_pss);
/* Construct the structure */
- grpc_pollset_set_add_fd(&exec_ctx, pollset_sets[0].pss, tfds[0].fd);
- grpc_pollset_set_add_fd(&exec_ctx, pollset_sets[1].pss, tfds[0].fd);
- grpc_pollset_set_add_fd(&exec_ctx, pollset_sets[1].pss, tfds[1].fd);
+ grpc_pollset_set_add_fd(pollset_sets[0].pss, tfds[0].fd);
+ grpc_pollset_set_add_fd(pollset_sets[1].pss, tfds[0].fd);
+ grpc_pollset_set_add_fd(pollset_sets[1].pss, tfds[1].fd);
- grpc_pollset_add_fd(&exec_ctx, pollset.ps, tfds[1].fd);
- grpc_pollset_add_fd(&exec_ctx, pollset.ps, tfds[2].fd);
+ grpc_pollset_add_fd(pollset.ps, tfds[1].fd);
+ grpc_pollset_add_fd(pollset.ps, tfds[2].fd);
- grpc_pollset_set_add_pollset(&exec_ctx, pollset_sets[1].pss, pollset.ps);
- grpc_pollset_set_add_pollset_set(&exec_ctx, pollset_sets[0].pss,
- pollset_sets[1].pss);
+ grpc_pollset_set_add_pollset(pollset_sets[1].pss, pollset.ps);
+ grpc_pollset_set_add_pollset_set(pollset_sets[0].pss, pollset_sets[1].pss);
/* Test. Make all FDs readable and make sure that can be observed by doing a
* grpc_pollset_work on the pollset 'PS' */
@@ -341,27 +332,26 @@ void pollset_set_test_dup_fds() {
deadline = grpc_timespec_to_millis_round_up(
grpc_timeout_milliseconds_to_deadline(2));
GPR_ASSERT(GRPC_ERROR_NONE ==
- grpc_pollset_work(&exec_ctx, pollset.ps, &worker, deadline));
+ grpc_pollset_work(pollset.ps, &worker, deadline));
gpr_mu_unlock(pollset.mu);
- grpc_exec_ctx_flush(&exec_ctx);
+ grpc_exec_ctx_flush();
- verify_readable_and_reset(&exec_ctx, tfds, num_fds);
- grpc_exec_ctx_flush(&exec_ctx);
+ verify_readable_and_reset(tfds, num_fds);
+ grpc_exec_ctx_flush();
/* Tear down */
- grpc_pollset_set_del_fd(&exec_ctx, pollset_sets[0].pss, tfds[0].fd);
- grpc_pollset_set_del_fd(&exec_ctx, pollset_sets[1].pss, tfds[0].fd);
- grpc_pollset_set_del_fd(&exec_ctx, pollset_sets[1].pss, tfds[1].fd);
-
- grpc_pollset_set_del_pollset(&exec_ctx, pollset_sets[1].pss, pollset.ps);
- grpc_pollset_set_del_pollset_set(&exec_ctx, pollset_sets[0].pss,
- pollset_sets[1].pss);
- grpc_exec_ctx_flush(&exec_ctx);
-
- cleanup_test_fds(&exec_ctx, tfds, num_fds);
- cleanup_test_pollsets(&exec_ctx, &pollset, num_ps);
- cleanup_test_pollset_sets(&exec_ctx, pollset_sets, num_pss);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_pollset_set_del_fd(pollset_sets[0].pss, tfds[0].fd);
+ grpc_pollset_set_del_fd(pollset_sets[1].pss, tfds[0].fd);
+ grpc_pollset_set_del_fd(pollset_sets[1].pss, tfds[1].fd);
+
+ 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();
+
+ 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 */
@@ -379,7 +369,7 @@ void pollset_set_test_empty_pollset() {
* |
* +---> FD2
*/
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_pollset_worker *worker;
grpc_millis deadline;
@@ -390,17 +380,17 @@ void pollset_set_test_empty_pollset() {
const int num_ps = GPR_ARRAY_SIZE(pollsets);
const int num_pss = 1;
- init_test_fds(&exec_ctx, tfds, num_fds);
+ init_test_fds(tfds, num_fds);
init_test_pollsets(pollsets, num_ps);
init_test_pollset_sets(&pollset_set, num_pss);
/* Construct the structure */
- grpc_pollset_set_add_fd(&exec_ctx, pollset_set.pss, tfds[0].fd);
- grpc_pollset_add_fd(&exec_ctx, pollsets[1].ps, tfds[1].fd);
- grpc_pollset_add_fd(&exec_ctx, pollsets[1].ps, tfds[2].fd);
+ grpc_pollset_set_add_fd(pollset_set.pss, tfds[0].fd);
+ grpc_pollset_add_fd(pollsets[1].ps, tfds[1].fd);
+ grpc_pollset_add_fd(pollsets[1].ps, tfds[2].fd);
- grpc_pollset_set_add_pollset(&exec_ctx, pollset_set.pss, pollsets[0].ps);
- grpc_pollset_set_add_pollset(&exec_ctx, pollset_set.pss, pollsets[1].ps);
+ grpc_pollset_set_add_pollset(pollset_set.pss, pollsets[0].ps);
+ grpc_pollset_set_add_pollset(pollset_set.pss, pollsets[1].ps);
/* Test. Make all FDs readable and make sure that can be observed by doing
* grpc_pollset_work on the empty pollset 'PS0' */
@@ -410,31 +400,31 @@ void pollset_set_test_empty_pollset() {
deadline = grpc_timespec_to_millis_round_up(
grpc_timeout_milliseconds_to_deadline(2));
GPR_ASSERT(GRPC_ERROR_NONE ==
- grpc_pollset_work(&exec_ctx, pollsets[0].ps, &worker, deadline));
+ grpc_pollset_work(pollsets[0].ps, &worker, deadline));
gpr_mu_unlock(pollsets[0].mu);
- grpc_exec_ctx_flush(&exec_ctx);
+ grpc_exec_ctx_flush();
- verify_readable_and_reset(&exec_ctx, tfds, num_fds);
- grpc_exec_ctx_flush(&exec_ctx);
+ verify_readable_and_reset(tfds, num_fds);
+ grpc_exec_ctx_flush();
/* Tear down */
- grpc_pollset_set_del_fd(&exec_ctx, pollset_set.pss, tfds[0].fd);
- grpc_pollset_set_del_pollset(&exec_ctx, pollset_set.pss, pollsets[0].ps);
- grpc_pollset_set_del_pollset(&exec_ctx, pollset_set.pss, pollsets[1].ps);
- grpc_exec_ctx_flush(&exec_ctx);
-
- cleanup_test_fds(&exec_ctx, tfds, num_fds);
- cleanup_test_pollsets(&exec_ctx, pollsets, num_ps);
- cleanup_test_pollset_sets(&exec_ctx, &pollset_set, num_pss);
- grpc_exec_ctx_finish(&exec_ctx);
+ 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();
+
+ 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) {
const char *poll_strategy = grpc_get_poll_strategy_name();
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_test_init(argc, argv);
- grpc_iomgr_init(&exec_ctx);
- grpc_iomgr_start(&exec_ctx);
+ grpc_iomgr_init();
+ grpc_iomgr_start();
if (poll_strategy != NULL &&
(strcmp(poll_strategy, "epoll") == 0 ||
@@ -449,8 +439,8 @@ int main(int argc, char **argv) {
poll_strategy);
}
- grpc_iomgr_shutdown(&exec_ctx);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_iomgr_shutdown();
+ grpc_exec_ctx_finish();
return 0;
}
#else /* defined(GRPC_LINUX_EPOLL) */
diff --git a/test/core/iomgr/resolve_address_posix_test.c b/test/core/iomgr/resolve_address_posix_test.cc
index cb9d6080fb..05c17fbf60 100644
--- a/test/core/iomgr/resolve_address_posix_test.c
+++ b/test/core/iomgr/resolve_address_posix_test.cc
@@ -46,29 +46,29 @@ typedef struct args_struct {
grpc_pollset_set *pollset_set;
} args_struct;
-static void do_nothing(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) {}
+static void do_nothing(void *arg, grpc_error *error) {}
-void args_init(grpc_exec_ctx *exec_ctx, args_struct *args) {
+void args_init(args_struct *args) {
gpr_event_init(&args->ev);
args->pollset = gpr_zalloc(grpc_pollset_size());
grpc_pollset_init(args->pollset, &args->mu);
args->pollset_set = grpc_pollset_set_create();
- grpc_pollset_set_add_pollset(exec_ctx, args->pollset_set, args->pollset);
+ grpc_pollset_set_add_pollset(args->pollset_set, args->pollset);
args->addrs = NULL;
}
-void args_finish(grpc_exec_ctx *exec_ctx, args_struct *args) {
+void args_finish(args_struct *args) {
GPR_ASSERT(gpr_event_wait(&args->ev, test_deadline()));
grpc_resolved_addresses_destroy(args->addrs);
- grpc_pollset_set_del_pollset(exec_ctx, args->pollset_set, args->pollset);
- grpc_pollset_set_destroy(exec_ctx, args->pollset_set);
+ grpc_pollset_set_del_pollset(args->pollset_set, args->pollset);
+ grpc_pollset_set_destroy(args->pollset_set);
grpc_closure do_nothing_cb;
GRPC_CLOSURE_INIT(&do_nothing_cb, do_nothing, NULL,
grpc_schedule_on_exec_ctx);
- grpc_pollset_shutdown(exec_ctx, args->pollset, &do_nothing_cb);
+ grpc_pollset_shutdown(args->pollset, &do_nothing_cb);
// exec_ctx needs to be flushed before calling grpc_pollset_destroy()
- grpc_exec_ctx_flush(exec_ctx);
- grpc_pollset_destroy(exec_ctx, args->pollset);
+ grpc_exec_ctx_flush();
+ grpc_pollset_destroy(args->pollset);
gpr_free(args->pollset);
}
@@ -79,26 +79,25 @@ static grpc_millis n_sec_deadline(int seconds) {
static void actually_poll(void *argsp) {
args_struct *args = argsp;
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ ExecCtx _local_exec_ctx;
grpc_millis deadline = n_sec_deadline(10);
while (true) {
bool done = gpr_atm_acq_load(&args->done_atm) != 0;
if (done) {
break;
}
- grpc_millis time_left = deadline - grpc_exec_ctx_now(&exec_ctx);
+ grpc_millis time_left = deadline - grpc_exec_ctx_now();
gpr_log(GPR_DEBUG, "done=%d, time_left=%" PRIdPTR, done, time_left);
GPR_ASSERT(time_left >= 0);
grpc_pollset_worker *worker = NULL;
gpr_mu_lock(args->mu);
- GRPC_LOG_IF_ERROR("pollset_work",
- grpc_pollset_work(&exec_ctx, args->pollset, &worker,
- n_sec_deadline(1)));
+ 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(&exec_ctx);
+ grpc_exec_ctx_flush();
}
gpr_event_set(&args->ev, (void *)1);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_exec_ctx_finish();
}
static void poll_pollset_until_request_done(args_struct *args) {
@@ -107,8 +106,7 @@ static void poll_pollset_until_request_done(args_struct *args) {
gpr_thd_new(&id, actually_poll, args, NULL);
}
-static void must_succeed(grpc_exec_ctx *exec_ctx, void *argsp,
- grpc_error *err) {
+static void must_succeed(void *argsp, grpc_error *err) {
args_struct *args = argsp;
GPR_ASSERT(err == GRPC_ERROR_NONE);
GPR_ASSERT(args->addrs != NULL);
@@ -116,29 +114,29 @@ static void must_succeed(grpc_exec_ctx *exec_ctx, void *argsp,
gpr_atm_rel_store(&args->done_atm, 1);
}
-static void must_fail(grpc_exec_ctx *exec_ctx, void *argsp, grpc_error *err) {
+static void must_fail(void *argsp, grpc_error *err) {
args_struct *args = argsp;
GPR_ASSERT(err != GRPC_ERROR_NONE);
gpr_atm_rel_store(&args->done_atm, 1);
}
static void test_unix_socket(void) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ ExecCtx _local_exec_ctx;
args_struct args;
- args_init(&exec_ctx, &args);
+ args_init(&args);
poll_pollset_until_request_done(&args);
grpc_resolve_address(
- &exec_ctx, "unix:/path/name", NULL, args.pollset_set,
+ "unix:/path/name", NULL, args.pollset_set,
GRPC_CLOSURE_CREATE(must_succeed, &args, grpc_schedule_on_exec_ctx),
&args.addrs);
- args_finish(&exec_ctx, &args);
- grpc_exec_ctx_finish(&exec_ctx);
+ args_finish(&args);
+ grpc_exec_ctx_finish();
}
static void test_unix_socket_path_name_too_long(void) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ ExecCtx _local_exec_ctx;
args_struct args;
- args_init(&exec_ctx, &args);
+ args_init(&args);
const char prefix[] = "unix:/path/name";
size_t path_name_length =
GPR_ARRAY_SIZE(((struct sockaddr_un *)0)->sun_path) + 6;
@@ -149,22 +147,22 @@ static void test_unix_socket_path_name_too_long(void) {
poll_pollset_until_request_done(&args);
grpc_resolve_address(
- &exec_ctx, path_name, NULL, args.pollset_set,
+ path_name, NULL, args.pollset_set,
GRPC_CLOSURE_CREATE(must_fail, &args, grpc_schedule_on_exec_ctx),
&args.addrs);
gpr_free(path_name);
- args_finish(&exec_ctx, &args);
- grpc_exec_ctx_finish(&exec_ctx);
+ args_finish(&args);
+ grpc_exec_ctx_finish();
}
int main(int argc, char **argv) {
grpc_test_init(argc, argv);
grpc_init();
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ ExecCtx _local_exec_ctx;
test_unix_socket();
test_unix_socket_path_name_too_long();
- grpc_executor_shutdown(&exec_ctx);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_executor_shutdown();
+ grpc_exec_ctx_finish();
grpc_shutdown();
return 0;
}
diff --git a/test/core/iomgr/resolve_address_test.c b/test/core/iomgr/resolve_address_test.c
index 178bbbb95f..7a59ee3dcc 100644
--- a/test/core/iomgr/resolve_address_test.c
+++ b/test/core/iomgr/resolve_address_test.c
@@ -39,32 +39,32 @@ typedef struct args_struct {
grpc_pollset_set *pollset_set;
} args_struct;
-static void do_nothing(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) {}
+static void do_nothing(void *arg, grpc_error *error) {}
-void args_init(grpc_exec_ctx *exec_ctx, args_struct *args) {
+void args_init(args_struct *args) {
gpr_event_init(&args->ev);
args->pollset = gpr_zalloc(grpc_pollset_size());
grpc_pollset_init(args->pollset, &args->mu);
args->pollset_set = grpc_pollset_set_create();
- grpc_pollset_set_add_pollset(exec_ctx, args->pollset_set, args->pollset);
+ grpc_pollset_set_add_pollset(args->pollset_set, args->pollset);
args->addrs = NULL;
gpr_atm_rel_store(&args->done_atm, 0);
}
-void args_finish(grpc_exec_ctx *exec_ctx, args_struct *args) {
+void args_finish(args_struct *args) {
GPR_ASSERT(gpr_event_wait(&args->ev, test_deadline()));
grpc_resolved_addresses_destroy(args->addrs);
- grpc_pollset_set_del_pollset(exec_ctx, args->pollset_set, args->pollset);
- grpc_pollset_set_destroy(exec_ctx, args->pollset_set);
+ grpc_pollset_set_del_pollset(args->pollset_set, args->pollset);
+ grpc_pollset_set_destroy(args->pollset_set);
grpc_closure do_nothing_cb;
GRPC_CLOSURE_INIT(&do_nothing_cb, do_nothing, NULL,
grpc_schedule_on_exec_ctx);
gpr_mu_lock(args->mu);
- grpc_pollset_shutdown(exec_ctx, args->pollset, &do_nothing_cb);
+ 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(exec_ctx);
- grpc_pollset_destroy(exec_ctx, args->pollset);
+ grpc_exec_ctx_flush();
+ grpc_pollset_destroy(args->pollset);
gpr_free(args->pollset);
}
@@ -74,119 +74,115 @@ static grpc_millis n_sec_deadline(int seconds) {
}
static void poll_pollset_until_request_done(args_struct *args) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_millis deadline = n_sec_deadline(10);
while (true) {
bool done = gpr_atm_acq_load(&args->done_atm) != 0;
if (done) {
break;
}
- grpc_millis time_left = deadline - grpc_exec_ctx_now(&exec_ctx);
+ grpc_millis time_left = deadline - grpc_exec_ctx_now();
gpr_log(GPR_DEBUG, "done=%d, time_left=%" PRIdPTR, done, time_left);
GPR_ASSERT(time_left >= 0);
grpc_pollset_worker *worker = NULL;
gpr_mu_lock(args->mu);
- GRPC_LOG_IF_ERROR("pollset_work",
- grpc_pollset_work(&exec_ctx, args->pollset, &worker,
- n_sec_deadline(1)));
+ 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(&exec_ctx);
+ grpc_exec_ctx_flush();
}
gpr_event_set(&args->ev, (void *)1);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_exec_ctx_finish();
}
-static void must_succeed(grpc_exec_ctx *exec_ctx, void *argsp,
- grpc_error *err) {
+static void must_succeed(void *argsp, grpc_error *err) {
args_struct *args = argsp;
GPR_ASSERT(err == GRPC_ERROR_NONE);
GPR_ASSERT(args->addrs != NULL);
GPR_ASSERT(args->addrs->naddrs > 0);
gpr_atm_rel_store(&args->done_atm, 1);
gpr_mu_lock(args->mu);
- GRPC_LOG_IF_ERROR("pollset_kick",
- grpc_pollset_kick(exec_ctx, args->pollset, NULL));
+ GRPC_LOG_IF_ERROR("pollset_kick", grpc_pollset_kick(args->pollset, NULL));
gpr_mu_unlock(args->mu);
}
-static void must_fail(grpc_exec_ctx *exec_ctx, void *argsp, grpc_error *err) {
+static void must_fail(void *argsp, grpc_error *err) {
args_struct *args = argsp;
GPR_ASSERT(err != GRPC_ERROR_NONE);
gpr_atm_rel_store(&args->done_atm, 1);
gpr_mu_lock(args->mu);
- GRPC_LOG_IF_ERROR("pollset_kick",
- grpc_pollset_kick(exec_ctx, args->pollset, NULL));
+ GRPC_LOG_IF_ERROR("pollset_kick", grpc_pollset_kick(args->pollset, NULL));
gpr_mu_unlock(args->mu);
}
static void test_localhost(void) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
args_struct args;
- args_init(&exec_ctx, &args);
+ args_init(&args);
grpc_resolve_address(
- &exec_ctx, "localhost:1", NULL, args.pollset_set,
+ "localhost:1", NULL, args.pollset_set,
GRPC_CLOSURE_CREATE(must_succeed, &args, grpc_schedule_on_exec_ctx),
&args.addrs);
- grpc_exec_ctx_flush(&exec_ctx);
+ grpc_exec_ctx_flush();
poll_pollset_until_request_done(&args);
- args_finish(&exec_ctx, &args);
- grpc_exec_ctx_finish(&exec_ctx);
+ args_finish(&args);
+ grpc_exec_ctx_finish();
}
static void test_default_port(void) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
args_struct args;
- args_init(&exec_ctx, &args);
+ args_init(&args);
grpc_resolve_address(
- &exec_ctx, "localhost", "1", args.pollset_set,
+ "localhost", "1", args.pollset_set,
GRPC_CLOSURE_CREATE(must_succeed, &args, grpc_schedule_on_exec_ctx),
&args.addrs);
- grpc_exec_ctx_flush(&exec_ctx);
+ grpc_exec_ctx_flush();
poll_pollset_until_request_done(&args);
- args_finish(&exec_ctx, &args);
- grpc_exec_ctx_finish(&exec_ctx);
+ args_finish(&args);
+ grpc_exec_ctx_finish();
}
static void test_non_numeric_default_port(void) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
args_struct args;
- args_init(&exec_ctx, &args);
+ args_init(&args);
grpc_resolve_address(
- &exec_ctx, "localhost", "https", args.pollset_set,
+ "localhost", "https", args.pollset_set,
GRPC_CLOSURE_CREATE(must_succeed, &args, grpc_schedule_on_exec_ctx),
&args.addrs);
- grpc_exec_ctx_flush(&exec_ctx);
+ grpc_exec_ctx_flush();
poll_pollset_until_request_done(&args);
- args_finish(&exec_ctx, &args);
- grpc_exec_ctx_finish(&exec_ctx);
+ args_finish(&args);
+ grpc_exec_ctx_finish();
}
static void test_missing_default_port(void) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
args_struct args;
- args_init(&exec_ctx, &args);
+ args_init(&args);
grpc_resolve_address(
- &exec_ctx, "localhost", NULL, args.pollset_set,
+ "localhost", NULL, args.pollset_set,
GRPC_CLOSURE_CREATE(must_fail, &args, grpc_schedule_on_exec_ctx),
&args.addrs);
- grpc_exec_ctx_flush(&exec_ctx);
+ grpc_exec_ctx_flush();
poll_pollset_until_request_done(&args);
- args_finish(&exec_ctx, &args);
- grpc_exec_ctx_finish(&exec_ctx);
+ args_finish(&args);
+ grpc_exec_ctx_finish();
}
static void test_ipv6_with_port(void) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
args_struct args;
- args_init(&exec_ctx, &args);
+ args_init(&args);
grpc_resolve_address(
- &exec_ctx, "[2001:db8::1]:1", NULL, args.pollset_set,
+ "[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(&exec_ctx);
+ grpc_exec_ctx_flush();
poll_pollset_until_request_done(&args);
- args_finish(&exec_ctx, &args);
- grpc_exec_ctx_finish(&exec_ctx);
+ args_finish(&args);
+ grpc_exec_ctx_finish();
}
static void test_ipv6_without_port(void) {
@@ -195,17 +191,17 @@ static void test_ipv6_without_port(void) {
};
unsigned i;
for (i = 0; i < sizeof(kCases) / sizeof(*kCases); i++) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
args_struct args;
- args_init(&exec_ctx, &args);
+ args_init(&args);
grpc_resolve_address(
- &exec_ctx, kCases[i], "80", args.pollset_set,
+ kCases[i], "80", args.pollset_set,
GRPC_CLOSURE_CREATE(must_succeed, &args, grpc_schedule_on_exec_ctx),
&args.addrs);
- grpc_exec_ctx_flush(&exec_ctx);
+ grpc_exec_ctx_flush();
poll_pollset_until_request_done(&args);
- args_finish(&exec_ctx, &args);
- grpc_exec_ctx_finish(&exec_ctx);
+ args_finish(&args);
+ grpc_exec_ctx_finish();
}
}
@@ -215,17 +211,17 @@ static void test_invalid_ip_addresses(void) {
};
unsigned i;
for (i = 0; i < sizeof(kCases) / sizeof(*kCases); i++) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
args_struct args;
- args_init(&exec_ctx, &args);
+ args_init(&args);
grpc_resolve_address(
- &exec_ctx, kCases[i], NULL, args.pollset_set,
+ kCases[i], NULL, args.pollset_set,
GRPC_CLOSURE_CREATE(must_fail, &args, grpc_schedule_on_exec_ctx),
&args.addrs);
- grpc_exec_ctx_flush(&exec_ctx);
+ grpc_exec_ctx_flush();
poll_pollset_until_request_done(&args);
- args_finish(&exec_ctx, &args);
- grpc_exec_ctx_finish(&exec_ctx);
+ args_finish(&args);
+ grpc_exec_ctx_finish();
}
}
@@ -235,24 +231,24 @@ static void test_unparseable_hostports(void) {
};
unsigned i;
for (i = 0; i < sizeof(kCases) / sizeof(*kCases); i++) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
args_struct args;
- args_init(&exec_ctx, &args);
+ args_init(&args);
grpc_resolve_address(
- &exec_ctx, kCases[i], "1", args.pollset_set,
+ kCases[i], "1", args.pollset_set,
GRPC_CLOSURE_CREATE(must_fail, &args, grpc_schedule_on_exec_ctx),
&args.addrs);
- grpc_exec_ctx_flush(&exec_ctx);
+ grpc_exec_ctx_flush();
poll_pollset_until_request_done(&args);
- args_finish(&exec_ctx, &args);
- grpc_exec_ctx_finish(&exec_ctx);
+ args_finish(&args);
+ grpc_exec_ctx_finish();
}
}
int main(int argc, char **argv) {
grpc_test_init(argc, argv);
grpc_init();
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
test_localhost();
test_default_port();
test_non_numeric_default_port();
@@ -261,8 +257,8 @@ int main(int argc, char **argv) {
test_ipv6_without_port();
test_invalid_ip_addresses();
test_unparseable_hostports();
- grpc_executor_shutdown(&exec_ctx);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_executor_shutdown();
+ grpc_exec_ctx_finish();
grpc_shutdown();
return 0;
}
diff --git a/test/core/iomgr/resource_quota_test.c b/test/core/iomgr/resource_quota_test.c
index b588f3d120..648e5f27d2 100644
--- a/test/core/iomgr/resource_quota_test.c
+++ b/test/core/iomgr/resource_quota_test.c
@@ -27,7 +27,7 @@
gpr_mu g_mu;
gpr_cv g_cv;
-static void inc_int_cb(grpc_exec_ctx *exec_ctx, void *a, grpc_error *error) {
+static void inc_int_cb(void *a, grpc_error *error) {
gpr_mu_lock(&g_mu);
++*(int *)a;
gpr_cv_signal(&g_cv);
@@ -43,7 +43,7 @@ static void assert_counter_becomes(int *ctr, int value) {
gpr_mu_unlock(&g_mu);
}
-static void set_event_cb(grpc_exec_ctx *exec_ctx, void *a, grpc_error *error) {
+static void set_event_cb(void *a, grpc_error *error) {
gpr_event_set((gpr_event *)a, (void *)1);
}
grpc_closure *set_event(gpr_event *ev) {
@@ -55,13 +55,12 @@ typedef struct {
grpc_resource_user *resource_user;
grpc_closure *then;
} reclaimer_args;
-static void reclaimer_cb(grpc_exec_ctx *exec_ctx, void *args,
- grpc_error *error) {
+static void reclaimer_cb(void *args, grpc_error *error) {
GPR_ASSERT(error == GRPC_ERROR_NONE);
reclaimer_args *a = args;
- grpc_resource_user_free(exec_ctx, a->resource_user, a->size);
- grpc_resource_user_finish_reclamation(exec_ctx, a->resource_user);
- GRPC_CLOSURE_RUN(exec_ctx, a->then, GRPC_ERROR_NONE);
+ grpc_resource_user_free(a->resource_user, a->size);
+ grpc_resource_user_finish_reclamation(a->resource_user);
+ GRPC_CLOSURE_RUN(a->then, GRPC_ERROR_NONE);
gpr_free(a);
}
grpc_closure *make_reclaimer(grpc_resource_user *resource_user, size_t size,
@@ -73,10 +72,9 @@ grpc_closure *make_reclaimer(grpc_resource_user *resource_user, size_t size,
return GRPC_CLOSURE_CREATE(reclaimer_cb, a, grpc_schedule_on_exec_ctx);
}
-static void unused_reclaimer_cb(grpc_exec_ctx *exec_ctx, void *arg,
- grpc_error *error) {
+static void unused_reclaimer_cb(void *arg, grpc_error *error) {
GPR_ASSERT(error == GRPC_ERROR_CANCELLED);
- GRPC_CLOSURE_RUN(exec_ctx, arg, GRPC_ERROR_NONE);
+ GRPC_CLOSURE_RUN(arg, GRPC_ERROR_NONE);
}
grpc_closure *make_unused_reclaimer(grpc_closure *then) {
return GRPC_CLOSURE_CREATE(unused_reclaimer_cb, then,
@@ -84,9 +82,9 @@ grpc_closure *make_unused_reclaimer(grpc_closure *then) {
}
static void destroy_user(grpc_resource_user *usr) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_resource_user_unref(&exec_ctx, usr);
- grpc_exec_ctx_finish(&exec_ctx);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_resource_user_unref(usr);
+ grpc_exec_ctx_finish();
}
static void test_no_op(void) {
@@ -118,14 +116,14 @@ static void test_instant_alloc_then_free(void) {
grpc_resource_quota_resize(q, 1024 * 1024);
grpc_resource_user *usr = grpc_resource_user_create(q, "usr");
{
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_resource_user_alloc(&exec_ctx, usr, 1024, NULL);
- grpc_exec_ctx_finish(&exec_ctx);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_resource_user_alloc(usr, 1024, NULL);
+ grpc_exec_ctx_finish();
}
{
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_resource_user_free(&exec_ctx, usr, 1024);
- grpc_exec_ctx_finish(&exec_ctx);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_resource_user_free(usr, 1024);
+ grpc_exec_ctx_finish();
}
grpc_resource_quota_unref(q);
destroy_user(usr);
@@ -138,10 +136,10 @@ static void test_instant_alloc_free_pair(void) {
grpc_resource_quota_resize(q, 1024 * 1024);
grpc_resource_user *usr = grpc_resource_user_create(q, "usr");
{
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_resource_user_alloc(&exec_ctx, usr, 1024, NULL);
- grpc_resource_user_free(&exec_ctx, usr, 1024);
- grpc_exec_ctx_finish(&exec_ctx);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ 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);
@@ -156,16 +154,16 @@ static void test_simple_async_alloc(void) {
{
gpr_event ev;
gpr_event_init(&ev);
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_resource_user_alloc(&exec_ctx, usr, 1024, set_event(&ev));
- grpc_exec_ctx_finish(&exec_ctx);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ 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);
}
{
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_resource_user_free(&exec_ctx, usr, 1024);
- grpc_exec_ctx_finish(&exec_ctx);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_resource_user_free(usr, 1024);
+ grpc_exec_ctx_finish();
}
grpc_resource_quota_unref(q);
destroy_user(usr);
@@ -180,9 +178,9 @@ static void test_async_alloc_blocked_by_size(void) {
gpr_event ev;
gpr_event_init(&ev);
{
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_resource_user_alloc(&exec_ctx, usr, 1024, set_event(&ev));
- grpc_exec_ctx_finish(&exec_ctx);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ 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);
}
@@ -190,9 +188,9 @@ static void test_async_alloc_blocked_by_size(void) {
GPR_ASSERT(gpr_event_wait(&ev, grpc_timeout_seconds_to_deadline(5)) != NULL);
;
{
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_resource_user_free(&exec_ctx, usr, 1024);
- grpc_exec_ctx_finish(&exec_ctx);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_resource_user_free(usr, 1024);
+ grpc_exec_ctx_finish();
}
grpc_resource_quota_unref(q);
destroy_user(usr);
@@ -207,32 +205,32 @@ static void test_scavenge(void) {
{
gpr_event ev;
gpr_event_init(&ev);
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_resource_user_alloc(&exec_ctx, usr1, 1024, set_event(&ev));
- grpc_exec_ctx_finish(&exec_ctx);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ 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);
;
}
{
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_resource_user_free(&exec_ctx, usr1, 1024);
- grpc_exec_ctx_finish(&exec_ctx);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_resource_user_free(usr1, 1024);
+ grpc_exec_ctx_finish();
}
{
gpr_event ev;
gpr_event_init(&ev);
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_resource_user_alloc(&exec_ctx, usr2, 1024, set_event(&ev));
- grpc_exec_ctx_finish(&exec_ctx);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ 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);
;
}
{
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_resource_user_free(&exec_ctx, usr2, 1024);
- grpc_exec_ctx_finish(&exec_ctx);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_resource_user_free(usr2, 1024);
+ grpc_exec_ctx_finish();
}
grpc_resource_quota_unref(q);
destroy_user(usr1);
@@ -248,33 +246,33 @@ static void test_scavenge_blocked(void) {
gpr_event ev;
{
gpr_event_init(&ev);
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_resource_user_alloc(&exec_ctx, usr1, 1024, set_event(&ev));
- grpc_exec_ctx_finish(&exec_ctx);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ 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);
;
}
{
gpr_event_init(&ev);
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_resource_user_alloc(&exec_ctx, usr2, 1024, set_event(&ev));
- grpc_exec_ctx_finish(&exec_ctx);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ 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);
}
{
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_resource_user_free(&exec_ctx, usr1, 1024);
- grpc_exec_ctx_finish(&exec_ctx);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_resource_user_free(usr1, 1024);
+ grpc_exec_ctx_finish();
GPR_ASSERT(gpr_event_wait(&ev, grpc_timeout_seconds_to_deadline(5)) !=
NULL);
;
}
{
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_resource_user_free(&exec_ctx, usr2, 1024);
- grpc_exec_ctx_finish(&exec_ctx);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_resource_user_free(usr2, 1024);
+ grpc_exec_ctx_finish();
}
grpc_resource_quota_unref(q);
destroy_user(usr1);
@@ -290,9 +288,9 @@ static void test_blocked_until_scheduled_reclaim(void) {
{
gpr_event ev;
gpr_event_init(&ev);
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_resource_user_alloc(&exec_ctx, usr, 1024, set_event(&ev));
- grpc_exec_ctx_finish(&exec_ctx);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ 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);
;
@@ -300,18 +298,17 @@ static void test_blocked_until_scheduled_reclaim(void) {
gpr_event reclaim_done;
gpr_event_init(&reclaim_done);
{
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_resource_user_post_reclaimer(
- &exec_ctx, usr, false,
- make_reclaimer(usr, 1024, set_event(&reclaim_done)));
- grpc_exec_ctx_finish(&exec_ctx);
+ usr, false, make_reclaimer(usr, 1024, set_event(&reclaim_done)));
+ grpc_exec_ctx_finish();
}
{
gpr_event ev;
gpr_event_init(&ev);
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_resource_user_alloc(&exec_ctx, usr, 1024, set_event(&ev));
- grpc_exec_ctx_finish(&exec_ctx);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ 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)) !=
@@ -319,9 +316,9 @@ static void test_blocked_until_scheduled_reclaim(void) {
;
}
{
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_resource_user_free(&exec_ctx, usr, 1024);
- grpc_exec_ctx_finish(&exec_ctx);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_resource_user_free(usr, 1024);
+ grpc_exec_ctx_finish();
}
grpc_resource_quota_unref(q);
destroy_user(usr);
@@ -337,9 +334,9 @@ static void test_blocked_until_scheduled_reclaim_and_scavenge(void) {
{
gpr_event ev;
gpr_event_init(&ev);
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_resource_user_alloc(&exec_ctx, usr1, 1024, set_event(&ev));
- grpc_exec_ctx_finish(&exec_ctx);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ 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);
;
@@ -347,18 +344,17 @@ static void test_blocked_until_scheduled_reclaim_and_scavenge(void) {
gpr_event reclaim_done;
gpr_event_init(&reclaim_done);
{
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_resource_user_post_reclaimer(
- &exec_ctx, usr1, false,
- make_reclaimer(usr1, 1024, set_event(&reclaim_done)));
- grpc_exec_ctx_finish(&exec_ctx);
+ usr1, false, make_reclaimer(usr1, 1024, set_event(&reclaim_done)));
+ grpc_exec_ctx_finish();
}
{
gpr_event ev;
gpr_event_init(&ev);
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_resource_user_alloc(&exec_ctx, usr2, 1024, set_event(&ev));
- grpc_exec_ctx_finish(&exec_ctx);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ 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,9 +362,9 @@ static void test_blocked_until_scheduled_reclaim_and_scavenge(void) {
;
}
{
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_resource_user_free(&exec_ctx, usr2, 1024);
- grpc_exec_ctx_finish(&exec_ctx);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_resource_user_free(usr2, 1024);
+ grpc_exec_ctx_finish();
}
grpc_resource_quota_unref(q);
destroy_user(usr1);
@@ -384,9 +380,9 @@ static void test_blocked_until_scheduled_destructive_reclaim(void) {
{
gpr_event ev;
gpr_event_init(&ev);
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_resource_user_alloc(&exec_ctx, usr, 1024, set_event(&ev));
- grpc_exec_ctx_finish(&exec_ctx);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ 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);
;
@@ -394,18 +390,17 @@ static void test_blocked_until_scheduled_destructive_reclaim(void) {
gpr_event reclaim_done;
gpr_event_init(&reclaim_done);
{
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_resource_user_post_reclaimer(
- &exec_ctx, usr, true,
- make_reclaimer(usr, 1024, set_event(&reclaim_done)));
- grpc_exec_ctx_finish(&exec_ctx);
+ usr, true, make_reclaimer(usr, 1024, set_event(&reclaim_done)));
+ grpc_exec_ctx_finish();
}
{
gpr_event ev;
gpr_event_init(&ev);
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_resource_user_alloc(&exec_ctx, usr, 1024, set_event(&ev));
- grpc_exec_ctx_finish(&exec_ctx);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ 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)) !=
@@ -413,9 +408,9 @@ static void test_blocked_until_scheduled_destructive_reclaim(void) {
;
}
{
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_resource_user_free(&exec_ctx, usr, 1024);
- grpc_exec_ctx_finish(&exec_ctx);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_resource_user_free(usr, 1024);
+ grpc_exec_ctx_finish();
}
grpc_resource_quota_unref(q);
destroy_user(usr);
@@ -432,13 +427,12 @@ static void test_unused_reclaim_is_cancelled(void) {
gpr_event destructive_done;
gpr_event_init(&destructive_done);
{
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_resource_user_post_reclaimer(
- &exec_ctx, usr, false, make_unused_reclaimer(set_event(&benign_done)));
+ usr, false, make_unused_reclaimer(set_event(&benign_done)));
grpc_resource_user_post_reclaimer(
- &exec_ctx, usr, true,
- make_unused_reclaimer(set_event(&destructive_done)));
- grpc_exec_ctx_finish(&exec_ctx);
+ 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);
@@ -467,22 +461,20 @@ static void test_benign_reclaim_is_preferred(void) {
{
gpr_event ev;
gpr_event_init(&ev);
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_resource_user_alloc(&exec_ctx, usr, 1024, set_event(&ev));
- grpc_exec_ctx_finish(&exec_ctx);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ 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);
;
}
{
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_resource_user_post_reclaimer(
- &exec_ctx, usr, false,
- make_reclaimer(usr, 1024, set_event(&benign_done)));
+ usr, false, make_reclaimer(usr, 1024, set_event(&benign_done)));
grpc_resource_user_post_reclaimer(
- &exec_ctx, usr, true,
- make_unused_reclaimer(set_event(&destructive_done)));
- grpc_exec_ctx_finish(&exec_ctx);
+ 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);
@@ -493,9 +485,9 @@ static void test_benign_reclaim_is_preferred(void) {
{
gpr_event ev;
gpr_event_init(&ev);
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_resource_user_alloc(&exec_ctx, usr, 1024, set_event(&ev));
- grpc_exec_ctx_finish(&exec_ctx);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ 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,
@@ -505,9 +497,9 @@ static void test_benign_reclaim_is_preferred(void) {
NULL);
}
{
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_resource_user_free(&exec_ctx, usr, 1024);
- grpc_exec_ctx_finish(&exec_ctx);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_resource_user_free(usr, 1024);
+ grpc_exec_ctx_finish();
}
grpc_resource_quota_unref(q);
destroy_user(usr);
@@ -530,22 +522,20 @@ static void test_multiple_reclaims_can_be_triggered(void) {
{
gpr_event ev;
gpr_event_init(&ev);
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_resource_user_alloc(&exec_ctx, usr, 1024, set_event(&ev));
- grpc_exec_ctx_finish(&exec_ctx);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ 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);
;
}
{
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_resource_user_post_reclaimer(
- &exec_ctx, usr, false,
- make_reclaimer(usr, 512, set_event(&benign_done)));
+ usr, false, make_reclaimer(usr, 512, set_event(&benign_done)));
grpc_resource_user_post_reclaimer(
- &exec_ctx, usr, true,
- make_reclaimer(usr, 512, set_event(&destructive_done)));
- grpc_exec_ctx_finish(&exec_ctx);
+ 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);
@@ -556,9 +546,9 @@ static void test_multiple_reclaims_can_be_triggered(void) {
{
gpr_event ev;
gpr_event_init(&ev);
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_resource_user_alloc(&exec_ctx, usr, 1024, set_event(&ev));
- grpc_exec_ctx_finish(&exec_ctx);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ 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,
@@ -568,9 +558,9 @@ static void test_multiple_reclaims_can_be_triggered(void) {
;
}
{
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_resource_user_free(&exec_ctx, usr, 1024);
- grpc_exec_ctx_finish(&exec_ctx);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_resource_user_free(usr, 1024);
+ grpc_exec_ctx_finish();
}
grpc_resource_quota_unref(q);
destroy_user(usr);
@@ -588,20 +578,20 @@ static void test_resource_user_stays_allocated_until_memory_released(void) {
grpc_resource_quota_resize(q, 1024 * 1024);
grpc_resource_user *usr = grpc_resource_user_create(q, "usr");
{
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_resource_user_alloc(&exec_ctx, usr, 1024, NULL);
- grpc_exec_ctx_finish(&exec_ctx);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_resource_user_alloc(usr, 1024, NULL);
+ grpc_exec_ctx_finish();
}
{
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_resource_quota_unref(q);
- grpc_resource_user_unref(&exec_ctx, usr);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_resource_user_unref(usr);
+ grpc_exec_ctx_finish();
}
{
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_resource_user_free(&exec_ctx, usr, 1024);
- grpc_exec_ctx_finish(&exec_ctx);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_resource_user_free(usr, 1024);
+ grpc_exec_ctx_finish();
}
}
@@ -621,11 +611,10 @@ test_resource_user_stays_allocated_and_reclaimers_unrun_until_memory_released(
gpr_event reclaimer_cancelled;
gpr_event_init(&reclaimer_cancelled);
{
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_resource_user_post_reclaimer(
- &exec_ctx, usr, false,
- make_unused_reclaimer(set_event(&reclaimer_cancelled)));
- grpc_exec_ctx_finish(&exec_ctx);
+ 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);
@@ -633,9 +622,9 @@ test_resource_user_stays_allocated_and_reclaimers_unrun_until_memory_released(
{
gpr_event allocated;
gpr_event_init(&allocated);
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_resource_user_alloc(&exec_ctx, usr, 1024, set_event(&allocated));
- grpc_exec_ctx_finish(&exec_ctx);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ 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,
@@ -643,17 +632,17 @@ test_resource_user_stays_allocated_and_reclaimers_unrun_until_memory_released(
NULL);
}
{
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_resource_user_unref(&exec_ctx, usr);
- grpc_exec_ctx_finish(&exec_ctx);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_resource_user_unref(usr);
+ grpc_exec_ctx_finish();
GPR_ASSERT(gpr_event_wait(&reclaimer_cancelled,
grpc_timeout_milliseconds_to_deadline(100)) ==
NULL);
}
{
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_resource_user_free(&exec_ctx, usr, 1024);
- grpc_exec_ctx_finish(&exec_ctx);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_resource_user_free(usr, 1024);
+ grpc_exec_ctx_finish();
GPR_ASSERT(gpr_event_wait(&reclaimer_cancelled,
grpc_timeout_seconds_to_deadline(5)) != NULL);
}
@@ -670,9 +659,9 @@ static void test_reclaimers_can_be_posted_repeatedly(void) {
{
gpr_event allocated;
gpr_event_init(&allocated);
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_resource_user_alloc(&exec_ctx, usr, 1024, set_event(&allocated));
- grpc_exec_ctx_finish(&exec_ctx);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ 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);
}
@@ -680,11 +669,10 @@ static void test_reclaimers_can_be_posted_repeatedly(void) {
gpr_event reclaimer_done;
gpr_event_init(&reclaimer_done);
{
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_resource_user_post_reclaimer(
- &exec_ctx, usr, false,
- make_reclaimer(usr, 1024, set_event(&reclaimer_done)));
- grpc_exec_ctx_finish(&exec_ctx);
+ 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);
@@ -692,9 +680,9 @@ static void test_reclaimers_can_be_posted_repeatedly(void) {
{
gpr_event allocated;
gpr_event_init(&allocated);
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_resource_user_alloc(&exec_ctx, usr, 1024, set_event(&allocated));
- grpc_exec_ctx_finish(&exec_ctx);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ 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,
@@ -702,9 +690,9 @@ static void test_reclaimers_can_be_posted_repeatedly(void) {
}
}
{
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_resource_user_free(&exec_ctx, usr, 1024);
- grpc_exec_ctx_finish(&exec_ctx);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_resource_user_free(usr, 1024);
+ grpc_exec_ctx_finish();
}
destroy_user(usr);
grpc_resource_quota_unref(q);
@@ -727,16 +715,16 @@ static void test_one_slice(void) {
{
const int start_allocs = num_allocs;
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_resource_user_alloc_slices(&exec_ctx, &alloc, 1024, 1, &buffer);
- grpc_exec_ctx_finish(&exec_ctx);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_resource_user_alloc_slices(&alloc, 1024, 1, &buffer);
+ grpc_exec_ctx_finish();
assert_counter_becomes(&num_allocs, start_allocs + 1);
}
{
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_slice_buffer_destroy_internal(&exec_ctx, &buffer);
- grpc_exec_ctx_finish(&exec_ctx);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_slice_buffer_destroy_internal(&buffer);
+ grpc_exec_ctx_finish();
}
destroy_user(usr);
grpc_resource_quota_unref(q);
@@ -760,23 +748,23 @@ static void test_one_slice_deleted_late(void) {
{
const int start_allocs = num_allocs;
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_resource_user_alloc_slices(&exec_ctx, &alloc, 1024, 1, &buffer);
- grpc_exec_ctx_finish(&exec_ctx);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_resource_user_alloc_slices(&alloc, 1024, 1, &buffer);
+ grpc_exec_ctx_finish();
assert_counter_becomes(&num_allocs, start_allocs + 1);
}
{
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_resource_user_unref(&exec_ctx, usr);
- grpc_exec_ctx_finish(&exec_ctx);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_resource_user_unref(usr);
+ grpc_exec_ctx_finish();
}
grpc_resource_quota_unref(q);
{
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_slice_buffer_destroy_internal(&exec_ctx, &buffer);
- grpc_exec_ctx_finish(&exec_ctx);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_slice_buffer_destroy_internal(&buffer);
+ grpc_exec_ctx_finish();
}
}
@@ -804,9 +792,9 @@ static void test_negative_rq_free_pool(void) {
{
const int start_allocs = num_allocs;
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_resource_user_alloc_slices(&exec_ctx, &alloc, 1024, 1, &buffer);
- grpc_exec_ctx_finish(&exec_ctx);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_resource_user_alloc_slices(&alloc, 1024, 1, &buffer);
+ grpc_exec_ctx_finish();
assert_counter_becomes(&num_allocs, start_allocs + 1);
}
@@ -817,16 +805,16 @@ static void test_negative_rq_free_pool(void) {
GPR_ASSERT(grpc_resource_quota_get_memory_pressure(q) > 1 - eps);
{
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_resource_user_unref(&exec_ctx, usr);
- grpc_exec_ctx_finish(&exec_ctx);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_resource_user_unref(usr);
+ grpc_exec_ctx_finish();
}
grpc_resource_quota_unref(q);
{
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_slice_buffer_destroy_internal(&exec_ctx, &buffer);
- grpc_exec_ctx_finish(&exec_ctx);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_slice_buffer_destroy_internal(&buffer);
+ grpc_exec_ctx_finish();
}
}
diff --git a/test/core/iomgr/tcp_client_posix_test.c b/test/core/iomgr/tcp_client_posix_test.c
index b8b76d1c42..1640cb4153 100644
--- a/test/core/iomgr/tcp_client_posix_test.c
+++ b/test/core/iomgr/tcp_client_posix_test.c
@@ -53,26 +53,24 @@ static grpc_millis test_deadline(void) {
static void finish_connection() {
gpr_mu_lock(g_mu);
g_connections_complete++;
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- GPR_ASSERT(GRPC_LOG_IF_ERROR("pollset_kick",
- grpc_pollset_kick(&exec_ctx, g_pollset, NULL)));
- grpc_exec_ctx_finish(&exec_ctx);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ GPR_ASSERT(
+ GRPC_LOG_IF_ERROR("pollset_kick", grpc_pollset_kick(g_pollset, NULL)));
+ grpc_exec_ctx_finish();
gpr_mu_unlock(g_mu);
}
-static void must_succeed(grpc_exec_ctx *exec_ctx, void *arg,
- grpc_error *error) {
+static void must_succeed(void *arg, grpc_error *error) {
GPR_ASSERT(g_connecting != NULL);
GPR_ASSERT(error == GRPC_ERROR_NONE);
- grpc_endpoint_shutdown(
- exec_ctx, g_connecting,
- GRPC_ERROR_CREATE_FROM_STATIC_STRING("must_succeed called"));
- grpc_endpoint_destroy(exec_ctx, g_connecting);
+ grpc_endpoint_shutdown(g_connecting, GRPC_ERROR_CREATE_FROM_STATIC_STRING(
+ "must_succeed called"));
+ grpc_endpoint_destroy(g_connecting);
g_connecting = NULL;
finish_connection();
}
-static void must_fail(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) {
+static void must_fail(void *arg, grpc_error *error) {
GPR_ASSERT(g_connecting == NULL);
GPR_ASSERT(error != GRPC_ERROR_NONE);
finish_connection();
@@ -85,7 +83,7 @@ void test_succeeds(void) {
int r;
int connections_complete_before;
grpc_closure done;
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
gpr_log(GPR_DEBUG, "test_succeeds");
@@ -108,7 +106,7 @@ void test_succeeds(void) {
GPR_ASSERT(getsockname(svr_fd, (struct sockaddr *)addr,
(socklen_t *)&resolved_addr.len) == 0);
GRPC_CLOSURE_INIT(&done, must_succeed, NULL, grpc_schedule_on_exec_ctx);
- grpc_tcp_client_connect(&exec_ctx, &done, &g_connecting, g_pollset_set, NULL,
+ grpc_tcp_client_connect(&done, &g_connecting, g_pollset_set, NULL,
&resolved_addr, GRPC_MILLIS_INF_FUTURE);
/* await the connection */
@@ -126,17 +124,17 @@ void test_succeeds(void) {
grpc_pollset_worker *worker = NULL;
GPR_ASSERT(GRPC_LOG_IF_ERROR(
"pollset_work",
- grpc_pollset_work(&exec_ctx, g_pollset, &worker,
+ grpc_pollset_work(g_pollset, &worker,
grpc_timespec_to_millis_round_up(
grpc_timeout_seconds_to_deadline(5)))));
gpr_mu_unlock(g_mu);
- grpc_exec_ctx_flush(&exec_ctx);
+ grpc_exec_ctx_flush();
gpr_mu_lock(g_mu);
}
gpr_mu_unlock(g_mu);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_exec_ctx_finish();
}
void test_fails(void) {
@@ -144,7 +142,7 @@ void test_fails(void) {
struct sockaddr_in *addr = (struct sockaddr_in *)resolved_addr.addr;
int connections_complete_before;
grpc_closure done;
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
gpr_log(GPR_DEBUG, "test_fails");
@@ -158,7 +156,7 @@ void test_fails(void) {
/* connect to a broken address */
GRPC_CLOSURE_INIT(&done, must_fail, NULL, grpc_schedule_on_exec_ctx);
- grpc_tcp_client_connect(&exec_ctx, &done, &g_connecting, g_pollset_set, NULL,
+ grpc_tcp_client_connect(&done, &g_connecting, g_pollset_set, NULL,
&resolved_addr, GRPC_MILLIS_INF_FUTURE);
gpr_mu_lock(g_mu);
@@ -167,7 +165,7 @@ void test_fails(void) {
while (g_connections_complete == connections_complete_before) {
grpc_pollset_worker *worker = NULL;
grpc_millis polling_deadline = test_deadline();
- switch (grpc_timer_check(&exec_ctx, &polling_deadline)) {
+ switch (grpc_timer_check(&polling_deadline)) {
case GRPC_TIMERS_FIRED:
break;
case GRPC_TIMERS_NOT_CHECKED:
@@ -175,42 +173,41 @@ void test_fails(void) {
/* fall through */
case GRPC_TIMERS_CHECKED_AND_EMPTY:
GPR_ASSERT(GRPC_LOG_IF_ERROR(
- "pollset_work", grpc_pollset_work(&exec_ctx, g_pollset, &worker,
- polling_deadline)));
+ "pollset_work",
+ grpc_pollset_work(g_pollset, &worker, polling_deadline)));
break;
}
gpr_mu_unlock(g_mu);
- grpc_exec_ctx_flush(&exec_ctx);
+ grpc_exec_ctx_flush();
gpr_mu_lock(g_mu);
}
gpr_mu_unlock(g_mu);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_exec_ctx_finish();
}
-static void destroy_pollset(grpc_exec_ctx *exec_ctx, void *p,
- grpc_error *error) {
- grpc_pollset_destroy(exec_ctx, p);
+static void destroy_pollset(void *p, grpc_error *error) {
+ grpc_pollset_destroy(p);
}
int main(int argc, char **argv) {
grpc_closure destroyed;
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_test_init(argc, argv);
grpc_init();
g_pollset_set = grpc_pollset_set_create();
g_pollset = gpr_zalloc(grpc_pollset_size());
grpc_pollset_init(g_pollset, &g_mu);
- grpc_pollset_set_add_pollset(&exec_ctx, g_pollset_set, g_pollset);
- grpc_exec_ctx_finish(&exec_ctx);
+ 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();
- grpc_pollset_set_destroy(&exec_ctx, g_pollset_set);
+ grpc_pollset_set_destroy(g_pollset_set);
GRPC_CLOSURE_INIT(&destroyed, destroy_pollset, g_pollset,
grpc_schedule_on_exec_ctx);
- grpc_pollset_shutdown(&exec_ctx, g_pollset, &destroyed);
- grpc_exec_ctx_finish(&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.c b/test/core/iomgr/tcp_client_uv_test.c
index edfccbe867..393c183fa9 100644
--- a/test/core/iomgr/tcp_client_uv_test.c
+++ b/test/core/iomgr/tcp_client_uv_test.c
@@ -46,30 +46,28 @@ static grpc_millis test_deadline(void) {
return grpc_timespec_to_millis_round_up(grpc_timeout_seconds_to_deadline(10));
}
-static void finish_connection(grpc_exec_ctx *exec_ctx) {
+static void finish_connection() {
gpr_mu_lock(g_mu);
g_connections_complete++;
- GPR_ASSERT(GRPC_LOG_IF_ERROR("pollset_kick",
- grpc_pollset_kick(exec_ctx, g_pollset, NULL)));
+ GPR_ASSERT(
+ GRPC_LOG_IF_ERROR("pollset_kick", grpc_pollset_kick(g_pollset, NULL)));
gpr_mu_unlock(g_mu);
}
-static void must_succeed(grpc_exec_ctx *exec_ctx, void *arg,
- grpc_error *error) {
+static void must_succeed(void *arg, grpc_error *error) {
GPR_ASSERT(g_connecting != NULL);
GPR_ASSERT(error == GRPC_ERROR_NONE);
- grpc_endpoint_shutdown(
- exec_ctx, g_connecting,
- GRPC_ERROR_CREATE_FROM_STATIC_STRING("must_succeed called"));
- grpc_endpoint_destroy(exec_ctx, g_connecting);
+ grpc_endpoint_shutdown(g_connecting, GRPC_ERROR_CREATE_FROM_STATIC_STRING(
+ "must_succeed called"));
+ grpc_endpoint_destroy(g_connecting);
g_connecting = NULL;
- finish_connection(exec_ctx);
+ finish_connection();
}
-static void must_fail(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) {
+static void must_fail(void *arg, grpc_error *error) {
GPR_ASSERT(g_connecting == NULL);
GPR_ASSERT(error != GRPC_ERROR_NONE);
- finish_connection(exec_ctx);
+ finish_connection();
}
static void close_cb(uv_handle_t *handle) { gpr_free(handle); }
@@ -88,7 +86,7 @@ void test_succeeds(void) {
uv_tcp_t *svr_handle = gpr_malloc(sizeof(uv_tcp_t));
int connections_complete_before;
grpc_closure done;
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
gpr_log(GPR_DEBUG, "test_succeeds");
@@ -109,8 +107,8 @@ void test_succeeds(void) {
GPR_ASSERT(uv_tcp_getsockname(svr_handle, (struct sockaddr *)addr,
(int *)&resolved_addr.len) == 0);
GRPC_CLOSURE_INIT(&done, must_succeed, NULL, grpc_schedule_on_exec_ctx);
- grpc_tcp_client_connect(&exec_ctx, &done, &g_connecting, NULL, NULL,
- &resolved_addr, GRPC_MILLIS_INF_FUTURE);
+ grpc_tcp_client_connect(&done, &g_connecting, NULL, NULL, &resolved_addr,
+ GRPC_MILLIS_INF_FUTURE);
gpr_mu_lock(g_mu);
@@ -118,11 +116,11 @@ void test_succeeds(void) {
grpc_pollset_worker *worker = NULL;
GPR_ASSERT(GRPC_LOG_IF_ERROR(
"pollset_work",
- grpc_pollset_work(&exec_ctx, g_pollset, &worker,
+ grpc_pollset_work(g_pollset, &worker,
grpc_timespec_to_millis_round_up(
grpc_timeout_seconds_to_deadline(5)))));
gpr_mu_unlock(g_mu);
- grpc_exec_ctx_flush(&exec_ctx);
+ grpc_exec_ctx_flush();
gpr_mu_lock(g_mu);
}
@@ -131,7 +129,7 @@ void test_succeeds(void) {
gpr_mu_unlock(g_mu);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_exec_ctx_finish();
}
void test_fails(void) {
@@ -139,7 +137,7 @@ void test_fails(void) {
struct sockaddr_in *addr = (struct sockaddr_in *)resolved_addr.addr;
int connections_complete_before;
grpc_closure done;
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
gpr_log(GPR_DEBUG, "test_fails");
@@ -153,8 +151,8 @@ void test_fails(void) {
/* connect to a broken address */
GRPC_CLOSURE_INIT(&done, must_fail, NULL, grpc_schedule_on_exec_ctx);
- grpc_tcp_client_connect(&exec_ctx, &done, &g_connecting, NULL, NULL,
- &resolved_addr, GRPC_MILLIS_INF_FUTURE);
+ grpc_tcp_client_connect(&done, &g_connecting, NULL, NULL, &resolved_addr,
+ GRPC_MILLIS_INF_FUTURE);
gpr_mu_lock(g_mu);
@@ -163,7 +161,7 @@ void test_fails(void) {
grpc_pollset_worker *worker = NULL;
gpr_timespec now = gpr_now(GPR_CLOCK_MONOTONIC);
grpc_millis polling_deadline = test_deadline();
- switch (grpc_timer_check(&exec_ctx, &polling_deadline)) {
+ switch (grpc_timer_check(&polling_deadline)) {
case GRPC_TIMERS_FIRED:
break;
case GRPC_TIMERS_NOT_CHECKED:
@@ -171,39 +169,38 @@ void test_fails(void) {
/* fall through */
case GRPC_TIMERS_CHECKED_AND_EMPTY:
GPR_ASSERT(GRPC_LOG_IF_ERROR(
- "pollset_work", grpc_pollset_work(&exec_ctx, g_pollset, &worker,
- polling_deadline)));
+ "pollset_work",
+ grpc_pollset_work(g_pollset, &worker, polling_deadline)));
break;
}
gpr_mu_unlock(g_mu);
- grpc_exec_ctx_flush(&exec_ctx);
+ grpc_exec_ctx_flush();
gpr_mu_lock(g_mu);
}
gpr_mu_unlock(g_mu);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_exec_ctx_finish();
}
-static void destroy_pollset(grpc_exec_ctx *exec_ctx, void *p,
- grpc_error *error) {
- grpc_pollset_destroy(exec_ctx, p);
+static void destroy_pollset(void *p, grpc_error *error) {
+ grpc_pollset_destroy(p);
}
int main(int argc, char **argv) {
grpc_closure destroyed;
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_test_init(argc, argv);
grpc_init();
g_pollset = gpr_malloc(grpc_pollset_size());
grpc_pollset_init(g_pollset, &g_mu);
- grpc_exec_ctx_finish(&exec_ctx);
+ 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(&exec_ctx, g_pollset, &destroyed);
- grpc_exec_ctx_finish(&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.c b/test/core/iomgr/tcp_posix_test.c
index 6501160c6f..83f1ad424d 100644
--- a/test/core/iomgr/tcp_posix_test.c
+++ b/test/core/iomgr/tcp_posix_test.c
@@ -131,8 +131,7 @@ static size_t count_slices(grpc_slice *slices, size_t nslices,
return num_bytes;
}
-static void read_cb(grpc_exec_ctx *exec_ctx, void *user_data,
- grpc_error *error) {
+static void read_cb(void *user_data, grpc_error *error) {
struct read_socket_state *state = (struct read_socket_state *)user_data;
size_t read_bytes;
int current_data;
@@ -147,11 +146,10 @@ static void read_cb(grpc_exec_ctx *exec_ctx, void *user_data,
gpr_log(GPR_INFO, "Read %" PRIuPTR " bytes of %" PRIuPTR, read_bytes,
state->target_read_bytes);
if (state->read_bytes >= state->target_read_bytes) {
- GPR_ASSERT(GRPC_LOG_IF_ERROR("kick",
- grpc_pollset_kick(exec_ctx, g_pollset, NULL)));
+ GPR_ASSERT(GRPC_LOG_IF_ERROR("kick", grpc_pollset_kick(g_pollset, NULL)));
gpr_mu_unlock(g_mu);
} else {
- grpc_endpoint_read(exec_ctx, state->ep, &state->incoming, &state->read_cb);
+ grpc_endpoint_read(state->ep, &state->incoming, &state->read_cb);
gpr_mu_unlock(g_mu);
}
}
@@ -164,7 +162,7 @@ static void read_test(size_t num_bytes, size_t slice_size) {
size_t written_bytes;
grpc_millis deadline =
grpc_timespec_to_millis_round_up(grpc_timeout_seconds_to_deadline(20));
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
gpr_log(GPR_INFO, "Read test of size %" PRIuPTR ", slice size %" PRIuPTR,
num_bytes, slice_size);
@@ -175,9 +173,8 @@ static void read_test(size_t num_bytes, size_t slice_size) {
.type = GRPC_ARG_INTEGER,
.value.integer = (int)slice_size}};
grpc_channel_args args = {.num_args = GPR_ARRAY_SIZE(a), .args = a};
- ep = grpc_tcp_create(&exec_ctx, grpc_fd_create(sv[1], "read_test"), &args,
- "test");
- grpc_endpoint_add_to_pollset(&exec_ctx, ep, g_pollset);
+ ep = grpc_tcp_create(grpc_fd_create(sv[1], "read_test"), &args, "test");
+ grpc_endpoint_add_to_pollset(ep, g_pollset);
written_bytes = fill_socket_partial(sv[0], num_bytes);
gpr_log(GPR_INFO, "Wrote %" PRIuPTR " bytes", written_bytes);
@@ -188,24 +185,23 @@ static void read_test(size_t num_bytes, size_t slice_size) {
grpc_slice_buffer_init(&state.incoming);
GRPC_CLOSURE_INIT(&state.read_cb, read_cb, &state, grpc_schedule_on_exec_ctx);
- grpc_endpoint_read(&exec_ctx, ep, &state.incoming, &state.read_cb);
+ grpc_endpoint_read(ep, &state.incoming, &state.read_cb);
gpr_mu_lock(g_mu);
while (state.read_bytes < state.target_read_bytes) {
grpc_pollset_worker *worker = NULL;
GPR_ASSERT(GRPC_LOG_IF_ERROR(
- "pollset_work",
- grpc_pollset_work(&exec_ctx, g_pollset, &worker, deadline)));
+ "pollset_work", grpc_pollset_work(g_pollset, &worker, deadline)));
gpr_mu_unlock(g_mu);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_exec_ctx_finish();
gpr_mu_lock(g_mu);
}
GPR_ASSERT(state.read_bytes == state.target_read_bytes);
gpr_mu_unlock(g_mu);
- grpc_slice_buffer_destroy_internal(&exec_ctx, &state.incoming);
- grpc_endpoint_destroy(&exec_ctx, ep);
- grpc_exec_ctx_finish(&exec_ctx);
+ 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
@@ -217,7 +213,7 @@ static void large_read_test(size_t slice_size) {
ssize_t written_bytes;
grpc_millis deadline =
grpc_timespec_to_millis_round_up(grpc_timeout_seconds_to_deadline(20));
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
gpr_log(GPR_INFO, "Start large read test, slice size %" PRIuPTR, slice_size);
@@ -227,9 +223,8 @@ static void large_read_test(size_t slice_size) {
.type = GRPC_ARG_INTEGER,
.value.integer = (int)slice_size}};
grpc_channel_args args = {.num_args = GPR_ARRAY_SIZE(a), .args = a};
- ep = grpc_tcp_create(&exec_ctx, grpc_fd_create(sv[1], "large_read_test"),
- &args, "test");
- grpc_endpoint_add_to_pollset(&exec_ctx, ep, g_pollset);
+ ep = grpc_tcp_create(grpc_fd_create(sv[1], "large_read_test"), &args, "test");
+ grpc_endpoint_add_to_pollset(ep, g_pollset);
written_bytes = fill_socket(sv[0]);
gpr_log(GPR_INFO, "Wrote %" PRIuPTR " bytes", written_bytes);
@@ -240,24 +235,23 @@ static void large_read_test(size_t slice_size) {
grpc_slice_buffer_init(&state.incoming);
GRPC_CLOSURE_INIT(&state.read_cb, read_cb, &state, grpc_schedule_on_exec_ctx);
- grpc_endpoint_read(&exec_ctx, ep, &state.incoming, &state.read_cb);
+ grpc_endpoint_read(ep, &state.incoming, &state.read_cb);
gpr_mu_lock(g_mu);
while (state.read_bytes < state.target_read_bytes) {
grpc_pollset_worker *worker = NULL;
GPR_ASSERT(GRPC_LOG_IF_ERROR(
- "pollset_work",
- grpc_pollset_work(&exec_ctx, g_pollset, &worker, deadline)));
+ "pollset_work", grpc_pollset_work(g_pollset, &worker, deadline)));
gpr_mu_unlock(g_mu);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_exec_ctx_finish();
gpr_mu_lock(g_mu);
}
GPR_ASSERT(state.read_bytes == state.target_read_bytes);
gpr_mu_unlock(g_mu);
- grpc_slice_buffer_destroy_internal(&exec_ctx, &state.incoming);
- grpc_endpoint_destroy(&exec_ctx, ep);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_slice_buffer_destroy_internal(&state.incoming);
+ grpc_endpoint_destroy(ep);
+ grpc_exec_ctx_finish();
}
struct write_socket_state {
@@ -288,16 +282,15 @@ static grpc_slice *allocate_blocks(size_t num_bytes, size_t slice_size,
return slices;
}
-static void write_done(grpc_exec_ctx *exec_ctx,
- void *user_data /* write_socket_state */,
+static void write_done(void *user_data /* write_socket_state */,
grpc_error *error) {
struct write_socket_state *state = (struct write_socket_state *)user_data;
gpr_log(GPR_INFO, "Write done callback called");
gpr_mu_lock(g_mu);
gpr_log(GPR_INFO, "Signalling write done");
state->write_done = 1;
- GPR_ASSERT(GRPC_LOG_IF_ERROR("pollset_kick",
- grpc_pollset_kick(exec_ctx, g_pollset, NULL)));
+ GPR_ASSERT(
+ GRPC_LOG_IF_ERROR("pollset_kick", grpc_pollset_kick(g_pollset, NULL)));
gpr_mu_unlock(g_mu);
}
@@ -308,7 +301,7 @@ void drain_socket_blocking(int fd, size_t num_bytes, size_t read_size) {
int flags;
int current = 0;
int i;
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
flags = fcntl(fd, F_GETFL, 0);
GPR_ASSERT(fcntl(fd, F_SETFL, flags & ~O_NONBLOCK) == 0);
@@ -318,11 +311,11 @@ void drain_socket_blocking(int fd, size_t num_bytes, size_t read_size) {
gpr_mu_lock(g_mu);
GPR_ASSERT(GRPC_LOG_IF_ERROR(
"pollset_work",
- grpc_pollset_work(&exec_ctx, g_pollset, &worker,
+ grpc_pollset_work(g_pollset, &worker,
grpc_timespec_to_millis_round_up(
grpc_timeout_milliseconds_to_deadline(10)))));
gpr_mu_unlock(g_mu);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_exec_ctx_finish();
do {
bytes_read =
read(fd, buf, bytes_left > read_size ? read_size : bytes_left);
@@ -355,7 +348,7 @@ static void write_test(size_t num_bytes, size_t slice_size) {
grpc_closure write_done_closure;
grpc_millis deadline =
grpc_timespec_to_millis_round_up(grpc_timeout_seconds_to_deadline(20));
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
gpr_log(GPR_INFO,
"Start write test with %" PRIuPTR " bytes, slice size %" PRIuPTR,
@@ -367,9 +360,8 @@ static void write_test(size_t num_bytes, size_t slice_size) {
.type = GRPC_ARG_INTEGER,
.value.integer = (int)slice_size}};
grpc_channel_args args = {.num_args = GPR_ARRAY_SIZE(a), .args = a};
- ep = grpc_tcp_create(&exec_ctx, grpc_fd_create(sv[1], "write_test"), &args,
- "test");
- grpc_endpoint_add_to_pollset(&exec_ctx, ep, g_pollset);
+ ep = grpc_tcp_create(grpc_fd_create(sv[1], "write_test"), &args, "test");
+ grpc_endpoint_add_to_pollset(ep, g_pollset);
state.ep = ep;
state.write_done = 0;
@@ -381,7 +373,7 @@ static void write_test(size_t num_bytes, size_t slice_size) {
GRPC_CLOSURE_INIT(&write_done_closure, write_done, &state,
grpc_schedule_on_exec_ctx);
- grpc_endpoint_write(&exec_ctx, ep, &outgoing, &write_done_closure);
+ grpc_endpoint_write(ep, &outgoing, &write_done_closure);
drain_socket_blocking(sv[0], num_bytes, num_bytes);
gpr_mu_lock(g_mu);
for (;;) {
@@ -390,25 +382,24 @@ static void write_test(size_t num_bytes, size_t slice_size) {
break;
}
GPR_ASSERT(GRPC_LOG_IF_ERROR(
- "pollset_work",
- grpc_pollset_work(&exec_ctx, g_pollset, &worker, deadline)));
+ "pollset_work", grpc_pollset_work(g_pollset, &worker, deadline)));
gpr_mu_unlock(g_mu);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_exec_ctx_finish();
gpr_mu_lock(g_mu);
}
gpr_mu_unlock(g_mu);
- grpc_slice_buffer_destroy_internal(&exec_ctx, &outgoing);
- grpc_endpoint_destroy(&exec_ctx, ep);
+ grpc_slice_buffer_destroy_internal(&outgoing);
+ grpc_endpoint_destroy(ep);
gpr_free(slices);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_exec_ctx_finish();
}
-void on_fd_released(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *errors) {
+void on_fd_released(void *arg, grpc_error *errors) {
int *done = (int *)arg;
*done = 1;
- GPR_ASSERT(GRPC_LOG_IF_ERROR("pollset_kick",
- grpc_pollset_kick(exec_ctx, g_pollset, NULL)));
+ GPR_ASSERT(
+ GRPC_LOG_IF_ERROR("pollset_kick", grpc_pollset_kick(g_pollset, NULL)));
}
/* Do a read_test, then release fd and try to read/write again. Verify that
@@ -421,7 +412,7 @@ static void release_fd_test(size_t num_bytes, size_t slice_size) {
int fd;
grpc_millis deadline =
grpc_timespec_to_millis_round_up(grpc_timeout_seconds_to_deadline(20));
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_closure fd_released_cb;
int fd_released_done = 0;
GRPC_CLOSURE_INIT(&fd_released_cb, &on_fd_released, &fd_released_done,
@@ -437,10 +428,9 @@ static void release_fd_test(size_t num_bytes, size_t slice_size) {
.type = GRPC_ARG_INTEGER,
.value.integer = (int)slice_size}};
grpc_channel_args args = {.num_args = GPR_ARRAY_SIZE(a), .args = a};
- ep = grpc_tcp_create(&exec_ctx, grpc_fd_create(sv[1], "read_test"), &args,
- "test");
+ ep = grpc_tcp_create(grpc_fd_create(sv[1], "read_test"), &args, "test");
GPR_ASSERT(grpc_tcp_fd(ep) == sv[1] && sv[1] >= 0);
- grpc_endpoint_add_to_pollset(&exec_ctx, ep, g_pollset);
+ grpc_endpoint_add_to_pollset(ep, g_pollset);
written_bytes = fill_socket_partial(sv[0], num_bytes);
gpr_log(GPR_INFO, "Wrote %" PRIuPTR " bytes", written_bytes);
@@ -451,38 +441,36 @@ static void release_fd_test(size_t num_bytes, size_t slice_size) {
grpc_slice_buffer_init(&state.incoming);
GRPC_CLOSURE_INIT(&state.read_cb, read_cb, &state, grpc_schedule_on_exec_ctx);
- grpc_endpoint_read(&exec_ctx, ep, &state.incoming, &state.read_cb);
+ grpc_endpoint_read(ep, &state.incoming, &state.read_cb);
gpr_mu_lock(g_mu);
while (state.read_bytes < state.target_read_bytes) {
grpc_pollset_worker *worker = NULL;
GPR_ASSERT(GRPC_LOG_IF_ERROR(
- "pollset_work",
- grpc_pollset_work(&exec_ctx, g_pollset, &worker, deadline)));
+ "pollset_work", grpc_pollset_work(g_pollset, &worker, deadline)));
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(&exec_ctx);
+ grpc_exec_ctx_flush();
gpr_mu_lock(g_mu);
}
GPR_ASSERT(state.read_bytes == state.target_read_bytes);
gpr_mu_unlock(g_mu);
- grpc_slice_buffer_destroy_internal(&exec_ctx, &state.incoming);
- grpc_tcp_destroy_and_release_fd(&exec_ctx, ep, &fd, &fd_released_cb);
- grpc_exec_ctx_flush(&exec_ctx);
+ grpc_slice_buffer_destroy_internal(&state.incoming);
+ grpc_tcp_destroy_and_release_fd(ep, &fd, &fd_released_cb);
+ grpc_exec_ctx_flush();
gpr_mu_lock(g_mu);
while (!fd_released_done) {
grpc_pollset_worker *worker = NULL;
GPR_ASSERT(GRPC_LOG_IF_ERROR(
- "pollset_work",
- grpc_pollset_work(&exec_ctx, g_pollset, &worker, deadline)));
+ "pollset_work", grpc_pollset_work(g_pollset, &worker, deadline)));
gpr_log(GPR_DEBUG, "wakeup: fd_released_done=%d", fd_released_done);
}
gpr_mu_unlock(g_mu);
GPR_ASSERT(fd_released_done == 1);
GPR_ASSERT(fd == sv[1]);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_exec_ctx_finish();
written_bytes = fill_socket_partial(sv[0], num_bytes);
drain_socket_blocking(fd, written_bytes, written_bytes);
@@ -520,7 +508,7 @@ static grpc_endpoint_test_fixture create_fixture_tcp_socketpair(
size_t slice_size) {
int sv[2];
grpc_endpoint_test_fixture f;
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
create_sockets(sv);
grpc_resource_quota *resource_quota =
@@ -529,15 +517,15 @@ static grpc_endpoint_test_fixture create_fixture_tcp_socketpair(
.type = GRPC_ARG_INTEGER,
.value.integer = (int)slice_size}};
grpc_channel_args args = {.num_args = GPR_ARRAY_SIZE(a), .args = a};
- f.client_ep = grpc_tcp_create(
- &exec_ctx, grpc_fd_create(sv[0], "fixture:client"), &args, "test");
- f.server_ep = grpc_tcp_create(
- &exec_ctx, grpc_fd_create(sv[1], "fixture:server"), &args, "test");
- grpc_resource_quota_unref_internal(&exec_ctx, resource_quota);
- grpc_endpoint_add_to_pollset(&exec_ctx, f.client_ep, g_pollset);
- grpc_endpoint_add_to_pollset(&exec_ctx, f.server_ep, g_pollset);
+ f.client_ep =
+ grpc_tcp_create(grpc_fd_create(sv[0], "fixture:client"), &args, "test");
+ f.server_ep =
+ grpc_tcp_create(grpc_fd_create(sv[1], "fixture:server"), &args, "test");
+ grpc_resource_quota_unref_internal(resource_quota);
+ grpc_endpoint_add_to_pollset(f.client_ep, g_pollset);
+ grpc_endpoint_add_to_pollset(f.server_ep, g_pollset);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_exec_ctx_finish();
return f;
}
@@ -546,14 +534,13 @@ static grpc_endpoint_test_config configs[] = {
{"tcp/tcp_socketpair", create_fixture_tcp_socketpair, clean_up},
};
-static void destroy_pollset(grpc_exec_ctx *exec_ctx, void *p,
- grpc_error *error) {
- grpc_pollset_destroy(exec_ctx, (grpc_pollset *)p);
+static void destroy_pollset(void *p, grpc_error *error) {
+ grpc_pollset_destroy((grpc_pollset *)p);
}
int main(int argc, char **argv) {
grpc_closure destroyed;
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_test_init(argc, argv);
grpc_init();
g_pollset = (grpc_pollset *)gpr_zalloc(grpc_pollset_size());
@@ -562,8 +549,8 @@ int main(int argc, char **argv) {
run_tests();
GRPC_CLOSURE_INIT(&destroyed, destroy_pollset, g_pollset,
grpc_schedule_on_exec_ctx);
- grpc_pollset_shutdown(&exec_ctx, g_pollset, &destroyed);
- grpc_exec_ctx_finish(&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.c b/test/core/iomgr/tcp_server_posix_test.c
index 782dfb413a..a1684fe72c 100644
--- a/test/core/iomgr/tcp_server_posix_test.c
+++ b/test/core/iomgr/tcp_server_posix_test.c
@@ -110,8 +110,7 @@ static void on_connect_result_set(on_connect_result *result,
result->server, acceptor->port_index, acceptor->fd_index);
}
-static void server_weak_ref_shutdown(grpc_exec_ctx *exec_ctx, void *arg,
- grpc_error *error) {
+static void server_weak_ref_shutdown(void *arg, grpc_error *error) {
server_weak_ref *weak_ref = arg;
weak_ref->server = NULL;
}
@@ -145,12 +144,11 @@ static void test_addr_init_str(test_addr *addr) {
}
}
-static void on_connect(grpc_exec_ctx *exec_ctx, void *arg, grpc_endpoint *tcp,
- grpc_pollset *pollset,
+static void on_connect(void *arg, grpc_endpoint *tcp, grpc_pollset *pollset,
grpc_tcp_server_acceptor *acceptor) {
- grpc_endpoint_shutdown(exec_ctx, tcp,
+ grpc_endpoint_shutdown(tcp,
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Connected"));
- grpc_endpoint_destroy(exec_ctx, tcp);
+ grpc_endpoint_destroy(tcp);
on_connect_result temp_result;
on_connect_result_set(&temp_result, acceptor);
@@ -159,38 +157,35 @@ static void on_connect(grpc_exec_ctx *exec_ctx, void *arg, grpc_endpoint *tcp,
gpr_mu_lock(g_mu);
g_result = temp_result;
g_nconnects++;
- GPR_ASSERT(GRPC_LOG_IF_ERROR("pollset_kick",
- grpc_pollset_kick(exec_ctx, g_pollset, NULL)));
+ GPR_ASSERT(
+ GRPC_LOG_IF_ERROR("pollset_kick", grpc_pollset_kick(g_pollset, NULL)));
gpr_mu_unlock(g_mu);
}
static void test_no_op(void) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_tcp_server *s;
- GPR_ASSERT(GRPC_ERROR_NONE ==
- grpc_tcp_server_create(&exec_ctx, NULL, NULL, &s));
- grpc_tcp_server_unref(&exec_ctx, s);
- grpc_exec_ctx_finish(&exec_ctx);
+ 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) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_tcp_server *s;
- GPR_ASSERT(GRPC_ERROR_NONE ==
- grpc_tcp_server_create(&exec_ctx, NULL, NULL, &s));
+ GPR_ASSERT(GRPC_ERROR_NONE == grpc_tcp_server_create(NULL, NULL, &s));
LOG_TEST("test_no_op_with_start");
- grpc_tcp_server_start(&exec_ctx, s, NULL, 0, on_connect, NULL);
- grpc_tcp_server_unref(&exec_ctx, s);
- grpc_exec_ctx_finish(&exec_ctx);
+ 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) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_resolved_address resolved_addr;
struct sockaddr_in *addr = (struct sockaddr_in *)resolved_addr.addr;
grpc_tcp_server *s;
- GPR_ASSERT(GRPC_ERROR_NONE ==
- grpc_tcp_server_create(&exec_ctx, NULL, NULL, &s));
+ GPR_ASSERT(GRPC_ERROR_NONE == grpc_tcp_server_create(NULL, NULL, &s));
LOG_TEST("test_no_op_with_port");
memset(&resolved_addr, 0, sizeof(resolved_addr));
@@ -201,17 +196,16 @@ static void test_no_op_with_port(void) {
GRPC_ERROR_NONE &&
port > 0);
- grpc_tcp_server_unref(&exec_ctx, s);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_tcp_server_unref(s);
+ grpc_exec_ctx_finish();
}
static void test_no_op_with_port_and_start(void) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_resolved_address resolved_addr;
struct sockaddr_in *addr = (struct sockaddr_in *)resolved_addr.addr;
grpc_tcp_server *s;
- GPR_ASSERT(GRPC_ERROR_NONE ==
- grpc_tcp_server_create(&exec_ctx, NULL, NULL, &s));
+ GPR_ASSERT(GRPC_ERROR_NONE == grpc_tcp_server_create(NULL, NULL, &s));
LOG_TEST("test_no_op_with_port_and_start");
int port = -1;
@@ -222,13 +216,13 @@ static void test_no_op_with_port_and_start(void) {
GRPC_ERROR_NONE &&
port > 0);
- grpc_tcp_server_start(&exec_ctx, s, NULL, 0, on_connect, NULL);
+ grpc_tcp_server_start(s, NULL, 0, on_connect, NULL);
- grpc_tcp_server_unref(&exec_ctx, s);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_tcp_server_unref(s);
+ grpc_exec_ctx_finish();
}
-static grpc_error *tcp_connect(grpc_exec_ctx *exec_ctx, const test_addr *remote,
+static grpc_error *tcp_connect(const test_addr *remote,
on_connect_result *result) {
grpc_millis deadline =
grpc_timespec_to_millis_round_up(grpc_timeout_seconds_to_deadline(10));
@@ -253,18 +247,17 @@ static grpc_error *tcp_connect(grpc_exec_ctx *exec_ctx, 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(exec_ctx)) {
+ while (g_nconnects == nconnects_before && deadline > grpc_exec_ctx_now()) {
grpc_pollset_worker *worker = NULL;
grpc_error *err;
- if ((err = grpc_pollset_work(exec_ctx, g_pollset, &worker, deadline)) !=
+ if ((err = grpc_pollset_work(g_pollset, &worker, deadline)) !=
GRPC_ERROR_NONE) {
gpr_mu_unlock(g_mu);
close(clifd);
return err;
}
gpr_mu_unlock(g_mu);
- grpc_exec_ctx_finish(exec_ctx);
+ grpc_exec_ctx_finish();
gpr_mu_lock(g_mu);
}
gpr_log(GPR_DEBUG, "wait done");
@@ -279,7 +272,7 @@ static grpc_error *tcp_connect(grpc_exec_ctx *exec_ctx, const test_addr *remote,
gpr_mu_unlock(g_mu);
gpr_log(GPR_INFO, "Result (%d, %d) fd %d", result->port_index,
result->fd_index, result->server_fd);
- grpc_tcp_server_unref(exec_ctx, result->server);
+ grpc_tcp_server_unref(result->server);
return GRPC_ERROR_NONE;
}
@@ -292,7 +285,7 @@ static grpc_error *tcp_connect(grpc_exec_ctx *exec_ctx, const test_addr *remote,
static void test_connect(size_t num_connects,
const grpc_channel_args *channel_args,
test_addrs *dst_addrs, bool test_dst_addrs) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_resolved_address resolved_addr;
grpc_resolved_address resolved_addr1;
struct sockaddr_storage *const addr =
@@ -306,8 +299,7 @@ static void test_connect(size_t num_connects,
int svr1_port;
grpc_tcp_server *s;
const unsigned num_ports = 2;
- GPR_ASSERT(GRPC_ERROR_NONE ==
- grpc_tcp_server_create(&exec_ctx, NULL, channel_args, &s));
+ GPR_ASSERT(GRPC_ERROR_NONE == grpc_tcp_server_create(NULL, channel_args, &s));
unsigned port_num;
server_weak_ref weak_ref;
server_weak_ref_init(&weak_ref);
@@ -352,7 +344,7 @@ static void test_connect(size_t num_connects,
svr1_fd_count = grpc_tcp_server_port_fd_count(s, 1);
GPR_ASSERT(svr1_fd_count >= 1);
- grpc_tcp_server_start(&exec_ctx, s, &g_pollset, 1, on_connect, NULL);
+ grpc_tcp_server_start(s, &g_pollset, 1, on_connect, NULL);
if (dst_addrs != NULL) {
int ports[] = {svr_port, svr1_port};
@@ -372,7 +364,7 @@ static void test_connect(size_t num_connects,
test_addr_init_str(&dst);
++num_tested;
on_connect_result_init(&result);
- if ((err = tcp_connect(&exec_ctx, &dst, &result)) == GRPC_ERROR_NONE &&
+ if ((err = tcp_connect(&dst, &result)) == GRPC_ERROR_NONE &&
result.server_fd >= 0 && result.server == s) {
continue;
}
@@ -403,8 +395,8 @@ static void test_connect(size_t num_connects,
for (connect_num = 0; connect_num < num_connects; ++connect_num) {
on_connect_result result;
on_connect_result_init(&result);
- GPR_ASSERT(GRPC_LOG_IF_ERROR("tcp_connect",
- tcp_connect(&exec_ctx, &dst, &result)));
+ GPR_ASSERT(
+ GRPC_LOG_IF_ERROR("tcp_connect", tcp_connect(&dst, &result)));
GPR_ASSERT(result.server_fd == fd);
GPR_ASSERT(result.port_index == port_num);
GPR_ASSERT(result.fd_index == fd_num);
@@ -420,21 +412,20 @@ static void test_connect(size_t num_connects,
GPR_ASSERT(weak_ref.server != NULL);
GPR_ASSERT(grpc_tcp_server_port_fd(s, 0, 0) >= 0);
- grpc_tcp_server_unref(&exec_ctx, s);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_tcp_server_unref(s);
+ grpc_exec_ctx_finish();
/* Weak ref lost. */
GPR_ASSERT(weak_ref.server == NULL);
}
-static void destroy_pollset(grpc_exec_ctx *exec_ctx, void *p,
- grpc_error *error) {
- grpc_pollset_destroy(exec_ctx, p);
+static void destroy_pollset(void *p, grpc_error *error) {
+ grpc_pollset_destroy(p);
}
int main(int argc, char **argv) {
grpc_closure destroyed;
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_arg chan_args[] = {
{GRPC_ARG_INTEGER, GRPC_ARG_EXPAND_WILDCARD_ADDRS, {.integer = 1}}};
const grpc_channel_args channel_args = {1, chan_args};
@@ -494,8 +485,8 @@ int main(int argc, char **argv) {
GRPC_CLOSURE_INIT(&destroyed, destroy_pollset, g_pollset,
grpc_schedule_on_exec_ctx);
- grpc_pollset_shutdown(&exec_ctx, g_pollset, &destroyed);
- grpc_exec_ctx_finish(&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.c b/test/core/iomgr/tcp_server_uv_test.c
index 9fafd3177a..08873a8860 100644
--- a/test/core/iomgr/tcp_server_uv_test.c
+++ b/test/core/iomgr/tcp_server_uv_test.c
@@ -74,8 +74,7 @@ static void on_connect_result_set(on_connect_result *result,
result->fd_index = acceptor->fd_index;
}
-static void server_weak_ref_shutdown(grpc_exec_ctx *exec_ctx, void *arg,
- grpc_error *error) {
+static void server_weak_ref_shutdown(void *arg, grpc_error *error) {
server_weak_ref *weak_ref = arg;
weak_ref->server = NULL;
}
@@ -97,12 +96,11 @@ static void server_weak_ref_set(server_weak_ref *weak_ref,
weak_ref->server = server;
}
-static void on_connect(grpc_exec_ctx *exec_ctx, void *arg, grpc_endpoint *tcp,
- grpc_pollset *pollset,
+static void on_connect(void *arg, grpc_endpoint *tcp, grpc_pollset *pollset,
grpc_tcp_server_acceptor *acceptor) {
- grpc_endpoint_shutdown(exec_ctx, tcp,
+ grpc_endpoint_shutdown(tcp,
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Connected"));
- grpc_endpoint_destroy(exec_ctx, tcp);
+ grpc_endpoint_destroy(tcp);
on_connect_result temp_result;
on_connect_result_set(&temp_result, acceptor);
@@ -111,38 +109,35 @@ static void on_connect(grpc_exec_ctx *exec_ctx, void *arg, grpc_endpoint *tcp,
gpr_mu_lock(g_mu);
g_result = temp_result;
g_nconnects++;
- GPR_ASSERT(GRPC_LOG_IF_ERROR("pollset_kick",
- grpc_pollset_kick(exec_ctx, g_pollset, NULL)));
+ GPR_ASSERT(
+ GRPC_LOG_IF_ERROR("pollset_kick", grpc_pollset_kick(g_pollset, NULL)));
gpr_mu_unlock(g_mu);
}
static void test_no_op(void) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_tcp_server *s;
- GPR_ASSERT(GRPC_ERROR_NONE ==
- grpc_tcp_server_create(&exec_ctx, NULL, NULL, &s));
- grpc_tcp_server_unref(&exec_ctx, s);
- grpc_exec_ctx_finish(&exec_ctx);
+ 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) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_tcp_server *s;
- GPR_ASSERT(GRPC_ERROR_NONE ==
- grpc_tcp_server_create(&exec_ctx, NULL, NULL, &s));
+ GPR_ASSERT(GRPC_ERROR_NONE == grpc_tcp_server_create(NULL, NULL, &s));
LOG_TEST("test_no_op_with_start");
- grpc_tcp_server_start(&exec_ctx, s, NULL, 0, on_connect, NULL);
- grpc_tcp_server_unref(&exec_ctx, s);
- grpc_exec_ctx_finish(&exec_ctx);
+ 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) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_resolved_address resolved_addr;
struct sockaddr_in *addr = (struct sockaddr_in *)resolved_addr.addr;
grpc_tcp_server *s;
- GPR_ASSERT(GRPC_ERROR_NONE ==
- grpc_tcp_server_create(&exec_ctx, NULL, NULL, &s));
+ GPR_ASSERT(GRPC_ERROR_NONE == grpc_tcp_server_create(NULL, NULL, &s));
LOG_TEST("test_no_op_with_port");
memset(&resolved_addr, 0, sizeof(resolved_addr));
@@ -153,17 +148,16 @@ static void test_no_op_with_port(void) {
GRPC_ERROR_NONE &&
port > 0);
- grpc_tcp_server_unref(&exec_ctx, s);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_tcp_server_unref(s);
+ grpc_exec_ctx_finish();
}
static void test_no_op_with_port_and_start(void) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_resolved_address resolved_addr;
struct sockaddr_in *addr = (struct sockaddr_in *)resolved_addr.addr;
grpc_tcp_server *s;
- GPR_ASSERT(GRPC_ERROR_NONE ==
- grpc_tcp_server_create(&exec_ctx, NULL, NULL, &s));
+ GPR_ASSERT(GRPC_ERROR_NONE == grpc_tcp_server_create(NULL, NULL, &s));
LOG_TEST("test_no_op_with_port_and_start");
int port;
@@ -174,10 +168,10 @@ static void test_no_op_with_port_and_start(void) {
GRPC_ERROR_NONE &&
port > 0);
- grpc_tcp_server_start(&exec_ctx, s, NULL, 0, on_connect, NULL);
+ grpc_tcp_server_start(s, NULL, 0, on_connect, NULL);
- grpc_tcp_server_unref(&exec_ctx, s);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_tcp_server_unref(s);
+ grpc_exec_ctx_finish();
}
static void connect_cb(uv_connect_t *req, int status) {
@@ -187,8 +181,8 @@ static void connect_cb(uv_connect_t *req, int status) {
static void close_cb(uv_handle_t *handle) { gpr_free(handle); }
-static void tcp_connect(grpc_exec_ctx *exec_ctx, const struct sockaddr *remote,
- socklen_t remote_len, on_connect_result *result) {
+static void tcp_connect(const struct sockaddr *remote, socklen_t remote_len,
+ on_connect_result *result) {
gpr_timespec deadline = grpc_timeout_seconds_to_deadline(10);
uv_tcp_t *client_handle = gpr_malloc(sizeof(uv_tcp_t));
uv_connect_t *req = gpr_malloc(sizeof(uv_connect_t));
@@ -206,10 +200,10 @@ static void tcp_connect(grpc_exec_ctx *exec_ctx, const struct sockaddr *remote,
grpc_pollset_worker *worker = NULL;
GPR_ASSERT(GRPC_LOG_IF_ERROR(
"pollset_work",
- grpc_pollset_work(exec_ctx, g_pollset, &worker,
+ grpc_pollset_work(g_pollset, &worker,
grpc_timespec_to_millis_round_up(deadline))));
gpr_mu_unlock(g_mu);
- grpc_exec_ctx_finish(exec_ctx);
+ grpc_exec_ctx_finish();
gpr_mu_lock(g_mu);
}
gpr_log(GPR_DEBUG, "wait done");
@@ -222,7 +216,7 @@ static void tcp_connect(grpc_exec_ctx *exec_ctx, const struct sockaddr *remote,
/* Tests a tcp server with multiple ports. */
static void test_connect(unsigned n) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_resolved_address resolved_addr;
grpc_resolved_address resolved_addr1;
struct sockaddr_storage *addr = (struct sockaddr_storage *)resolved_addr.addr;
@@ -231,8 +225,7 @@ static void test_connect(unsigned n) {
int svr_port;
int svr1_port;
grpc_tcp_server *s;
- GPR_ASSERT(GRPC_ERROR_NONE ==
- grpc_tcp_server_create(&exec_ctx, NULL, NULL, &s));
+ GPR_ASSERT(GRPC_ERROR_NONE == grpc_tcp_server_create(NULL, NULL, &s));
unsigned i;
server_weak_ref weak_ref;
server_weak_ref_init(&weak_ref);
@@ -255,48 +248,46 @@ static void test_connect(unsigned n) {
GRPC_ERROR_NONE &&
svr_port == svr1_port);
- grpc_tcp_server_start(&exec_ctx, s, &g_pollset, 1, on_connect, NULL);
+ grpc_tcp_server_start(s, &g_pollset, 1, on_connect, NULL);
GPR_ASSERT(uv_ip6_addr("::", svr_port, (struct sockaddr_in6 *)addr1) == 0);
for (i = 0; i < n; i++) {
on_connect_result result;
on_connect_result_init(&result);
- tcp_connect(&exec_ctx, (struct sockaddr *)addr,
- (socklen_t)resolved_addr.len, &result);
+ tcp_connect((struct sockaddr *)addr, (socklen_t)resolved_addr.len, &result);
GPR_ASSERT(result.port_index == 0);
GPR_ASSERT(result.server == s);
if (weak_ref.server == NULL) {
server_weak_ref_set(&weak_ref, result.server);
}
- grpc_tcp_server_unref(&exec_ctx, result.server);
+ grpc_tcp_server_unref(result.server);
on_connect_result_init(&result);
- tcp_connect(&exec_ctx, (struct sockaddr *)addr1,
- (socklen_t)resolved_addr1.len, &result);
+ tcp_connect((struct sockaddr *)addr1, (socklen_t)resolved_addr1.len,
+ &result);
GPR_ASSERT(result.port_index == 1);
GPR_ASSERT(result.server == s);
- grpc_tcp_server_unref(&exec_ctx, result.server);
+ grpc_tcp_server_unref(result.server);
}
/* Weak ref to server valid until final unref. */
GPR_ASSERT(weak_ref.server != NULL);
- grpc_tcp_server_unref(&exec_ctx, s);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_tcp_server_unref(s);
+ grpc_exec_ctx_finish();
/* Weak ref lost. */
GPR_ASSERT(weak_ref.server == NULL);
}
-static void destroy_pollset(grpc_exec_ctx *exec_ctx, void *p,
- grpc_error *error) {
- grpc_pollset_destroy(exec_ctx, p);
+static void destroy_pollset(void *p, grpc_error *error) {
+ grpc_pollset_destroy(p);
}
int main(int argc, char **argv) {
grpc_closure destroyed;
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_test_init(argc, argv);
grpc_init();
g_pollset = gpr_malloc(grpc_pollset_size());
@@ -311,8 +302,8 @@ int main(int argc, char **argv) {
GRPC_CLOSURE_INIT(&destroyed, destroy_pollset, g_pollset,
grpc_schedule_on_exec_ctx);
- grpc_pollset_shutdown(&exec_ctx, g_pollset, &destroyed);
- grpc_exec_ctx_finish(&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.c b/test/core/iomgr/timer_list_test.c
index c3d9f9d88d..1ef4501a36 100644
--- a/test/core/iomgr/timer_list_test.c
+++ b/test/core/iomgr/timer_list_test.c
@@ -36,51 +36,50 @@ extern grpc_tracer_flag grpc_timer_check_trace;
static int cb_called[MAX_CB][2];
-static void cb(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) {
+static void cb(void *arg, grpc_error *error) {
cb_called[(intptr_t)arg][error == GRPC_ERROR_NONE]++;
}
static void add_test(void) {
int i;
grpc_timer timers[20];
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
gpr_log(GPR_INFO, "add_test");
- grpc_timer_list_init(&exec_ctx);
+ grpc_timer_list_init();
grpc_timer_trace.value = 1;
grpc_timer_check_trace.value = 1;
memset(cb_called, 0, sizeof(cb_called));
- grpc_millis start = grpc_exec_ctx_now(&exec_ctx);
+ grpc_millis start = grpc_exec_ctx_now();
/* 10 ms timers. will expire in the current epoch */
for (i = 0; i < 10; i++) {
- grpc_timer_init(&exec_ctx, &timers[i], start + 10,
+ grpc_timer_init(&timers[i], start + 10,
GRPC_CLOSURE_CREATE(cb, (void *)(intptr_t)i,
grpc_schedule_on_exec_ctx));
}
/* 1010 ms timers. will expire in the next epoch */
for (i = 10; i < 20; i++) {
- grpc_timer_init(&exec_ctx, &timers[i], start + 1010,
+ grpc_timer_init(&timers[i], start + 1010,
GRPC_CLOSURE_CREATE(cb, (void *)(intptr_t)i,
grpc_schedule_on_exec_ctx));
}
/* collect timers. Only the first batch should be ready. */
exec_ctx.now = start + 500;
- GPR_ASSERT(grpc_timer_check(&exec_ctx, NULL) == GRPC_TIMERS_FIRED);
- grpc_exec_ctx_finish(&exec_ctx);
+ 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;
- GPR_ASSERT(grpc_timer_check(&exec_ctx, NULL) ==
- GRPC_TIMERS_CHECKED_AND_EMPTY);
- grpc_exec_ctx_finish(&exec_ctx);
+ 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);
@@ -88,66 +87,65 @@ static void add_test(void) {
/* collect the rest of the timers */
exec_ctx.now = start + 1500;
- GPR_ASSERT(grpc_timer_check(&exec_ctx, NULL) == GRPC_TIMERS_FIRED);
- grpc_exec_ctx_finish(&exec_ctx);
+ 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;
- GPR_ASSERT(grpc_timer_check(&exec_ctx, NULL) ==
- GRPC_TIMERS_CHECKED_AND_EMPTY);
+ 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));
GPR_ASSERT(cb_called[i][0] == 0);
}
- grpc_timer_list_shutdown(&exec_ctx);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_timer_list_shutdown();
+ grpc_exec_ctx_finish();
}
/* Cleaning up a list with pending timers. */
void destruction_test(void) {
grpc_timer timers[5];
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
gpr_log(GPR_INFO, "destruction_test");
exec_ctx.now_is_valid = true;
exec_ctx.now = 0;
- grpc_timer_list_init(&exec_ctx);
+ grpc_timer_list_init();
grpc_timer_trace.value = 1;
grpc_timer_check_trace.value = 1;
memset(cb_called, 0, sizeof(cb_called));
grpc_timer_init(
- &exec_ctx, &timers[0], 100,
+ &timers[0], 100,
GRPC_CLOSURE_CREATE(cb, (void *)(intptr_t)0, grpc_schedule_on_exec_ctx));
grpc_timer_init(
- &exec_ctx, &timers[1], 3,
+ &timers[1], 3,
GRPC_CLOSURE_CREATE(cb, (void *)(intptr_t)1, grpc_schedule_on_exec_ctx));
grpc_timer_init(
- &exec_ctx, &timers[2], 100,
+ &timers[2], 100,
GRPC_CLOSURE_CREATE(cb, (void *)(intptr_t)2, grpc_schedule_on_exec_ctx));
grpc_timer_init(
- &exec_ctx, &timers[3], 3,
+ &timers[3], 3,
GRPC_CLOSURE_CREATE(cb, (void *)(intptr_t)3, grpc_schedule_on_exec_ctx));
grpc_timer_init(
- &exec_ctx, &timers[4], 1,
+ &timers[4], 1,
GRPC_CLOSURE_CREATE(cb, (void *)(intptr_t)4, grpc_schedule_on_exec_ctx));
exec_ctx.now = 2;
- GPR_ASSERT(grpc_timer_check(&exec_ctx, NULL) == GRPC_TIMERS_FIRED);
- grpc_exec_ctx_finish(&exec_ctx);
+ GPR_ASSERT(grpc_timer_check(NULL) == GRPC_TIMERS_FIRED);
+ grpc_exec_ctx_finish();
GPR_ASSERT(1 == cb_called[4][1]);
- grpc_timer_cancel(&exec_ctx, &timers[0]);
- grpc_timer_cancel(&exec_ctx, &timers[3]);
- grpc_exec_ctx_finish(&exec_ctx);
+ 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(&exec_ctx);
- grpc_exec_ctx_finish(&exec_ctx);
+ 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.c b/test/core/iomgr/udp_server_test.c
index 2e44d0abc8..2e2643749c 100644
--- a/test/core/iomgr/udp_server_test.c
+++ b/test/core/iomgr/udp_server_test.c
@@ -50,7 +50,7 @@ static int g_number_of_writes = 0;
static int g_number_of_bytes_read = 0;
static int g_number_of_orphan_calls = 0;
-static void on_read(grpc_exec_ctx *exec_ctx, grpc_fd *emfd, void *user_data) {
+static void on_read(grpc_fd *emfd, void *user_data) {
char read_buffer[512];
ssize_t byte_count;
@@ -61,22 +61,22 @@ static void on_read(grpc_exec_ctx *exec_ctx, grpc_fd *emfd, void *user_data) {
g_number_of_reads++;
g_number_of_bytes_read += (int)byte_count;
- GPR_ASSERT(GRPC_LOG_IF_ERROR("pollset_kick",
- grpc_pollset_kick(exec_ctx, g_pollset, NULL)));
+ GPR_ASSERT(
+ GRPC_LOG_IF_ERROR("pollset_kick", grpc_pollset_kick(g_pollset, NULL)));
gpr_mu_unlock(g_mu);
}
-static void on_write(grpc_exec_ctx *exec_ctx, grpc_fd *emfd, void *user_data) {
+static void on_write(grpc_fd *emfd, void *user_data) {
gpr_mu_lock(g_mu);
g_number_of_writes++;
- GPR_ASSERT(GRPC_LOG_IF_ERROR("pollset_kick",
- grpc_pollset_kick(exec_ctx, g_pollset, NULL)));
+ GPR_ASSERT(
+ GRPC_LOG_IF_ERROR("pollset_kick", grpc_pollset_kick(g_pollset, NULL)));
gpr_mu_unlock(g_mu);
}
-static void on_fd_orphaned(grpc_exec_ctx *exec_ctx, grpc_fd *emfd,
- grpc_closure *closure, void *user_data) {
+static void on_fd_orphaned(grpc_fd *emfd, grpc_closure *closure,
+ void *user_data) {
gpr_log(GPR_INFO, "gRPC FD about to be orphaned: %d",
grpc_fd_wrapped_fd(emfd));
g_number_of_orphan_calls++;
@@ -126,24 +126,24 @@ static test_socket_factory *test_socket_factory_create(void) {
}
static void test_no_op(void) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_udp_server *s = grpc_udp_server_create(NULL);
- grpc_udp_server_destroy(&exec_ctx, s, NULL);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_udp_server_destroy(s, NULL);
+ grpc_exec_ctx_finish();
}
static void test_no_op_with_start(void) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_udp_server *s = grpc_udp_server_create(NULL);
LOG_TEST("test_no_op_with_start");
- grpc_udp_server_start(&exec_ctx, s, NULL, 0, NULL);
- grpc_udp_server_destroy(&exec_ctx, s, NULL);
- grpc_exec_ctx_finish(&exec_ctx);
+ 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) {
g_number_of_orphan_calls = 0;
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_resolved_address resolved_addr;
struct sockaddr_in *addr = (struct sockaddr_in *)resolved_addr.addr;
grpc_udp_server *s = grpc_udp_server_create(NULL);
@@ -155,8 +155,8 @@ static void test_no_op_with_port(void) {
GPR_ASSERT(grpc_udp_server_add_port(s, &resolved_addr, on_read, on_write,
on_fd_orphaned));
- grpc_udp_server_destroy(&exec_ctx, s, NULL);
- grpc_exec_ctx_finish(&exec_ctx);
+ 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);
@@ -164,7 +164,7 @@ static void test_no_op_with_port(void) {
static void test_no_op_with_port_and_socket_factory(void) {
g_number_of_orphan_calls = 0;
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_resolved_address resolved_addr;
struct sockaddr_in *addr = (struct sockaddr_in *)resolved_addr.addr;
@@ -174,7 +174,7 @@ static void test_no_op_with_port_and_socket_factory(void) {
grpc_channel_args *channel_args =
grpc_channel_args_copy_and_add(NULL, &socket_factory_arg, 1);
grpc_udp_server *s = grpc_udp_server_create(channel_args);
- grpc_channel_args_destroy(&exec_ctx, channel_args);
+ grpc_channel_args_destroy(channel_args);
LOG_TEST("test_no_op_with_port_and_socket_factory");
@@ -186,8 +186,8 @@ static void test_no_op_with_port_and_socket_factory(void) {
GPR_ASSERT(socket_factory->number_of_socket_calls == 1);
GPR_ASSERT(socket_factory->number_of_bind_calls == 1);
- grpc_udp_server_destroy(&exec_ctx, s, NULL);
- grpc_exec_ctx_finish(&exec_ctx);
+ 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. */
@@ -196,7 +196,7 @@ static void test_no_op_with_port_and_socket_factory(void) {
static void test_no_op_with_port_and_start(void) {
g_number_of_orphan_calls = 0;
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_resolved_address resolved_addr;
struct sockaddr_in *addr = (struct sockaddr_in *)resolved_addr.addr;
grpc_udp_server *s = grpc_udp_server_create(NULL);
@@ -208,10 +208,10 @@ static void test_no_op_with_port_and_start(void) {
GPR_ASSERT(grpc_udp_server_add_port(s, &resolved_addr, on_read, on_write,
on_fd_orphaned));
- grpc_udp_server_start(&exec_ctx, s, NULL, 0, NULL);
+ grpc_udp_server_start(s, NULL, 0, NULL);
- grpc_udp_server_destroy(&exec_ctx, s, NULL);
- grpc_exec_ctx_finish(&exec_ctx);
+ 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. */
@@ -219,7 +219,7 @@ static void test_no_op_with_port_and_start(void) {
}
static void test_receive(int number_of_clients) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_resolved_address resolved_addr;
struct sockaddr_storage *addr = (struct sockaddr_storage *)resolved_addr.addr;
int clifd, svrfd;
@@ -247,7 +247,7 @@ static void test_receive(int number_of_clients) {
GPR_ASSERT(resolved_addr.len <= sizeof(struct sockaddr_storage));
pollsets[0] = g_pollset;
- grpc_udp_server_start(&exec_ctx, s, pollsets, 1, NULL);
+ grpc_udp_server_start(s, pollsets, 1, NULL);
gpr_mu_lock(g_mu);
@@ -263,13 +263,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(&exec_ctx)) {
+ deadline > grpc_exec_ctx_now()) {
grpc_pollset_worker *worker = NULL;
GPR_ASSERT(GRPC_LOG_IF_ERROR(
- "pollset_work",
- grpc_pollset_work(&exec_ctx, g_pollset, &worker, deadline)));
+ "pollset_work", grpc_pollset_work(g_pollset, &worker, deadline)));
gpr_mu_unlock(g_mu);
- grpc_exec_ctx_flush(&exec_ctx);
+ grpc_exec_ctx_flush();
gpr_mu_lock(g_mu);
}
GPR_ASSERT(g_number_of_reads == number_of_reads_before + 1);
@@ -279,8 +278,8 @@ static void test_receive(int number_of_clients) {
gpr_mu_unlock(g_mu);
- grpc_udp_server_destroy(&exec_ctx, s, NULL);
- grpc_exec_ctx_finish(&exec_ctx);
+ 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. */
@@ -290,14 +289,13 @@ static void test_receive(int number_of_clients) {
GPR_ASSERT(g_number_of_writes > 0);
}
-static void destroy_pollset(grpc_exec_ctx *exec_ctx, void *p,
- grpc_error *error) {
- grpc_pollset_destroy(exec_ctx, p);
+static void destroy_pollset(void *p, grpc_error *error) {
+ grpc_pollset_destroy(p);
}
int main(int argc, char **argv) {
grpc_closure destroyed;
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_test_init(argc, argv);
grpc_init();
g_pollset = gpr_zalloc(grpc_pollset_size());
@@ -313,8 +311,8 @@ int main(int argc, char **argv) {
GRPC_CLOSURE_INIT(&destroyed, destroy_pollset, g_pollset,
grpc_schedule_on_exec_ctx);
- grpc_pollset_shutdown(&exec_ctx, g_pollset, &destroyed);
- grpc_exec_ctx_finish(&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.c b/test/core/security/credentials_test.c
index 34f310142c..7f15642d94 100644
--- a/test/core/security/credentials_test.c
+++ b/test/core/security/credentials_test.c
@@ -144,41 +144,39 @@ static grpc_httpcli_response http_response(int status, const char *body) {
/* -- Tests. -- */
static void test_empty_md_array(void) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_credentials_mdelem_array md_array;
memset(&md_array, 0, sizeof(md_array));
GPR_ASSERT(md_array.md == NULL);
GPR_ASSERT(md_array.size == 0);
- grpc_credentials_mdelem_array_destroy(&exec_ctx, &md_array);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_credentials_mdelem_array_destroy(&md_array);
+ grpc_exec_ctx_finish();
}
static void test_add_to_empty_md_array(void) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_credentials_mdelem_array md_array;
memset(&md_array, 0, sizeof(md_array));
const char *key = "hello";
const char *value = "there blah blah blah blah blah blah blah";
- grpc_mdelem md =
- grpc_mdelem_from_slices(&exec_ctx, grpc_slice_from_copied_string(key),
- grpc_slice_from_copied_string(value));
+ grpc_mdelem md = grpc_mdelem_from_slices(
+ grpc_slice_from_copied_string(key), grpc_slice_from_copied_string(value));
grpc_credentials_mdelem_array_add(&md_array, md);
GPR_ASSERT(md_array.size == 1);
GPR_ASSERT(grpc_mdelem_eq(md, md_array.md[0]));
- GRPC_MDELEM_UNREF(&exec_ctx, md);
- grpc_credentials_mdelem_array_destroy(&exec_ctx, &md_array);
- grpc_exec_ctx_finish(&exec_ctx);
+ GRPC_MDELEM_UNREF(md);
+ grpc_credentials_mdelem_array_destroy(&md_array);
+ grpc_exec_ctx_finish();
}
static void test_add_abunch_to_md_array(void) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_credentials_mdelem_array md_array;
memset(&md_array, 0, sizeof(md_array));
const char *key = "hello";
const char *value = "there blah blah blah blah blah blah blah";
- grpc_mdelem md =
- grpc_mdelem_from_slices(&exec_ctx, grpc_slice_from_copied_string(key),
- grpc_slice_from_copied_string(value));
+ grpc_mdelem md = grpc_mdelem_from_slices(
+ grpc_slice_from_copied_string(key), grpc_slice_from_copied_string(value));
size_t num_entries = 1000;
for (size_t i = 0; i < num_entries; ++i) {
grpc_credentials_mdelem_array_add(&md_array, md);
@@ -186,57 +184,56 @@ static void test_add_abunch_to_md_array(void) {
for (size_t i = 0; i < num_entries; ++i) {
GPR_ASSERT(grpc_mdelem_eq(md_array.md[i], md));
}
- GRPC_MDELEM_UNREF(&exec_ctx, md);
- grpc_credentials_mdelem_array_destroy(&exec_ctx, &md_array);
- grpc_exec_ctx_finish(&exec_ctx);
+ 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) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_mdelem token_md = GRPC_MDNULL;
grpc_millis token_lifetime;
grpc_httpcli_response response =
http_response(200, valid_oauth2_json_response);
GPR_ASSERT(grpc_oauth2_token_fetcher_credentials_parse_server_response(
- &exec_ctx, &response, &token_md, &token_lifetime) ==
- GRPC_CREDENTIALS_OK);
+ &response, &token_md, &token_lifetime) == GRPC_CREDENTIALS_OK);
GPR_ASSERT(token_lifetime == 3599 * GPR_MS_PER_SEC);
GPR_ASSERT(grpc_slice_str_cmp(GRPC_MDKEY(token_md), "authorization") == 0);
GPR_ASSERT(grpc_slice_str_cmp(GRPC_MDVALUE(token_md),
"Bearer ya29.AHES6ZRN3-HlhAPya30GnW_bHSb_") ==
0);
- GRPC_MDELEM_UNREF(&exec_ctx, token_md);
+ GRPC_MDELEM_UNREF(token_md);
grpc_http_response_destroy(&response);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_exec_ctx_finish();
}
static void test_oauth2_token_fetcher_creds_parsing_bad_http_status(void) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_mdelem token_md = GRPC_MDNULL;
grpc_millis token_lifetime;
grpc_httpcli_response response =
http_response(401, valid_oauth2_json_response);
GPR_ASSERT(grpc_oauth2_token_fetcher_credentials_parse_server_response(
- &exec_ctx, &response, &token_md, &token_lifetime) ==
+ &response, &token_md, &token_lifetime) ==
GRPC_CREDENTIALS_ERROR);
grpc_http_response_destroy(&response);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_exec_ctx_finish();
}
static void test_oauth2_token_fetcher_creds_parsing_empty_http_body(void) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_mdelem token_md = GRPC_MDNULL;
grpc_millis token_lifetime;
grpc_httpcli_response response = http_response(200, "");
GPR_ASSERT(grpc_oauth2_token_fetcher_credentials_parse_server_response(
- &exec_ctx, &response, &token_md, &token_lifetime) ==
+ &response, &token_md, &token_lifetime) ==
GRPC_CREDENTIALS_ERROR);
grpc_http_response_destroy(&response);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_exec_ctx_finish();
}
static void test_oauth2_token_fetcher_creds_parsing_invalid_json(void) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_mdelem token_md = GRPC_MDNULL;
grpc_millis token_lifetime;
grpc_httpcli_response response =
@@ -245,14 +242,14 @@ static void test_oauth2_token_fetcher_creds_parsing_invalid_json(void) {
" \"expires_in\":3599, "
" \"token_type\":\"Bearer\"");
GPR_ASSERT(grpc_oauth2_token_fetcher_credentials_parse_server_response(
- &exec_ctx, &response, &token_md, &token_lifetime) ==
+ &response, &token_md, &token_lifetime) ==
GRPC_CREDENTIALS_ERROR);
grpc_http_response_destroy(&response);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_exec_ctx_finish();
}
static void test_oauth2_token_fetcher_creds_parsing_missing_token(void) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_mdelem token_md = GRPC_MDNULL;
grpc_millis token_lifetime;
grpc_httpcli_response response = http_response(200,
@@ -260,14 +257,14 @@ static void test_oauth2_token_fetcher_creds_parsing_missing_token(void) {
" \"expires_in\":3599, "
" \"token_type\":\"Bearer\"}");
GPR_ASSERT(grpc_oauth2_token_fetcher_credentials_parse_server_response(
- &exec_ctx, &response, &token_md, &token_lifetime) ==
+ &response, &token_md, &token_lifetime) ==
GRPC_CREDENTIALS_ERROR);
grpc_http_response_destroy(&response);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_exec_ctx_finish();
}
static void test_oauth2_token_fetcher_creds_parsing_missing_token_type(void) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_mdelem token_md = GRPC_MDNULL;
grpc_millis token_lifetime;
grpc_httpcli_response response =
@@ -276,15 +273,15 @@ static void test_oauth2_token_fetcher_creds_parsing_missing_token_type(void) {
" \"expires_in\":3599, "
"}");
GPR_ASSERT(grpc_oauth2_token_fetcher_credentials_parse_server_response(
- &exec_ctx, &response, &token_md, &token_lifetime) ==
+ &response, &token_md, &token_lifetime) ==
GRPC_CREDENTIALS_ERROR);
grpc_http_response_destroy(&response);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_exec_ctx_finish();
}
static void test_oauth2_token_fetcher_creds_parsing_missing_token_lifetime(
void) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_mdelem token_md = GRPC_MDNULL;
grpc_millis token_lifetime;
grpc_httpcli_response response =
@@ -292,10 +289,10 @@ static void test_oauth2_token_fetcher_creds_parsing_missing_token_lifetime(
"{\"access_token\":\"ya29.AHES6ZRN3-HlhAPya30GnW_bHSb_\","
" \"token_type\":\"Bearer\"}");
GPR_ASSERT(grpc_oauth2_token_fetcher_credentials_parse_server_response(
- &exec_ctx, &response, &token_md, &token_lifetime) ==
+ &response, &token_md, &token_lifetime) ==
GRPC_CREDENTIALS_ERROR);
grpc_http_response_destroy(&response);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_exec_ctx_finish();
}
typedef struct {
@@ -332,8 +329,7 @@ static void check_metadata(const expected_md *expected,
}
}
-static void check_request_metadata(grpc_exec_ctx *exec_ctx, void *arg,
- grpc_error *error) {
+static void check_request_metadata(void *arg, grpc_error *error) {
request_metadata_state *state = (request_metadata_state *)arg;
gpr_log(GPR_INFO, "expected_error: %s",
grpc_error_string(state->expected_error));
@@ -354,9 +350,8 @@ static void check_request_metadata(grpc_exec_ctx *exec_ctx, void *arg,
state->expected_size, state->md_array.size);
GPR_ASSERT(state->md_array.size == state->expected_size);
check_metadata(state->expected, &state->md_array);
- grpc_credentials_mdelem_array_destroy(exec_ctx, &state->md_array);
- grpc_pollset_set_destroy(exec_ctx,
- grpc_polling_entity_pollset_set(&state->pollent));
+ grpc_credentials_mdelem_array_destroy(&state->md_array);
+ grpc_pollset_set_destroy(grpc_polling_entity_pollset_set(&state->pollent));
gpr_free(state);
}
@@ -374,22 +369,21 @@ static request_metadata_state *make_request_metadata_state(
return state;
}
-static void run_request_metadata_test(grpc_exec_ctx *exec_ctx,
- grpc_call_credentials *creds,
+static void run_request_metadata_test(grpc_call_credentials *creds,
grpc_auth_metadata_context auth_md_ctx,
request_metadata_state *state) {
grpc_error *error = GRPC_ERROR_NONE;
if (grpc_call_credentials_get_request_metadata(
- exec_ctx, creds, &state->pollent, auth_md_ctx, &state->md_array,
+ creds, &state->pollent, auth_md_ctx, &state->md_array,
&state->on_request_metadata, &error)) {
// Synchronous result. Invoke the callback directly.
- check_request_metadata(exec_ctx, state, error);
+ check_request_metadata(state, error);
GRPC_ERROR_UNREF(error);
}
}
static void test_google_iam_creds(void) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
expected_md emd[] = {{GRPC_IAM_AUTHORIZATION_TOKEN_METADATA_KEY,
test_google_iam_authorization_token},
{GRPC_IAM_AUTHORITY_SELECTOR_METADATA_KEY,
@@ -401,13 +395,13 @@ static void test_google_iam_creds(void) {
NULL);
grpc_auth_metadata_context auth_md_ctx = {test_service_url, test_method, NULL,
NULL};
- run_request_metadata_test(&exec_ctx, creds, auth_md_ctx, state);
- grpc_call_credentials_unref(&exec_ctx, creds);
- grpc_exec_ctx_finish(&exec_ctx);
+ 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) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
expected_md emd[] = {{GRPC_AUTHORIZATION_METADATA_KEY, "Bearer blah"}};
request_metadata_state *state =
make_request_metadata_state(GRPC_ERROR_NONE, emd, GPR_ARRAY_SIZE(emd));
@@ -416,16 +410,15 @@ static void test_access_token_creds(void) {
grpc_auth_metadata_context auth_md_ctx = {test_service_url, test_method, NULL,
NULL};
GPR_ASSERT(strcmp(creds->type, GRPC_CALL_CREDENTIALS_TYPE_OAUTH2) == 0);
- run_request_metadata_test(&exec_ctx, creds, auth_md_ctx, state);
- grpc_call_credentials_unref(&exec_ctx, creds);
- grpc_exec_ctx_finish(&exec_ctx);
+ 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(
- grpc_exec_ctx *exec_ctx, grpc_channel_credentials *c,
- grpc_call_credentials *call_creds, const char *target,
- const grpc_channel_args *args, grpc_channel_security_connector **sc,
- grpc_channel_args **new_args) {
+ grpc_channel_credentials *c, grpc_call_credentials *call_creds,
+ const char *target, const grpc_channel_args *args,
+ grpc_channel_security_connector **sc, grpc_channel_args **new_args) {
GPR_ASSERT(strcmp(c->type, "mock") == 0);
GPR_ASSERT(call_creds != NULL);
GPR_ASSERT(strcmp(call_creds->type, GRPC_CALL_CREDENTIALS_TYPE_OAUTH2) == 0);
@@ -433,7 +426,7 @@ static grpc_security_status check_channel_oauth2_create_security_connector(
}
static void test_channel_oauth2_composite_creds(void) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_channel_args *new_args;
grpc_channel_credentials_vtable vtable = {
NULL, check_channel_oauth2_create_security_connector, NULL};
@@ -447,14 +440,14 @@ static void test_channel_oauth2_composite_creds(void) {
grpc_channel_credentials_release(channel_creds);
grpc_call_credentials_release(oauth2_creds);
GPR_ASSERT(grpc_channel_credentials_create_security_connector(
- &exec_ctx, channel_oauth2_creds, NULL, NULL, NULL,
- &new_args) == GRPC_SECURITY_OK);
+ channel_oauth2_creds, NULL, NULL, NULL, &new_args) ==
+ GRPC_SECURITY_OK);
grpc_channel_credentials_release(channel_oauth2_creds);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_exec_ctx_finish();
}
static void test_oauth2_google_iam_composite_creds(void) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
expected_md emd[] = {
{GRPC_AUTHORIZATION_METADATA_KEY, test_oauth2_bearer_token},
{GRPC_IAM_AUTHORIZATION_TOKEN_METADATA_KEY,
@@ -466,15 +459,15 @@ static void test_oauth2_google_iam_composite_creds(void) {
grpc_auth_metadata_context auth_md_ctx = {test_service_url, test_method, NULL,
NULL};
grpc_call_credentials *oauth2_creds = grpc_md_only_test_credentials_create(
- &exec_ctx, "authorization", test_oauth2_bearer_token, 0);
+ "authorization", test_oauth2_bearer_token, 0);
grpc_call_credentials *google_iam_creds = grpc_google_iam_credentials_create(
test_google_iam_authorization_token, test_google_iam_authority_selector,
NULL);
grpc_call_credentials *composite_creds =
grpc_composite_call_credentials_create(oauth2_creds, google_iam_creds,
NULL);
- grpc_call_credentials_unref(&exec_ctx, oauth2_creds);
- grpc_call_credentials_unref(&exec_ctx, google_iam_creds);
+ grpc_call_credentials_unref(oauth2_creds);
+ grpc_call_credentials_unref(google_iam_creds);
GPR_ASSERT(
strcmp(composite_creds->type, GRPC_CALL_CREDENTIALS_TYPE_COMPOSITE) == 0);
const grpc_call_credentials_array *creds_array =
@@ -484,17 +477,16 @@ static void test_oauth2_google_iam_composite_creds(void) {
GRPC_CALL_CREDENTIALS_TYPE_OAUTH2) == 0);
GPR_ASSERT(strcmp(creds_array->creds_array[1]->type,
GRPC_CALL_CREDENTIALS_TYPE_IAM) == 0);
- run_request_metadata_test(&exec_ctx, composite_creds, auth_md_ctx, state);
- grpc_call_credentials_unref(&exec_ctx, composite_creds);
- grpc_exec_ctx_finish(&exec_ctx);
+ run_request_metadata_test(composite_creds, auth_md_ctx, state);
+ grpc_call_credentials_unref(composite_creds);
+ grpc_exec_ctx_finish();
}
static grpc_security_status
check_channel_oauth2_google_iam_create_security_connector(
- grpc_exec_ctx *exec_ctx, grpc_channel_credentials *c,
- grpc_call_credentials *call_creds, const char *target,
- const grpc_channel_args *args, grpc_channel_security_connector **sc,
- grpc_channel_args **new_args) {
+ grpc_channel_credentials *c, grpc_call_credentials *call_creds,
+ const char *target, const grpc_channel_args *args,
+ grpc_channel_security_connector **sc, grpc_channel_args **new_args) {
const grpc_call_credentials_array *creds_array;
GPR_ASSERT(strcmp(c->type, "mock") == 0);
GPR_ASSERT(call_creds != NULL);
@@ -509,7 +501,7 @@ check_channel_oauth2_google_iam_create_security_connector(
}
static void test_channel_oauth2_google_iam_composite_creds(void) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_channel_args *new_args;
grpc_channel_credentials_vtable vtable = {
NULL, check_channel_oauth2_google_iam_create_security_connector, NULL};
@@ -532,11 +524,11 @@ static void test_channel_oauth2_google_iam_composite_creds(void) {
grpc_call_credentials_release(google_iam_creds);
GPR_ASSERT(grpc_channel_credentials_create_security_connector(
- &exec_ctx, channel_oauth2_iam_creds, NULL, NULL, NULL,
- &new_args) == GRPC_SECURITY_OK);
+ channel_oauth2_iam_creds, NULL, NULL, NULL, &new_args) ==
+ GRPC_SECURITY_OK);
grpc_channel_credentials_release(channel_oauth2_iam_creds);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_exec_ctx_finish();
}
static void validate_compute_engine_http_request(
@@ -553,35 +545,32 @@ static void validate_compute_engine_http_request(
}
static int compute_engine_httpcli_get_success_override(
- grpc_exec_ctx *exec_ctx, const grpc_httpcli_request *request,
- grpc_millis deadline, grpc_closure *on_done,
- grpc_httpcli_response *response) {
+ const grpc_httpcli_request *request, grpc_millis deadline,
+ grpc_closure *on_done, grpc_httpcli_response *response) {
validate_compute_engine_http_request(request);
*response = http_response(200, valid_oauth2_json_response);
- GRPC_CLOSURE_SCHED(exec_ctx, on_done, GRPC_ERROR_NONE);
+ GRPC_CLOSURE_SCHED(on_done, GRPC_ERROR_NONE);
return 1;
}
static int compute_engine_httpcli_get_failure_override(
- grpc_exec_ctx *exec_ctx, const grpc_httpcli_request *request,
- grpc_millis deadline, grpc_closure *on_done,
- grpc_httpcli_response *response) {
+ const grpc_httpcli_request *request, grpc_millis deadline,
+ grpc_closure *on_done, grpc_httpcli_response *response) {
validate_compute_engine_http_request(request);
*response = http_response(403, "Not Authorized.");
- GRPC_CLOSURE_SCHED(exec_ctx, on_done, GRPC_ERROR_NONE);
+ GRPC_CLOSURE_SCHED(on_done, GRPC_ERROR_NONE);
return 1;
}
static int httpcli_post_should_not_be_called(
- grpc_exec_ctx *exec_ctx, const grpc_httpcli_request *request,
- const char *body_bytes, size_t body_size, grpc_millis deadline,
- grpc_closure *on_done, grpc_httpcli_response *response) {
+ const grpc_httpcli_request *request, const char *body_bytes,
+ size_t body_size, grpc_millis deadline, grpc_closure *on_done,
+ grpc_httpcli_response *response) {
GPR_ASSERT("HTTP POST should not be called" == NULL);
return 1;
}
-static int httpcli_get_should_not_be_called(grpc_exec_ctx *exec_ctx,
- const grpc_httpcli_request *request,
+static int httpcli_get_should_not_be_called(const grpc_httpcli_request *request,
grpc_millis deadline,
grpc_closure *on_done,
grpc_httpcli_response *response) {
@@ -590,7 +579,7 @@ static int httpcli_get_should_not_be_called(grpc_exec_ctx *exec_ctx,
}
static void test_compute_engine_creds_success(void) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
expected_md emd[] = {
{"authorization", "Bearer ya29.AHES6ZRN3-HlhAPya30GnW_bHSb_"}};
grpc_call_credentials *creds =
@@ -603,24 +592,24 @@ static void test_compute_engine_creds_success(void) {
make_request_metadata_state(GRPC_ERROR_NONE, emd, GPR_ARRAY_SIZE(emd));
grpc_httpcli_set_override(compute_engine_httpcli_get_success_override,
httpcli_post_should_not_be_called);
- run_request_metadata_test(&exec_ctx, creds, auth_md_ctx, state);
- grpc_exec_ctx_flush(&exec_ctx);
+ run_request_metadata_test(creds, auth_md_ctx, state);
+ grpc_exec_ctx_flush();
/* Second request: the cached token should be served directly. */
state =
make_request_metadata_state(GRPC_ERROR_NONE, emd, GPR_ARRAY_SIZE(emd));
grpc_httpcli_set_override(httpcli_get_should_not_be_called,
httpcli_post_should_not_be_called);
- run_request_metadata_test(&exec_ctx, creds, auth_md_ctx, state);
- grpc_exec_ctx_flush(&exec_ctx);
+ run_request_metadata_test(creds, auth_md_ctx, state);
+ grpc_exec_ctx_flush();
- grpc_call_credentials_unref(&exec_ctx, creds);
+ grpc_call_credentials_unref(creds);
grpc_httpcli_set_override(NULL, NULL);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_exec_ctx_finish();
}
static void test_compute_engine_creds_failure(void) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
request_metadata_state *state = make_request_metadata_state(
GRPC_ERROR_CREATE_FROM_STATIC_STRING(
"Error occured when fetching oauth2 token."),
@@ -631,10 +620,10 @@ static void test_compute_engine_creds_failure(void) {
grpc_google_compute_engine_credentials_create(NULL);
grpc_httpcli_set_override(compute_engine_httpcli_get_failure_override,
httpcli_post_should_not_be_called);
- run_request_metadata_test(&exec_ctx, creds, auth_md_ctx, state);
- grpc_call_credentials_unref(&exec_ctx, creds);
+ run_request_metadata_test(creds, auth_md_ctx, state);
+ grpc_call_credentials_unref(creds);
grpc_httpcli_set_override(NULL, NULL);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_exec_ctx_finish();
}
static void validate_refresh_token_http_request(
@@ -661,27 +650,27 @@ static void validate_refresh_token_http_request(
}
static int refresh_token_httpcli_post_success(
- grpc_exec_ctx *exec_ctx, const grpc_httpcli_request *request,
- const char *body, size_t body_size, grpc_millis deadline,
- grpc_closure *on_done, grpc_httpcli_response *response) {
+ const grpc_httpcli_request *request, const char *body, size_t body_size,
+ grpc_millis deadline, grpc_closure *on_done,
+ grpc_httpcli_response *response) {
validate_refresh_token_http_request(request, body, body_size);
*response = http_response(200, valid_oauth2_json_response);
- GRPC_CLOSURE_SCHED(exec_ctx, on_done, GRPC_ERROR_NONE);
+ GRPC_CLOSURE_SCHED(on_done, GRPC_ERROR_NONE);
return 1;
}
static int refresh_token_httpcli_post_failure(
- grpc_exec_ctx *exec_ctx, const grpc_httpcli_request *request,
- const char *body, size_t body_size, grpc_millis deadline,
- grpc_closure *on_done, grpc_httpcli_response *response) {
+ const grpc_httpcli_request *request, const char *body, size_t body_size,
+ grpc_millis deadline, grpc_closure *on_done,
+ grpc_httpcli_response *response) {
validate_refresh_token_http_request(request, body, body_size);
*response = http_response(403, "Not Authorized.");
- GRPC_CLOSURE_SCHED(exec_ctx, on_done, GRPC_ERROR_NONE);
+ GRPC_CLOSURE_SCHED(on_done, GRPC_ERROR_NONE);
return 1;
}
static void test_refresh_token_creds_success(void) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
expected_md emd[] = {
{"authorization", "Bearer ya29.AHES6ZRN3-HlhAPya30GnW_bHSb_"}};
grpc_auth_metadata_context auth_md_ctx = {test_service_url, test_method, NULL,
@@ -694,24 +683,24 @@ static void test_refresh_token_creds_success(void) {
make_request_metadata_state(GRPC_ERROR_NONE, emd, GPR_ARRAY_SIZE(emd));
grpc_httpcli_set_override(httpcli_get_should_not_be_called,
refresh_token_httpcli_post_success);
- run_request_metadata_test(&exec_ctx, creds, auth_md_ctx, state);
- grpc_exec_ctx_flush(&exec_ctx);
+ run_request_metadata_test(creds, auth_md_ctx, state);
+ grpc_exec_ctx_flush();
/* Second request: the cached token should be served directly. */
state =
make_request_metadata_state(GRPC_ERROR_NONE, emd, GPR_ARRAY_SIZE(emd));
grpc_httpcli_set_override(httpcli_get_should_not_be_called,
httpcli_post_should_not_be_called);
- run_request_metadata_test(&exec_ctx, creds, auth_md_ctx, state);
- grpc_exec_ctx_flush(&exec_ctx);
+ run_request_metadata_test(creds, auth_md_ctx, state);
+ grpc_exec_ctx_flush();
- grpc_call_credentials_unref(&exec_ctx, creds);
+ grpc_call_credentials_unref(creds);
grpc_httpcli_set_override(NULL, NULL);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_exec_ctx_finish();
}
static void test_refresh_token_creds_failure(void) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
request_metadata_state *state = make_request_metadata_state(
GRPC_ERROR_CREATE_FROM_STATIC_STRING(
"Error occured when fetching oauth2 token."),
@@ -722,10 +711,10 @@ static void test_refresh_token_creds_failure(void) {
test_refresh_token_str, NULL);
grpc_httpcli_set_override(httpcli_get_should_not_be_called,
refresh_token_httpcli_post_failure);
- run_request_metadata_test(&exec_ctx, creds, auth_md_ctx, state);
- grpc_call_credentials_unref(&exec_ctx, creds);
+ run_request_metadata_test(creds, auth_md_ctx, state);
+ grpc_call_credentials_unref(creds);
grpc_httpcli_set_override(NULL, NULL);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_exec_ctx_finish();
}
static void validate_jwt_encode_and_sign_params(
@@ -815,7 +804,7 @@ static void test_jwt_creds_lifetime(void) {
static void test_jwt_creds_success(void) {
char *json_key_string = test_json_key_str();
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_auth_metadata_context auth_md_ctx = {test_service_url, test_method, NULL,
NULL};
char *expected_md_value;
@@ -829,16 +818,16 @@ static void test_jwt_creds_success(void) {
request_metadata_state *state =
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(&exec_ctx, creds, auth_md_ctx, state);
- grpc_exec_ctx_flush(&exec_ctx);
+ run_request_metadata_test(creds, auth_md_ctx, state);
+ grpc_exec_ctx_flush();
/* Second request: the cached token should be served directly. */
state =
make_request_metadata_state(GRPC_ERROR_NONE, emd, GPR_ARRAY_SIZE(emd));
grpc_jwt_encode_and_sign_set_override(
encode_and_sign_jwt_should_not_be_called);
- run_request_metadata_test(&exec_ctx, creds, auth_md_ctx, state);
- grpc_exec_ctx_flush(&exec_ctx);
+ run_request_metadata_test(creds, auth_md_ctx, state);
+ grpc_exec_ctx_flush();
/* Third request: Different service url so jwt_encode_and_sign should be
called again (no caching). */
@@ -846,19 +835,19 @@ static void test_jwt_creds_success(void) {
make_request_metadata_state(GRPC_ERROR_NONE, emd, GPR_ARRAY_SIZE(emd));
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(&exec_ctx, creds, auth_md_ctx, state);
- grpc_exec_ctx_flush(&exec_ctx);
+ run_request_metadata_test(creds, auth_md_ctx, state);
+ grpc_exec_ctx_flush();
- grpc_call_credentials_unref(&exec_ctx, creds);
+ 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(&exec_ctx);
+ grpc_exec_ctx_finish();
}
static void test_jwt_creds_signing_failure(void) {
char *json_key_string = test_json_key_str();
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_auth_metadata_context auth_md_ctx = {test_service_url, test_method, NULL,
NULL};
request_metadata_state *state = make_request_metadata_state(
@@ -868,12 +857,12 @@ static void test_jwt_creds_signing_failure(void) {
json_key_string, grpc_max_auth_token_lifetime(), NULL);
grpc_jwt_encode_and_sign_set_override(encode_and_sign_jwt_failure);
- run_request_metadata_test(&exec_ctx, creds, auth_md_ctx, state);
+ run_request_metadata_test(creds, auth_md_ctx, state);
gpr_free(json_key_string);
- grpc_call_credentials_unref(&exec_ctx, creds);
+ grpc_call_credentials_unref(creds);
grpc_jwt_encode_and_sign_set_override(NULL);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_exec_ctx_finish();
}
static void set_google_default_creds_env_var_with_file_contents(
@@ -890,7 +879,7 @@ static void set_google_default_creds_env_var_with_file_contents(
}
static void test_google_default_creds_auth_key(void) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_service_account_jwt_access_credentials *jwt;
grpc_composite_channel_credentials *creds;
char *json_key = test_json_key_str();
@@ -906,13 +895,13 @@ static void test_google_default_creds_auth_key(void) {
strcmp(jwt->key.client_id,
"777-abaslkan11hlb6nmim3bpspl31ud.apps.googleusercontent.com") ==
0);
- grpc_channel_credentials_unref(&exec_ctx, &creds->base);
+ grpc_channel_credentials_unref(&creds->base);
gpr_setenv(GRPC_GOOGLE_CREDENTIALS_ENV_VAR, ""); /* Reset. */
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_exec_ctx_finish();
}
static void test_google_default_creds_refresh_token(void) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_google_refresh_token_credentials *refresh;
grpc_composite_channel_credentials *creds;
grpc_flush_cached_google_default_credentials();
@@ -924,15 +913,14 @@ static void test_google_default_creds_refresh_token(void) {
refresh = (grpc_google_refresh_token_credentials *)creds->call_creds;
GPR_ASSERT(strcmp(refresh->refresh_token.client_id,
"32555999999.apps.googleusercontent.com") == 0);
- grpc_channel_credentials_unref(&exec_ctx, &creds->base);
+ grpc_channel_credentials_unref(&creds->base);
gpr_setenv(GRPC_GOOGLE_CREDENTIALS_ENV_VAR, ""); /* Reset. */
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_exec_ctx_finish();
}
static int default_creds_gce_detection_httpcli_get_success_override(
- grpc_exec_ctx *exec_ctx, const grpc_httpcli_request *request,
- grpc_millis deadline, grpc_closure *on_done,
- grpc_httpcli_response *response) {
+ const grpc_httpcli_request *request, grpc_millis deadline,
+ grpc_closure *on_done, grpc_httpcli_response *response) {
*response = http_response(200, "");
grpc_http_header *headers = gpr_malloc(sizeof(*headers) * 1);
headers[0].key = gpr_strdup("Metadata-Flavor");
@@ -941,14 +929,14 @@ static int default_creds_gce_detection_httpcli_get_success_override(
response->hdrs = headers;
GPR_ASSERT(strcmp(request->http.path, "/") == 0);
GPR_ASSERT(strcmp(request->host, "metadata.google.internal") == 0);
- GRPC_CLOSURE_SCHED(exec_ctx, on_done, GRPC_ERROR_NONE);
+ GRPC_CLOSURE_SCHED(on_done, GRPC_ERROR_NONE);
return 1;
}
static char *null_well_known_creds_path_getter(void) { return NULL; }
static void test_google_default_creds_gce(void) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
expected_md emd[] = {
{"authorization", "Bearer ya29.AHES6ZRN3-HlhAPya30GnW_bHSb_"}};
request_metadata_state *state =
@@ -973,8 +961,8 @@ static void test_google_default_creds_gce(void) {
GPR_ASSERT(creds->call_creds != NULL);
grpc_httpcli_set_override(compute_engine_httpcli_get_success_override,
httpcli_post_should_not_be_called);
- run_request_metadata_test(&exec_ctx, creds->call_creds, auth_md_ctx, state);
- grpc_exec_ctx_flush(&exec_ctx);
+ run_request_metadata_test(creds->call_creds, auth_md_ctx, state);
+ grpc_exec_ctx_flush();
/* Check that we get a cached creds if we call
grpc_google_default_credentials_create again.
@@ -986,22 +974,21 @@ static void test_google_default_creds_gce(void) {
GPR_ASSERT(cached_creds == &creds->base);
/* Cleanup. */
- grpc_channel_credentials_unref(&exec_ctx, cached_creds);
- grpc_channel_credentials_unref(&exec_ctx, &creds->base);
+ grpc_channel_credentials_unref(cached_creds);
+ grpc_channel_credentials_unref(&creds->base);
grpc_httpcli_set_override(NULL, NULL);
grpc_override_well_known_credentials_path_getter(NULL);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_exec_ctx_finish();
}
static int default_creds_gce_detection_httpcli_get_failure_override(
- grpc_exec_ctx *exec_ctx, const grpc_httpcli_request *request,
- grpc_millis deadline, grpc_closure *on_done,
- grpc_httpcli_response *response) {
+ const grpc_httpcli_request *request, grpc_millis deadline,
+ grpc_closure *on_done, grpc_httpcli_response *response) {
/* No magic header. */
GPR_ASSERT(strcmp(request->http.path, "/") == 0);
GPR_ASSERT(strcmp(request->host, "metadata.google.internal") == 0);
*response = http_response(200, "");
- GRPC_CLOSURE_SCHED(exec_ctx, on_done, GRPC_ERROR_NONE);
+ GRPC_CLOSURE_SCHED(on_done, GRPC_ERROR_NONE);
return 1;
}
@@ -1085,7 +1072,7 @@ static void plugin_destroy(void *state) {
static void test_metadata_plugin_success(void) {
plugin_state state = PLUGIN_INITIAL_STATE;
grpc_metadata_credentials_plugin plugin;
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_auth_metadata_context auth_md_ctx = {test_service_url, test_method, NULL,
NULL};
request_metadata_state *md_state = make_request_metadata_state(
@@ -1098,17 +1085,17 @@ static void test_metadata_plugin_success(void) {
grpc_call_credentials *creds =
grpc_metadata_credentials_create_from_plugin(plugin, NULL);
GPR_ASSERT(state == PLUGIN_INITIAL_STATE);
- run_request_metadata_test(&exec_ctx, creds, auth_md_ctx, md_state);
+ run_request_metadata_test(creds, auth_md_ctx, md_state);
GPR_ASSERT(state == PLUGIN_GET_METADATA_CALLED_STATE);
- grpc_call_credentials_unref(&exec_ctx, creds);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_call_credentials_unref(creds);
+ grpc_exec_ctx_finish();
GPR_ASSERT(state == PLUGIN_DESTROY_CALLED_STATE);
}
static void test_metadata_plugin_failure(void) {
plugin_state state = PLUGIN_INITIAL_STATE;
grpc_metadata_credentials_plugin plugin;
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_auth_metadata_context auth_md_ctx = {test_service_url, test_method, NULL,
NULL};
char *expected_error;
@@ -1126,10 +1113,10 @@ static void test_metadata_plugin_failure(void) {
grpc_call_credentials *creds =
grpc_metadata_credentials_create_from_plugin(plugin, NULL);
GPR_ASSERT(state == PLUGIN_INITIAL_STATE);
- run_request_metadata_test(&exec_ctx, creds, auth_md_ctx, md_state);
+ run_request_metadata_test(creds, auth_md_ctx, md_state);
GPR_ASSERT(state == PLUGIN_GET_METADATA_CALLED_STATE);
- grpc_call_credentials_unref(&exec_ctx, creds);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_call_credentials_unref(creds);
+ grpc_exec_ctx_finish();
GPR_ASSERT(state == PLUGIN_DESTROY_CALLED_STATE);
}
@@ -1150,7 +1137,7 @@ static void test_get_well_known_google_credentials_file_path(void) {
}
static void test_channel_creds_duplicate_without_call_creds(void) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_channel_credentials *channel_creds =
grpc_fake_transport_security_credentials_create();
@@ -1159,23 +1146,23 @@ static void test_channel_creds_duplicate_without_call_creds(void) {
grpc_channel_credentials_duplicate_without_call_credentials(
channel_creds);
GPR_ASSERT(dup == channel_creds);
- grpc_channel_credentials_unref(&exec_ctx, dup);
+ grpc_channel_credentials_unref(dup);
grpc_call_credentials *call_creds =
grpc_access_token_credentials_create("blah", NULL);
grpc_channel_credentials *composite_creds =
grpc_composite_channel_credentials_create(channel_creds, call_creds,
NULL);
- grpc_call_credentials_unref(&exec_ctx, call_creds);
+ grpc_call_credentials_unref(call_creds);
dup = grpc_channel_credentials_duplicate_without_call_credentials(
composite_creds);
GPR_ASSERT(dup == channel_creds);
- grpc_channel_credentials_unref(&exec_ctx, dup);
+ grpc_channel_credentials_unref(dup);
- grpc_channel_credentials_unref(&exec_ctx, channel_creds);
- grpc_channel_credentials_unref(&exec_ctx, composite_creds);
+ grpc_channel_credentials_unref(channel_creds);
+ grpc_channel_credentials_unref(composite_creds);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_exec_ctx_finish();
}
int main(int argc, char **argv) {
diff --git a/test/core/security/json_token_test.c b/test/core/security/json_token_test.c
index 6573f70e72..3e410f44b9 100644
--- a/test/core/security/json_token_test.c
+++ b/test/core/security/json_token_test.c
@@ -206,7 +206,7 @@ static void test_parse_json_key_failure_no_private_key(void) {
static grpc_json *parse_json_part_from_jwt(const char *str, size_t len,
char **scratchpad) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
char *b64;
char *decoded;
grpc_json *json;
@@ -214,7 +214,7 @@ static grpc_json *parse_json_part_from_jwt(const char *str, size_t len,
b64 = gpr_malloc(len + 1);
strncpy(b64, str, len);
b64[len] = '\0';
- slice = grpc_base64_decode(&exec_ctx, b64, 1);
+ slice = grpc_base64_decode(b64, 1);
GPR_ASSERT(!GRPC_SLICE_IS_EMPTY(slice));
decoded = gpr_malloc(GRPC_SLICE_LENGTH(slice) + 1);
strncpy(decoded, (const char *)GRPC_SLICE_START_PTR(slice),
@@ -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(&exec_ctx);
+ grpc_exec_ctx_finish();
return json;
}
@@ -326,12 +326,12 @@ static void check_jwt_claim(grpc_json *claim, const char *expected_audience,
static void check_jwt_signature(const char *b64_signature, RSA *rsa_key,
const char *signed_data,
size_t signed_data_size) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
EVP_MD_CTX *md_ctx = EVP_MD_CTX_create();
EVP_PKEY *key = EVP_PKEY_new();
- grpc_slice sig = grpc_base64_decode(&exec_ctx, b64_signature, 1);
+ grpc_slice sig = grpc_base64_decode(b64_signature, 1);
GPR_ASSERT(!GRPC_SLICE_IS_EMPTY(sig));
GPR_ASSERT(GRPC_SLICE_LENGTH(sig) == 128);
@@ -345,11 +345,11 @@ static void check_jwt_signature(const char *b64_signature, RSA *rsa_key,
GPR_ASSERT(EVP_DigestVerifyFinal(md_ctx, GRPC_SLICE_START_PTR(sig),
GRPC_SLICE_LENGTH(sig)) == 1);
- grpc_slice_unref_internal(&exec_ctx, sig);
+ 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(&exec_ctx);
+ grpc_exec_ctx_finish();
}
static char *service_account_creds_jwt_encode_and_sign(
diff --git a/test/core/security/jwt_verifier_test.c b/test/core/security/jwt_verifier_test.c
index a4bfe0130e..9fffa4d90c 100644
--- a/test/core/security/jwt_verifier_test.c
+++ b/test/core/security/jwt_verifier_test.c
@@ -209,8 +209,8 @@ static void test_claims_success(void) {
grpc_json *json = grpc_json_parse_string_with_len(
(char *)GRPC_SLICE_START_PTR(s), GRPC_SLICE_LENGTH(s));
GPR_ASSERT(json != NULL);
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- claims = grpc_jwt_claims_from_json(&exec_ctx, json, s);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ claims = grpc_jwt_claims_from_json(json, s);
GPR_ASSERT(claims != NULL);
GPR_ASSERT(grpc_jwt_claims_json(claims) == json);
GPR_ASSERT(strcmp(grpc_jwt_claims_audience(claims), "https://foo.com") == 0);
@@ -219,8 +219,8 @@ static void test_claims_success(void) {
GPR_ASSERT(strcmp(grpc_jwt_claims_id(claims), "jwtuniqueid") == 0);
GPR_ASSERT(grpc_jwt_claims_check(claims, "https://foo.com") ==
GRPC_JWT_VERIFIER_OK);
- grpc_jwt_claims_destroy(&exec_ctx, claims);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_jwt_claims_destroy(claims);
+ grpc_exec_ctx_finish();
}
static void test_expired_claims_failure(void) {
@@ -232,8 +232,8 @@ static void test_expired_claims_failure(void) {
gpr_timespec exp_exp = {120, 0, GPR_CLOCK_REALTIME};
gpr_timespec exp_nbf = {60, 0, GPR_CLOCK_REALTIME};
GPR_ASSERT(json != NULL);
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- claims = grpc_jwt_claims_from_json(&exec_ctx, json, s);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ claims = grpc_jwt_claims_from_json(json, s);
GPR_ASSERT(claims != NULL);
GPR_ASSERT(grpc_jwt_claims_json(claims) == json);
GPR_ASSERT(strcmp(grpc_jwt_claims_audience(claims), "https://foo.com") == 0);
@@ -246,17 +246,17 @@ 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(&exec_ctx, claims);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_jwt_claims_destroy(claims);
+ grpc_exec_ctx_finish();
}
static void test_invalid_claims_failure(void) {
grpc_slice s = grpc_slice_from_copied_string(invalid_claims);
grpc_json *json = grpc_json_parse_string_with_len(
(char *)GRPC_SLICE_START_PTR(s), GRPC_SLICE_LENGTH(s));
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- GPR_ASSERT(grpc_jwt_claims_from_json(&exec_ctx, json, s) == NULL);
- grpc_exec_ctx_finish(&exec_ctx);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ GPR_ASSERT(grpc_jwt_claims_from_json(json, s) == NULL);
+ grpc_exec_ctx_finish();
}
static void test_bad_audience_claims_failure(void) {
@@ -265,13 +265,13 @@ static void test_bad_audience_claims_failure(void) {
grpc_json *json = grpc_json_parse_string_with_len(
(char *)GRPC_SLICE_START_PTR(s), GRPC_SLICE_LENGTH(s));
GPR_ASSERT(json != NULL);
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- claims = grpc_jwt_claims_from_json(&exec_ctx, json, s);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ claims = grpc_jwt_claims_from_json(json, s);
GPR_ASSERT(claims != NULL);
GPR_ASSERT(grpc_jwt_claims_check(claims, "https://bar.com") ==
GRPC_JWT_VERIFIER_BAD_AUDIENCE);
- grpc_jwt_claims_destroy(&exec_ctx, claims);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_jwt_claims_destroy(claims);
+ grpc_exec_ctx_finish();
}
static void test_bad_subject_claims_failure(void) {
@@ -280,13 +280,13 @@ static void test_bad_subject_claims_failure(void) {
grpc_json *json = grpc_json_parse_string_with_len(
(char *)GRPC_SLICE_START_PTR(s), GRPC_SLICE_LENGTH(s));
GPR_ASSERT(json != NULL);
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- claims = grpc_jwt_claims_from_json(&exec_ctx, json, s);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ claims = grpc_jwt_claims_from_json(json, s);
GPR_ASSERT(claims != NULL);
GPR_ASSERT(grpc_jwt_claims_check(claims, "https://foo.com") ==
GRPC_JWT_VERIFIER_BAD_SUBJECT);
- grpc_jwt_claims_destroy(&exec_ctx, claims);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_jwt_claims_destroy(claims);
+ grpc_exec_ctx_finish();
}
static char *json_key_str(const char *last_part) {
@@ -323,17 +323,16 @@ static grpc_httpcli_response http_response(int status, char *body) {
}
static int httpcli_post_should_not_be_called(
- grpc_exec_ctx *exec_ctx, const grpc_httpcli_request *request,
- const char *body_bytes, size_t body_size, grpc_millis deadline,
- grpc_closure *on_done, grpc_httpcli_response *response) {
+ const grpc_httpcli_request *request, const char *body_bytes,
+ size_t body_size, grpc_millis deadline, grpc_closure *on_done,
+ grpc_httpcli_response *response) {
GPR_ASSERT("HTTP POST should not be called" == NULL);
return 1;
}
static int httpcli_get_google_keys_for_email(
- grpc_exec_ctx *exec_ctx, const grpc_httpcli_request *request,
- grpc_millis deadline, grpc_closure *on_done,
- grpc_httpcli_response *response) {
+ const grpc_httpcli_request *request, grpc_millis deadline,
+ grpc_closure *on_done, grpc_httpcli_response *response) {
*response = http_response(200, good_google_email_keys());
GPR_ASSERT(request->handshaker == &grpc_httpcli_ssl);
GPR_ASSERT(strcmp(request->host, "www.googleapis.com") == 0);
@@ -341,22 +340,22 @@ static int httpcli_get_google_keys_for_email(
"/robot/v1/metadata/x509/"
"777-abaslkan11hlb6nmim3bpspl31ud@developer."
"gserviceaccount.com") == 0);
- GRPC_CLOSURE_SCHED(exec_ctx, on_done, GRPC_ERROR_NONE);
+ GRPC_CLOSURE_SCHED(on_done, GRPC_ERROR_NONE);
return 1;
}
-static void on_verification_success(grpc_exec_ctx *exec_ctx, void *user_data,
+static void on_verification_success(void *user_data,
grpc_jwt_verifier_status status,
grpc_jwt_claims *claims) {
GPR_ASSERT(status == GRPC_JWT_VERIFIER_OK);
GPR_ASSERT(claims != NULL);
GPR_ASSERT(user_data == (void *)expected_user_data);
GPR_ASSERT(strcmp(grpc_jwt_claims_audience(claims), expected_audience) == 0);
- grpc_jwt_claims_destroy(exec_ctx, claims);
+ grpc_jwt_claims_destroy(claims);
}
static void test_jwt_verifier_google_email_issuer_success(void) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_jwt_verifier *verifier = grpc_jwt_verifier_create(NULL, 0);
char *jwt = NULL;
char *key_str = json_key_str(json_key_str_part3_for_google_email_issuer);
@@ -369,28 +368,27 @@ static void test_jwt_verifier_google_email_issuer_success(void) {
NULL);
grpc_auth_json_key_destruct(&key);
GPR_ASSERT(jwt != NULL);
- grpc_jwt_verifier_verify(&exec_ctx, verifier, NULL, jwt, expected_audience,
+ grpc_jwt_verifier_verify(verifier, NULL, jwt, expected_audience,
on_verification_success, (void *)expected_user_data);
- grpc_jwt_verifier_destroy(&exec_ctx, verifier);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_jwt_verifier_destroy(verifier);
+ grpc_exec_ctx_finish();
gpr_free(jwt);
grpc_httpcli_set_override(NULL, NULL);
}
static int httpcli_get_custom_keys_for_email(
- grpc_exec_ctx *exec_ctx, const grpc_httpcli_request *request,
- grpc_millis deadline, grpc_closure *on_done,
- grpc_httpcli_response *response) {
+ const grpc_httpcli_request *request, grpc_millis deadline,
+ grpc_closure *on_done, grpc_httpcli_response *response) {
*response = http_response(200, gpr_strdup(good_jwk_set));
GPR_ASSERT(request->handshaker == &grpc_httpcli_ssl);
GPR_ASSERT(strcmp(request->host, "keys.bar.com") == 0);
GPR_ASSERT(strcmp(request->http.path, "/jwk/foo@bar.com") == 0);
- GRPC_CLOSURE_SCHED(exec_ctx, on_done, GRPC_ERROR_NONE);
+ GRPC_CLOSURE_SCHED(on_done, GRPC_ERROR_NONE);
return 1;
}
static void test_jwt_verifier_custom_email_issuer_success(void) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_jwt_verifier *verifier = grpc_jwt_verifier_create(&custom_mapping, 1);
char *jwt = NULL;
char *key_str = json_key_str(json_key_str_part3_for_custom_email_issuer);
@@ -403,28 +401,26 @@ static void test_jwt_verifier_custom_email_issuer_success(void) {
NULL);
grpc_auth_json_key_destruct(&key);
GPR_ASSERT(jwt != NULL);
- grpc_jwt_verifier_verify(&exec_ctx, verifier, NULL, jwt, expected_audience,
+ grpc_jwt_verifier_verify(verifier, NULL, jwt, expected_audience,
on_verification_success, (void *)expected_user_data);
- grpc_jwt_verifier_destroy(&exec_ctx, verifier);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_jwt_verifier_destroy(verifier);
+ grpc_exec_ctx_finish();
gpr_free(jwt);
grpc_httpcli_set_override(NULL, NULL);
}
-static int httpcli_get_jwk_set(grpc_exec_ctx *exec_ctx,
- const grpc_httpcli_request *request,
+static int httpcli_get_jwk_set(const grpc_httpcli_request *request,
grpc_millis deadline, grpc_closure *on_done,
grpc_httpcli_response *response) {
*response = http_response(200, gpr_strdup(good_jwk_set));
GPR_ASSERT(request->handshaker == &grpc_httpcli_ssl);
GPR_ASSERT(strcmp(request->host, "www.googleapis.com") == 0);
GPR_ASSERT(strcmp(request->http.path, "/oauth2/v3/certs") == 0);
- GRPC_CLOSURE_SCHED(exec_ctx, on_done, GRPC_ERROR_NONE);
+ GRPC_CLOSURE_SCHED(on_done, GRPC_ERROR_NONE);
return 1;
}
-static int httpcli_get_openid_config(grpc_exec_ctx *exec_ctx,
- const grpc_httpcli_request *request,
+static int httpcli_get_openid_config(const grpc_httpcli_request *request,
grpc_millis deadline,
grpc_closure *on_done,
grpc_httpcli_response *response) {
@@ -434,12 +430,12 @@ static int httpcli_get_openid_config(grpc_exec_ctx *exec_ctx,
GPR_ASSERT(strcmp(request->http.path, GRPC_OPENID_CONFIG_URL_SUFFIX) == 0);
grpc_httpcli_set_override(httpcli_get_jwk_set,
httpcli_post_should_not_be_called);
- GRPC_CLOSURE_SCHED(exec_ctx, on_done, GRPC_ERROR_NONE);
+ GRPC_CLOSURE_SCHED(on_done, GRPC_ERROR_NONE);
return 1;
}
static void test_jwt_verifier_url_issuer_success(void) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_jwt_verifier *verifier = grpc_jwt_verifier_create(NULL, 0);
char *jwt = NULL;
char *key_str = json_key_str(json_key_str_part3_for_url_issuer);
@@ -452,16 +448,15 @@ static void test_jwt_verifier_url_issuer_success(void) {
NULL);
grpc_auth_json_key_destruct(&key);
GPR_ASSERT(jwt != NULL);
- grpc_jwt_verifier_verify(&exec_ctx, verifier, NULL, jwt, expected_audience,
+ grpc_jwt_verifier_verify(verifier, NULL, jwt, expected_audience,
on_verification_success, (void *)expected_user_data);
- grpc_jwt_verifier_destroy(&exec_ctx, verifier);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_jwt_verifier_destroy(verifier);
+ grpc_exec_ctx_finish();
gpr_free(jwt);
grpc_httpcli_set_override(NULL, NULL);
}
-static void on_verification_key_retrieval_error(grpc_exec_ctx *exec_ctx,
- void *user_data,
+static void on_verification_key_retrieval_error(void *user_data,
grpc_jwt_verifier_status status,
grpc_jwt_claims *claims) {
GPR_ASSERT(status == GRPC_JWT_VERIFIER_KEY_RETRIEVAL_ERROR);
@@ -469,18 +464,17 @@ static void on_verification_key_retrieval_error(grpc_exec_ctx *exec_ctx,
GPR_ASSERT(user_data == (void *)expected_user_data);
}
-static int httpcli_get_bad_json(grpc_exec_ctx *exec_ctx,
- const grpc_httpcli_request *request,
+static int httpcli_get_bad_json(const grpc_httpcli_request *request,
grpc_millis deadline, grpc_closure *on_done,
grpc_httpcli_response *response) {
*response = http_response(200, gpr_strdup("{\"bad\": \"stuff\"}"));
GPR_ASSERT(request->handshaker == &grpc_httpcli_ssl);
- GRPC_CLOSURE_SCHED(exec_ctx, on_done, GRPC_ERROR_NONE);
+ GRPC_CLOSURE_SCHED(on_done, GRPC_ERROR_NONE);
return 1;
}
static void test_jwt_verifier_url_issuer_bad_config(void) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_jwt_verifier *verifier = grpc_jwt_verifier_create(NULL, 0);
char *jwt = NULL;
char *key_str = json_key_str(json_key_str_part3_for_url_issuer);
@@ -493,17 +487,17 @@ static void test_jwt_verifier_url_issuer_bad_config(void) {
NULL);
grpc_auth_json_key_destruct(&key);
GPR_ASSERT(jwt != NULL);
- grpc_jwt_verifier_verify(&exec_ctx, verifier, NULL, jwt, expected_audience,
+ grpc_jwt_verifier_verify(verifier, NULL, jwt, expected_audience,
on_verification_key_retrieval_error,
(void *)expected_user_data);
- grpc_jwt_verifier_destroy(&exec_ctx, verifier);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_jwt_verifier_destroy(verifier);
+ grpc_exec_ctx_finish();
gpr_free(jwt);
grpc_httpcli_set_override(NULL, NULL);
}
static void test_jwt_verifier_bad_json_key(void) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_jwt_verifier *verifier = grpc_jwt_verifier_create(NULL, 0);
char *jwt = NULL;
char *key_str = json_key_str(json_key_str_part3_for_google_email_issuer);
@@ -516,11 +510,11 @@ static void test_jwt_verifier_bad_json_key(void) {
NULL);
grpc_auth_json_key_destruct(&key);
GPR_ASSERT(jwt != NULL);
- grpc_jwt_verifier_verify(&exec_ctx, verifier, NULL, jwt, expected_audience,
+ grpc_jwt_verifier_verify(verifier, NULL, jwt, expected_audience,
on_verification_key_retrieval_error,
(void *)expected_user_data);
- grpc_jwt_verifier_destroy(&exec_ctx, verifier);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_jwt_verifier_destroy(verifier);
+ grpc_exec_ctx_finish();
gpr_free(jwt);
grpc_httpcli_set_override(NULL, NULL);
}
@@ -532,9 +526,9 @@ static void corrupt_jwt_sig(char *jwt) {
char *last_dot = strrchr(jwt, '.');
GPR_ASSERT(last_dot != NULL);
{
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- sig = grpc_base64_decode(&exec_ctx, last_dot + 1, 1);
- grpc_exec_ctx_finish(&exec_ctx);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ 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);
@@ -546,8 +540,7 @@ static void corrupt_jwt_sig(char *jwt) {
grpc_slice_unref(sig);
}
-static void on_verification_bad_signature(grpc_exec_ctx *exec_ctx,
- void *user_data,
+static void on_verification_bad_signature(void *user_data,
grpc_jwt_verifier_status status,
grpc_jwt_claims *claims) {
GPR_ASSERT(status == GRPC_JWT_VERIFIER_BAD_SIGNATURE);
@@ -556,7 +549,7 @@ static void on_verification_bad_signature(grpc_exec_ctx *exec_ctx,
}
static void test_jwt_verifier_bad_signature(void) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_jwt_verifier *verifier = grpc_jwt_verifier_create(NULL, 0);
char *jwt = NULL;
char *key_str = json_key_str(json_key_str_part3_for_url_issuer);
@@ -570,17 +563,16 @@ static void test_jwt_verifier_bad_signature(void) {
grpc_auth_json_key_destruct(&key);
corrupt_jwt_sig(jwt);
GPR_ASSERT(jwt != NULL);
- grpc_jwt_verifier_verify(&exec_ctx, verifier, NULL, jwt, expected_audience,
+ grpc_jwt_verifier_verify(verifier, NULL, jwt, expected_audience,
on_verification_bad_signature,
(void *)expected_user_data);
gpr_free(jwt);
- grpc_jwt_verifier_destroy(&exec_ctx, verifier);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_jwt_verifier_destroy(verifier);
+ grpc_exec_ctx_finish();
grpc_httpcli_set_override(NULL, NULL);
}
-static int httpcli_get_should_not_be_called(grpc_exec_ctx *exec_ctx,
- const grpc_httpcli_request *request,
+static int httpcli_get_should_not_be_called(const grpc_httpcli_request *request,
grpc_millis deadline,
grpc_closure *on_done,
grpc_httpcli_response *response) {
@@ -588,7 +580,7 @@ static int httpcli_get_should_not_be_called(grpc_exec_ctx *exec_ctx,
return 1;
}
-static void on_verification_bad_format(grpc_exec_ctx *exec_ctx, void *user_data,
+static void on_verification_bad_format(void *user_data,
grpc_jwt_verifier_status status,
grpc_jwt_claims *claims) {
GPR_ASSERT(status == GRPC_JWT_VERIFIER_BAD_FORMAT);
@@ -597,15 +589,15 @@ static void on_verification_bad_format(grpc_exec_ctx *exec_ctx, void *user_data,
}
static void test_jwt_verifier_bad_format(void) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_jwt_verifier *verifier = grpc_jwt_verifier_create(NULL, 0);
grpc_httpcli_set_override(httpcli_get_should_not_be_called,
httpcli_post_should_not_be_called);
- grpc_jwt_verifier_verify(&exec_ctx, verifier, NULL, "bad jwt",
- expected_audience, on_verification_bad_format,
+ grpc_jwt_verifier_verify(verifier, NULL, "bad jwt", expected_audience,
+ on_verification_bad_format,
(void *)expected_user_data);
- grpc_jwt_verifier_destroy(&exec_ctx, verifier);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_jwt_verifier_destroy(verifier);
+ grpc_exec_ctx_finish();
grpc_httpcli_set_override(NULL, NULL);
}
diff --git a/test/core/security/oauth2_utils.c b/test/core/security/oauth2_utils.cc
index 73d6c5bc7d..3282701cfa 100644
--- a/test/core/security/oauth2_utils.c
+++ b/test/core/security/oauth2_utils.cc
@@ -39,8 +39,7 @@ typedef struct {
grpc_closure closure;
} oauth2_request;
-static void on_oauth2_response(grpc_exec_ctx *exec_ctx, void *arg,
- grpc_error *error) {
+static void on_oauth2_response(void *arg, grpc_error *error) {
oauth2_request *request = (oauth2_request *)arg;
char *token = NULL;
grpc_slice token_slice;
@@ -54,25 +53,23 @@ static void on_oauth2_response(grpc_exec_ctx *exec_ctx, void *arg,
GRPC_SLICE_LENGTH(token_slice));
token[GRPC_SLICE_LENGTH(token_slice)] = '\0';
}
- grpc_credentials_mdelem_array_destroy(exec_ctx, &request->md_array);
+ grpc_credentials_mdelem_array_destroy(&request->md_array);
gpr_mu_lock(request->mu);
request->is_done = true;
request->token = token;
GRPC_LOG_IF_ERROR(
"pollset_kick",
- grpc_pollset_kick(exec_ctx, grpc_polling_entity_pollset(&request->pops),
- NULL));
+ grpc_pollset_kick(grpc_polling_entity_pollset(&request->pops), NULL));
gpr_mu_unlock(request->mu);
}
-static void do_nothing(grpc_exec_ctx *exec_ctx, void *unused,
- grpc_error *error) {}
+static void do_nothing(void *unused, grpc_error *error) {}
char *grpc_test_fetch_oauth2_token_with_credentials(
grpc_call_credentials *creds) {
oauth2_request request;
memset(&request, 0, sizeof(request));
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ ExecCtx _local_exec_ctx;
grpc_closure do_nothing_closure;
grpc_auth_metadata_context null_ctx = {"", "", NULL, NULL};
@@ -88,31 +85,30 @@ char *grpc_test_fetch_oauth2_token_with_credentials(
grpc_schedule_on_exec_ctx);
grpc_error *error = GRPC_ERROR_NONE;
- if (grpc_call_credentials_get_request_metadata(
- &exec_ctx, creds, &request.pops, null_ctx, &request.md_array,
- &request.closure, &error)) {
+ if (grpc_call_credentials_get_request_metadata(creds, &request.pops, null_ctx,
+ &request.md_array,
+ &request.closure, &error)) {
// Synchronous result; invoke callback directly.
- on_oauth2_response(&exec_ctx, &request, error);
+ on_oauth2_response(&request, error);
GRPC_ERROR_UNREF(error);
}
- grpc_exec_ctx_flush(&exec_ctx);
+ grpc_exec_ctx_flush();
gpr_mu_lock(request.mu);
while (!request.is_done) {
grpc_pollset_worker *worker = NULL;
if (!GRPC_LOG_IF_ERROR(
"pollset_work",
- grpc_pollset_work(&exec_ctx,
- grpc_polling_entity_pollset(&request.pops),
+ grpc_pollset_work(grpc_polling_entity_pollset(&request.pops),
&worker, GRPC_MILLIS_INF_FUTURE))) {
request.is_done = true;
}
}
gpr_mu_unlock(request.mu);
- grpc_pollset_shutdown(&exec_ctx, grpc_polling_entity_pollset(&request.pops),
+ grpc_pollset_shutdown(grpc_polling_entity_pollset(&request.pops),
&do_nothing_closure);
- grpc_exec_ctx_finish(&exec_ctx);
+ 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.c b/test/core/security/print_google_default_creds_token.c
index 29c38dfdf8..d93f236307 100644
--- a/test/core/security/print_google_default_creds_token.c
+++ b/test/core/security/print_google_default_creds_token.c
@@ -41,8 +41,7 @@ typedef struct {
grpc_closure on_request_metadata;
} synchronizer;
-static void on_metadata_response(grpc_exec_ctx *exec_ctx, void *arg,
- grpc_error *error) {
+static void on_metadata_response(void *arg, grpc_error *error) {
synchronizer *sync = arg;
if (error != GRPC_ERROR_NONE) {
fprintf(stderr, "Fetching token failed: %s\n", grpc_error_string(error));
@@ -57,14 +56,13 @@ static void on_metadata_response(grpc_exec_ctx *exec_ctx, void *arg,
sync->is_done = true;
GRPC_LOG_IF_ERROR(
"pollset_kick",
- grpc_pollset_kick(exec_ctx, grpc_polling_entity_pollset(&sync->pops),
- NULL));
+ grpc_pollset_kick(grpc_polling_entity_pollset(&sync->pops), NULL));
gpr_mu_unlock(sync->mu);
}
int main(int argc, char **argv) {
int result = 0;
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
synchronizer sync;
grpc_channel_credentials *creds = NULL;
char *service_url = "https://test.foo.google.com/Foo";
@@ -95,11 +93,10 @@ int main(int argc, char **argv) {
grpc_error *error = GRPC_ERROR_NONE;
if (grpc_call_credentials_get_request_metadata(
- &exec_ctx, ((grpc_composite_channel_credentials *)creds)->call_creds,
- &sync.pops, context, &sync.md_array, &sync.on_request_metadata,
- &error)) {
+ ((grpc_composite_channel_credentials *)creds)->call_creds, &sync.pops,
+ context, &sync.md_array, &sync.on_request_metadata, &error)) {
// Synchronous response. Invoke callback directly.
- on_metadata_response(&exec_ctx, &sync, error);
+ on_metadata_response(&sync, error);
GRPC_ERROR_UNREF(error);
}
@@ -108,17 +105,16 @@ int main(int argc, char **argv) {
grpc_pollset_worker *worker = NULL;
if (!GRPC_LOG_IF_ERROR(
"pollset_work",
- grpc_pollset_work(&exec_ctx,
- grpc_polling_entity_pollset(&sync.pops), &worker,
+ grpc_pollset_work(grpc_polling_entity_pollset(&sync.pops), &worker,
GRPC_MILLIS_INF_FUTURE)))
sync.is_done = true;
gpr_mu_unlock(sync.mu);
- grpc_exec_ctx_flush(&exec_ctx);
+ grpc_exec_ctx_flush();
gpr_mu_lock(sync.mu);
}
gpr_mu_unlock(sync.mu);
- grpc_exec_ctx_finish(&exec_ctx);
+ 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.c b/test/core/security/secure_endpoint_test.c
index 839a05fa9b..929f64cd40 100644
--- a/test/core/security/secure_endpoint_test.c
+++ b/test/core/security/secure_endpoint_test.c
@@ -38,7 +38,7 @@ static grpc_pollset *g_pollset;
static grpc_endpoint_test_fixture secure_endpoint_create_fixture_tcp_socketpair(
size_t slice_size, grpc_slice *leftover_slices, size_t leftover_nslices,
bool use_zero_copy_protector) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
tsi_frame_protector *fake_read_protector =
tsi_create_fake_frame_protector(NULL);
tsi_frame_protector *fake_write_protector =
@@ -57,8 +57,8 @@ static grpc_endpoint_test_fixture secure_endpoint_create_fixture_tcp_socketpair(
.value.integer = (int)slice_size}};
grpc_channel_args args = {.num_args = GPR_ARRAY_SIZE(a), .args = a};
tcp = grpc_iomgr_create_endpoint_pair("fixture", &args);
- grpc_endpoint_add_to_pollset(&exec_ctx, tcp.client, g_pollset);
- grpc_endpoint_add_to_pollset(&exec_ctx, tcp.server, g_pollset);
+ grpc_endpoint_add_to_pollset(tcp.client, g_pollset);
+ grpc_endpoint_add_to_pollset(tcp.server, g_pollset);
if (leftover_nslices == 0) {
f.client_ep = grpc_secure_endpoint_create(fake_read_protector,
@@ -114,7 +114,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(&exec_ctx);
+ grpc_exec_ctx_finish();
return f;
}
@@ -162,52 +162,46 @@ static grpc_endpoint_test_config configs[] = {
clean_up},
};
-static void inc_call_ctr(grpc_exec_ctx *exec_ctx, void *arg,
- grpc_error *error) {
- ++*(int *)arg;
-}
+static void inc_call_ctr(void *arg, grpc_error *error) { ++*(int *)arg; }
static void test_leftover(grpc_endpoint_test_config config, size_t slice_size) {
grpc_endpoint_test_fixture f = config.create_fixture(slice_size);
grpc_slice_buffer incoming;
grpc_slice s =
grpc_slice_from_copied_string("hello world 12345678900987654321");
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
int n = 0;
grpc_closure done_closure;
gpr_log(GPR_INFO, "Start test left over");
grpc_slice_buffer_init(&incoming);
GRPC_CLOSURE_INIT(&done_closure, inc_call_ctr, &n, grpc_schedule_on_exec_ctx);
- grpc_endpoint_read(&exec_ctx, f.client_ep, &incoming, &done_closure);
- grpc_exec_ctx_finish(&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]));
grpc_endpoint_shutdown(
- &exec_ctx, f.client_ep,
- GRPC_ERROR_CREATE_FROM_STATIC_STRING("test_leftover end"));
+ f.client_ep, GRPC_ERROR_CREATE_FROM_STATIC_STRING("test_leftover end"));
grpc_endpoint_shutdown(
- &exec_ctx, f.server_ep,
- GRPC_ERROR_CREATE_FROM_STATIC_STRING("test_leftover end"));
- grpc_endpoint_destroy(&exec_ctx, f.client_ep);
- grpc_endpoint_destroy(&exec_ctx, f.server_ep);
- grpc_exec_ctx_finish(&exec_ctx);
- grpc_slice_unref_internal(&exec_ctx, s);
- grpc_slice_buffer_destroy_internal(&exec_ctx, &incoming);
+ 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);
clean_up();
}
-static void destroy_pollset(grpc_exec_ctx *exec_ctx, void *p,
- grpc_error *error) {
- grpc_pollset_destroy(exec_ctx, (grpc_pollset *)p);
+static void destroy_pollset(void *p, grpc_error *error) {
+ grpc_pollset_destroy((grpc_pollset *)p);
}
int main(int argc, char **argv) {
grpc_closure destroyed;
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_test_init(argc, argv);
grpc_init();
@@ -219,8 +213,8 @@ int main(int argc, char **argv) {
test_leftover(configs[3], 1);
GRPC_CLOSURE_INIT(&destroyed, destroy_pollset, g_pollset,
grpc_schedule_on_exec_ctx);
- grpc_pollset_shutdown(&exec_ctx, g_pollset, &destroyed);
- grpc_exec_ctx_finish(&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.c b/test/core/security/ssl_server_fuzzer.c
index f9b754b8f2..98e2b368f7 100644
--- a/test/core/security/ssl_server_fuzzer.c
+++ b/test/core/security/ssl_server_fuzzer.c
@@ -40,8 +40,7 @@ struct handshake_state {
bool done_callback_called;
};
-static void on_handshake_done(grpc_exec_ctx *exec_ctx, void *arg,
- grpc_error *error) {
+static void on_handshake_done(void *arg, grpc_error *error) {
grpc_handshaker_args *args = arg;
struct handshake_state *state = args->user_data;
GPR_ASSERT(state->done_callback_called == false);
@@ -55,17 +54,16 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
if (squelch) gpr_set_log_function(dont_log);
if (leak_check) grpc_memory_counters_init();
grpc_init();
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_resource_quota *resource_quota =
grpc_resource_quota_create("ssl_server_fuzzer");
grpc_endpoint *mock_endpoint =
grpc_mock_endpoint_create(discard_write, resource_quota);
- grpc_resource_quota_unref_internal(&exec_ctx, resource_quota);
+ grpc_resource_quota_unref_internal(resource_quota);
grpc_mock_endpoint_put_read(
- &exec_ctx, mock_endpoint,
- grpc_slice_from_copied_buffer((const char *)data, size));
+ mock_endpoint, grpc_slice_from_copied_buffer((const char *)data, size));
// Load key pair and establish server SSL credentials.
grpc_ssl_pem_key_cert_pair pem_key_cert_pair;
@@ -82,38 +80,37 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
// Create security connector
grpc_server_security_connector *sc = NULL;
grpc_security_status status =
- grpc_server_credentials_create_security_connector(&exec_ctx, creds, &sc);
+ 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(&exec_ctx);
+ grpc_millis deadline = GPR_MS_PER_SEC + grpc_exec_ctx_now();
struct handshake_state state;
state.done_callback_called = false;
grpc_handshake_manager *handshake_mgr = grpc_handshake_manager_create();
- grpc_server_security_connector_add_handshakers(&exec_ctx, sc, handshake_mgr);
+ grpc_server_security_connector_add_handshakers(sc, handshake_mgr);
grpc_handshake_manager_do_handshake(
- &exec_ctx, handshake_mgr, mock_endpoint, NULL /* channel_args */,
- deadline, NULL /* acceptor */, on_handshake_done, &state);
- grpc_exec_ctx_flush(&exec_ctx);
+ handshake_mgr, mock_endpoint, NULL /* channel_args */, deadline,
+ NULL /* acceptor */, on_handshake_done, &state);
+ grpc_exec_ctx_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
// the endpoint.
if (!state.done_callback_called) {
grpc_endpoint_shutdown(
- &exec_ctx, mock_endpoint,
- GRPC_ERROR_CREATE_FROM_STATIC_STRING("Explicit close"));
- grpc_exec_ctx_flush(&exec_ctx);
+ mock_endpoint, GRPC_ERROR_CREATE_FROM_STATIC_STRING("Explicit close"));
+ grpc_exec_ctx_flush();
}
GPR_ASSERT(state.done_callback_called);
- grpc_handshake_manager_destroy(&exec_ctx, handshake_mgr);
- GRPC_SECURITY_CONNECTOR_UNREF(&exec_ctx, &sc->base, "test");
+ grpc_handshake_manager_destroy(handshake_mgr);
+ GRPC_SECURITY_CONNECTOR_UNREF(&sc->base, "test");
grpc_server_credentials_release(creds);
grpc_slice_unref(cert_slice);
grpc_slice_unref(key_slice);
grpc_slice_unref(ca_slice);
- grpc_exec_ctx_flush(&exec_ctx);
+ grpc_exec_ctx_flush();
grpc_shutdown();
if (leak_check) {
diff --git a/test/core/security/verify_jwt.c b/test/core/security/verify_jwt.cc
index cec6fb94b4..13f8acb242 100644
--- a/test/core/security/verify_jwt.c
+++ b/test/core/security/verify_jwt.cc
@@ -44,7 +44,7 @@ static void print_usage_and_exit(gpr_cmdline *cl, const char *argv0) {
exit(1);
}
-static void on_jwt_verification_done(grpc_exec_ctx *exec_ctx, void *user_data,
+static void on_jwt_verification_done(void *user_data,
grpc_jwt_verifier_status status,
grpc_jwt_claims *claims) {
synchronizer *sync = user_data;
@@ -57,7 +57,7 @@ static void on_jwt_verification_done(grpc_exec_ctx *exec_ctx, void *user_data,
grpc_json_dump_to_string((grpc_json *)grpc_jwt_claims_json(claims), 2);
printf("Claims: \n\n%s\n", claims_str);
gpr_free(claims_str);
- grpc_jwt_claims_destroy(exec_ctx, claims);
+ grpc_jwt_claims_destroy(claims);
} else {
GPR_ASSERT(claims == NULL);
fprintf(stderr, "Verification failed with error %s\n",
@@ -66,8 +66,7 @@ static void on_jwt_verification_done(grpc_exec_ctx *exec_ctx, void *user_data,
gpr_mu_lock(sync->mu);
sync->is_done = 1;
- GRPC_LOG_IF_ERROR("pollset_kick",
- grpc_pollset_kick(exec_ctx, sync->pollset, NULL));
+ GRPC_LOG_IF_ERROR("pollset_kick", grpc_pollset_kick(sync->pollset, NULL));
gpr_mu_unlock(sync->mu);
}
@@ -77,7 +76,7 @@ int main(int argc, char **argv) {
gpr_cmdline *cl;
char *jwt = NULL;
char *aud = NULL;
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ ExecCtx _local_exec_ctx;
grpc_init();
cl = gpr_cmdline_create("JWT verifier tool");
@@ -96,26 +95,26 @@ int main(int argc, char **argv) {
grpc_pollset_init(sync.pollset, &sync.mu);
sync.is_done = 0;
- grpc_jwt_verifier_verify(&exec_ctx, verifier, sync.pollset, jwt, aud,
+ grpc_jwt_verifier_verify(verifier, sync.pollset, jwt, aud,
on_jwt_verification_done, &sync);
gpr_mu_lock(sync.mu);
while (!sync.is_done) {
grpc_pollset_worker *worker = NULL;
- if (!GRPC_LOG_IF_ERROR("pollset_work",
- grpc_pollset_work(&exec_ctx, sync.pollset, &worker,
- GRPC_MILLIS_INF_FUTURE)))
+ if (!GRPC_LOG_IF_ERROR(
+ "pollset_work",
+ grpc_pollset_work(sync.pollset, &worker, GRPC_MILLIS_INF_FUTURE)))
sync.is_done = true;
gpr_mu_unlock(sync.mu);
- grpc_exec_ctx_flush(&exec_ctx);
+ grpc_exec_ctx_flush();
gpr_mu_lock(sync.mu);
}
gpr_mu_unlock(sync.mu);
gpr_free(sync.pollset);
- grpc_jwt_verifier_destroy(&exec_ctx, verifier);
- grpc_exec_ctx_finish(&exec_ctx);
+ 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.c b/test/core/slice/b64_test.c
index bd375aa6a7..0740315195 100644
--- a/test/core/slice/b64_test.c
+++ b/test/core/slice/b64_test.c
@@ -44,14 +44,14 @@ static void test_simple_encode_decode_b64(int url_safe, int multiline) {
const char *hello = "hello";
char *hello_b64 =
grpc_base64_encode(hello, strlen(hello), url_safe, multiline);
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_slice hello_slice = grpc_base64_decode(&exec_ctx, hello_b64, url_safe);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_slice hello_slice = grpc_base64_decode(hello_b64, url_safe);
GPR_ASSERT(GRPC_SLICE_LENGTH(hello_slice) == strlen(hello));
GPR_ASSERT(strncmp((const char *)GRPC_SLICE_START_PTR(hello_slice), hello,
GRPC_SLICE_LENGTH(hello_slice)) == 0);
- grpc_slice_unref_internal(&exec_ctx, hello_slice);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_slice_unref_internal(hello_slice);
+ grpc_exec_ctx_finish();
gpr_free(hello_b64);
}
@@ -64,15 +64,15 @@ static void test_full_range_encode_decode_b64(int url_safe, int multiline) {
/* Try all the different paddings. */
for (i = 0; i < 3; i++) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
b64 = grpc_base64_encode(orig, sizeof(orig) - i, url_safe, multiline);
- orig_decoded = grpc_base64_decode(&exec_ctx, b64, url_safe);
+ orig_decoded = grpc_base64_decode(b64, url_safe);
GPR_ASSERT(GRPC_SLICE_LENGTH(orig_decoded) == (sizeof(orig) - i));
GPR_ASSERT(buffers_are_equal(orig, GRPC_SLICE_START_PTR(orig_decoded),
sizeof(orig) - i));
- grpc_slice_unref_internal(&exec_ctx, orig_decoded);
+ grpc_slice_unref_internal(orig_decoded);
gpr_free(b64);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_exec_ctx_finish();
}
}
@@ -116,19 +116,19 @@ static void test_url_safe_unsafe_mismatch_failure(void) {
int url_safe = 1;
for (i = 0; i < sizeof(orig); i++) orig[i] = (uint8_t)i;
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
b64 = grpc_base64_encode(orig, sizeof(orig), url_safe, 0);
- orig_decoded = grpc_base64_decode(&exec_ctx, b64, !url_safe);
+ orig_decoded = grpc_base64_decode(b64, !url_safe);
GPR_ASSERT(GRPC_SLICE_IS_EMPTY(orig_decoded));
gpr_free(b64);
- grpc_slice_unref_internal(&exec_ctx, orig_decoded);
+ grpc_slice_unref_internal(orig_decoded);
b64 = grpc_base64_encode(orig, sizeof(orig), !url_safe, 0);
- orig_decoded = grpc_base64_decode(&exec_ctx, b64, url_safe);
+ orig_decoded = grpc_base64_decode(b64, url_safe);
GPR_ASSERT(GRPC_SLICE_IS_EMPTY(orig_decoded));
gpr_free(b64);
- grpc_slice_unref_internal(&exec_ctx, orig_decoded);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_slice_unref_internal(orig_decoded);
+ grpc_exec_ctx_finish();
}
static void test_rfc4648_test_vectors(void) {
@@ -166,40 +166,40 @@ static void test_rfc4648_test_vectors(void) {
static void test_unpadded_decode(void) {
grpc_slice decoded;
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- decoded = grpc_base64_decode(&exec_ctx, "Zm9vYmFy", 0);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ decoded = grpc_base64_decode("Zm9vYmFy", 0);
GPR_ASSERT(!GRPC_SLICE_IS_EMPTY(decoded));
GPR_ASSERT(grpc_slice_str_cmp(decoded, "foobar") == 0);
grpc_slice_unref(decoded);
- decoded = grpc_base64_decode(&exec_ctx, "Zm9vYmE", 0);
+ decoded = grpc_base64_decode("Zm9vYmE", 0);
GPR_ASSERT(!GRPC_SLICE_IS_EMPTY(decoded));
GPR_ASSERT(grpc_slice_str_cmp(decoded, "fooba") == 0);
grpc_slice_unref(decoded);
- decoded = grpc_base64_decode(&exec_ctx, "Zm9vYg", 0);
+ decoded = grpc_base64_decode("Zm9vYg", 0);
GPR_ASSERT(!GRPC_SLICE_IS_EMPTY(decoded));
GPR_ASSERT(grpc_slice_str_cmp(decoded, "foob") == 0);
grpc_slice_unref(decoded);
- decoded = grpc_base64_decode(&exec_ctx, "Zm9v", 0);
+ decoded = grpc_base64_decode("Zm9v", 0);
GPR_ASSERT(!GRPC_SLICE_IS_EMPTY(decoded));
GPR_ASSERT(grpc_slice_str_cmp(decoded, "foo") == 0);
grpc_slice_unref(decoded);
- decoded = grpc_base64_decode(&exec_ctx, "Zm8", 0);
+ decoded = grpc_base64_decode("Zm8", 0);
GPR_ASSERT(!GRPC_SLICE_IS_EMPTY(decoded));
GPR_ASSERT(grpc_slice_str_cmp(decoded, "fo") == 0);
grpc_slice_unref(decoded);
- decoded = grpc_base64_decode(&exec_ctx, "Zg", 0);
+ decoded = grpc_base64_decode("Zg", 0);
GPR_ASSERT(!GRPC_SLICE_IS_EMPTY(decoded));
GPR_ASSERT(grpc_slice_str_cmp(decoded, "f") == 0);
grpc_slice_unref(decoded);
- decoded = grpc_base64_decode(&exec_ctx, "", 0);
+ decoded = grpc_base64_decode("", 0);
GPR_ASSERT(GRPC_SLICE_IS_EMPTY(decoded));
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_exec_ctx_finish();
}
int main(int argc, char **argv) {
diff --git a/test/core/slice/slice_hash_table_test.c b/test/core/slice/slice_hash_table_test.c
index f3689aac64..67748433b1 100644
--- a/test/core/slice/slice_hash_table_test.c
+++ b/test/core/slice/slice_hash_table_test.c
@@ -58,9 +58,7 @@ static void check_non_existent_value(const char* key_string,
grpc_slice_unref(key);
}
-static void destroy_string(grpc_exec_ctx* exec_ctx, void* value) {
- gpr_free(value);
-}
+static void destroy_string(void* value) { gpr_free(value); }
static grpc_slice_hash_table* create_table_from_entries(
const test_entry* test_entries, size_t num_test_entries,
@@ -119,9 +117,9 @@ static void test_slice_hash_table() {
check_values(test_entries, num_entries, table);
check_non_existent_value("XX", table);
// Clean up.
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_slice_hash_table_unref(&exec_ctx, table);
- grpc_exec_ctx_finish(&exec_ctx);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_slice_hash_table_unref(table);
+ grpc_exec_ctx_finish();
}
static int value_cmp_fn(void* a, void* b) {
@@ -147,10 +145,10 @@ static void test_slice_hash_table_eq() {
create_table_from_entries(test_entries_b, num_entries_b, value_cmp_fn);
GPR_ASSERT(grpc_slice_hash_table_cmp(table_a, table_b) == 0);
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_slice_hash_table_unref(&exec_ctx, table_a);
- grpc_slice_hash_table_unref(&exec_ctx, table_b);
- grpc_exec_ctx_finish(&exec_ctx);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ 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() {
@@ -219,17 +217,17 @@ static void test_slice_hash_table_not_eq() {
create_table_from_entries(test_entries_h, num_entries_h, pointer_cmp_fn);
GPR_ASSERT(grpc_slice_hash_table_cmp(table_g, table_h) != 0);
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_slice_hash_table_unref(&exec_ctx, table_a);
- grpc_slice_hash_table_unref(&exec_ctx, table_b_larger);
- grpc_slice_hash_table_unref(&exec_ctx, table_b_smaller);
- grpc_slice_hash_table_unref(&exec_ctx, table_c);
- grpc_slice_hash_table_unref(&exec_ctx, table_d);
- grpc_slice_hash_table_unref(&exec_ctx, table_e);
- grpc_slice_hash_table_unref(&exec_ctx, table_f);
- grpc_slice_hash_table_unref(&exec_ctx, table_g);
- grpc_slice_hash_table_unref(&exec_ctx, table_h);
- grpc_exec_ctx_finish(&exec_ctx);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_slice_hash_table_unref(table_a);
+ grpc_slice_hash_table_unref(table_b_larger);
+ grpc_slice_hash_table_unref(table_b_smaller);
+ grpc_slice_hash_table_unref(table_c);
+ grpc_slice_hash_table_unref(table_d);
+ grpc_slice_hash_table_unref(table_e);
+ 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.c b/test/core/surface/byte_buffer_reader_test.c
index a6b4c86abc..820f56e15b 100644
--- a/test/core/surface/byte_buffer_reader_test.c
+++ b/test/core/surface/byte_buffer_reader_test.c
@@ -132,10 +132,9 @@ static void read_compressed_slice(grpc_compression_algorithm algorithm,
memset(GRPC_SLICE_START_PTR(input_slice), 'a', input_size);
grpc_slice_buffer_add(&sliceb_in, input_slice); /* takes ownership */
{
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- GPR_ASSERT(
- grpc_msg_compress(&exec_ctx, algorithm, &sliceb_in, &sliceb_out));
- grpc_exec_ctx_finish(&exec_ctx);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ 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.c b/test/core/surface/channel_create_test.c
index a6884750e7..61cf2f7f3c 100644
--- a/test/core/surface/channel_create_test.c
+++ b/test/core/surface/channel_create_test.c
@@ -35,11 +35,11 @@ void test_unknown_scheme_target(void) {
chan = grpc_insecure_channel_create("blah://blah", NULL, NULL);
GPR_ASSERT(chan != NULL);
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
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(&exec_ctx);
+ grpc_exec_ctx_finish();
grpc_channel_destroy(chan);
}
diff --git a/test/core/surface/completion_queue_test.c b/test/core/surface/completion_queue_test.c
index e6372a379c..21e23fd500 100644
--- a/test/core/surface/completion_queue_test.c
+++ b/test/core/surface/completion_queue_test.c
@@ -120,8 +120,7 @@ static void test_wait_empty(void) {
}
}
-static void do_nothing_end_completion(grpc_exec_ctx *exec_ctx, void *arg,
- grpc_cq_completion *c) {}
+static void do_nothing_end_completion(void *arg, grpc_cq_completion *c) {}
static void test_cq_end_op(void) {
grpc_event ev;
@@ -130,8 +129,6 @@ static void test_cq_end_op(void) {
grpc_cq_polling_type polling_types[] = {
GRPC_CQ_DEFAULT_POLLING, GRPC_CQ_NON_LISTENING, GRPC_CQ_NON_POLLING};
grpc_completion_queue_attributes attr;
- grpc_exec_ctx init_exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_exec_ctx exec_ctx;
void *tag = create_test_tag();
LOG_TEST("test_cq_end_op");
@@ -139,14 +136,13 @@ static void test_cq_end_op(void) {
attr.version = 1;
attr.cq_completion_type = GRPC_CQ_NEXT;
for (size_t i = 0; i < GPR_ARRAY_SIZE(polling_types); i++) {
- exec_ctx = init_exec_ctx; // Reset exec_ctx
attr.cq_polling_type = polling_types[i];
cc = grpc_completion_queue_create(
grpc_completion_queue_factory_lookup(&attr), &attr, NULL);
GPR_ASSERT(grpc_cq_begin_op(cc, tag));
- grpc_cq_end_op(&exec_ctx, cc, tag, GRPC_ERROR_NONE,
- do_nothing_end_completion, NULL, &completion);
+ grpc_cq_end_op(cc, tag, GRPC_ERROR_NONE, do_nothing_end_completion, NULL,
+ &completion);
ev = grpc_completion_queue_next(cc, gpr_inf_past(GPR_CLOCK_REALTIME), NULL);
GPR_ASSERT(ev.type == GRPC_OP_COMPLETE);
@@ -154,7 +150,7 @@ static void test_cq_end_op(void) {
GPR_ASSERT(ev.success);
shutdown_and_destroy(cc);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_exec_ctx_finish();
}
}
@@ -211,8 +207,6 @@ static void test_pluck(void) {
grpc_cq_polling_type polling_types[] = {
GRPC_CQ_DEFAULT_POLLING, GRPC_CQ_NON_LISTENING, GRPC_CQ_NON_POLLING};
grpc_completion_queue_attributes attr;
- grpc_exec_ctx init_exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_exec_ctx exec_ctx;
unsigned i, j;
LOG_TEST("test_pluck");
@@ -227,15 +221,14 @@ static void test_pluck(void) {
attr.version = 1;
attr.cq_completion_type = GRPC_CQ_PLUCK;
for (size_t pidx = 0; pidx < GPR_ARRAY_SIZE(polling_types); pidx++) {
- exec_ctx = init_exec_ctx; // reset exec_ctx
attr.cq_polling_type = polling_types[pidx];
cc = grpc_completion_queue_create(
grpc_completion_queue_factory_lookup(&attr), &attr, NULL);
for (i = 0; i < GPR_ARRAY_SIZE(tags); i++) {
GPR_ASSERT(grpc_cq_begin_op(cc, tags[i]));
- grpc_cq_end_op(&exec_ctx, cc, tags[i], GRPC_ERROR_NONE,
- do_nothing_end_completion, NULL, &completions[i]);
+ grpc_cq_end_op(cc, tags[i], GRPC_ERROR_NONE, do_nothing_end_completion,
+ NULL, &completions[i]);
}
for (i = 0; i < GPR_ARRAY_SIZE(tags); i++) {
@@ -246,8 +239,8 @@ static void test_pluck(void) {
for (i = 0; i < GPR_ARRAY_SIZE(tags); i++) {
GPR_ASSERT(grpc_cq_begin_op(cc, tags[i]));
- grpc_cq_end_op(&exec_ctx, cc, tags[i], GRPC_ERROR_NONE,
- do_nothing_end_completion, NULL, &completions[i]);
+ grpc_cq_end_op(cc, tags[i], GRPC_ERROR_NONE, do_nothing_end_completion,
+ NULL, &completions[i]);
}
for (i = 0; i < GPR_ARRAY_SIZE(tags); i++) {
@@ -257,7 +250,7 @@ static void test_pluck(void) {
}
shutdown_and_destroy(cc);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_exec_ctx_finish();
}
}
diff --git a/test/core/surface/completion_queue_threading_test.c b/test/core/surface/completion_queue_threading_test.cc
index 9996b6b840..8a8d87be1a 100644
--- a/test/core/surface/completion_queue_threading_test.c
+++ b/test/core/surface/completion_queue_threading_test.cc
@@ -59,8 +59,7 @@ static void shutdown_and_destroy(grpc_completion_queue *cc) {
grpc_completion_queue_destroy(cc);
}
-static void do_nothing_end_completion(grpc_exec_ctx *exec_ctx, void *arg,
- grpc_cq_completion *c) {}
+static void do_nothing_end_completion(void *arg, grpc_cq_completion *c) {}
struct thread_state {
grpc_completion_queue *cc;
@@ -81,7 +80,7 @@ static void test_too_many_plucks(void) {
gpr_thd_id thread_ids[GPR_ARRAY_SIZE(tags)];
struct thread_state thread_states[GPR_ARRAY_SIZE(tags)];
gpr_thd_options thread_options = gpr_thd_options_default();
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ ExecCtx _local_exec_ctx;
unsigned i, j;
LOG_TEST("test_too_many_plucks");
@@ -108,8 +107,8 @@ static void test_too_many_plucks(void) {
for (i = 0; i < GPR_ARRAY_SIZE(tags); i++) {
GPR_ASSERT(grpc_cq_begin_op(cc, tags[i]));
- grpc_cq_end_op(&exec_ctx, cc, tags[i], GRPC_ERROR_NONE,
- do_nothing_end_completion, NULL, &completions[i]);
+ grpc_cq_end_op(cc, tags[i], GRPC_ERROR_NONE, do_nothing_end_completion,
+ NULL, &completions[i]);
}
for (i = 0; i < GPR_ARRAY_SIZE(tags); i++) {
@@ -117,7 +116,7 @@ static void test_too_many_plucks(void) {
}
shutdown_and_destroy(cc);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_exec_ctx_finish();
}
#define TEST_THREAD_EVENTS 10000
@@ -137,15 +136,14 @@ gpr_timespec ten_seconds_time(void) {
return grpc_timeout_seconds_to_deadline(10);
}
-static void free_completion(grpc_exec_ctx *exec_ctx, void *arg,
- grpc_cq_completion *completion) {
+static void free_completion(void *arg, grpc_cq_completion *completion) {
gpr_free(completion);
}
static void producer_thread(void *arg) {
test_thread_options *opt = arg;
int i;
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ ExecCtx _local_exec_ctx;
gpr_log(GPR_INFO, "producer %d started", opt->id);
gpr_event_set(&opt->on_started, (void *)(intptr_t)1);
@@ -162,16 +160,16 @@ static void producer_thread(void *arg) {
gpr_log(GPR_INFO, "producer %d phase 2", opt->id);
for (i = 0; i < TEST_THREAD_EVENTS; i++) {
- grpc_cq_end_op(&exec_ctx, opt->cc, (void *)(intptr_t)1, GRPC_ERROR_NONE,
+ grpc_cq_end_op(opt->cc, (void *)(intptr_t)1, GRPC_ERROR_NONE,
free_completion, NULL,
gpr_malloc(sizeof(grpc_cq_completion)));
opt->events_triggered++;
- grpc_exec_ctx_finish(&exec_ctx);
+ 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(&exec_ctx);
+ grpc_exec_ctx_finish();
}
static void consumer_thread(void *arg) {
diff --git a/test/core/surface/concurrent_connectivity_test.c b/test/core/surface/concurrent_connectivity_test.c
index 3595885ff6..28bdf5d1d3 100644
--- a/test/core/surface/concurrent_connectivity_test.c
+++ b/test/core/surface/concurrent_connectivity_test.c
@@ -99,29 +99,28 @@ void server_thread(void *vargs) {
GPR_ASSERT(detag(ev.tag) == 0xd1e);
}
-static void on_connect(grpc_exec_ctx *exec_ctx, void *vargs, grpc_endpoint *tcp,
+static void on_connect(void *vargs, grpc_endpoint *tcp,
grpc_pollset *accepting_pollset,
grpc_tcp_server_acceptor *acceptor) {
gpr_free(acceptor);
struct server_thread_args *args = (struct server_thread_args *)vargs;
- grpc_endpoint_shutdown(exec_ctx, tcp,
+ grpc_endpoint_shutdown(tcp,
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Connected"));
- grpc_endpoint_destroy(exec_ctx, tcp);
+ grpc_endpoint_destroy(tcp);
gpr_mu_lock(args->mu);
- GRPC_LOG_IF_ERROR("pollset_kick",
- grpc_pollset_kick(exec_ctx, args->pollset, NULL));
+ GRPC_LOG_IF_ERROR("pollset_kick", grpc_pollset_kick(args->pollset, NULL));
gpr_mu_unlock(args->mu);
}
void bad_server_thread(void *vargs) {
struct server_thread_args *args = (struct server_thread_args *)vargs;
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_resolved_address resolved_addr;
struct sockaddr_storage *addr = (struct sockaddr_storage *)resolved_addr.addr;
int port;
grpc_tcp_server *s;
- grpc_error *error = grpc_tcp_server_create(&exec_ctx, NULL, NULL, &s);
+ grpc_error *error = grpc_tcp_server_create(NULL, NULL, &s);
GPR_ASSERT(error == GRPC_ERROR_NONE);
memset(&resolved_addr, 0, sizeof(resolved_addr));
addr->ss_family = AF_INET;
@@ -130,35 +129,34 @@ void bad_server_thread(void *vargs) {
GPR_ASSERT(port > 0);
gpr_asprintf(&args->addr, "localhost:%d", port);
- grpc_tcp_server_start(&exec_ctx, s, &args->pollset, 1, on_connect, args);
+ grpc_tcp_server_start(s, &args->pollset, 1, on_connect, args);
gpr_event_set(&args->ready, (void *)1);
gpr_mu_lock(args->mu);
while (gpr_atm_acq_load(&args->stop) == 0) {
- grpc_millis deadline = grpc_exec_ctx_now(&exec_ctx) + 100;
+ grpc_millis deadline = grpc_exec_ctx_now() + 100;
grpc_pollset_worker *worker = NULL;
if (!GRPC_LOG_IF_ERROR(
"pollset_work",
- grpc_pollset_work(&exec_ctx, args->pollset, &worker, deadline))) {
+ grpc_pollset_work(args->pollset, &worker, deadline))) {
gpr_atm_rel_store(&args->stop, 1);
}
gpr_mu_unlock(args->mu);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_exec_ctx_finish();
gpr_mu_lock(args->mu);
}
gpr_mu_unlock(args->mu);
- grpc_tcp_server_unref(&exec_ctx, s);
+ grpc_tcp_server_unref(s);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_exec_ctx_finish();
gpr_free(args->addr);
}
-static void done_pollset_shutdown(grpc_exec_ctx *exec_ctx, void *pollset,
- grpc_error *error) {
- grpc_pollset_destroy(exec_ctx, pollset);
+static void done_pollset_shutdown(void *pollset, grpc_error *error) {
+ grpc_pollset_destroy(pollset);
gpr_free(pollset);
}
@@ -226,11 +224,11 @@ int run_concurrent_connectivity_test() {
gpr_atm_rel_store(&args.stop, 1);
gpr_thd_join(server);
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_pollset_shutdown(&exec_ctx, args.pollset,
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_pollset_shutdown(args.pollset,
GRPC_CLOSURE_CREATE(done_pollset_shutdown, args.pollset,
grpc_schedule_on_exec_ctx));
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_exec_ctx_finish();
grpc_shutdown();
return 0;
diff --git a/test/core/surface/lame_client_test.c b/test/core/surface/lame_client_test.c
index f623e1a743..f3890743d0 100644
--- a/test/core/surface/lame_client_test.c
+++ b/test/core/surface/lame_client_test.c
@@ -32,20 +32,19 @@ grpc_closure transport_op_cb;
static void *tag(intptr_t x) { return (void *)x; }
-void verify_connectivity(grpc_exec_ctx *exec_ctx, void *arg,
- grpc_error *error) {
+void verify_connectivity(void *arg, grpc_error *error) {
grpc_connectivity_state *state = arg;
GPR_ASSERT(GRPC_CHANNEL_SHUTDOWN == *state);
GPR_ASSERT(error == GRPC_ERROR_NONE);
}
-void do_nothing(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) {}
+void do_nothing(void *arg, grpc_error *error) {}
void test_transport_op(grpc_channel *channel) {
grpc_transport_op *op;
grpc_channel_element *elem;
grpc_connectivity_state state = GRPC_CHANNEL_IDLE;
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
GRPC_CLOSURE_INIT(&transport_op_cb, verify_connectivity, &state,
grpc_schedule_on_exec_ctx);
@@ -54,14 +53,14 @@ void test_transport_op(grpc_channel *channel) {
op->on_connectivity_state_change = &transport_op_cb;
op->connectivity_state = &state;
elem = grpc_channel_stack_element(grpc_channel_get_channel_stack(channel), 0);
- elem->filter->start_transport_op(&exec_ctx, elem, op);
- grpc_exec_ctx_finish(&exec_ctx);
+ 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(&exec_ctx, elem, op);
- grpc_exec_ctx_finish(&exec_ctx);
+ 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.c b/test/core/surface/num_external_connectivity_watchers_test.c
index 16401bb7ac..5c71d41bfc 100644
--- a/test/core/surface/num_external_connectivity_watchers_test.c
+++ b/test/core/surface/num_external_connectivity_watchers_test.c
@@ -176,9 +176,9 @@ static grpc_channel *secure_test_create_channel(const char *addr) {
grpc_channel *channel =
grpc_secure_channel_create(ssl_creds, addr, new_client_args, NULL);
{
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_channel_args_destroy(&exec_ctx, new_client_args);
- grpc_exec_ctx_finish(&exec_ctx);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ 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.c b/test/core/surface/secure_channel_create_test.c
index 0c45135501..78062cb2d1 100644
--- a/test/core/surface/secure_channel_create_test.c
+++ b/test/core/surface/secure_channel_create_test.c
@@ -37,10 +37,10 @@ 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 exec_ctx = GRPC_EXEC_CTX_INIT;
- GRPC_CHANNEL_INTERNAL_UNREF(&exec_ctx, chan, "test");
- grpc_channel_credentials_unref(&exec_ctx, creds);
- grpc_exec_ctx_finish(&exec_ctx);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ GRPC_CHANNEL_INTERNAL_UNREF(chan, "test");
+ grpc_channel_credentials_unref(creds);
+ grpc_exec_ctx_finish();
}
void test_security_connector_already_in_arg(void) {
@@ -55,9 +55,9 @@ void test_security_connector_already_in_arg(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 exec_ctx = GRPC_EXEC_CTX_INIT;
- GRPC_CHANNEL_INTERNAL_UNREF(&exec_ctx, chan, "test");
- grpc_exec_ctx_finish(&exec_ctx);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ GRPC_CHANNEL_INTERNAL_UNREF(chan, "test");
+ grpc_exec_ctx_finish();
}
void test_null_creds(void) {
@@ -65,9 +65,9 @@ void test_null_creds(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 exec_ctx = GRPC_EXEC_CTX_INIT;
- GRPC_CHANNEL_INTERNAL_UNREF(&exec_ctx, chan, "test");
- grpc_exec_ctx_finish(&exec_ctx);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ 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.c b/test/core/surface/sequential_connectivity_test.c
index d5fd2db81b..ae5288427f 100644
--- a/test/core/surface/sequential_connectivity_test.c
+++ b/test/core/surface/sequential_connectivity_test.c
@@ -153,9 +153,9 @@ static grpc_channel *secure_test_create_channel(const char *addr) {
grpc_channel *channel =
grpc_secure_channel_create(ssl_creds, addr, new_client_args, NULL);
{
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_channel_args_destroy(&exec_ctx, new_client_args);
- grpc_exec_ctx_finish(&exec_ctx);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ 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 7ac35016c0..cf1b422043 100644
--- a/test/core/transport/bdp_estimator_test.cc
+++ b/test/core/transport/bdp_estimator_test.cc
@@ -23,92 +23,97 @@
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
#include <grpc/support/useful.h>
-#include <gtest/gtest.h>
#include <limits.h>
#include "src/core/lib/iomgr/timer_manager.h"
#include "src/core/lib/support/string.h"
#include "test/core/util/test_config.h"
-extern "C" gpr_timespec (*gpr_now_impl)(gpr_clock_type clock_type);
+extern gpr_timespec (*gpr_now_impl)(gpr_clock_type clock_type);
-namespace grpc_core {
-namespace testing {
-namespace {
-int g_clock = 0;
+static int g_clock = 0;
-gpr_timespec fake_gpr_now(gpr_clock_type clock_type) {
- gpr_timespec ts;
- ts.tv_sec = g_clock;
- ts.tv_nsec = 0;
- ts.clock_type = clock_type;
- return ts;
+static gpr_timespec fake_gpr_now(gpr_clock_type clock_type) {
+ return (gpr_timespec){
+ .tv_sec = g_clock, .tv_nsec = 0, .clock_type = clock_type,
+ };
}
-void inc_time(void) { g_clock += 30; }
-} // namespace
+static void inc_time(void) { g_clock += 30; }
-TEST(BdpEstimatorTest, NoOp) { BdpEstimator est("test"); }
+static void test_noop(void) {
+ gpr_log(GPR_INFO, "test_noop");
+ grpc_bdp_estimator est;
+ grpc_bdp_estimator_init(&est, "test");
+}
-TEST(BdpEstimatorTest, EstimateBdpNoSamples) {
- BdpEstimator est("test");
+static void test_get_estimate_no_samples(void) {
+ gpr_log(GPR_INFO, "test_get_estimate_no_samples");
+ grpc_bdp_estimator est;
+ grpc_bdp_estimator_init(&est, "test");
int64_t estimate;
- est.EstimateBdp(&estimate);
+ grpc_bdp_estimator_get_estimate(&est, &estimate);
}
-namespace {
-void AddSamples(BdpEstimator *estimator, int64_t *samples, size_t n) {
- estimator->AddIncomingBytes(1234567);
+static void add_samples(grpc_bdp_estimator *estimator, int64_t *samples,
+ size_t n) {
+ grpc_bdp_estimator_add_incoming_bytes(estimator, 1234567);
inc_time();
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- estimator->SchedulePing();
- estimator->StartPing();
+
+ GPR_ASSERT(grpc_bdp_estimator_need_ping(estimator) == true);
+ grpc_bdp_estimator_schedule_ping(estimator);
+ grpc_bdp_estimator_start_ping(estimator);
+
for (size_t i = 0; i < n; i++) {
- estimator->AddIncomingBytes(samples[i]);
+ grpc_bdp_estimator_add_incoming_bytes(estimator, samples[i]);
+ GPR_ASSERT(grpc_bdp_estimator_need_ping(estimator) == false);
}
gpr_sleep_until(gpr_time_add(gpr_now(GPR_CLOCK_REALTIME),
gpr_time_from_millis(1, GPR_TIMESPAN)));
- grpc_exec_ctx_invalidate_now(&exec_ctx);
- estimator->CompletePing(&exec_ctx);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_bdp_estimator_complete_ping(estimator);
+ grpc_exec_ctx_finish();
}
-void AddSample(BdpEstimator *estimator, int64_t sample) {
- AddSamples(estimator, &sample, 1);
+static void add_sample(grpc_bdp_estimator *estimator, int64_t sample) {
+ add_samples(estimator, &sample, 1);
}
-} // namespace
-TEST(BdpEstimatorTest, GetEstimate1Sample) {
- BdpEstimator est("test");
- AddSample(&est, 100);
+static void test_get_estimate_1_sample(void) {
+ gpr_log(GPR_INFO, "test_get_estimate_1_sample");
+ grpc_bdp_estimator est;
+ grpc_bdp_estimator_init(&est, "test");
+ add_sample(&est, 100);
int64_t estimate;
- est.EstimateBdp(&estimate);
+ grpc_bdp_estimator_get_estimate(&est, &estimate);
}
-TEST(BdpEstimatorTest, GetEstimate2Samples) {
- BdpEstimator est("test");
- AddSample(&est, 100);
- AddSample(&est, 100);
+static void test_get_estimate_2_samples(void) {
+ gpr_log(GPR_INFO, "test_get_estimate_2_samples");
+ grpc_bdp_estimator est;
+ grpc_bdp_estimator_init(&est, "test");
+ add_sample(&est, 100);
+ add_sample(&est, 100);
int64_t estimate;
- est.EstimateBdp(&estimate);
+ grpc_bdp_estimator_get_estimate(&est, &estimate);
}
-TEST(BdpEstimatorTest, GetEstimate3Samples) {
- BdpEstimator est("test");
- AddSample(&est, 100);
- AddSample(&est, 100);
- AddSample(&est, 100);
- int64_t estimate;
- est.EstimateBdp(&estimate);
-}
-
-namespace {
-static int64_t GetEstimate(const BdpEstimator &estimator) {
+static int64_t get_estimate(grpc_bdp_estimator *estimator) {
int64_t out;
- EXPECT_TRUE(estimator.EstimateBdp(&out));
+ GPR_ASSERT(grpc_bdp_estimator_get_estimate(estimator, &out));
return out;
}
-int64_t NextPow2(int64_t v) {
+static void test_get_estimate_3_samples(void) {
+ gpr_log(GPR_INFO, "test_get_estimate_3_samples");
+ grpc_bdp_estimator est;
+ grpc_bdp_estimator_init(&est, "test");
+ add_sample(&est, 100);
+ add_sample(&est, 100);
+ add_sample(&est, 100);
+ int64_t estimate;
+ grpc_bdp_estimator_get_estimate(&est, &estimate);
+}
+
+static int64_t next_pow_2(int64_t v) {
v--;
v |= v >> 1;
v |= v >> 2;
@@ -119,40 +124,40 @@ int64_t NextPow2(int64_t v) {
v++;
return v;
}
-} // namespace
-
-class BdpEstimatorRandomTest : public ::testing::TestWithParam<size_t> {};
-TEST_P(BdpEstimatorRandomTest, GetEstimateRandomValues) {
- BdpEstimator est("test");
+static void test_get_estimate_random_values(size_t n) {
+ gpr_log(GPR_INFO, "test_get_estimate_random_values(%" PRIdPTR ")", n);
+ grpc_bdp_estimator est;
+ grpc_bdp_estimator_init(&est, "test");
const int kMaxSample = 65535;
int min = kMaxSample;
int max = 0;
- for (size_t i = 0; i < GetParam(); i++) {
+ for (size_t i = 0; i < n; i++) {
int sample = rand() % (kMaxSample + 1);
if (sample < min) min = sample;
if (sample > max) max = sample;
- AddSample(&est, sample);
+ add_sample(&est, sample);
if (i >= 3) {
- EXPECT_LE(GetEstimate(est), GPR_MAX(65536, 2 * NextPow2(max)))
- << " min:" << min << " max:" << max << " sample:" << sample;
+ gpr_log(GPR_DEBUG, "est:%" PRId64 " min:%d max:%d", get_estimate(&est),
+ min, max);
+ GPR_ASSERT(get_estimate(&est) <= GPR_MAX(65536, 2 * next_pow_2(max)));
}
}
}
-INSTANTIATE_TEST_CASE_P(TooManyNames, BdpEstimatorRandomTest,
- ::testing::Values(3, 4, 6, 9, 13, 19, 28, 42, 63, 94,
- 141, 211, 316, 474, 711));
-} // namespace testing
-} // namespace grpc_core
-
int main(int argc, char **argv) {
grpc_test_init(argc, argv);
- gpr_now_impl = grpc_core::testing::fake_gpr_now;
+ gpr_now_impl = fake_gpr_now;
grpc_init();
grpc_timer_manager_set_threading(false);
- ::testing::InitGoogleTest(&argc, argv);
- int ret = RUN_ALL_TESTS();
+ test_noop();
+ test_get_estimate_no_samples();
+ test_get_estimate_1_sample();
+ test_get_estimate_2_samples();
+ test_get_estimate_3_samples();
+ for (size_t i = 3; i < 1000; i = i * 3 / 2) {
+ test_get_estimate_random_values(i);
+ }
grpc_shutdown();
- return ret;
+ return 0;
}
diff --git a/test/core/transport/byte_stream_test.c b/test/core/transport/byte_stream_test.c
index a0c5f961cf..3516c191e2 100644
--- a/test/core/transport/byte_stream_test.c
+++ b/test/core/transport/byte_stream_test.c
@@ -30,14 +30,13 @@
// grpc_slice_buffer_stream tests
//
-static void not_called_closure(grpc_exec_ctx *exec_ctx, void *arg,
- grpc_error *error) {
+static void not_called_closure(void *arg, grpc_error *error) {
GPR_ASSERT(false);
}
static void test_slice_buffer_stream_basic(void) {
gpr_log(GPR_DEBUG, "test_slice_buffer_stream_basic");
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
// Create and populate slice buffer.
grpc_slice_buffer buffer;
grpc_slice_buffer_init(&buffer);
@@ -57,23 +56,22 @@ static void test_slice_buffer_stream_basic(void) {
grpc_schedule_on_exec_ctx);
// Read each slice. Note that next() always returns synchronously.
for (size_t i = 0; i < GPR_ARRAY_SIZE(input); ++i) {
- GPR_ASSERT(
- grpc_byte_stream_next(&exec_ctx, &stream.base, ~(size_t)0, &closure));
+ GPR_ASSERT(grpc_byte_stream_next(&stream.base, ~(size_t)0, &closure));
grpc_slice output;
- grpc_error *error = grpc_byte_stream_pull(&exec_ctx, &stream.base, &output);
+ grpc_error *error = grpc_byte_stream_pull(&stream.base, &output);
GPR_ASSERT(error == GRPC_ERROR_NONE);
GPR_ASSERT(grpc_slice_eq(input[i], output));
- grpc_slice_unref_internal(&exec_ctx, output);
+ grpc_slice_unref_internal(output);
}
// Clean up.
- grpc_byte_stream_destroy(&exec_ctx, &stream.base);
- grpc_slice_buffer_destroy_internal(&exec_ctx, &buffer);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_byte_stream_destroy(&stream.base);
+ grpc_slice_buffer_destroy_internal(&buffer);
+ grpc_exec_ctx_finish();
}
static void test_slice_buffer_stream_shutdown(void) {
gpr_log(GPR_DEBUG, "test_slice_buffer_stream_shutdown");
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
// Create and populate slice buffer.
grpc_slice_buffer buffer;
grpc_slice_buffer_init(&buffer);
@@ -92,29 +90,26 @@ static void test_slice_buffer_stream_shutdown(void) {
GRPC_CLOSURE_INIT(&closure, not_called_closure, NULL,
grpc_schedule_on_exec_ctx);
// Read the first slice.
- GPR_ASSERT(
- grpc_byte_stream_next(&exec_ctx, &stream.base, ~(size_t)0, &closure));
+ GPR_ASSERT(grpc_byte_stream_next(&stream.base, ~(size_t)0, &closure));
grpc_slice output;
- grpc_error *error = grpc_byte_stream_pull(&exec_ctx, &stream.base, &output);
+ grpc_error *error = grpc_byte_stream_pull(&stream.base, &output);
GPR_ASSERT(error == GRPC_ERROR_NONE);
GPR_ASSERT(grpc_slice_eq(input[0], output));
- grpc_slice_unref_internal(&exec_ctx, output);
+ grpc_slice_unref_internal(output);
// Now shutdown.
grpc_error *shutdown_error =
GRPC_ERROR_CREATE_FROM_STATIC_STRING("shutdown error");
- grpc_byte_stream_shutdown(&exec_ctx, &stream.base,
- GRPC_ERROR_REF(shutdown_error));
+ grpc_byte_stream_shutdown(&stream.base, GRPC_ERROR_REF(shutdown_error));
// After shutdown, the next pull() should return the error.
- GPR_ASSERT(
- grpc_byte_stream_next(&exec_ctx, &stream.base, ~(size_t)0, &closure));
- error = grpc_byte_stream_pull(&exec_ctx, &stream.base, &output);
+ GPR_ASSERT(grpc_byte_stream_next(&stream.base, ~(size_t)0, &closure));
+ error = grpc_byte_stream_pull(&stream.base, &output);
GPR_ASSERT(error == shutdown_error);
GRPC_ERROR_UNREF(error);
GRPC_ERROR_UNREF(shutdown_error);
// Clean up.
- grpc_byte_stream_destroy(&exec_ctx, &stream.base);
- grpc_slice_buffer_destroy_internal(&exec_ctx, &buffer);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_byte_stream_destroy(&stream.base);
+ grpc_slice_buffer_destroy_internal(&buffer);
+ grpc_exec_ctx_finish();
}
//
@@ -123,7 +118,7 @@ static void test_slice_buffer_stream_shutdown(void) {
static void test_caching_byte_stream_basic(void) {
gpr_log(GPR_DEBUG, "test_caching_byte_stream_basic");
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
// Create and populate slice buffer byte stream.
grpc_slice_buffer buffer;
grpc_slice_buffer_init(&buffer);
@@ -147,24 +142,23 @@ static void test_caching_byte_stream_basic(void) {
// Read each slice. Note that next() always returns synchronously,
// because the underlying byte stream always does.
for (size_t i = 0; i < GPR_ARRAY_SIZE(input); ++i) {
- GPR_ASSERT(
- grpc_byte_stream_next(&exec_ctx, &stream.base, ~(size_t)0, &closure));
+ GPR_ASSERT(grpc_byte_stream_next(&stream.base, ~(size_t)0, &closure));
grpc_slice output;
- grpc_error *error = grpc_byte_stream_pull(&exec_ctx, &stream.base, &output);
+ grpc_error *error = grpc_byte_stream_pull(&stream.base, &output);
GPR_ASSERT(error == GRPC_ERROR_NONE);
GPR_ASSERT(grpc_slice_eq(input[i], output));
- grpc_slice_unref_internal(&exec_ctx, output);
+ grpc_slice_unref_internal(output);
}
// Clean up.
- grpc_byte_stream_destroy(&exec_ctx, &stream.base);
- grpc_byte_stream_cache_destroy(&exec_ctx, &cache);
- grpc_slice_buffer_destroy_internal(&exec_ctx, &buffer);
- grpc_exec_ctx_finish(&exec_ctx);
+ 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) {
gpr_log(GPR_DEBUG, "test_caching_byte_stream_reset");
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
// Create and populate slice buffer byte stream.
grpc_slice_buffer buffer;
grpc_slice_buffer_init(&buffer);
@@ -186,34 +180,32 @@ static void test_caching_byte_stream_reset(void) {
GRPC_CLOSURE_INIT(&closure, not_called_closure, NULL,
grpc_schedule_on_exec_ctx);
// Read one slice.
- GPR_ASSERT(
- grpc_byte_stream_next(&exec_ctx, &stream.base, ~(size_t)0, &closure));
+ GPR_ASSERT(grpc_byte_stream_next(&stream.base, ~(size_t)0, &closure));
grpc_slice output;
- grpc_error *error = grpc_byte_stream_pull(&exec_ctx, &stream.base, &output);
+ grpc_error *error = grpc_byte_stream_pull(&stream.base, &output);
GPR_ASSERT(error == GRPC_ERROR_NONE);
GPR_ASSERT(grpc_slice_eq(input[0], output));
- grpc_slice_unref_internal(&exec_ctx, output);
+ grpc_slice_unref_internal(output);
// Reset the caching stream. The reads should start over from the
// first slice.
grpc_caching_byte_stream_reset(&stream);
for (size_t i = 0; i < GPR_ARRAY_SIZE(input); ++i) {
- GPR_ASSERT(
- grpc_byte_stream_next(&exec_ctx, &stream.base, ~(size_t)0, &closure));
- error = grpc_byte_stream_pull(&exec_ctx, &stream.base, &output);
+ GPR_ASSERT(grpc_byte_stream_next(&stream.base, ~(size_t)0, &closure));
+ error = grpc_byte_stream_pull(&stream.base, &output);
GPR_ASSERT(error == GRPC_ERROR_NONE);
GPR_ASSERT(grpc_slice_eq(input[i], output));
- grpc_slice_unref_internal(&exec_ctx, output);
+ grpc_slice_unref_internal(output);
}
// Clean up.
- grpc_byte_stream_destroy(&exec_ctx, &stream.base);
- grpc_byte_stream_cache_destroy(&exec_ctx, &cache);
- grpc_slice_buffer_destroy_internal(&exec_ctx, &buffer);
- grpc_exec_ctx_finish(&exec_ctx);
+ 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) {
gpr_log(GPR_DEBUG, "test_caching_byte_stream_shared_cache");
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
// Create and populate slice buffer byte stream.
grpc_slice_buffer buffer;
grpc_slice_buffer_init(&buffer);
@@ -237,35 +229,32 @@ static void test_caching_byte_stream_shared_cache(void) {
GRPC_CLOSURE_INIT(&closure, not_called_closure, NULL,
grpc_schedule_on_exec_ctx);
// Read one slice from stream1.
- GPR_ASSERT(
- grpc_byte_stream_next(&exec_ctx, &stream1.base, ~(size_t)0, &closure));
+ GPR_ASSERT(grpc_byte_stream_next(&stream1.base, ~(size_t)0, &closure));
grpc_slice output;
- grpc_error *error = grpc_byte_stream_pull(&exec_ctx, &stream1.base, &output);
+ grpc_error *error = grpc_byte_stream_pull(&stream1.base, &output);
GPR_ASSERT(error == GRPC_ERROR_NONE);
GPR_ASSERT(grpc_slice_eq(input[0], output));
- grpc_slice_unref_internal(&exec_ctx, output);
+ grpc_slice_unref_internal(output);
// Read all slices from stream2.
for (size_t i = 0; i < GPR_ARRAY_SIZE(input); ++i) {
- GPR_ASSERT(
- grpc_byte_stream_next(&exec_ctx, &stream2.base, ~(size_t)0, &closure));
- error = grpc_byte_stream_pull(&exec_ctx, &stream2.base, &output);
+ GPR_ASSERT(grpc_byte_stream_next(&stream2.base, ~(size_t)0, &closure));
+ error = grpc_byte_stream_pull(&stream2.base, &output);
GPR_ASSERT(error == GRPC_ERROR_NONE);
GPR_ASSERT(grpc_slice_eq(input[i], output));
- grpc_slice_unref_internal(&exec_ctx, output);
+ grpc_slice_unref_internal(output);
}
// Now read the second slice from stream1.
- GPR_ASSERT(
- grpc_byte_stream_next(&exec_ctx, &stream1.base, ~(size_t)0, &closure));
- error = grpc_byte_stream_pull(&exec_ctx, &stream1.base, &output);
+ GPR_ASSERT(grpc_byte_stream_next(&stream1.base, ~(size_t)0, &closure));
+ error = grpc_byte_stream_pull(&stream1.base, &output);
GPR_ASSERT(error == GRPC_ERROR_NONE);
GPR_ASSERT(grpc_slice_eq(input[1], output));
- grpc_slice_unref_internal(&exec_ctx, output);
+ grpc_slice_unref_internal(output);
// Clean up.
- grpc_byte_stream_destroy(&exec_ctx, &stream1.base);
- grpc_byte_stream_destroy(&exec_ctx, &stream2.base);
- grpc_byte_stream_cache_destroy(&exec_ctx, &cache);
- grpc_slice_buffer_destroy_internal(&exec_ctx, &buffer);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_byte_stream_destroy(&stream1.base);
+ 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.c b/test/core/transport/chttp2/bin_decoder_test.c
index 775161ec91..824b756398 100644
--- a/test/core/transport/chttp2/bin_decoder_test.c
+++ b/test/core/transport/chttp2/bin_decoder_test.c
@@ -29,8 +29,8 @@
static int all_ok = 1;
-static void expect_slice_eq(grpc_exec_ctx *exec_ctx, grpc_slice expected,
- grpc_slice slice, char *debug, int line) {
+static void expect_slice_eq(grpc_slice expected, grpc_slice slice, char *debug,
+ int line) {
if (!grpc_slice_eq(slice, expected)) {
char *hs = grpc_dump_slice(slice, GPR_DUMP_HEX | GPR_DUMP_ASCII);
char *he = grpc_dump_slice(expected, GPR_DUMP_HEX | GPR_DUMP_ASCII);
@@ -40,104 +40,94 @@ static void expect_slice_eq(grpc_exec_ctx *exec_ctx, grpc_slice expected,
gpr_free(he);
all_ok = 0;
}
- grpc_slice_unref_internal(exec_ctx, expected);
- grpc_slice_unref_internal(exec_ctx, slice);
+ grpc_slice_unref_internal(expected);
+ grpc_slice_unref_internal(slice);
}
-static grpc_slice base64_encode(grpc_exec_ctx *exec_ctx, const char *s) {
+static grpc_slice base64_encode(const char *s) {
grpc_slice ss = grpc_slice_from_copied_string(s);
grpc_slice out = grpc_chttp2_base64_encode(ss);
- grpc_slice_unref_internal(exec_ctx, ss);
+ grpc_slice_unref_internal(ss);
return out;
}
-static grpc_slice base64_decode(grpc_exec_ctx *exec_ctx, const char *s) {
+static grpc_slice base64_decode(const char *s) {
grpc_slice ss = grpc_slice_from_copied_string(s);
- grpc_slice out = grpc_chttp2_base64_decode(exec_ctx, ss);
- grpc_slice_unref_internal(exec_ctx, ss);
+ grpc_slice out = grpc_chttp2_base64_decode(ss);
+ grpc_slice_unref_internal(ss);
return out;
}
-static grpc_slice base64_decode_with_length(grpc_exec_ctx *exec_ctx,
- const char *s,
+static grpc_slice base64_decode_with_length(const char *s,
size_t output_length) {
grpc_slice ss = grpc_slice_from_copied_string(s);
- grpc_slice out =
- grpc_chttp2_base64_decode_with_length(exec_ctx, ss, output_length);
- grpc_slice_unref_internal(exec_ctx, ss);
+ grpc_slice out = grpc_chttp2_base64_decode_with_length(ss, output_length);
+ grpc_slice_unref_internal(ss);
return out;
}
-#define EXPECT_SLICE_EQ(exec_ctx, expected, slice) \
- expect_slice_eq( \
- exec_ctx, grpc_slice_from_copied_buffer(expected, sizeof(expected) - 1), \
- slice, #slice, __LINE__);
+#define EXPECT_SLICE_EQ(expected, slice) \
+ expect_slice_eq( \
+ grpc_slice_from_copied_buffer(expected, sizeof(expected) - 1), slice, \
+ #slice, __LINE__);
-#define ENCODE_AND_DECODE(exec_ctx, s) \
- EXPECT_SLICE_EQ(exec_ctx, s, \
- grpc_chttp2_base64_decode_with_length( \
- exec_ctx, base64_encode(exec_ctx, s), strlen(s)));
+#define ENCODE_AND_DECODE(s) \
+ EXPECT_SLICE_EQ( \
+ s, grpc_chttp2_base64_decode_with_length(base64_encode(s), strlen(s)));
int main(int argc, char **argv) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
-
/* ENCODE_AND_DECODE tests grpc_chttp2_base64_decode_with_length(), which
takes encoded base64 strings without pad chars, but output length is
required. */
/* Base64 test vectors from RFC 4648 */
- ENCODE_AND_DECODE(&exec_ctx, "");
- ENCODE_AND_DECODE(&exec_ctx, "f");
- ENCODE_AND_DECODE(&exec_ctx, "foo");
- ENCODE_AND_DECODE(&exec_ctx, "fo");
- ENCODE_AND_DECODE(&exec_ctx, "foob");
- ENCODE_AND_DECODE(&exec_ctx, "fooba");
- ENCODE_AND_DECODE(&exec_ctx, "foobar");
+ ENCODE_AND_DECODE("");
+ ENCODE_AND_DECODE("f");
+ ENCODE_AND_DECODE("foo");
+ ENCODE_AND_DECODE("fo");
+ ENCODE_AND_DECODE("foob");
+ ENCODE_AND_DECODE("fooba");
+ ENCODE_AND_DECODE("foobar");
- ENCODE_AND_DECODE(&exec_ctx, "\xc0\xc1\xc2\xc3\xc4\xc5");
+ ENCODE_AND_DECODE("\xc0\xc1\xc2\xc3\xc4\xc5");
/* Base64 test vectors from RFC 4648, with pad chars */
/* BASE64("") = "" */
- EXPECT_SLICE_EQ(&exec_ctx, "", base64_decode(&exec_ctx, ""));
+ EXPECT_SLICE_EQ("", base64_decode(""));
/* BASE64("f") = "Zg==" */
- EXPECT_SLICE_EQ(&exec_ctx, "f", base64_decode(&exec_ctx, "Zg=="));
+ EXPECT_SLICE_EQ("f", base64_decode("Zg=="));
/* BASE64("fo") = "Zm8=" */
- EXPECT_SLICE_EQ(&exec_ctx, "fo", base64_decode(&exec_ctx, "Zm8="));
+ EXPECT_SLICE_EQ("fo", base64_decode("Zm8="));
/* BASE64("foo") = "Zm9v" */
- EXPECT_SLICE_EQ(&exec_ctx, "foo", base64_decode(&exec_ctx, "Zm9v"));
+ EXPECT_SLICE_EQ("foo", base64_decode("Zm9v"));
/* BASE64("foob") = "Zm9vYg==" */
- EXPECT_SLICE_EQ(&exec_ctx, "foob", base64_decode(&exec_ctx, "Zm9vYg=="));
+ EXPECT_SLICE_EQ("foob", base64_decode("Zm9vYg=="));
/* BASE64("fooba") = "Zm9vYmE=" */
- EXPECT_SLICE_EQ(&exec_ctx, "fooba", base64_decode(&exec_ctx, "Zm9vYmE="));
+ EXPECT_SLICE_EQ("fooba", base64_decode("Zm9vYmE="));
/* BASE64("foobar") = "Zm9vYmFy" */
- EXPECT_SLICE_EQ(&exec_ctx, "foobar", base64_decode(&exec_ctx, "Zm9vYmFy"));
+ EXPECT_SLICE_EQ("foobar", base64_decode("Zm9vYmFy"));
- EXPECT_SLICE_EQ(&exec_ctx, "\xc0\xc1\xc2\xc3\xc4\xc5",
- base64_decode(&exec_ctx, "wMHCw8TF"));
+ EXPECT_SLICE_EQ("\xc0\xc1\xc2\xc3\xc4\xc5", base64_decode("wMHCw8TF"));
// Test illegal input length in grpc_chttp2_base64_decode
- EXPECT_SLICE_EQ(&exec_ctx, "", base64_decode(&exec_ctx, "a"));
- EXPECT_SLICE_EQ(&exec_ctx, "", base64_decode(&exec_ctx, "ab"));
- EXPECT_SLICE_EQ(&exec_ctx, "", base64_decode(&exec_ctx, "abc"));
+ EXPECT_SLICE_EQ("", base64_decode("a"));
+ EXPECT_SLICE_EQ("", base64_decode("ab"));
+ EXPECT_SLICE_EQ("", base64_decode("abc"));
// Test illegal charactors in grpc_chttp2_base64_decode
- EXPECT_SLICE_EQ(&exec_ctx, "", base64_decode(&exec_ctx, "Zm:v"));
- EXPECT_SLICE_EQ(&exec_ctx, "", base64_decode(&exec_ctx, "Zm=v"));
+ EXPECT_SLICE_EQ("", base64_decode("Zm:v"));
+ EXPECT_SLICE_EQ("", base64_decode("Zm=v"));
// Test output_length longer than max possible output length in
// grpc_chttp2_base64_decode_with_length
- EXPECT_SLICE_EQ(&exec_ctx, "", base64_decode_with_length(&exec_ctx, "Zg", 2));
- EXPECT_SLICE_EQ(&exec_ctx, "",
- base64_decode_with_length(&exec_ctx, "Zm8", 3));
- EXPECT_SLICE_EQ(&exec_ctx, "",
- base64_decode_with_length(&exec_ctx, "Zm9v", 4));
+ EXPECT_SLICE_EQ("", base64_decode_with_length("Zg", 2));
+ EXPECT_SLICE_EQ("", base64_decode_with_length("Zm8", 3));
+ EXPECT_SLICE_EQ("", base64_decode_with_length("Zm9v", 4));
// Test illegal charactors in grpc_chttp2_base64_decode_with_length
- EXPECT_SLICE_EQ(&exec_ctx, "",
- base64_decode_with_length(&exec_ctx, "Zm:v", 3));
- EXPECT_SLICE_EQ(&exec_ctx, "",
- base64_decode_with_length(&exec_ctx, "Zm=v", 3));
+ EXPECT_SLICE_EQ("", base64_decode_with_length("Zm:v", 3));
+ EXPECT_SLICE_EQ("", base64_decode_with_length("Zm=v", 3));
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_exec_ctx_finish();
return all_ok ? 0 : 1;
}
diff --git a/test/core/transport/chttp2/bin_decoder_test.cc b/test/core/transport/chttp2/bin_decoder_test.cc
new file mode 100644
index 0000000000..d426731dae
--- /dev/null
+++ b/test/core/transport/chttp2/bin_decoder_test.cc
@@ -0,0 +1,135 @@
+/*
+ *
+ * Copyright 2016 gRPC authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include "src/core/ext/transport/chttp2/transport/bin_decoder.h"
+
+#include <string.h>
+
+#include <grpc/support/alloc.h>
+#include <grpc/support/log.h>
+#include "src/core/ext/transport/chttp2/transport/bin_encoder.h"
+#include "src/core/lib/slice/slice_internal.h"
+#include "src/core/lib/slice/slice_string_helpers.h"
+#include "src/core/lib/support/string.h"
+
+static int all_ok = 1;
+
+static void expect_slice_eq(grpc_slice expected, grpc_slice slice, char *debug,
+ int line) {
+ if (!grpc_slice_eq(slice, expected)) {
+ char *hs = grpc_dump_slice(slice, GPR_DUMP_HEX | GPR_DUMP_ASCII);
+ char *he = grpc_dump_slice(expected, GPR_DUMP_HEX | GPR_DUMP_ASCII);
+ gpr_log(GPR_ERROR, "FAILED:%d: %s\ngot: %s\nwant: %s", line, debug, hs,
+ he);
+ gpr_free(hs);
+ gpr_free(he);
+ all_ok = 0;
+ }
+ grpc_slice_unref_internal(expected);
+ grpc_slice_unref_internal(slice);
+}
+
+static grpc_slice base64_encode(const char *s) {
+ grpc_slice ss = grpc_slice_from_copied_string(s);
+ grpc_slice out = grpc_chttp2_base64_encode(ss);
+ grpc_slice_unref_internal(ss);
+ return out;
+}
+
+static grpc_slice base64_decode(const char *s) {
+ grpc_slice ss = grpc_slice_from_copied_string(s);
+ grpc_slice out = grpc_chttp2_base64_decode(ss);
+ grpc_slice_unref_internal(ss);
+ return out;
+}
+
+static grpc_slice base64_decode_with_length(const char *s,
+ size_t output_length) {
+ grpc_slice ss = grpc_slice_from_copied_string(s);
+ grpc_slice out = grpc_chttp2_base64_decode_with_length(ss, output_length);
+ grpc_slice_unref_internal(ss);
+ return out;
+}
+
+#define EXPECT_SLICE_EQ(expected, slice) \
+ expect_slice_eq( \
+ exec_ctx, grpc_slice_from_copied_buffer(expected, sizeof(expected) - 1), \
+ slice, #slice, __LINE__);
+
+#define ENCODE_AND_DECODE(s) \
+ EXPECT_SLICE_EQ(s, grpc_chttp2_base64_decode_with_length( \
+ exec_ctx, base64_encode(s), strlen(s)));
+
+int main(int argc, char **argv) {
+ ExecCtx _local_exec_ctx;
+
+ /* ENCODE_AND_DECODE tests grpc_chttp2_base64_decode_with_length(), which
+ takes encoded base64 strings without pad chars, but output length is
+ required. */
+ /* Base64 test vectors from RFC 4648 */
+ ENCODE_AND_DECODE("");
+ ENCODE_AND_DECODE("f");
+ ENCODE_AND_DECODE("foo");
+ ENCODE_AND_DECODE("fo");
+ ENCODE_AND_DECODE("foob");
+ ENCODE_AND_DECODE("fooba");
+ ENCODE_AND_DECODE("foobar");
+
+ ENCODE_AND_DECODE("\xc0\xc1\xc2\xc3\xc4\xc5");
+
+ /* Base64 test vectors from RFC 4648, with pad chars */
+ /* BASE64("") = "" */
+ EXPECT_SLICE_EQ("", base64_decode(""));
+ /* BASE64("f") = "Zg==" */
+ EXPECT_SLICE_EQ("f", base64_decode("Zg=="));
+ /* BASE64("fo") = "Zm8=" */
+ EXPECT_SLICE_EQ("fo", base64_decode("Zm8="));
+ /* BASE64("foo") = "Zm9v" */
+ EXPECT_SLICE_EQ("foo", base64_decode("Zm9v"));
+ /* BASE64("foob") = "Zm9vYg==" */
+ EXPECT_SLICE_EQ("foob", base64_decode("Zm9vYg=="));
+ /* BASE64("fooba") = "Zm9vYmE=" */
+ EXPECT_SLICE_EQ("fooba", base64_decode("Zm9vYmE="));
+ /* BASE64("foobar") = "Zm9vYmFy" */
+ EXPECT_SLICE_EQ("foobar", base64_decode("Zm9vYmFy"));
+
+ EXPECT_SLICE_EQ("\xc0\xc1\xc2\xc3\xc4\xc5", base64_decode("wMHCw8TF"));
+
+ // Test illegal input length in grpc_chttp2_base64_decode
+ EXPECT_SLICE_EQ("", base64_decode("a"));
+ EXPECT_SLICE_EQ("", base64_decode("ab"));
+ EXPECT_SLICE_EQ("", base64_decode("abc"));
+
+ // Test illegal charactors in grpc_chttp2_base64_decode
+ EXPECT_SLICE_EQ("", base64_decode("Zm:v"));
+ EXPECT_SLICE_EQ("", base64_decode("Zm=v"));
+
+ // Test output_length longer than max possible output length in
+ // grpc_chttp2_base64_decode_with_length
+ EXPECT_SLICE_EQ("", base64_decode_with_length("Zg", 2));
+ EXPECT_SLICE_EQ("", base64_decode_with_length("Zm8", 3));
+ EXPECT_SLICE_EQ("", base64_decode_with_length("Zm9v", 4));
+
+ // Test illegal charactors in grpc_chttp2_base64_decode_with_length
+ 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.c b/test/core/transport/chttp2/hpack_encoder_test.c
index ed51dd1859..f3690fc410 100644
--- a/test/core/transport/chttp2/hpack_encoder_test.c
+++ b/test/core/transport/chttp2/hpack_encoder_test.c
@@ -45,7 +45,7 @@ size_t cap_to_delete = 0;
/* verify that the output generated by encoding the stream matches the
hexstring passed in */
-static void verify(grpc_exec_ctx *exec_ctx, size_t window_available, bool eof,
+static void verify(size_t window_available, bool eof,
bool use_true_binary_metadata, size_t expect_window_used,
const char *expected, size_t nheaders, ...) {
grpc_slice_buffer output;
@@ -67,7 +67,7 @@ static void verify(grpc_exec_ctx *exec_ctx, size_t window_available, bool eof,
e[i].prev = &e[i - 1];
}
e[i].md = grpc_mdelem_from_slices(
- exec_ctx, grpc_slice_intern(grpc_slice_from_static_string(key)),
+ grpc_slice_intern(grpc_slice_from_static_string(key)),
grpc_slice_intern(grpc_slice_from_static_string(value)));
}
e[0].prev = NULL;
@@ -95,11 +95,10 @@ static void verify(grpc_exec_ctx *exec_ctx, size_t window_available, bool eof,
.max_frame_size = 16384,
.stats = &stats,
};
- grpc_chttp2_encode_header(exec_ctx, &g_compressor, NULL, 0, &b, &hopt,
- &output);
+ grpc_chttp2_encode_header(&g_compressor, NULL, 0, &b, &hopt, &output);
merged = grpc_slice_merge(output.slices, output.count);
- grpc_slice_buffer_destroy_internal(exec_ctx, &output);
- grpc_metadata_batch_destroy(exec_ctx, &b);
+ grpc_slice_buffer_destroy_internal(&output);
+ grpc_metadata_batch_destroy(&b);
if (!grpc_slice_eq(merged, expect)) {
char *expect_str = grpc_dump_slice(expect, GPR_DUMP_HEX | GPR_DUMP_ASCII);
@@ -112,35 +111,32 @@ static void verify(grpc_exec_ctx *exec_ctx, size_t window_available, bool eof,
g_failure = 1;
}
- grpc_slice_unref_internal(exec_ctx, merged);
- grpc_slice_unref_internal(exec_ctx, expect);
+ grpc_slice_unref_internal(merged);
+ grpc_slice_unref_internal(expect);
}
-static void test_basic_headers(grpc_exec_ctx *exec_ctx) {
+static void test_basic_headers() {
int i;
- verify(exec_ctx, 0, false, false, 0, "000005 0104 deadbeef 40 0161 0161", 1,
- "a", "a");
- verify(exec_ctx, 0, false, false, 0, "000001 0104 deadbeef be", 1, "a", "a");
- verify(exec_ctx, 0, false, false, 0, "000001 0104 deadbeef be", 1, "a", "a");
- verify(exec_ctx, 0, false, false, 0, "000006 0104 deadbeef be 40 0162 0163",
- 2, "a", "a", "b", "c");
- verify(exec_ctx, 0, false, false, 0, "000002 0104 deadbeef bf be", 2, "a",
+ verify(0, false, false, 0, "000005 0104 deadbeef 40 0161 0161", 1, "a", "a");
+ verify(0, false, false, 0, "000001 0104 deadbeef be", 1, "a", "a");
+ verify(0, false, false, 0, "000001 0104 deadbeef be", 1, "a", "a");
+ verify(0, false, false, 0, "000006 0104 deadbeef be 40 0162 0163", 2, "a",
"a", "b", "c");
- verify(exec_ctx, 0, false, false, 0, "000004 0104 deadbeef 7f 00 0164", 1,
- "a", "d");
+ verify(0, false, false, 0, "000002 0104 deadbeef bf be", 2, "a", "a", "b",
+ "c");
+ verify(0, false, false, 0, "000004 0104 deadbeef 7f 00 0164", 1, "a", "d");
/* flush out what's there to make a few values look very popular */
for (i = 0; i < 350; i++) {
- verify(exec_ctx, 0, false, false, 0, "000003 0104 deadbeef c0 bf be", 3,
- "a", "a", "b", "c", "a", "d");
+ verify(0, false, false, 0, "000003 0104 deadbeef c0 bf be", 3, "a", "a",
+ "b", "c", "a", "d");
}
- verify(exec_ctx, 0, false, false, 0, "000006 0104 deadbeef c0 00 016b 0176",
- 2, "a", "a", "k", "v");
+ verify(0, false, false, 0, "000006 0104 deadbeef c0 00 016b 0176", 2, "a",
+ "a", "k", "v");
/* this could be 000004 0104 deadbeef 0f 30 0176 also */
- verify(exec_ctx, 0, false, false, 0, "000004 0104 deadbeef 0f 2f 0176", 1,
- "a", "v");
+ verify(0, false, false, 0, "000004 0104 deadbeef 0f 2f 0176", 1, "a", "v");
}
static void encode_int_to_str(int i, char *p) {
@@ -151,7 +147,7 @@ static void encode_int_to_str(int i, char *p) {
p[2] = 0;
}
-static void test_decode_table_overflow(grpc_exec_ctx *exec_ctx) {
+static void test_decode_table_overflow() {
int i;
char key[3], value[3];
char *expect;
@@ -174,25 +170,24 @@ static void test_decode_table_overflow(grpc_exec_ctx *exec_ctx) {
}
if (i > 0) {
- verify(exec_ctx, 0, false, false, 0, expect, 2, "aa", "ba", key, value);
+ verify(0, false, false, 0, expect, 2, "aa", "ba", key, value);
} else {
- verify(exec_ctx, 0, false, false, 0, expect, 1, key, value);
+ verify(0, false, false, 0, expect, 1, key, value);
}
gpr_free(expect);
}
/* if the above passes, then we must have just knocked this pair out of the
decoder stack, and so we'll be forced to re-encode it */
- verify(exec_ctx, 0, false, false, 0, "000007 0104 deadbeef 40 026161 026261",
- 1, "aa", "ba");
+ verify(0, false, false, 0, "000007 0104 deadbeef 40 026161 026261", 1, "aa",
+ "ba");
}
-static void verify_table_size_change_match_elem_size(grpc_exec_ctx *exec_ctx,
- const char *key,
+static void verify_table_size_change_match_elem_size(const char *key,
const char *value) {
grpc_slice_buffer output;
grpc_mdelem elem = grpc_mdelem_from_slices(
- exec_ctx, grpc_slice_intern(grpc_slice_from_static_string(key)),
+ grpc_slice_intern(grpc_slice_from_static_string(key)),
grpc_slice_intern(grpc_slice_from_static_string(value)));
size_t elem_size = grpc_mdelem_get_size_in_hpack_table(elem);
size_t initial_table_size = g_compressor.table_size;
@@ -214,27 +209,26 @@ static void verify_table_size_change_match_elem_size(grpc_exec_ctx *exec_ctx,
.use_true_binary_metadata = false,
.max_frame_size = 16384,
.stats = &stats};
- grpc_chttp2_encode_header(exec_ctx, &g_compressor, NULL, 0, &b, &hopt,
- &output);
- grpc_slice_buffer_destroy_internal(exec_ctx, &output);
- grpc_metadata_batch_destroy(exec_ctx, &b);
+ grpc_chttp2_encode_header(&g_compressor, NULL, 0, &b, &hopt, &output);
+ grpc_slice_buffer_destroy_internal(&output);
+ grpc_metadata_batch_destroy(&b);
GPR_ASSERT(g_compressor.table_size == elem_size + initial_table_size);
gpr_free(e);
}
-static void test_encode_header_size(grpc_exec_ctx *exec_ctx) {
- verify_table_size_change_match_elem_size(exec_ctx, "hello", "world");
- verify_table_size_change_match_elem_size(exec_ctx, "hello-bin", "world");
+static void test_encode_header_size() {
+ verify_table_size_change_match_elem_size("hello", "world");
+ verify_table_size_change_match_elem_size("hello-bin", "world");
}
-static void run_test(void (*test)(grpc_exec_ctx *exec_ctx), const char *name) {
+static void run_test(void (*test)(), const char *name) {
gpr_log(GPR_INFO, "RUN TEST: %s", name);
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+
grpc_chttp2_hpack_compressor_init(&g_compressor);
- test(&exec_ctx);
- grpc_chttp2_hpack_compressor_destroy(&exec_ctx, &g_compressor);
- grpc_exec_ctx_finish(&exec_ctx);
+ 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.c b/test/core/transport/chttp2/hpack_parser_fuzzer_test.c
index 03834084cb..944f81f7c6 100644
--- a/test/core/transport/chttp2/hpack_parser_fuzzer_test.c
+++ b/test/core/transport/chttp2/hpack_parser_fuzzer_test.c
@@ -29,9 +29,7 @@
bool squelch = true;
bool leak_check = true;
-static void onhdr(grpc_exec_ctx *exec_ctx, void *ud, grpc_mdelem md) {
- GRPC_MDELEM_UNREF(exec_ctx, md);
-}
+static void onhdr(void *ud, grpc_mdelem md) { GRPC_MDELEM_UNREF(md); }
static void dont_log(gpr_log_func_args *args) {}
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
@@ -39,13 +37,13 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
if (squelch) gpr_set_log_function(dont_log);
grpc_init();
grpc_chttp2_hpack_parser parser;
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_chttp2_hpack_parser_init(&exec_ctx, &parser);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_chttp2_hpack_parser_init(&parser);
parser.on_header = onhdr;
GRPC_ERROR_UNREF(grpc_chttp2_hpack_parser_parse(
- &exec_ctx, &parser, grpc_slice_from_static_buffer(data, size)));
- grpc_chttp2_hpack_parser_destroy(&exec_ctx, &parser);
- grpc_exec_ctx_finish(&exec_ctx);
+ &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.c b/test/core/transport/chttp2/hpack_parser_test.c
index 0946c05261..67b527934e 100644
--- a/test/core/transport/chttp2/hpack_parser_test.c
+++ b/test/core/transport/chttp2/hpack_parser_test.c
@@ -30,7 +30,7 @@
typedef struct { va_list args; } test_checker;
-static void onhdr(grpc_exec_ctx *exec_ctx, void *ud, grpc_mdelem md) {
+static void onhdr(void *ud, grpc_mdelem md) {
const char *ekey, *evalue;
test_checker *chk = ud;
ekey = va_arg(chk->args, char *);
@@ -39,7 +39,7 @@ static void onhdr(grpc_exec_ctx *exec_ctx, void *ud, grpc_mdelem md) {
GPR_ASSERT(evalue);
GPR_ASSERT(grpc_slice_str_cmp(GRPC_MDKEY(md), ekey) == 0);
GPR_ASSERT(grpc_slice_str_cmp(GRPC_MDVALUE(md), evalue) == 0);
- GRPC_MDELEM_UNREF(exec_ctx, md);
+ GRPC_MDELEM_UNREF(md);
}
static void test_vector(grpc_chttp2_hpack_parser *parser,
@@ -60,10 +60,10 @@ static void test_vector(grpc_chttp2_hpack_parser *parser,
grpc_slice_unref(input);
for (i = 0; i < nslices; i++) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- GPR_ASSERT(grpc_chttp2_hpack_parser_parse(&exec_ctx, parser, slices[i]) ==
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ GPR_ASSERT(grpc_chttp2_hpack_parser_parse(parser, slices[i]) ==
GRPC_ERROR_NONE);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_exec_ctx_finish();
}
for (i = 0; i < nslices; i++) {
@@ -78,9 +78,9 @@ static void test_vector(grpc_chttp2_hpack_parser *parser,
static void test_vectors(grpc_slice_split_mode mode) {
grpc_chttp2_hpack_parser parser;
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_chttp2_hpack_parser_init(&exec_ctx, &parser);
+ grpc_chttp2_hpack_parser_init(&parser);
/* D.2.1 */
test_vector(&parser, mode,
"400a 6375 7374 6f6d 2d6b 6579 0d63 7573"
@@ -96,9 +96,9 @@ static void test_vectors(grpc_slice_split_mode mode) {
"password", "secret", NULL);
/* D.2.4 */
test_vector(&parser, mode, "82", ":method", "GET", NULL);
- grpc_chttp2_hpack_parser_destroy(&exec_ctx, &parser);
+ grpc_chttp2_hpack_parser_destroy(&parser);
- grpc_chttp2_hpack_parser_init(&exec_ctx, &parser);
+ grpc_chttp2_hpack_parser_init(&parser);
/* D.3.1 */
test_vector(&parser, mode,
"8286 8441 0f77 7777 2e65 7861 6d70 6c65"
@@ -116,9 +116,9 @@ static void test_vectors(grpc_slice_split_mode mode) {
":method", "GET", ":scheme", "https", ":path", "/index.html",
":authority", "www.example.com", "custom-key", "custom-value",
NULL);
- grpc_chttp2_hpack_parser_destroy(&exec_ctx, &parser);
+ grpc_chttp2_hpack_parser_destroy(&parser);
- grpc_chttp2_hpack_parser_init(&exec_ctx, &parser);
+ grpc_chttp2_hpack_parser_init(&parser);
/* D.4.1 */
test_vector(&parser, mode,
"8286 8441 8cf1 e3c2 e5f2 3a6b a0ab 90f4"
@@ -136,11 +136,11 @@ static void test_vectors(grpc_slice_split_mode mode) {
":method", "GET", ":scheme", "https", ":path", "/index.html",
":authority", "www.example.com", "custom-key", "custom-value",
NULL);
- grpc_chttp2_hpack_parser_destroy(&exec_ctx, &parser);
+ grpc_chttp2_hpack_parser_destroy(&parser);
- grpc_chttp2_hpack_parser_init(&exec_ctx, &parser);
- grpc_chttp2_hptbl_set_max_bytes(&exec_ctx, &parser.table, 256);
- grpc_chttp2_hptbl_set_current_table_size(&exec_ctx, &parser.table, 256);
+ grpc_chttp2_hpack_parser_init(&parser);
+ grpc_chttp2_hptbl_set_max_bytes(&parser.table, 256);
+ grpc_chttp2_hptbl_set_current_table_size(&parser.table, 256);
/* D.5.1 */
test_vector(&parser, mode,
"4803 3330 3258 0770 7269 7661 7465 611d"
@@ -170,11 +170,11 @@ static void test_vectors(grpc_slice_split_mode mode) {
"https://www.example.com", "content-encoding", "gzip",
"set-cookie",
"foo=ASDJKHQKBZXOQWEOPIUAXQWEOIU; max-age=3600; version=1", NULL);
- grpc_chttp2_hpack_parser_destroy(&exec_ctx, &parser);
+ grpc_chttp2_hpack_parser_destroy(&parser);
- grpc_chttp2_hpack_parser_init(&exec_ctx, &parser);
- grpc_chttp2_hptbl_set_max_bytes(&exec_ctx, &parser.table, 256);
- grpc_chttp2_hptbl_set_current_table_size(&exec_ctx, &parser.table, 256);
+ grpc_chttp2_hpack_parser_init(&parser);
+ grpc_chttp2_hptbl_set_max_bytes(&parser.table, 256);
+ grpc_chttp2_hptbl_set_current_table_size(&parser.table, 256);
/* D.6.1 */
test_vector(&parser, mode,
"4882 6402 5885 aec3 771a 4b61 96d0 7abe"
@@ -201,9 +201,9 @@ static void test_vectors(grpc_slice_split_mode mode) {
"https://www.example.com", "content-encoding", "gzip",
"set-cookie",
"foo=ASDJKHQKBZXOQWEOPIUAXQWEOIU; max-age=3600; version=1", NULL);
- grpc_chttp2_hpack_parser_destroy(&exec_ctx, &parser);
+ grpc_chttp2_hpack_parser_destroy(&parser);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_exec_ctx_finish();
}
int main(int argc, char **argv) {
diff --git a/test/core/transport/chttp2/hpack_table_test.c b/test/core/transport/chttp2/hpack_table_test.c
index 430ece33c7..cbb6b1d7a3 100644
--- a/test/core/transport/chttp2/hpack_table_test.c
+++ b/test/core/transport/chttp2/hpack_table_test.c
@@ -44,10 +44,10 @@ static void assert_index(const grpc_chttp2_hptbl *tbl, uint32_t idx,
}
static void test_static_lookup(void) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_chttp2_hptbl tbl;
- grpc_chttp2_hptbl_init(&exec_ctx, &tbl);
+ grpc_chttp2_hptbl_init(&tbl);
LOG_TEST("test_static_lookup");
assert_index(&tbl, 1, ":authority", "");
@@ -112,8 +112,8 @@ static void test_static_lookup(void) {
assert_index(&tbl, 60, "via", "");
assert_index(&tbl, 61, "www-authenticate", "");
- grpc_chttp2_hptbl_destroy(&exec_ctx, &tbl);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_chttp2_hptbl_destroy(&tbl);
+ grpc_exec_ctx_finish();
}
static void test_many_additions(void) {
@@ -124,18 +124,17 @@ static void test_many_additions(void) {
LOG_TEST("test_many_additions");
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_chttp2_hptbl_init(&exec_ctx, &tbl);
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_chttp2_hptbl_init(&tbl);
for (i = 0; i < 100000; i++) {
grpc_mdelem elem;
gpr_asprintf(&key, "K:%d", i);
gpr_asprintf(&value, "VALUE:%d", i);
- elem =
- grpc_mdelem_from_slices(&exec_ctx, grpc_slice_from_copied_string(key),
- grpc_slice_from_copied_string(value));
- GPR_ASSERT(grpc_chttp2_hptbl_add(&exec_ctx, &tbl, elem) == GRPC_ERROR_NONE);
- GRPC_MDELEM_UNREF(&exec_ctx, elem);
+ elem = grpc_mdelem_from_slices(grpc_slice_from_copied_string(key),
+ grpc_slice_from_copied_string(value));
+ GPR_ASSERT(grpc_chttp2_hptbl_add(&tbl, elem) == GRPC_ERROR_NONE);
+ GRPC_MDELEM_UNREF(elem);
assert_index(&tbl, 1 + GRPC_CHTTP2_LAST_STATIC_ENTRY, key, value);
gpr_free(key);
gpr_free(value);
@@ -148,25 +147,24 @@ static void test_many_additions(void) {
}
}
- grpc_chttp2_hptbl_destroy(&exec_ctx, &tbl);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_chttp2_hptbl_destroy(&tbl);
+ grpc_exec_ctx_finish();
}
static grpc_chttp2_hptbl_find_result find_simple(grpc_chttp2_hptbl *tbl,
const char *key,
const char *value) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_mdelem md =
- grpc_mdelem_from_slices(&exec_ctx, grpc_slice_from_copied_string(key),
- grpc_slice_from_copied_string(value));
+ exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_mdelem md = grpc_mdelem_from_slices(
+ 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(&exec_ctx, md);
- grpc_exec_ctx_finish(&exec_ctx);
+ GRPC_MDELEM_UNREF(md);
+ grpc_exec_ctx_finish();
return r;
}
static void test_find(void) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_chttp2_hptbl tbl;
uint32_t i;
char buffer[32];
@@ -175,21 +173,19 @@ static void test_find(void) {
LOG_TEST("test_find");
- grpc_chttp2_hptbl_init(&exec_ctx, &tbl);
- elem =
- grpc_mdelem_from_slices(&exec_ctx, grpc_slice_from_static_string("abc"),
- grpc_slice_from_static_string("xyz"));
- GPR_ASSERT(grpc_chttp2_hptbl_add(&exec_ctx, &tbl, elem) == GRPC_ERROR_NONE);
- GRPC_MDELEM_UNREF(&exec_ctx, elem);
- elem =
- grpc_mdelem_from_slices(&exec_ctx, grpc_slice_from_static_string("abc"),
- grpc_slice_from_static_string("123"));
- GPR_ASSERT(grpc_chttp2_hptbl_add(&exec_ctx, &tbl, elem) == GRPC_ERROR_NONE);
- GRPC_MDELEM_UNREF(&exec_ctx, elem);
- elem = grpc_mdelem_from_slices(&exec_ctx, grpc_slice_from_static_string("x"),
+ grpc_chttp2_hptbl_init(&tbl);
+ elem = grpc_mdelem_from_slices(grpc_slice_from_static_string("abc"),
+ grpc_slice_from_static_string("xyz"));
+ GPR_ASSERT(grpc_chttp2_hptbl_add(&tbl, elem) == GRPC_ERROR_NONE);
+ GRPC_MDELEM_UNREF(elem);
+ elem = grpc_mdelem_from_slices(grpc_slice_from_static_string("abc"),
+ grpc_slice_from_static_string("123"));
+ GPR_ASSERT(grpc_chttp2_hptbl_add(&tbl, elem) == GRPC_ERROR_NONE);
+ GRPC_MDELEM_UNREF(elem);
+ elem = grpc_mdelem_from_slices(grpc_slice_from_static_string("x"),
grpc_slice_from_static_string("1"));
- GPR_ASSERT(grpc_chttp2_hptbl_add(&exec_ctx, &tbl, elem) == GRPC_ERROR_NONE);
- GRPC_MDELEM_UNREF(&exec_ctx, elem);
+ GPR_ASSERT(grpc_chttp2_hptbl_add(&tbl, elem) == GRPC_ERROR_NONE);
+ GRPC_MDELEM_UNREF(elem);
r = find_simple(&tbl, "abc", "123");
GPR_ASSERT(r.index == 2 + GRPC_CHTTP2_LAST_STATIC_ENTRY);
@@ -238,11 +234,10 @@ static void test_find(void) {
/* overflow the string buffer, check find still works */
for (i = 0; i < 10000; i++) {
int64_ttoa(i, buffer);
- elem = grpc_mdelem_from_slices(&exec_ctx,
- grpc_slice_from_static_string("test"),
+ elem = grpc_mdelem_from_slices(grpc_slice_from_static_string("test"),
grpc_slice_from_copied_string(buffer));
- GPR_ASSERT(grpc_chttp2_hptbl_add(&exec_ctx, &tbl, elem) == GRPC_ERROR_NONE);
- GRPC_MDELEM_UNREF(&exec_ctx, elem);
+ GPR_ASSERT(grpc_chttp2_hptbl_add(&tbl, elem) == GRPC_ERROR_NONE);
+ GRPC_MDELEM_UNREF(elem);
}
r = find_simple(&tbl, "abc", "123");
@@ -270,8 +265,8 @@ static void test_find(void) {
GPR_ASSERT(r.index != 0);
GPR_ASSERT(r.has_value == 0);
- grpc_chttp2_hptbl_destroy(&exec_ctx, &tbl);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_chttp2_hptbl_destroy(&tbl);
+ grpc_exec_ctx_finish();
}
int main(int argc, char **argv) {
diff --git a/test/core/transport/connectivity_state_test.c b/test/core/transport/connectivity_state_test.c
index 4ef8683107..f0a907d4c7 100644
--- a/test/core/transport/connectivity_state_test.c
+++ b/test/core/transport/connectivity_state_test.c
@@ -28,14 +28,13 @@
int g_counter;
-static void must_succeed(grpc_exec_ctx *exec_ctx, void *arg,
- grpc_error *error) {
+static void must_succeed(void *arg, grpc_error *error) {
GPR_ASSERT(error == GRPC_ERROR_NONE);
GPR_ASSERT(arg == THE_ARG);
g_counter++;
}
-static void must_fail(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) {
+static void must_fail(void *arg, grpc_error *error) {
GPR_ASSERT(error != GRPC_ERROR_NONE);
GPR_ASSERT(arg == THE_ARG);
g_counter++;
@@ -58,7 +57,7 @@ static void test_connectivity_state_name(void) {
static void test_check(void) {
grpc_connectivity_state_tracker tracker;
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_error *error;
gpr_log(GPR_DEBUG, "test_check");
grpc_connectivity_state_init(&tracker, GRPC_CHANNEL_IDLE, "xxx");
@@ -66,8 +65,8 @@ static void test_check(void) {
GRPC_CHANNEL_IDLE);
GPR_ASSERT(grpc_connectivity_state_check(&tracker) == GRPC_CHANNEL_IDLE);
GPR_ASSERT(error == GRPC_ERROR_NONE);
- grpc_connectivity_state_destroy(&exec_ctx, &tracker);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_connectivity_state_destroy(&tracker);
+ grpc_exec_ctx_finish();
}
static void test_subscribe_then_unsubscribe(void) {
@@ -75,23 +74,22 @@ static void test_subscribe_then_unsubscribe(void) {
grpc_closure *closure =
GRPC_CLOSURE_CREATE(must_fail, THE_ARG, grpc_schedule_on_exec_ctx);
grpc_connectivity_state state = GRPC_CHANNEL_IDLE;
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
gpr_log(GPR_DEBUG, "test_subscribe_then_unsubscribe");
g_counter = 0;
grpc_connectivity_state_init(&tracker, GRPC_CHANNEL_IDLE, "xxx");
- GPR_ASSERT(grpc_connectivity_state_notify_on_state_change(&exec_ctx, &tracker,
- &state, closure));
- grpc_exec_ctx_flush(&exec_ctx);
+ GPR_ASSERT(grpc_connectivity_state_notify_on_state_change(&tracker, &state,
+ closure));
+ grpc_exec_ctx_flush();
GPR_ASSERT(state == GRPC_CHANNEL_IDLE);
GPR_ASSERT(g_counter == 0);
- grpc_connectivity_state_notify_on_state_change(&exec_ctx, &tracker, NULL,
- closure);
- grpc_exec_ctx_flush(&exec_ctx);
+ grpc_connectivity_state_notify_on_state_change(&tracker, NULL, closure);
+ grpc_exec_ctx_flush();
GPR_ASSERT(state == GRPC_CHANNEL_IDLE);
GPR_ASSERT(g_counter == 1);
- grpc_connectivity_state_destroy(&exec_ctx, &tracker);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_connectivity_state_destroy(&tracker);
+ grpc_exec_ctx_finish();
}
static void test_subscribe_then_destroy(void) {
@@ -99,17 +97,17 @@ static void test_subscribe_then_destroy(void) {
grpc_closure *closure =
GRPC_CLOSURE_CREATE(must_succeed, THE_ARG, grpc_schedule_on_exec_ctx);
grpc_connectivity_state state = GRPC_CHANNEL_IDLE;
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
gpr_log(GPR_DEBUG, "test_subscribe_then_destroy");
g_counter = 0;
grpc_connectivity_state_init(&tracker, GRPC_CHANNEL_IDLE, "xxx");
- GPR_ASSERT(grpc_connectivity_state_notify_on_state_change(&exec_ctx, &tracker,
- &state, closure));
- grpc_exec_ctx_flush(&exec_ctx);
+ GPR_ASSERT(grpc_connectivity_state_notify_on_state_change(&tracker, &state,
+ closure));
+ grpc_exec_ctx_flush();
GPR_ASSERT(state == GRPC_CHANNEL_IDLE);
GPR_ASSERT(g_counter == 0);
- grpc_connectivity_state_destroy(&exec_ctx, &tracker);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_connectivity_state_destroy(&tracker);
+ grpc_exec_ctx_finish();
GPR_ASSERT(state == GRPC_CHANNEL_SHUTDOWN);
GPR_ASSERT(g_counter == 1);
}
@@ -119,17 +117,17 @@ static void test_subscribe_with_failure_then_destroy(void) {
grpc_closure *closure =
GRPC_CLOSURE_CREATE(must_fail, THE_ARG, grpc_schedule_on_exec_ctx);
grpc_connectivity_state state = GRPC_CHANNEL_SHUTDOWN;
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
gpr_log(GPR_DEBUG, "test_subscribe_with_failure_then_destroy");
g_counter = 0;
grpc_connectivity_state_init(&tracker, GRPC_CHANNEL_SHUTDOWN, "xxx");
GPR_ASSERT(0 == grpc_connectivity_state_notify_on_state_change(
- &exec_ctx, &tracker, &state, closure));
- grpc_exec_ctx_flush(&exec_ctx);
+ &tracker, &state, closure));
+ grpc_exec_ctx_flush();
GPR_ASSERT(state == GRPC_CHANNEL_SHUTDOWN);
GPR_ASSERT(g_counter == 0);
- grpc_connectivity_state_destroy(&exec_ctx, &tracker);
- grpc_exec_ctx_finish(&exec_ctx);
+ 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.c b/test/core/transport/metadata_test.c
index cb06fce30b..a721247766 100644
--- a/test/core/transport/metadata_test.c
+++ b/test/core/transport/metadata_test.c
@@ -60,15 +60,15 @@ static void test_create_metadata(bool intern_keys, bool intern_values) {
intern_keys, intern_values);
grpc_init();
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
m1 = grpc_mdelem_from_slices(
- &exec_ctx, maybe_intern(grpc_slice_from_static_string("a"), intern_keys),
+ maybe_intern(grpc_slice_from_static_string("a"), intern_keys),
maybe_intern(grpc_slice_from_static_string("b"), intern_values));
m2 = grpc_mdelem_from_slices(
- &exec_ctx, maybe_intern(grpc_slice_from_static_string("a"), intern_keys),
+ maybe_intern(grpc_slice_from_static_string("a"), intern_keys),
maybe_intern(grpc_slice_from_static_string("b"), intern_values));
m3 = grpc_mdelem_from_slices(
- &exec_ctx, maybe_intern(grpc_slice_from_static_string("a"), intern_keys),
+ maybe_intern(grpc_slice_from_static_string("a"), intern_keys),
maybe_intern(grpc_slice_from_static_string("c"), intern_values));
GPR_ASSERT(grpc_mdelem_eq(m1, m2));
GPR_ASSERT(!grpc_mdelem_eq(m3, m1));
@@ -77,10 +77,10 @@ static void test_create_metadata(bool intern_keys, bool intern_values) {
GPR_ASSERT(grpc_slice_str_cmp(GRPC_MDKEY(m1), "a") == 0);
GPR_ASSERT(grpc_slice_str_cmp(GRPC_MDVALUE(m1), "b") == 0);
GPR_ASSERT(grpc_slice_str_cmp(GRPC_MDVALUE(m3), "c") == 0);
- GRPC_MDELEM_UNREF(&exec_ctx, m1);
- GRPC_MDELEM_UNREF(&exec_ctx, m2);
- GRPC_MDELEM_UNREF(&exec_ctx, m3);
- grpc_exec_ctx_finish(&exec_ctx);
+ GRPC_MDELEM_UNREF(m1);
+ GRPC_MDELEM_UNREF(m2);
+ GRPC_MDELEM_UNREF(m3);
+ grpc_exec_ctx_finish();
grpc_shutdown();
}
@@ -95,19 +95,15 @@ static void test_create_many_ephemeral_metadata(bool intern_keys,
intern_keys, intern_values);
grpc_init();
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
/* add, and immediately delete a bunch of different elements */
for (i = 0; i < MANY; i++) {
gpr_ltoa(i, buffer);
- GRPC_MDELEM_UNREF(
- &exec_ctx,
- grpc_mdelem_from_slices(
- &exec_ctx,
- maybe_intern(grpc_slice_from_static_string("a"), intern_keys),
- maybe_intern(grpc_slice_from_copied_string(buffer),
- intern_values)));
+ GRPC_MDELEM_UNREF(grpc_mdelem_from_slices(
+ maybe_intern(grpc_slice_from_static_string("a"), intern_keys),
+ maybe_intern(grpc_slice_from_copied_string(buffer), intern_values)));
}
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_exec_ctx_finish();
grpc_shutdown();
}
@@ -120,28 +116,28 @@ static void test_create_many_persistant_metadata(void) {
gpr_log(GPR_INFO, "test_create_many_persistant_metadata");
grpc_init();
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
/* add phase */
for (i = 0; i < MANY; i++) {
gpr_ltoa(i, buffer);
created[i] = grpc_mdelem_from_slices(
- &exec_ctx, grpc_slice_intern(grpc_slice_from_static_string("a")),
+ grpc_slice_intern(grpc_slice_from_static_string("a")),
grpc_slice_intern(grpc_slice_from_static_string(buffer)));
}
/* verify phase */
for (i = 0; i < MANY; i++) {
gpr_ltoa(i, buffer);
md = grpc_mdelem_from_slices(
- &exec_ctx, grpc_slice_intern(grpc_slice_from_static_string("a")),
+ grpc_slice_intern(grpc_slice_from_static_string("a")),
grpc_slice_intern(grpc_slice_from_static_string(buffer)));
GPR_ASSERT(grpc_mdelem_eq(md, created[i]));
- GRPC_MDELEM_UNREF(&exec_ctx, md);
+ GRPC_MDELEM_UNREF(md);
}
/* cleanup phase */
for (i = 0; i < MANY; i++) {
- GRPC_MDELEM_UNREF(&exec_ctx, created[i]);
+ GRPC_MDELEM_UNREF(created[i]);
}
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_exec_ctx_finish();
grpc_shutdown();
gpr_free(created);
@@ -154,31 +150,25 @@ static void test_spin_creating_the_same_thing(bool intern_keys,
intern_keys, intern_values);
grpc_init();
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_mdelem a, b, c;
GRPC_MDELEM_UNREF(
- &exec_ctx,
a = grpc_mdelem_from_slices(
- &exec_ctx,
maybe_intern(grpc_slice_from_static_string("a"), intern_keys),
maybe_intern(grpc_slice_from_static_string("b"), intern_values)));
GRPC_MDELEM_UNREF(
- &exec_ctx,
b = grpc_mdelem_from_slices(
- &exec_ctx,
maybe_intern(grpc_slice_from_static_string("a"), intern_keys),
maybe_intern(grpc_slice_from_static_string("b"), intern_values)));
GRPC_MDELEM_UNREF(
- &exec_ctx,
c = grpc_mdelem_from_slices(
- &exec_ctx,
maybe_intern(grpc_slice_from_static_string("a"), intern_keys),
maybe_intern(grpc_slice_from_static_string("b"), intern_values)));
if (intern_keys && intern_values) {
GPR_ASSERT(a.payload == b.payload);
GPR_ASSERT(a.payload == c.payload);
}
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_exec_ctx_finish();
grpc_shutdown();
}
@@ -187,16 +177,16 @@ static void test_identity_laws(bool intern_keys, bool intern_values) {
intern_keys, intern_values);
grpc_init();
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_mdelem a, b, c;
a = grpc_mdelem_from_slices(
- &exec_ctx, maybe_intern(grpc_slice_from_static_string("a"), intern_keys),
+ maybe_intern(grpc_slice_from_static_string("a"), intern_keys),
maybe_intern(grpc_slice_from_static_string("b"), intern_values));
b = grpc_mdelem_from_slices(
- &exec_ctx, maybe_intern(grpc_slice_from_static_string("a"), intern_keys),
+ maybe_intern(grpc_slice_from_static_string("a"), intern_keys),
maybe_intern(grpc_slice_from_static_string("b"), intern_values));
c = grpc_mdelem_from_slices(
- &exec_ctx, maybe_intern(grpc_slice_from_static_string("a"), intern_keys),
+ maybe_intern(grpc_slice_from_static_string("a"), intern_keys),
maybe_intern(grpc_slice_from_static_string("b"), intern_values));
GPR_ASSERT(grpc_mdelem_eq(a, a));
GPR_ASSERT(grpc_mdelem_eq(b, b));
@@ -215,10 +205,10 @@ static void test_identity_laws(bool intern_keys, bool intern_values) {
GPR_ASSERT(a.payload != c.payload);
GPR_ASSERT(b.payload != c.payload);
}
- GRPC_MDELEM_UNREF(&exec_ctx, a);
- GRPC_MDELEM_UNREF(&exec_ctx, b);
- GRPC_MDELEM_UNREF(&exec_ctx, c);
- grpc_exec_ctx_finish(&exec_ctx);
+ GRPC_MDELEM_UNREF(a);
+ GRPC_MDELEM_UNREF(b);
+ GRPC_MDELEM_UNREF(c);
+ grpc_exec_ctx_finish();
grpc_shutdown();
}
@@ -233,7 +223,7 @@ static void test_things_stick_around(void) {
gpr_log(GPR_INFO, "test_things_stick_around");
grpc_init();
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
for (i = 0; i < nstrs; i++) {
gpr_asprintf(&buffer, "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx%" PRIuPTR "x", i);
@@ -244,7 +234,7 @@ static void test_things_stick_around(void) {
for (i = 0; i < nstrs; i++) {
grpc_slice_ref_internal(strs[i]);
- grpc_slice_unref_internal(&exec_ctx, strs[i]);
+ grpc_slice_unref_internal(strs[i]);
}
for (i = 0; i < nstrs; i++) {
@@ -256,18 +246,18 @@ static void test_things_stick_around(void) {
}
for (i = 0; i < nstrs; i++) {
- grpc_slice_unref_internal(&exec_ctx, strs[shuf[i]]);
+ grpc_slice_unref_internal(strs[shuf[i]]);
for (j = i + 1; j < nstrs; j++) {
gpr_asprintf(&buffer, "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx%" PRIuPTR "x",
shuf[j]);
test = grpc_slice_intern(grpc_slice_from_static_string(buffer));
GPR_ASSERT(grpc_slice_is_equivalent(test, strs[shuf[j]]));
- grpc_slice_unref_internal(&exec_ctx, test);
+ grpc_slice_unref_internal(test);
gpr_free(buffer);
}
}
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_exec_ctx_finish();
grpc_shutdown();
gpr_free(strs);
gpr_free(shuf);
@@ -280,39 +270,38 @@ static void test_user_data_works(void) {
gpr_log(GPR_INFO, "test_user_data_works");
grpc_init();
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
ud1 = gpr_malloc(sizeof(int));
*ud1 = 1;
ud2 = gpr_malloc(sizeof(int));
*ud2 = 2;
md = grpc_mdelem_from_slices(
- &exec_ctx, grpc_slice_intern(grpc_slice_from_static_string("abc")),
+ grpc_slice_intern(grpc_slice_from_static_string("abc")),
grpc_slice_intern(grpc_slice_from_static_string("123")));
grpc_mdelem_set_user_data(md, gpr_free, ud1);
grpc_mdelem_set_user_data(md, gpr_free, ud2);
GPR_ASSERT(grpc_mdelem_get_user_data(md, gpr_free) == ud1);
- GRPC_MDELEM_UNREF(&exec_ctx, md);
- grpc_exec_ctx_finish(&exec_ctx);
+ GRPC_MDELEM_UNREF(md);
+ grpc_exec_ctx_finish();
grpc_shutdown();
}
-static void verify_ascii_header_size(grpc_exec_ctx *exec_ctx, const char *key,
- const char *value, bool intern_key,
- bool intern_value) {
+static void verify_ascii_header_size(const char *key, const char *value,
+ bool intern_key, bool intern_value) {
grpc_mdelem elem = grpc_mdelem_from_slices(
- exec_ctx, maybe_intern(grpc_slice_from_static_string(key), intern_key),
+ maybe_intern(grpc_slice_from_static_string(key), intern_key),
maybe_intern(grpc_slice_from_static_string(value), intern_value));
size_t elem_size = grpc_mdelem_get_size_in_hpack_table(elem);
size_t expected_size = 32 + strlen(key) + strlen(value);
GPR_ASSERT(expected_size == elem_size);
- GRPC_MDELEM_UNREF(exec_ctx, elem);
+ GRPC_MDELEM_UNREF(elem);
}
-static void verify_binary_header_size(grpc_exec_ctx *exec_ctx, const char *key,
- const uint8_t *value, size_t value_len,
- bool intern_key, bool intern_value) {
+static void verify_binary_header_size(const char *key, const uint8_t *value,
+ size_t value_len, bool intern_key,
+ bool intern_value) {
grpc_mdelem elem = grpc_mdelem_from_slices(
- exec_ctx, maybe_intern(grpc_slice_from_static_string(key), intern_key),
+ maybe_intern(grpc_slice_from_static_string(key), intern_key),
maybe_intern(grpc_slice_from_static_buffer(value, value_len),
intern_value));
GPR_ASSERT(grpc_is_binary_header(GRPC_MDKEY(elem)));
@@ -322,9 +311,9 @@ static void verify_binary_header_size(grpc_exec_ctx *exec_ctx, const char *key,
grpc_slice base64_encoded = grpc_chttp2_base64_encode(value_slice);
size_t expected_size = 32 + strlen(key) + GRPC_SLICE_LENGTH(base64_encoded);
GPR_ASSERT(expected_size == elem_size);
- grpc_slice_unref_internal(exec_ctx, value_slice);
- grpc_slice_unref_internal(exec_ctx, base64_encoded);
- GRPC_MDELEM_UNREF(exec_ctx, elem);
+ grpc_slice_unref_internal(value_slice);
+ grpc_slice_unref_internal(base64_encoded);
+ GRPC_MDELEM_UNREF(elem);
}
#define BUFFER_SIZE 64
@@ -332,27 +321,24 @@ static void test_mdelem_sizes_in_hpack(bool intern_key, bool intern_value) {
gpr_log(GPR_INFO, "test_mdelem_size: intern_key=%d intern_value=%d",
intern_key, intern_value);
grpc_init();
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
uint8_t binary_value[BUFFER_SIZE] = {0};
for (uint8_t i = 0; i < BUFFER_SIZE; i++) {
binary_value[i] = i;
}
- verify_ascii_header_size(&exec_ctx, "hello", "world", intern_key,
- intern_value);
- verify_ascii_header_size(&exec_ctx, "hello",
- "worldxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", intern_key,
- intern_value);
- verify_ascii_header_size(&exec_ctx, ":scheme", "http", intern_key,
- intern_value);
+ verify_ascii_header_size("hello", "world", intern_key, intern_value);
+ verify_ascii_header_size("hello", "worldxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
+ intern_key, intern_value);
+ verify_ascii_header_size(":scheme", "http", intern_key, intern_value);
for (uint8_t i = 0; i < BUFFER_SIZE; i++) {
- verify_binary_header_size(&exec_ctx, "hello-bin", binary_value, i,
- intern_key, intern_value);
+ verify_binary_header_size("hello-bin", binary_value, i, intern_key,
+ intern_value);
}
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_exec_ctx_finish();
grpc_shutdown();
}
@@ -360,13 +346,13 @@ static void test_copied_static_metadata(bool dup_key, bool dup_value) {
gpr_log(GPR_INFO, "test_static_metadata: dup_key=%d dup_value=%d", dup_key,
dup_value);
grpc_init();
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ exec_ctx = GRPC_EXEC_CTX_INIT;
for (size_t i = 0; i < GRPC_STATIC_MDELEM_COUNT; i++) {
grpc_mdelem p = GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[i],
GRPC_MDELEM_STORAGE_STATIC);
grpc_mdelem q =
- grpc_mdelem_from_slices(&exec_ctx, maybe_dup(GRPC_MDKEY(p), dup_key),
+ grpc_mdelem_from_slices(maybe_dup(GRPC_MDKEY(p), dup_key),
maybe_dup(GRPC_MDVALUE(p), dup_value));
GPR_ASSERT(grpc_mdelem_eq(p, q));
if (dup_key || dup_value) {
@@ -374,11 +360,11 @@ static void test_copied_static_metadata(bool dup_key, bool dup_value) {
} else {
GPR_ASSERT(p.payload == q.payload);
}
- GRPC_MDELEM_UNREF(&exec_ctx, p);
- GRPC_MDELEM_UNREF(&exec_ctx, q);
+ GRPC_MDELEM_UNREF(p);
+ GRPC_MDELEM_UNREF(q);
}
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_exec_ctx_finish();
grpc_shutdown();
}
diff --git a/test/core/transport/status_conversion_test.c b/test/core/transport/status_conversion_test.c
index de8fa4458a..d91f3765c6 100644
--- a/test/core/transport/status_conversion_test.c
+++ b/test/core/transport/status_conversion_test.c
@@ -22,12 +22,9 @@
#define GRPC_STATUS_TO_HTTP2_ERROR(a, b) \
GPR_ASSERT(grpc_status_to_http2_error(a) == (b))
-#define HTTP2_ERROR_TO_GRPC_STATUS(a, deadline, b) \
- do { \
- grpc_exec_ctx my_exec_ctx = GRPC_EXEC_CTX_INIT; \
- GPR_ASSERT(grpc_http2_error_to_grpc_status(&my_exec_ctx, a, deadline) == \
- (b)); \
- grpc_exec_ctx_finish(&my_exec_ctx); \
+#define HTTP2_ERROR_TO_GRPC_STATUS(a, deadline, b) \
+ do { \
+ GPR_ASSERT(grpc_http2_error_to_grpc_status(a, deadline) == (b)); \
} while (0)
#define GRPC_STATUS_TO_HTTP2_STATUS(a, b) \
GPR_ASSERT(grpc_status_to_http2_status(a) == (b))
diff --git a/test/core/transport/stream_owned_slice_test.c b/test/core/transport/stream_owned_slice_test.c
index 774ad4e72e..f380763a6c 100644
--- a/test/core/transport/stream_owned_slice_test.c
+++ b/test/core/transport/stream_owned_slice_test.c
@@ -22,7 +22,7 @@
#include <grpc/support/log.h>
-static void do_nothing(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) {}
+static void do_nothing(void *arg, grpc_error *error) {}
int main(int argc, char **argv) {
grpc_test_init(argc, argv);
diff --git a/test/core/util/mock_endpoint.c b/test/core/util/mock_endpoint.cc
index bd386b2148..b7017057b0 100644
--- a/test/core/util/mock_endpoint.c
+++ b/test/core/util/mock_endpoint.cc
@@ -40,13 +40,13 @@ typedef struct grpc_mock_endpoint {
grpc_resource_user *resource_user;
} grpc_mock_endpoint;
-static void me_read(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep,
- grpc_slice_buffer *slices, grpc_closure *cb) {
+static void me_read(grpc_endpoint *ep, grpc_slice_buffer *slices,
+ grpc_closure *cb) {
grpc_mock_endpoint *m = (grpc_mock_endpoint *)ep;
gpr_mu_lock(&m->mu);
if (m->read_buffer.count > 0) {
grpc_slice_buffer_swap(&m->read_buffer, slices);
- GRPC_CLOSURE_SCHED(exec_ctx, cb, GRPC_ERROR_NONE);
+ GRPC_CLOSURE_SCHED(cb, GRPC_ERROR_NONE);
} else {
m->on_read = cb;
m->on_read_out = slices;
@@ -54,40 +54,38 @@ static void me_read(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep,
gpr_mu_unlock(&m->mu);
}
-static void me_write(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep,
- grpc_slice_buffer *slices, grpc_closure *cb) {
+static void me_write(grpc_endpoint *ep, grpc_slice_buffer *slices,
+ grpc_closure *cb) {
grpc_mock_endpoint *m = (grpc_mock_endpoint *)ep;
for (size_t i = 0; i < slices->count; i++) {
m->on_write(slices->slices[i]);
}
- GRPC_CLOSURE_SCHED(exec_ctx, cb, GRPC_ERROR_NONE);
+ GRPC_CLOSURE_SCHED(cb, GRPC_ERROR_NONE);
}
-static void me_add_to_pollset(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep,
- grpc_pollset *pollset) {}
+static void me_add_to_pollset(grpc_endpoint *ep, grpc_pollset *pollset) {}
-static void me_add_to_pollset_set(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep,
+static void me_add_to_pollset_set(grpc_endpoint *ep,
grpc_pollset_set *pollset) {}
-static void me_shutdown(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep,
- grpc_error *why) {
+static void me_shutdown(grpc_endpoint *ep, grpc_error *why) {
grpc_mock_endpoint *m = (grpc_mock_endpoint *)ep;
gpr_mu_lock(&m->mu);
if (m->on_read) {
- GRPC_CLOSURE_SCHED(exec_ctx, m->on_read,
+ GRPC_CLOSURE_SCHED(m->on_read,
GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING(
"Endpoint Shutdown", &why, 1));
m->on_read = NULL;
}
gpr_mu_unlock(&m->mu);
- grpc_resource_user_shutdown(exec_ctx, m->resource_user);
+ grpc_resource_user_shutdown(m->resource_user);
GRPC_ERROR_UNREF(why);
}
-static void me_destroy(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep) {
+static void me_destroy(grpc_endpoint *ep) {
grpc_mock_endpoint *m = (grpc_mock_endpoint *)ep;
grpc_slice_buffer_destroy(&m->read_buffer);
- grpc_resource_user_unref(exec_ctx, m->resource_user);
+ grpc_resource_user_unref(m->resource_user);
gpr_free(m);
}
@@ -123,13 +121,12 @@ grpc_endpoint *grpc_mock_endpoint_create(void (*on_write)(grpc_slice slice),
return &m->base;
}
-void grpc_mock_endpoint_put_read(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep,
- grpc_slice slice) {
+void grpc_mock_endpoint_put_read(grpc_endpoint *ep, grpc_slice slice) {
grpc_mock_endpoint *m = (grpc_mock_endpoint *)ep;
gpr_mu_lock(&m->mu);
if (m->on_read != NULL) {
grpc_slice_buffer_add(m->on_read_out, slice);
- GRPC_CLOSURE_SCHED(exec_ctx, m->on_read, GRPC_ERROR_NONE);
+ GRPC_CLOSURE_SCHED(m->on_read, GRPC_ERROR_NONE);
m->on_read = NULL;
} else {
grpc_slice_buffer_add(&m->read_buffer, slice);
diff --git a/test/core/util/mock_endpoint.h b/test/core/util/mock_endpoint.h
index 73b08dca31..b59d67733b 100644
--- a/test/core/util/mock_endpoint.h
+++ b/test/core/util/mock_endpoint.h
@@ -23,8 +23,7 @@
grpc_endpoint *grpc_mock_endpoint_create(void (*on_write)(grpc_slice slice),
grpc_resource_quota *resource_quota);
-void grpc_mock_endpoint_put_read(grpc_exec_ctx *exec_ctx,
- grpc_endpoint *mock_endpoint,
+void grpc_mock_endpoint_put_read(grpc_endpoint *mock_endpoint,
grpc_slice slice);
#endif
diff --git a/test/core/util/passthru_endpoint.c b/test/core/util/passthru_endpoint.cc
index 38a47584d5..4fcae991eb 100644
--- a/test/core/util/passthru_endpoint.c
+++ b/test/core/util/passthru_endpoint.cc
@@ -55,16 +55,16 @@ struct passthru_endpoint {
half server;
};
-static void me_read(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep,
- grpc_slice_buffer *slices, grpc_closure *cb) {
+static void me_read(grpc_endpoint *ep, grpc_slice_buffer *slices,
+ grpc_closure *cb) {
half *m = (half *)ep;
gpr_mu_lock(&m->parent->mu);
if (m->parent->shutdown) {
GRPC_CLOSURE_SCHED(
- exec_ctx, cb, GRPC_ERROR_CREATE_FROM_STATIC_STRING("Already shutdown"));
+ cb, GRPC_ERROR_CREATE_FROM_STATIC_STRING("Already shutdown"));
} else if (m->read_buffer.count > 0) {
grpc_slice_buffer_swap(&m->read_buffer, slices);
- GRPC_CLOSURE_SCHED(exec_ctx, cb, GRPC_ERROR_NONE);
+ GRPC_CLOSURE_SCHED(cb, GRPC_ERROR_NONE);
} else {
m->on_read = cb;
m->on_read_out = slices;
@@ -77,8 +77,8 @@ static half *other_half(half *h) {
return &h->parent->client;
}
-static void me_write(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep,
- grpc_slice_buffer *slices, grpc_closure *cb) {
+static void me_write(grpc_endpoint *ep, grpc_slice_buffer *slices,
+ grpc_closure *cb) {
half *m = other_half((half *)ep);
gpr_mu_lock(&m->parent->mu);
grpc_error *error = GRPC_ERROR_NONE;
@@ -89,7 +89,7 @@ static void me_write(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep,
for (size_t i = 0; i < slices->count; i++) {
grpc_slice_buffer_add(m->on_read_out, grpc_slice_copy(slices->slices[i]));
}
- GRPC_CLOSURE_SCHED(exec_ctx, m->on_read, GRPC_ERROR_NONE);
+ GRPC_CLOSURE_SCHED(m->on_read, GRPC_ERROR_NONE);
m->on_read = NULL;
} else {
for (size_t i = 0; i < slices->count; i++) {
@@ -98,48 +98,46 @@ static void me_write(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep,
}
}
gpr_mu_unlock(&m->parent->mu);
- GRPC_CLOSURE_SCHED(exec_ctx, cb, error);
+ GRPC_CLOSURE_SCHED(cb, error);
}
-static void me_add_to_pollset(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep,
- grpc_pollset *pollset) {}
+static void me_add_to_pollset(grpc_endpoint *ep, grpc_pollset *pollset) {}
-static void me_add_to_pollset_set(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep,
+static void me_add_to_pollset_set(grpc_endpoint *ep,
grpc_pollset_set *pollset) {}
-static void me_shutdown(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep,
- grpc_error *why) {
+static void me_shutdown(grpc_endpoint *ep, grpc_error *why) {
half *m = (half *)ep;
gpr_mu_lock(&m->parent->mu);
m->parent->shutdown = true;
if (m->on_read) {
GRPC_CLOSURE_SCHED(
- exec_ctx, m->on_read,
+ m->on_read,
GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING("Shutdown", &why, 1));
m->on_read = NULL;
}
m = other_half(m);
if (m->on_read) {
GRPC_CLOSURE_SCHED(
- exec_ctx, m->on_read,
+ m->on_read,
GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING("Shutdown", &why, 1));
m->on_read = NULL;
}
gpr_mu_unlock(&m->parent->mu);
- grpc_resource_user_shutdown(exec_ctx, m->resource_user);
+ grpc_resource_user_shutdown(m->resource_user);
GRPC_ERROR_UNREF(why);
}
-static void me_destroy(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep) {
+static void me_destroy(grpc_endpoint *ep) {
passthru_endpoint *p = ((half *)ep)->parent;
gpr_mu_lock(&p->mu);
if (0 == --p->halves) {
gpr_mu_unlock(&p->mu);
gpr_mu_destroy(&p->mu);
- grpc_slice_buffer_destroy_internal(exec_ctx, &p->client.read_buffer);
- grpc_slice_buffer_destroy_internal(exec_ctx, &p->server.read_buffer);
- grpc_resource_user_unref(exec_ctx, p->client.resource_user);
- grpc_resource_user_unref(exec_ctx, p->server.resource_user);
+ grpc_slice_buffer_destroy_internal(&p->client.read_buffer);
+ grpc_slice_buffer_destroy_internal(&p->server.read_buffer);
+ grpc_resource_user_unref(p->client.resource_user);
+ grpc_resource_user_unref(p->server.resource_user);
gpr_free(p);
} else {
gpr_mu_unlock(&p->mu);
diff --git a/test/core/util/passthru_endpoint.h b/test/core/util/passthru_endpoint.h
index da769024a5..6d28c2cbcd 100644
--- a/test/core/util/passthru_endpoint.h
+++ b/test/core/util/passthru_endpoint.h
@@ -21,6 +21,10 @@
#include "src/core/lib/iomgr/endpoint.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
typedef struct { int num_writes; } grpc_passthru_endpoint_stats;
void grpc_passthru_endpoint_create(grpc_endpoint **client,
@@ -28,4 +32,8 @@ void grpc_passthru_endpoint_create(grpc_endpoint **client,
grpc_resource_quota *resource_quota,
grpc_passthru_endpoint_stats *stats);
+#ifdef __cplusplus
+}
+#endif
+
#endif
diff --git a/test/core/util/port.c b/test/core/util/port.cc
index 61f2e5018f..61f2e5018f 100644
--- a/test/core/util/port.c
+++ b/test/core/util/port.cc
diff --git a/test/core/util/port_server_client.c b/test/core/util/port_server_client.cc
index 7b94ac4ada..253a1df29e 100644
--- a/test/core/util/port_server_client.c
+++ b/test/core/util/port_server_client.cc
@@ -40,22 +40,19 @@ typedef struct freereq {
int done;
} freereq;
-static void destroy_pops_and_shutdown(grpc_exec_ctx *exec_ctx, void *p,
- grpc_error *error) {
+static void destroy_pops_and_shutdown(void *p, grpc_error *error) {
grpc_pollset *pollset = grpc_polling_entity_pollset((grpc_polling_entity *)p);
- grpc_pollset_destroy(exec_ctx, pollset);
+ grpc_pollset_destroy(pollset);
gpr_free(pollset);
}
-static void freed_port_from_server(grpc_exec_ctx *exec_ctx, void *arg,
- grpc_error *error) {
+static void freed_port_from_server(void *arg, grpc_error *error) {
freereq *pr = (freereq *)arg;
gpr_mu_lock(pr->mu);
pr->done = 1;
GRPC_LOG_IF_ERROR(
"pollset_kick",
- grpc_pollset_kick(exec_ctx, grpc_polling_entity_pollset(&pr->pops),
- NULL));
+ grpc_pollset_kick(grpc_polling_entity_pollset(&pr->pops), NULL));
gpr_mu_unlock(pr->mu);
}
@@ -65,7 +62,7 @@ void grpc_free_port_using_server(int port) {
grpc_httpcli_response rsp;
freereq pr;
char *path;
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ ExecCtx _local_exec_ctx;
grpc_closure *shutdown_closure;
grpc_init();
@@ -80,37 +77,36 @@ void grpc_free_port_using_server(int port) {
shutdown_closure = GRPC_CLOSURE_CREATE(destroy_pops_and_shutdown, &pr.pops,
grpc_schedule_on_exec_ctx);
- req.host = GRPC_PORT_SERVER_ADDRESS;
+ req.host = (char *)GRPC_PORT_SERVER_ADDRESS;
gpr_asprintf(&path, "/drop/%d", port);
req.http.path = path;
grpc_httpcli_context_init(&context);
grpc_resource_quota *resource_quota =
grpc_resource_quota_create("port_server_client/free");
- grpc_httpcli_get(&exec_ctx, &context, &pr.pops, resource_quota, &req,
- grpc_exec_ctx_now(&exec_ctx) + 30 * GPR_MS_PER_SEC,
+ grpc_httpcli_get(&context, &pr.pops, resource_quota, &req,
+ grpc_exec_ctx_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(&exec_ctx, resource_quota);
- grpc_exec_ctx_flush(&exec_ctx);
+ grpc_resource_quota_unref_internal(resource_quota);
+ grpc_exec_ctx_flush();
gpr_mu_lock(pr.mu);
while (!pr.done) {
grpc_pollset_worker *worker = NULL;
if (!GRPC_LOG_IF_ERROR(
"pollset_work",
- grpc_pollset_work(&exec_ctx, grpc_polling_entity_pollset(&pr.pops),
- &worker,
- grpc_exec_ctx_now(&exec_ctx) + GPR_MS_PER_SEC))) {
+ grpc_pollset_work(grpc_polling_entity_pollset(&pr.pops), &worker,
+ grpc_exec_ctx_now() + GPR_MS_PER_SEC))) {
pr.done = 1;
}
}
gpr_mu_unlock(pr.mu);
- grpc_httpcli_context_destroy(&exec_ctx, &context);
- grpc_pollset_shutdown(&exec_ctx, grpc_polling_entity_pollset(&pr.pops),
+ grpc_httpcli_context_destroy(&context);
+ grpc_pollset_shutdown(grpc_polling_entity_pollset(&pr.pops),
shutdown_closure);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_exec_ctx_finish();
gpr_free(path);
grpc_http_response_destroy(&rsp);
@@ -127,8 +123,7 @@ typedef struct portreq {
grpc_httpcli_response response;
} portreq;
-static void got_port_from_server(grpc_exec_ctx *exec_ctx, void *arg,
- grpc_error *error) {
+static void got_port_from_server(void *arg, grpc_error *error) {
size_t i;
int port = 0;
portreq *pr = (portreq *)arg;
@@ -154,8 +149,7 @@ static void got_port_from_server(grpc_exec_ctx *exec_ctx, void *arg,
pr->port = 0;
GRPC_LOG_IF_ERROR(
"pollset_kick",
- grpc_pollset_kick(exec_ctx, grpc_polling_entity_pollset(&pr->pops),
- NULL));
+ grpc_pollset_kick(grpc_polling_entity_pollset(&pr->pops), NULL));
gpr_mu_unlock(pr->mu);
return;
}
@@ -167,17 +161,17 @@ static void got_port_from_server(grpc_exec_ctx *exec_ctx, void *arg,
GPR_TIMESPAN)));
pr->retries++;
req.host = pr->server;
- req.http.path = "/get";
+ req.http.path = (char *)"/get";
grpc_http_response_destroy(&pr->response);
memset(&pr->response, 0, sizeof(pr->response));
grpc_resource_quota *resource_quota =
grpc_resource_quota_create("port_server_client/pick_retry");
- grpc_httpcli_get(exec_ctx, pr->ctx, &pr->pops, resource_quota, &req,
- grpc_exec_ctx_now(exec_ctx) + 30 * GPR_MS_PER_SEC,
+ grpc_httpcli_get(pr->ctx, &pr->pops, resource_quota, &req,
+ grpc_exec_ctx_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(exec_ctx, resource_quota);
+ grpc_resource_quota_unref_internal(resource_quota);
return;
}
GPR_ASSERT(response);
@@ -191,8 +185,7 @@ static void got_port_from_server(grpc_exec_ctx *exec_ctx, void *arg,
pr->port = port;
GRPC_LOG_IF_ERROR(
"pollset_kick",
- grpc_pollset_kick(exec_ctx, grpc_polling_entity_pollset(&pr->pops),
- NULL));
+ grpc_pollset_kick(grpc_polling_entity_pollset(&pr->pops), NULL));
gpr_mu_unlock(pr->mu);
}
@@ -200,7 +193,7 @@ int grpc_pick_port_using_server(void) {
grpc_httpcli_context context;
grpc_httpcli_request req;
portreq pr;
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ ExecCtx _local_exec_ctx;
grpc_closure *shutdown_closure;
grpc_init();
@@ -213,40 +206,39 @@ int grpc_pick_port_using_server(void) {
shutdown_closure = GRPC_CLOSURE_CREATE(destroy_pops_and_shutdown, &pr.pops,
grpc_schedule_on_exec_ctx);
pr.port = -1;
- pr.server = GRPC_PORT_SERVER_ADDRESS;
+ pr.server = (char *)GRPC_PORT_SERVER_ADDRESS;
pr.ctx = &context;
- req.host = GRPC_PORT_SERVER_ADDRESS;
- req.http.path = "/get";
+ req.host = (char *)GRPC_PORT_SERVER_ADDRESS;
+ req.http.path = (char *)"/get";
grpc_httpcli_context_init(&context);
grpc_resource_quota *resource_quota =
grpc_resource_quota_create("port_server_client/pick");
grpc_httpcli_get(
- &exec_ctx, &context, &pr.pops, resource_quota, &req,
- grpc_exec_ctx_now(&exec_ctx) + 30 * GPR_MS_PER_SEC,
+ &context, &pr.pops, resource_quota, &req,
+ grpc_exec_ctx_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(&exec_ctx, resource_quota);
- grpc_exec_ctx_flush(&exec_ctx);
+ grpc_resource_quota_unref_internal(resource_quota);
+ grpc_exec_ctx_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(&exec_ctx, grpc_polling_entity_pollset(&pr.pops),
- &worker,
- grpc_exec_ctx_now(&exec_ctx) + GPR_MS_PER_SEC))) {
+ grpc_pollset_work(grpc_polling_entity_pollset(&pr.pops), &worker,
+ grpc_exec_ctx_now() + GPR_MS_PER_SEC))) {
pr.port = 0;
}
}
gpr_mu_unlock(pr.mu);
grpc_http_response_destroy(&pr.response);
- grpc_httpcli_context_destroy(&exec_ctx, &context);
- grpc_pollset_shutdown(&exec_ctx, grpc_polling_entity_pollset(&pr.pops),
+ grpc_httpcli_context_destroy(&context);
+ grpc_pollset_shutdown(grpc_polling_entity_pollset(&pr.pops),
shutdown_closure);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_exec_ctx_finish();
grpc_shutdown();
return pr.port;
diff --git a/test/core/util/port_server_client.h b/test/core/util/port_server_client.h
index 86dd7018ff..a88026ebe8 100644
--- a/test/core/util/port_server_client.h
+++ b/test/core/util/port_server_client.h
@@ -24,7 +24,15 @@
// must be synchronized with tools/run_tests/python_utils/start_port_server.py
#define GRPC_PORT_SERVER_ADDRESS "localhost:32766"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
int grpc_pick_port_using_server(void);
void grpc_free_port_using_server(int port);
+#ifdef __cplusplus
+}
+#endif
+
#endif // GRPC_TEST_CORE_UTIL_PORT_SERVER_CLIENT_H
diff --git a/test/core/util/reconnect_server.c b/test/core/util/reconnect_server.c
index 9c56e02e8e..ef4b5e01cd 100644
--- a/test/core/util/reconnect_server.c
+++ b/test/core/util/reconnect_server.c
@@ -55,7 +55,7 @@ static void pretty_print_backoffs(reconnect_server *server) {
}
}
-static void on_connect(grpc_exec_ctx *exec_ctx, void *arg, grpc_endpoint *tcp,
+static void on_connect(void *arg, grpc_endpoint *tcp,
grpc_pollset *accepting_pollset,
grpc_tcp_server_acceptor *acceptor) {
gpr_free(acceptor);
@@ -65,9 +65,9 @@ static void on_connect(grpc_exec_ctx *exec_ctx, void *arg, grpc_endpoint *tcp,
gpr_timespec now = gpr_now(GPR_CLOCK_REALTIME);
timestamp_list *new_tail;
peer = grpc_endpoint_get_peer(tcp);
- grpc_endpoint_shutdown(exec_ctx, tcp,
+ grpc_endpoint_shutdown(tcp,
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Connected"));
- grpc_endpoint_destroy(exec_ctx, tcp);
+ grpc_endpoint_destroy(tcp);
if (peer) {
last_colon = strrchr(peer, ':');
if (server->peer == NULL) {
diff --git a/test/core/util/test_tcp_server.c b/test/core/util/test_tcp_server.cc
index 611ecb330c..8b482b36e0 100644
--- a/test/core/util/test_tcp_server.c
+++ b/test/core/util/test_tcp_server.cc
@@ -33,9 +33,8 @@
#include "test/core/util/port.h"
#include "test/core/util/test_config.h"
-static void on_server_destroyed(grpc_exec_ctx *exec_ctx, void *data,
- grpc_error *error) {
- test_tcp_server *server = data;
+static void on_server_destroyed(void *data, grpc_error *error) {
+ test_tcp_server *server = (test_tcp_server *)data;
server->shutdown = 1;
}
@@ -46,7 +45,7 @@ void test_tcp_server_init(test_tcp_server *server,
GRPC_CLOSURE_INIT(&server->shutdown_complete, on_server_destroyed, server,
grpc_schedule_on_exec_ctx);
server->shutdown = 0;
- server->pollset = gpr_zalloc(grpc_pollset_size());
+ server->pollset = (grpc_pollset *)gpr_zalloc(grpc_pollset_size());
grpc_pollset_init(server->pollset, &server->mu);
server->on_connect = on_connect;
server->cb_data = user_data;
@@ -56,51 +55,49 @@ void test_tcp_server_start(test_tcp_server *server, int port) {
grpc_resolved_address resolved_addr;
struct sockaddr_in *addr = (struct sockaddr_in *)resolved_addr.addr;
int port_added;
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ ExecCtx _local_exec_ctx;
addr->sin_family = AF_INET;
addr->sin_port = htons((uint16_t)port);
memset(&addr->sin_addr, 0, sizeof(addr->sin_addr));
- grpc_error *error = grpc_tcp_server_create(
- &exec_ctx, &server->shutdown_complete, NULL, &server->tcp_server);
+ grpc_error *error = grpc_tcp_server_create(&server->shutdown_complete, NULL,
+ &server->tcp_server);
GPR_ASSERT(error == GRPC_ERROR_NONE);
error =
grpc_tcp_server_add_port(server->tcp_server, &resolved_addr, &port_added);
GPR_ASSERT(error == GRPC_ERROR_NONE);
GPR_ASSERT(port_added == port);
- grpc_tcp_server_start(&exec_ctx, server->tcp_server, &server->pollset, 1,
+ 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(&exec_ctx);
+ grpc_exec_ctx_finish();
}
void test_tcp_server_poll(test_tcp_server *server, int seconds) {
grpc_pollset_worker *worker = NULL;
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ ExecCtx _local_exec_ctx;
grpc_millis deadline = grpc_timespec_to_millis_round_up(
grpc_timeout_seconds_to_deadline(seconds));
gpr_mu_lock(server->mu);
- GRPC_LOG_IF_ERROR(
- "pollset_work",
- grpc_pollset_work(&exec_ctx, server->pollset, &worker, deadline));
+ GRPC_LOG_IF_ERROR("pollset_work",
+ grpc_pollset_work(server->pollset, &worker, deadline));
gpr_mu_unlock(server->mu);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_exec_ctx_finish();
}
-static void do_nothing(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) {}
-static void finish_pollset(grpc_exec_ctx *exec_ctx, void *arg,
- grpc_error *error) {
- grpc_pollset_destroy(exec_ctx, arg);
+static void do_nothing(void *arg, grpc_error *error) {}
+static void finish_pollset(void *arg, grpc_error *error) {
+ grpc_pollset_destroy((grpc_pollset *)arg);
}
void test_tcp_server_destroy(test_tcp_server *server) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ ExecCtx _local_exec_ctx;
gpr_timespec shutdown_deadline;
grpc_closure do_nothing_cb;
- grpc_tcp_server_unref(&exec_ctx, server->tcp_server);
+ grpc_tcp_server_unref(server->tcp_server);
GRPC_CLOSURE_INIT(&do_nothing_cb, do_nothing, NULL,
grpc_schedule_on_exec_ctx);
shutdown_deadline = gpr_time_add(gpr_now(GPR_CLOCK_MONOTONIC),
@@ -109,10 +106,10 @@ void test_tcp_server_destroy(test_tcp_server *server) {
gpr_time_cmp(gpr_now(GPR_CLOCK_MONOTONIC), shutdown_deadline) < 0) {
test_tcp_server_poll(server, 1);
}
- grpc_pollset_shutdown(&exec_ctx, server->pollset,
+ grpc_pollset_shutdown(server->pollset,
GRPC_CLOSURE_CREATE(finish_pollset, server->pollset,
grpc_schedule_on_exec_ctx));
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_exec_ctx_finish();
gpr_free(server->pollset);
grpc_shutdown();
}
diff --git a/test/core/util/trickle_endpoint.c b/test/core/util/trickle_endpoint.cc
index fc066f9d80..e36f64816e 100644
--- a/test/core/util/trickle_endpoint.c
+++ b/test/core/util/trickle_endpoint.cc
@@ -45,23 +45,22 @@ typedef struct {
grpc_closure *write_cb;
} trickle_endpoint;
-static void te_read(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep,
- grpc_slice_buffer *slices, grpc_closure *cb) {
+static void te_read(grpc_endpoint *ep, grpc_slice_buffer *slices,
+ grpc_closure *cb) {
trickle_endpoint *te = (trickle_endpoint *)ep;
- grpc_endpoint_read(exec_ctx, te->wrapped, slices, cb);
+ grpc_endpoint_read(te->wrapped, slices, cb);
}
-static void maybe_call_write_cb_locked(grpc_exec_ctx *exec_ctx,
- trickle_endpoint *te) {
+static void maybe_call_write_cb_locked(trickle_endpoint *te) {
if (te->write_cb != NULL && (te->error != GRPC_ERROR_NONE ||
te->write_buffer.length <= WRITE_BUFFER_SIZE)) {
- GRPC_CLOSURE_SCHED(exec_ctx, te->write_cb, GRPC_ERROR_REF(te->error));
+ GRPC_CLOSURE_SCHED(te->write_cb, GRPC_ERROR_REF(te->error));
te->write_cb = NULL;
}
}
-static void te_write(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep,
- grpc_slice_buffer *slices, grpc_closure *cb) {
+static void te_write(grpc_endpoint *ep, grpc_slice_buffer *slices,
+ grpc_closure *cb) {
trickle_endpoint *te = (trickle_endpoint *)ep;
gpr_mu_lock(&te->mu);
GPR_ASSERT(te->write_cb == NULL);
@@ -73,40 +72,38 @@ static void te_write(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep,
grpc_slice_copy(slices->slices[i]));
}
te->write_cb = cb;
- maybe_call_write_cb_locked(exec_ctx, te);
+ maybe_call_write_cb_locked(te);
gpr_mu_unlock(&te->mu);
}
-static void te_add_to_pollset(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep,
- grpc_pollset *pollset) {
+static void te_add_to_pollset(grpc_endpoint *ep, grpc_pollset *pollset) {
trickle_endpoint *te = (trickle_endpoint *)ep;
- grpc_endpoint_add_to_pollset(exec_ctx, te->wrapped, pollset);
+ grpc_endpoint_add_to_pollset(te->wrapped, pollset);
}
-static void te_add_to_pollset_set(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep,
+static void te_add_to_pollset_set(grpc_endpoint *ep,
grpc_pollset_set *pollset_set) {
trickle_endpoint *te = (trickle_endpoint *)ep;
- grpc_endpoint_add_to_pollset_set(exec_ctx, te->wrapped, pollset_set);
+ grpc_endpoint_add_to_pollset_set(te->wrapped, pollset_set);
}
-static void te_shutdown(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep,
- grpc_error *why) {
+static void te_shutdown(grpc_endpoint *ep, grpc_error *why) {
trickle_endpoint *te = (trickle_endpoint *)ep;
gpr_mu_lock(&te->mu);
if (te->error == GRPC_ERROR_NONE) {
te->error = GRPC_ERROR_REF(why);
}
- maybe_call_write_cb_locked(exec_ctx, te);
+ maybe_call_write_cb_locked(te);
gpr_mu_unlock(&te->mu);
- grpc_endpoint_shutdown(exec_ctx, te->wrapped, why);
+ grpc_endpoint_shutdown(te->wrapped, why);
}
-static void te_destroy(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep) {
+static void te_destroy(grpc_endpoint *ep) {
trickle_endpoint *te = (trickle_endpoint *)ep;
- grpc_endpoint_destroy(exec_ctx, te->wrapped);
+ grpc_endpoint_destroy(te->wrapped);
gpr_mu_destroy(&te->mu);
- grpc_slice_buffer_destroy_internal(exec_ctx, &te->write_buffer);
- grpc_slice_buffer_destroy_internal(exec_ctx, &te->writing_buffer);
+ grpc_slice_buffer_destroy_internal(&te->write_buffer);
+ grpc_slice_buffer_destroy_internal(&te->writing_buffer);
GRPC_ERROR_UNREF(te->error);
gpr_free(te);
}
@@ -126,8 +123,7 @@ static int te_get_fd(grpc_endpoint *ep) {
return grpc_endpoint_get_fd(te->wrapped);
}
-static void te_finish_write(grpc_exec_ctx *exec_ctx, void *arg,
- grpc_error *error) {
+static void te_finish_write(void *arg, grpc_error *error) {
trickle_endpoint *te = (trickle_endpoint *)arg;
gpr_mu_lock(&te->mu);
te->writing = false;
@@ -159,8 +155,7 @@ static double ts2dbl(gpr_timespec s) {
return (double)s.tv_sec + 1e-9 * (double)s.tv_nsec;
}
-size_t grpc_trickle_endpoint_trickle(grpc_exec_ctx *exec_ctx,
- grpc_endpoint *ep) {
+size_t grpc_trickle_endpoint_trickle(grpc_endpoint *ep) {
trickle_endpoint *te = (trickle_endpoint *)ep;
gpr_mu_lock(&te->mu);
if (!te->writing && te->write_buffer.length > 0) {
@@ -175,9 +170,9 @@ size_t grpc_trickle_endpoint_trickle(grpc_exec_ctx *exec_ctx,
te->writing = true;
te->last_write = now;
grpc_endpoint_write(
- exec_ctx, te->wrapped, &te->writing_buffer,
+ te->wrapped, &te->writing_buffer,
GRPC_CLOSURE_CREATE(te_finish_write, te, grpc_schedule_on_exec_ctx));
- maybe_call_write_cb_locked(exec_ctx, te);
+ maybe_call_write_cb_locked(te);
}
}
size_t backlog = te->write_buffer.length;
diff --git a/test/core/util/trickle_endpoint.h b/test/core/util/trickle_endpoint.h
index ca39638ba0..be19dd2035 100644
--- a/test/core/util/trickle_endpoint.h
+++ b/test/core/util/trickle_endpoint.h
@@ -29,8 +29,7 @@ grpc_endpoint *grpc_trickle_endpoint_create(grpc_endpoint *wrap,
double bytes_per_second);
/* Allow up to \a bytes through the endpoint. Returns the new backlog. */
-size_t grpc_trickle_endpoint_trickle(grpc_exec_ctx *exec_ctx,
- grpc_endpoint *endpoint);
+size_t grpc_trickle_endpoint_trickle(grpc_endpoint *endpoint);
size_t grpc_trickle_get_backlog(grpc_endpoint *endpoint);