aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/core/surface/completion_queue_test.cc
diff options
context:
space:
mode:
authorGravatar Yash Tibrewal <yashkt@google.com>2017-12-06 09:05:05 -0800
committerGravatar GitHub <noreply@github.com>2017-12-06 09:05:05 -0800
commitad4d2dde0052efbbf49d64b0843c45f0381cfeb3 (patch)
tree6a657f8c6179d873b34505cdc24bce9462ca68eb /test/core/surface/completion_queue_test.cc
parenta3df36cc2505a89c2f481eea4a66a87b3002844a (diff)
Revert "All instances of exec_ctx being passed around in src/core removed"
Diffstat (limited to 'test/core/surface/completion_queue_test.cc')
-rw-r--r--test/core/surface/completion_queue_test.cc39
1 files changed, 26 insertions, 13 deletions
diff --git a/test/core/surface/completion_queue_test.cc b/test/core/surface/completion_queue_test.cc
index fefbb3c185..c6e13d2386 100644
--- a/test/core/surface/completion_queue_test.cc
+++ b/test/core/surface/completion_queue_test.cc
@@ -121,7 +121,8 @@ static void test_wait_empty(void) {
}
}
-static void do_nothing_end_completion(void* arg, grpc_cq_completion* c) {}
+static void do_nothing_end_completion(grpc_exec_ctx* exec_ctx, void* arg,
+ grpc_cq_completion* c) {}
static void test_cq_end_op(void) {
grpc_event ev;
@@ -130,6 +131,8 @@ 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");
@@ -137,14 +140,14 @@ 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++) {
- grpc_core::ExecCtx exec_ctx;
+ 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, nullptr);
GPR_ASSERT(grpc_cq_begin_op(cc, tag));
- grpc_cq_end_op(cc, tag, GRPC_ERROR_NONE, do_nothing_end_completion, nullptr,
- &completion);
+ grpc_cq_end_op(&exec_ctx, cc, tag, GRPC_ERROR_NONE,
+ do_nothing_end_completion, nullptr, &completion);
ev = grpc_completion_queue_next(cc, gpr_inf_past(GPR_CLOCK_REALTIME),
nullptr);
@@ -153,6 +156,7 @@ static void test_cq_end_op(void) {
GPR_ASSERT(ev.success);
shutdown_and_destroy(cc);
+ grpc_exec_ctx_finish(&exec_ctx);
}
}
@@ -163,6 +167,8 @@ static void test_cq_tls_cache_full(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();
void* res_tag;
int ok;
@@ -172,15 +178,15 @@ static void test_cq_tls_cache_full(void) {
attr.version = 1;
attr.cq_completion_type = GRPC_CQ_NEXT;
for (size_t i = 0; i < GPR_ARRAY_SIZE(polling_types); i++) {
- grpc_core::ExecCtx exec_ctx; // Reset exec_ctx
+ 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, nullptr);
grpc_completion_queue_thread_local_cache_init(cc);
GPR_ASSERT(grpc_cq_begin_op(cc, tag));
- grpc_cq_end_op(cc, tag, GRPC_ERROR_NONE, do_nothing_end_completion, nullptr,
- &completion);
+ grpc_cq_end_op(&exec_ctx, cc, tag, GRPC_ERROR_NONE,
+ do_nothing_end_completion, nullptr, &completion);
ev = grpc_completion_queue_next(cc, gpr_inf_past(GPR_CLOCK_REALTIME),
nullptr);
@@ -196,6 +202,7 @@ static void test_cq_tls_cache_full(void) {
GPR_ASSERT(ev.type == GRPC_QUEUE_TIMEOUT);
shutdown_and_destroy(cc);
+ grpc_exec_ctx_finish(&exec_ctx);
}
}
@@ -204,6 +211,8 @@ static void test_cq_tls_cache_empty(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* res_tag;
int ok;
@@ -212,7 +221,7 @@ static void test_cq_tls_cache_empty(void) {
attr.version = 1;
attr.cq_completion_type = GRPC_CQ_NEXT;
for (size_t i = 0; i < GPR_ARRAY_SIZE(polling_types); i++) {
- grpc_core::ExecCtx exec_ctx; // Reset exec_ctx
+ 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, nullptr);
@@ -223,6 +232,7 @@ static void test_cq_tls_cache_empty(void) {
GPR_ASSERT(
grpc_completion_queue_thread_local_cache_flush(cc, &res_tag, &ok) == 0);
shutdown_and_destroy(cc);
+ grpc_exec_ctx_finish(&exec_ctx);
}
}
@@ -279,6 +289,8 @@ 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");
@@ -293,15 +305,15 @@ 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++) {
- grpc_core::ExecCtx exec_ctx; // reset exec_ctx
+ 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, nullptr);
for (i = 0; i < GPR_ARRAY_SIZE(tags); i++) {
GPR_ASSERT(grpc_cq_begin_op(cc, tags[i]));
- grpc_cq_end_op(cc, tags[i], GRPC_ERROR_NONE, do_nothing_end_completion,
- nullptr, &completions[i]);
+ grpc_cq_end_op(&exec_ctx, cc, tags[i], GRPC_ERROR_NONE,
+ do_nothing_end_completion, nullptr, &completions[i]);
}
for (i = 0; i < GPR_ARRAY_SIZE(tags); i++) {
@@ -312,8 +324,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(cc, tags[i], GRPC_ERROR_NONE, do_nothing_end_completion,
- nullptr, &completions[i]);
+ grpc_cq_end_op(&exec_ctx, cc, tags[i], GRPC_ERROR_NONE,
+ do_nothing_end_completion, nullptr, &completions[i]);
}
for (i = 0; i < GPR_ARRAY_SIZE(tags); i++) {
@@ -324,6 +336,7 @@ static void test_pluck(void) {
}
shutdown_and_destroy(cc);
+ grpc_exec_ctx_finish(&exec_ctx);
}
}