|
|
@ -104,7 +104,6 @@ static void test_cq_end_op(void) { |
|
|
|
|
|
|
|
|
|
|
|
static void test_cq_alarm(void) { |
|
|
|
static void test_cq_alarm(void) { |
|
|
|
grpc_completion_queue *cc; |
|
|
|
grpc_completion_queue *cc; |
|
|
|
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LOG_TEST("test_cq_alarm"); |
|
|
|
LOG_TEST("test_cq_alarm"); |
|
|
|
cc = grpc_completion_queue_create(NULL); |
|
|
|
cc = grpc_completion_queue_create(NULL); |
|
|
@ -112,35 +111,32 @@ static void test_cq_alarm(void) { |
|
|
|
/* regular expiry */ |
|
|
|
/* regular expiry */ |
|
|
|
grpc_event ev; |
|
|
|
grpc_event ev; |
|
|
|
void *tag = create_test_tag(); |
|
|
|
void *tag = create_test_tag(); |
|
|
|
grpc_cq_alarm *cq_alarm = grpc_cq_alarm_create( |
|
|
|
grpc_cq_alarm *cq_alarm = |
|
|
|
&exec_ctx, cc, GRPC_TIMEOUT_SECONDS_TO_DEADLINE(1), tag); |
|
|
|
grpc_cq_alarm_create(cc, GRPC_TIMEOUT_SECONDS_TO_DEADLINE(1), tag); |
|
|
|
|
|
|
|
|
|
|
|
ev = grpc_completion_queue_next(cc, GRPC_TIMEOUT_SECONDS_TO_DEADLINE(2), |
|
|
|
ev = grpc_completion_queue_next(cc, GRPC_TIMEOUT_SECONDS_TO_DEADLINE(2), |
|
|
|
NULL); |
|
|
|
NULL); |
|
|
|
GPR_ASSERT(ev.type == GRPC_OP_COMPLETE); |
|
|
|
GPR_ASSERT(ev.type == GRPC_OP_COMPLETE); |
|
|
|
GPR_ASSERT(ev.tag == tag); |
|
|
|
GPR_ASSERT(ev.tag == tag); |
|
|
|
GPR_ASSERT(ev.success); |
|
|
|
GPR_ASSERT(ev.success); |
|
|
|
grpc_cq_alarm_destroy(&exec_ctx, cq_alarm); |
|
|
|
grpc_cq_alarm_destroy(cq_alarm); |
|
|
|
} |
|
|
|
} |
|
|
|
{ |
|
|
|
{ |
|
|
|
/* cancellation */ |
|
|
|
/* cancellation */ |
|
|
|
grpc_event ev; |
|
|
|
grpc_event ev; |
|
|
|
void *tag = create_test_tag(); |
|
|
|
void *tag = create_test_tag(); |
|
|
|
grpc_cq_alarm *cq_alarm = grpc_cq_alarm_create( |
|
|
|
grpc_cq_alarm *cq_alarm = |
|
|
|
&exec_ctx, cc, GRPC_TIMEOUT_SECONDS_TO_DEADLINE(2), tag); |
|
|
|
grpc_cq_alarm_create(cc, GRPC_TIMEOUT_SECONDS_TO_DEADLINE(2), tag); |
|
|
|
|
|
|
|
|
|
|
|
grpc_cq_alarm_cancel(&exec_ctx, cq_alarm); |
|
|
|
grpc_cq_alarm_cancel(cq_alarm); |
|
|
|
GPR_ASSERT(grpc_exec_ctx_flush(&exec_ctx) == 1); |
|
|
|
|
|
|
|
ev = grpc_completion_queue_next(cc, GRPC_TIMEOUT_SECONDS_TO_DEADLINE(1), |
|
|
|
ev = grpc_completion_queue_next(cc, GRPC_TIMEOUT_SECONDS_TO_DEADLINE(1), |
|
|
|
NULL); |
|
|
|
NULL); |
|
|
|
GPR_ASSERT(ev.type == GRPC_OP_COMPLETE); |
|
|
|
GPR_ASSERT(ev.type == GRPC_OP_COMPLETE); |
|
|
|
GPR_ASSERT(ev.tag == tag); |
|
|
|
GPR_ASSERT(ev.tag == tag); |
|
|
|
GPR_ASSERT(ev.success == 0); |
|
|
|
GPR_ASSERT(ev.success == 0); |
|
|
|
grpc_cq_alarm_destroy(&exec_ctx, cq_alarm); |
|
|
|
grpc_cq_alarm_destroy(cq_alarm); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
shutdown_and_destroy(cc); |
|
|
|
shutdown_and_destroy(cc); |
|
|
|
grpc_exec_ctx_finish(&exec_ctx); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static void test_shutdown_then_next_polling(void) { |
|
|
|
static void test_shutdown_then_next_polling(void) { |
|
|
|