diff options
Diffstat (limited to 'test/core/end2end')
29 files changed, 155 insertions, 273 deletions
diff --git a/test/core/end2end/cq_verifier.c b/test/core/end2end/cq_verifier.c index f291e73e3b..66480254d2 100644 --- a/test/core/end2end/cq_verifier.c +++ b/test/core/end2end/cq_verifier.c @@ -45,6 +45,8 @@ #include <grpc/support/time.h> #include <grpc/support/useful.h> +#define ROOT_EXPECTATION 1000 + /* a set of metadata we expect to find on an event */ typedef struct metadata { size_t count; @@ -60,9 +62,7 @@ typedef struct expectation { struct expectation *prev; grpc_completion_type type; void *tag; - union { - grpc_op_error op_complete; - } data; + int success; } expectation; /* the verifier itself */ @@ -75,7 +75,7 @@ struct cq_verifier { cq_verifier *cq_verifier_create(grpc_completion_queue *cq) { cq_verifier *v = gpr_malloc(sizeof(cq_verifier)); - v->expect.type = GRPC_COMPLETION_DO_NOT_USE; + v->expect.type = ROOT_EXPECTATION; v->expect.tag = NULL; v->expect.next = &v->expect; v->expect.prev = &v->expect; @@ -149,11 +149,9 @@ static void verify_matches(expectation *e, grpc_event *ev) { abort(); break; case GRPC_OP_COMPLETE: - GPR_ASSERT(e->data.op_complete == ev->data.op_complete); - break; - case GRPC_SERVER_SHUTDOWN: + GPR_ASSERT(e->success == ev->success); break; - case GRPC_COMPLETION_DO_NOT_USE: + case GRPC_QUEUE_TIMEOUT: gpr_log(GPR_ERROR, "not implemented"); abort(); break; @@ -165,13 +163,10 @@ static void expectation_to_strvec(gpr_strvec *buf, expectation *e) { switch (e->type) { case GRPC_OP_COMPLETE: - gpr_asprintf(&tmp, "GRPC_OP_COMPLETE result=%d", e->data.op_complete); + gpr_asprintf(&tmp, "GRPC_OP_COMPLETE result=%d", e->success); gpr_strvec_add(buf, tmp); break; - case GRPC_SERVER_SHUTDOWN: - gpr_strvec_add(buf, gpr_strdup("GRPC_SERVER_SHUTDOWN")); - break; - case GRPC_COMPLETION_DO_NOT_USE: + case GRPC_QUEUE_TIMEOUT: case GRPC_QUEUE_SHUTDOWN: gpr_log(GPR_ERROR, "not implemented"); abort(); @@ -203,7 +198,7 @@ static void fail_no_event_received(cq_verifier *v) { void cq_verify(cq_verifier *v) { gpr_timespec deadline = GRPC_TIMEOUT_SECONDS_TO_DEADLINE(10); - grpc_event *ev; + grpc_event ev; expectation *e; char *s; gpr_strvec have_tags; @@ -212,15 +207,16 @@ void cq_verify(cq_verifier *v) { while (v->expect.next != &v->expect) { ev = grpc_completion_queue_next(v->cq, deadline); - if (!ev) { + if (ev.type == GRPC_QUEUE_TIMEOUT) { fail_no_event_received(v); + break; } for (e = v->expect.next; e != &v->expect; e = e->next) { gpr_asprintf(&s, " %p", e->tag); gpr_strvec_add(&have_tags, s); - if (e->tag == ev->tag) { - verify_matches(e, ev); + if (e->tag == ev.tag) { + verify_matches(e, &ev); e->next->prev = e->prev; e->prev->next = e->next; gpr_free(e); @@ -228,7 +224,7 @@ void cq_verify(cq_verifier *v) { } } if (e == &v->expect) { - s = grpc_event_string(ev); + s = grpc_event_string(&ev); gpr_log(GPR_ERROR, "event not found: %s", s); gpr_free(s); s = gpr_strvec_flatten(&have_tags, NULL); @@ -237,8 +233,6 @@ void cq_verify(cq_verifier *v) { gpr_strvec_destroy(&have_tags); abort(); } - - grpc_event_finish(ev); } gpr_strvec_destroy(&have_tags); @@ -246,13 +240,13 @@ void cq_verify(cq_verifier *v) { void cq_verify_empty(cq_verifier *v) { gpr_timespec deadline = gpr_time_add(gpr_now(), gpr_time_from_seconds(1)); - grpc_event *ev; + grpc_event ev; GPR_ASSERT(v->expect.next == &v->expect && "expectation queue must be empty"); ev = grpc_completion_queue_next(v->cq, deadline); - if (ev != NULL) { - char *s = grpc_event_string(ev); + if (ev.type != GRPC_QUEUE_TIMEOUT) { + char *s = grpc_event_string(&ev); gpr_log(GPR_ERROR, "unexpected event (expected nothing): %s", s); gpr_free(s); abort(); @@ -269,10 +263,6 @@ static expectation *add(cq_verifier *v, grpc_completion_type type, void *tag) { return e; } -void cq_expect_completion(cq_verifier *v, void *tag, grpc_op_error result) { - add(v, GRPC_OP_COMPLETE, tag)->data.op_complete = result; -} - -void cq_expect_server_shutdown(cq_verifier *v, void *tag) { - add(v, GRPC_SERVER_SHUTDOWN, tag); +void cq_expect_completion(cq_verifier *v, void *tag, int success) { + add(v, GRPC_OP_COMPLETE, tag)->success = success; } diff --git a/test/core/end2end/cq_verifier.h b/test/core/end2end/cq_verifier.h index bae3c6caf0..1ecd4db5da 100644 --- a/test/core/end2end/cq_verifier.h +++ b/test/core/end2end/cq_verifier.h @@ -57,8 +57,7 @@ void cq_verify_empty(cq_verifier *v); Any functions taking ... expect a NULL terminated list of key/value pairs (each pair using two parameter slots) of metadata that MUST be present in the event. */ -void cq_expect_completion(cq_verifier *v, void *tag, grpc_op_error result); -void cq_expect_server_shutdown(cq_verifier *v, void *tag); +void cq_expect_completion(cq_verifier *v, void *tag, int success); int byte_buffer_eq_string(grpc_byte_buffer *byte_buffer, const char *string); int contains_metadata(grpc_metadata_array *array, const char *key, const char *value); diff --git a/test/core/end2end/dualstack_socket_test.c b/test/core/end2end/dualstack_socket_test.c index 5e278ca66c..92bb49b9ab 100644 --- a/test/core/end2end/dualstack_socket_test.c +++ b/test/core/end2end/dualstack_socket_test.c @@ -50,15 +50,10 @@ static gpr_timespec ms_from_now(int ms) { } static void drain_cq(grpc_completion_queue *cq) { - grpc_event *ev; - grpc_completion_type type; + grpc_event ev; do { ev = grpc_completion_queue_next(cq, ms_from_now(5000)); - GPR_ASSERT(ev); - type = ev->type; - grpc_event_finish(ev); - gpr_log(GPR_INFO, "Drained event type %d", type); - } while (type != GRPC_QUEUE_SHUTDOWN); + } while (ev.type != GRPC_QUEUE_SHUTDOWN); } void test_connect(const char *server_host, const char *client_host, int port, @@ -159,7 +154,7 @@ void test_connect(const char *server_host, const char *client_host, int port, &call_details, &request_metadata_recv, server_cq, tag(101))); - cq_expect_completion(v_server, tag(101), GRPC_OP_OK); + cq_expect_completion(v_server, tag(101), 1); cq_verify(v_server); op = ops; @@ -177,10 +172,10 @@ void test_connect(const char *server_host, const char *client_host, int port, GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(s, ops, op - ops, tag(102))); - cq_expect_completion(v_server, tag(102), GRPC_OP_OK); + cq_expect_completion(v_server, tag(102), 1); cq_verify(v_server); - cq_expect_completion(v_client, tag(1), GRPC_OP_OK); + cq_expect_completion(v_client, tag(1), 1); cq_verify(v_client); GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED); @@ -192,7 +187,7 @@ void test_connect(const char *server_host, const char *client_host, int port, grpc_call_destroy(s); } else { /* Check for a failed connection. */ - cq_expect_completion(v_client, tag(1), GRPC_OP_OK); + cq_expect_completion(v_client, tag(1), 1); cq_verify(v_client); GPR_ASSERT(status == GRPC_STATUS_DEADLINE_EXCEEDED); diff --git a/test/core/end2end/no_server_test.c b/test/core/end2end/no_server_test.c index b292620fe9..bba9cd1a56 100644 --- a/test/core/end2end/no_server_test.c +++ b/test/core/end2end/no_server_test.c @@ -45,8 +45,6 @@ int main(int argc, char **argv) { gpr_timespec deadline = GRPC_TIMEOUT_SECONDS_TO_DEADLINE(2); grpc_completion_queue *cq; cq_verifier *cqv; - grpc_event *ev; - int done; grpc_op ops[6]; grpc_op *op; grpc_metadata_array trailing_metadata_recv; @@ -79,17 +77,15 @@ int main(int argc, char **argv) { GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(call, ops, op - ops, tag(1))); /* verify that all tags get completed */ - cq_expect_completion(cqv, tag(1), GRPC_OP_OK); + cq_expect_completion(cqv, tag(1), 1); cq_verify(cqv); GPR_ASSERT(status == GRPC_STATUS_DEADLINE_EXCEEDED); grpc_completion_queue_shutdown(cq); - for (done = 0; !done;) { - ev = grpc_completion_queue_next(cq, gpr_inf_future); - done = ev->type == GRPC_QUEUE_SHUTDOWN; - grpc_event_finish(ev); - } + while (grpc_completion_queue_next(cq, gpr_inf_future).type != + GRPC_QUEUE_SHUTDOWN) + ; grpc_completion_queue_destroy(cq); grpc_call_destroy(call); grpc_channel_destroy(chan); diff --git a/test/core/end2end/tests/bad_hostname.c b/test/core/end2end/tests/bad_hostname.c index 80922f3b6f..c43dfff625 100644 --- a/test/core/end2end/tests/bad_hostname.c +++ b/test/core/end2end/tests/bad_hostname.c @@ -69,14 +69,10 @@ static gpr_timespec n_seconds_time(int n) { static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); } static void drain_cq(grpc_completion_queue *cq) { - grpc_event *ev; - grpc_completion_type type; + grpc_event ev; do { ev = grpc_completion_queue_next(cq, five_seconds_time()); - GPR_ASSERT(ev); - type = ev->type; - grpc_event_finish(ev); - } while (type != GRPC_QUEUE_SHUTDOWN); + } while (ev.type != GRPC_QUEUE_SHUTDOWN); } static void shutdown_server(grpc_end2end_test_fixture *f) { @@ -144,7 +140,7 @@ static void simple_request_body(grpc_end2end_test_fixture f) { op++; GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(c, ops, op - ops, tag(1))); - cq_expect_completion(v_client, tag(1), GRPC_OP_OK); + cq_expect_completion(v_client, tag(1), 1); cq_verify(v_client); GPR_ASSERT(status == GRPC_STATUS_UNAUTHENTICATED); diff --git a/test/core/end2end/tests/cancel_after_accept.c b/test/core/end2end/tests/cancel_after_accept.c index 21057969d9..3cd8114b32 100644 --- a/test/core/end2end/tests/cancel_after_accept.c +++ b/test/core/end2end/tests/cancel_after_accept.c @@ -68,14 +68,10 @@ static gpr_timespec n_seconds_time(int n) { static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); } static void drain_cq(grpc_completion_queue *cq) { - grpc_event *ev; - grpc_completion_type type; + grpc_event ev; do { ev = grpc_completion_queue_next(cq, five_seconds_time()); - GPR_ASSERT(ev); - type = ev->type; - grpc_event_finish(ev); - } while (type != GRPC_QUEUE_SHUTDOWN); + } while (ev.type != GRPC_QUEUE_SHUTDOWN); } static void shutdown_server(grpc_end2end_test_fixture *f) { @@ -164,7 +160,7 @@ static void test_cancel_after_accept(grpc_end2end_test_config config, GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call( f.server, &s, &call_details, &request_metadata_recv, f.server_cq, tag(2))); - cq_expect_completion(v_server, tag(2), GRPC_OP_OK); + cq_expect_completion(v_server, tag(2), 1); cq_verify(v_server); op = ops; @@ -184,10 +180,10 @@ static void test_cancel_after_accept(grpc_end2end_test_config config, GPR_ASSERT(GRPC_CALL_OK == mode.initiate_cancel(c)); - cq_expect_completion(v_server, tag(3), GRPC_OP_OK); + cq_expect_completion(v_server, tag(3), 1); cq_verify(v_server); - cq_expect_completion(v_client, tag(1), GRPC_OP_OK); + cq_expect_completion(v_client, tag(1), 1); cq_verify(v_client); GPR_ASSERT(status == mode.expect_status); diff --git a/test/core/end2end/tests/cancel_after_accept_and_writes_closed.c b/test/core/end2end/tests/cancel_after_accept_and_writes_closed.c index f8733ef444..57c696c76c 100644 --- a/test/core/end2end/tests/cancel_after_accept_and_writes_closed.c +++ b/test/core/end2end/tests/cancel_after_accept_and_writes_closed.c @@ -68,14 +68,10 @@ static gpr_timespec n_seconds_time(int n) { static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); } static void drain_cq(grpc_completion_queue *cq) { - grpc_event *ev; - grpc_completion_type type; + grpc_event ev; do { ev = grpc_completion_queue_next(cq, five_seconds_time()); - GPR_ASSERT(ev); - type = ev->type; - grpc_event_finish(ev); - } while (type != GRPC_QUEUE_SHUTDOWN); + } while (ev.type != GRPC_QUEUE_SHUTDOWN); } static void shutdown_server(grpc_end2end_test_fixture *f) { @@ -166,7 +162,7 @@ static void test_cancel_after_accept_and_writes_closed( GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call( f.server, &s, &call_details, &request_metadata_recv, f.server_cq, tag(2))); - cq_expect_completion(v_server, tag(2), GRPC_OP_OK); + cq_expect_completion(v_server, tag(2), 1); cq_verify(v_server); op = ops; @@ -186,10 +182,10 @@ static void test_cancel_after_accept_and_writes_closed( GPR_ASSERT(GRPC_CALL_OK == mode.initiate_cancel(c)); - cq_expect_completion(v_server, tag(3), GRPC_OP_OK); + cq_expect_completion(v_server, tag(3), 1); cq_verify(v_server); - cq_expect_completion(v_client, tag(1), GRPC_OP_OK); + cq_expect_completion(v_client, tag(1), 1); cq_verify(v_client); GPR_ASSERT(status == mode.expect_status); diff --git a/test/core/end2end/tests/cancel_after_invoke.c b/test/core/end2end/tests/cancel_after_invoke.c index 592dfd415f..33b117222b 100644 --- a/test/core/end2end/tests/cancel_after_invoke.c +++ b/test/core/end2end/tests/cancel_after_invoke.c @@ -69,14 +69,10 @@ static gpr_timespec n_seconds_time(int n) { static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); } static void drain_cq(grpc_completion_queue *cq) { - grpc_event *ev; - grpc_completion_type type; + grpc_event ev; do { ev = grpc_completion_queue_next(cq, five_seconds_time()); - GPR_ASSERT(ev); - type = ev->type; - grpc_event_finish(ev); - } while (type != GRPC_QUEUE_SHUTDOWN); + } while (ev.type != GRPC_QUEUE_SHUTDOWN); } static void shutdown_server(grpc_end2end_test_fixture *f) { @@ -160,7 +156,7 @@ static void test_cancel_after_invoke(grpc_end2end_test_config config, GPR_ASSERT(GRPC_CALL_OK == mode.initiate_cancel(c)); - cq_expect_completion(v_client, tag(1), GRPC_OP_OK); + cq_expect_completion(v_client, tag(1), 1); cq_verify(v_client); GPR_ASSERT(status == mode.expect_status); diff --git a/test/core/end2end/tests/cancel_before_invoke.c b/test/core/end2end/tests/cancel_before_invoke.c index 6e100db185..cb7ba4d3e2 100644 --- a/test/core/end2end/tests/cancel_before_invoke.c +++ b/test/core/end2end/tests/cancel_before_invoke.c @@ -67,14 +67,10 @@ static gpr_timespec n_seconds_time(int n) { static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); } static void drain_cq(grpc_completion_queue *cq) { - grpc_event *ev; - grpc_completion_type type; + grpc_event ev; do { ev = grpc_completion_queue_next(cq, five_seconds_time()); - GPR_ASSERT(ev); - type = ev->type; - grpc_event_finish(ev); - } while (type != GRPC_QUEUE_SHUTDOWN); + } while (ev.type != GRPC_QUEUE_SHUTDOWN); } static void shutdown_server(grpc_end2end_test_fixture *f) { @@ -157,7 +153,7 @@ static void test_cancel_before_invoke(grpc_end2end_test_config config, op++; GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(c, ops, test_ops, tag(1))); - cq_expect_completion(v_client, tag(1), GRPC_OP_OK); + cq_expect_completion(v_client, tag(1), 1); cq_verify(v_client); GPR_ASSERT(status == GRPC_STATUS_CANCELLED); diff --git a/test/core/end2end/tests/cancel_in_a_vacuum.c b/test/core/end2end/tests/cancel_in_a_vacuum.c index a88ca0b5b7..84c0ad2191 100644 --- a/test/core/end2end/tests/cancel_in_a_vacuum.c +++ b/test/core/end2end/tests/cancel_in_a_vacuum.c @@ -66,14 +66,10 @@ static gpr_timespec n_seconds_time(int n) { static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); } static void drain_cq(grpc_completion_queue *cq) { - grpc_event *ev; - grpc_completion_type type; + grpc_event ev; do { ev = grpc_completion_queue_next(cq, five_seconds_time()); - GPR_ASSERT(ev); - type = ev->type; - grpc_event_finish(ev); - } while (type != GRPC_QUEUE_SHUTDOWN); + } while (ev.type != GRPC_QUEUE_SHUTDOWN); } static void shutdown_server(grpc_end2end_test_fixture *f) { diff --git a/test/core/end2end/tests/census_simple_request.c b/test/core/end2end/tests/census_simple_request.c index 67c769c08b..a45757438b 100644 --- a/test/core/end2end/tests/census_simple_request.c +++ b/test/core/end2end/tests/census_simple_request.c @@ -75,14 +75,10 @@ static void shutdown_client(grpc_end2end_test_fixture *f) { } static void drain_cq(grpc_completion_queue *cq) { - grpc_event *ev; - grpc_completion_type type; + grpc_event ev; do { ev = grpc_completion_queue_next(cq, n_seconds_time(5)); - GPR_ASSERT(ev); - type = ev->type; - grpc_event_finish(ev); - } while (type != GRPC_QUEUE_SHUTDOWN); + } while (ev.type != GRPC_QUEUE_SHUTDOWN); } static void end_test(grpc_end2end_test_fixture *f) { @@ -146,7 +142,7 @@ static void test_body(grpc_end2end_test_fixture f) { &call_details, &request_metadata_recv, f.server_cq, tag(101))); - cq_expect_completion(v_server, tag(101), GRPC_OP_OK); + cq_expect_completion(v_server, tag(101), 1); cq_verify(v_server); op = ops; @@ -163,10 +159,10 @@ static void test_body(grpc_end2end_test_fixture f) { op++; GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(s, ops, op - ops, tag(102))); - cq_expect_completion(v_server, tag(102), GRPC_OP_OK); + cq_expect_completion(v_server, tag(102), 1); cq_verify(v_server); - cq_expect_completion(v_client, tag(1), GRPC_OP_OK); + cq_expect_completion(v_client, tag(1), 1); cq_verify(v_client); GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED); diff --git a/test/core/end2end/tests/disappearing_server.c b/test/core/end2end/tests/disappearing_server.c index c8e22ce11c..4ac36b81c2 100644 --- a/test/core/end2end/tests/disappearing_server.c +++ b/test/core/end2end/tests/disappearing_server.c @@ -55,14 +55,10 @@ static gpr_timespec n_seconds_time(int n) { static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); } static void drain_cq(grpc_completion_queue *cq) { - grpc_event *ev; - grpc_completion_type type; + grpc_event ev; do { ev = grpc_completion_queue_next(cq, five_seconds_time()); - GPR_ASSERT(ev); - type = ev->type; - grpc_event_finish(ev); - } while (type != GRPC_QUEUE_SHUTDOWN); + } while (ev.type != GRPC_QUEUE_SHUTDOWN); } static void shutdown_server(grpc_end2end_test_fixture *f) { @@ -137,7 +133,7 @@ static void do_request_and_shutdown_server(grpc_end2end_test_fixture *f, &call_details, &request_metadata_recv, f->server_cq, tag(101))); - cq_expect_completion(v_server, tag(101), GRPC_OP_OK); + cq_expect_completion(v_server, tag(101), 1); cq_verify(v_server); /* should be able to shut down the server early @@ -158,10 +154,10 @@ static void do_request_and_shutdown_server(grpc_end2end_test_fixture *f, op++; GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(s, ops, op - ops, tag(102))); - cq_expect_completion(v_server, tag(102), GRPC_OP_OK); + cq_expect_completion(v_server, tag(102), 1); cq_verify(v_server); - cq_expect_completion(v_client, tag(1), GRPC_OP_OK); + cq_expect_completion(v_client, tag(1), 1); cq_verify(v_client); GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED); diff --git a/test/core/end2end/tests/early_server_shutdown_finishes_inflight_calls.c b/test/core/end2end/tests/early_server_shutdown_finishes_inflight_calls.c index 2c2d2e895b..90713d189b 100644 --- a/test/core/end2end/tests/early_server_shutdown_finishes_inflight_calls.c +++ b/test/core/end2end/tests/early_server_shutdown_finishes_inflight_calls.c @@ -67,14 +67,10 @@ static gpr_timespec n_seconds_time(int n) { static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); } static void drain_cq(grpc_completion_queue *cq) { - grpc_event *ev; - grpc_completion_type type; + grpc_event ev; do { ev = grpc_completion_queue_next(cq, five_seconds_time()); - GPR_ASSERT(ev); - type = ev->type; - grpc_event_finish(ev); - } while (type != GRPC_QUEUE_SHUTDOWN); + } while (ev.type != GRPC_QUEUE_SHUTDOWN); } static void shutdown_server(grpc_end2end_test_fixture *f) { @@ -152,7 +148,7 @@ static void test_early_server_shutdown_finishes_inflight_calls( &call_details, &request_metadata_recv, f.server_cq, tag(101))); - cq_expect_completion(v_server, tag(101), GRPC_OP_OK); + cq_expect_completion(v_server, tag(101), 1); cq_verify(v_server); op = ops; @@ -164,10 +160,10 @@ static void test_early_server_shutdown_finishes_inflight_calls( /* shutdown and destroy the server */ shutdown_server(&f); - cq_expect_completion(v_server, tag(102), GRPC_OP_OK); + cq_expect_completion(v_server, tag(102), 1); cq_verify(v_server); - cq_expect_completion(v_client, tag(1), GRPC_OP_OK); + cq_expect_completion(v_client, tag(1), 1); cq_verify(v_client); GPR_ASSERT(status == GRPC_STATUS_UNAVAILABLE); diff --git a/test/core/end2end/tests/early_server_shutdown_finishes_tags.c b/test/core/end2end/tests/early_server_shutdown_finishes_tags.c index 96978a8cb9..5515bd8ae2 100644 --- a/test/core/end2end/tests/early_server_shutdown_finishes_tags.c +++ b/test/core/end2end/tests/early_server_shutdown_finishes_tags.c @@ -67,14 +67,10 @@ static gpr_timespec n_seconds_time(int n) { static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); } static void drain_cq(grpc_completion_queue *cq) { - grpc_event *ev; - grpc_completion_type type; + grpc_event ev; do { ev = grpc_completion_queue_next(cq, five_seconds_time()); - GPR_ASSERT(ev); - type = ev->type; - grpc_event_finish(ev); - } while (type != GRPC_QUEUE_SHUTDOWN); + } while (ev.type != GRPC_QUEUE_SHUTDOWN); } static void shutdown_server(grpc_end2end_test_fixture *f) { @@ -120,7 +116,7 @@ static void test_early_server_shutdown_finishes_tags( &request_metadata_recv, f.server_cq, tag(101))); grpc_server_shutdown(f.server); - cq_expect_completion(v_server, tag(101), GRPC_OP_ERROR); + cq_expect_completion(v_server, tag(101), 0); cq_verify(v_server); GPR_ASSERT(s == NULL); diff --git a/test/core/end2end/tests/empty_batch.c b/test/core/end2end/tests/empty_batch.c index 6237e29b12..3b8e33c265 100644 --- a/test/core/end2end/tests/empty_batch.c +++ b/test/core/end2end/tests/empty_batch.c @@ -69,14 +69,10 @@ static gpr_timespec n_seconds_time(int n) { static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); } static void drain_cq(grpc_completion_queue *cq) { - grpc_event *ev; - grpc_completion_type type; + grpc_event ev; do { ev = grpc_completion_queue_next(cq, five_seconds_time()); - GPR_ASSERT(ev); - type = ev->type; - grpc_event_finish(ev); - } while (type != GRPC_QUEUE_SHUTDOWN); + } while (ev.type != GRPC_QUEUE_SHUTDOWN); } static void shutdown_server(grpc_end2end_test_fixture *f) { @@ -115,7 +111,7 @@ static void empty_batch_body(grpc_end2end_test_fixture f) { GPR_ASSERT(c); GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(c, op, 0, tag(1))); - cq_expect_completion(v_client, tag(1), GRPC_OP_OK); + cq_expect_completion(v_client, tag(1), 1); cq_verify(v_client); grpc_call_destroy(c); diff --git a/test/core/end2end/tests/graceful_server_shutdown.c b/test/core/end2end/tests/graceful_server_shutdown.c index d084530a9c..eb853c96cd 100644 --- a/test/core/end2end/tests/graceful_server_shutdown.c +++ b/test/core/end2end/tests/graceful_server_shutdown.c @@ -67,14 +67,10 @@ static gpr_timespec n_seconds_time(int n) { static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); } static void drain_cq(grpc_completion_queue *cq) { - grpc_event *ev; - grpc_completion_type type; + grpc_event ev; do { ev = grpc_completion_queue_next(cq, five_seconds_time()); - GPR_ASSERT(ev); - type = ev->type; - grpc_event_finish(ev); - } while (type != GRPC_QUEUE_SHUTDOWN); + } while (ev.type != GRPC_QUEUE_SHUTDOWN); } static void shutdown_server(grpc_end2end_test_fixture *f) { @@ -151,7 +147,7 @@ static void test_early_server_shutdown_finishes_inflight_calls( &call_details, &request_metadata_recv, f.server_cq, tag(101))); - cq_expect_completion(v_server, tag(101), GRPC_OP_OK); + cq_expect_completion(v_server, tag(101), 1); cq_verify(v_server); /* shutdown and destroy the server */ @@ -172,14 +168,14 @@ static void test_early_server_shutdown_finishes_inflight_calls( op++; GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(s, ops, op - ops, tag(102))); - cq_expect_completion(v_server, tag(102), GRPC_OP_OK); + cq_expect_completion(v_server, tag(102), 1); cq_verify(v_server); grpc_call_destroy(s); - cq_expect_server_shutdown(v_server, tag(0xdead)); + cq_expect_completion(v_server, tag(0xdead), 1); cq_verify(v_server); - cq_expect_completion(v_client, tag(1), GRPC_OP_OK); + cq_expect_completion(v_client, tag(1), 1); cq_verify(v_client); GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED); diff --git a/test/core/end2end/tests/invoke_large_request.c b/test/core/end2end/tests/invoke_large_request.c index d9d9e934cb..8d0b1fa725 100644 --- a/test/core/end2end/tests/invoke_large_request.c +++ b/test/core/end2end/tests/invoke_large_request.c @@ -65,14 +65,10 @@ static gpr_timespec n_seconds_time(int n) { } static void drain_cq(grpc_completion_queue *cq) { - grpc_event *ev; - grpc_completion_type type; + grpc_event ev; do { ev = grpc_completion_queue_next(cq, n_seconds_time(5)); - GPR_ASSERT(ev); - type = ev->type; - grpc_event_finish(ev); - } while (type != GRPC_QUEUE_SHUTDOWN); + } while (ev.type != GRPC_QUEUE_SHUTDOWN); } static void shutdown_server(grpc_end2end_test_fixture *f) { @@ -169,7 +165,7 @@ static void test_invoke_large_request(grpc_end2end_test_config config) { &call_details, &request_metadata_recv, f.server_cq, tag(101))); - cq_expect_completion(v_server, tag(101), GRPC_OP_OK); + cq_expect_completion(v_server, tag(101), 1); cq_verify(v_server); op = ops; @@ -192,10 +188,10 @@ static void test_invoke_large_request(grpc_end2end_test_config config) { op++; GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(s, ops, op - ops, tag(102))); - cq_expect_completion(v_server, tag(102), GRPC_OP_OK); + cq_expect_completion(v_server, tag(102), 1); cq_verify(v_server); - cq_expect_completion(v_client, tag(1), GRPC_OP_OK); + cq_expect_completion(v_client, tag(1), 1); cq_verify(v_client); GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED); diff --git a/test/core/end2end/tests/max_concurrent_streams.c b/test/core/end2end/tests/max_concurrent_streams.c index 6e95a6c5f8..56d81a1130 100644 --- a/test/core/end2end/tests/max_concurrent_streams.c +++ b/test/core/end2end/tests/max_concurrent_streams.c @@ -67,14 +67,10 @@ static gpr_timespec n_seconds_time(int n) { static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); } static void drain_cq(grpc_completion_queue *cq) { - grpc_event *ev; - grpc_completion_type type; + grpc_event ev; do { ev = grpc_completion_queue_next(cq, five_seconds_time()); - GPR_ASSERT(ev); - type = ev->type; - grpc_event_finish(ev); - } while (type != GRPC_QUEUE_SHUTDOWN); + } while (ev.type != GRPC_QUEUE_SHUTDOWN); } static void shutdown_server(grpc_end2end_test_fixture *f) { @@ -149,7 +145,7 @@ static void simple_request_body(grpc_end2end_test_fixture f) { &call_details, &request_metadata_recv, f.server_cq, tag(101))); - cq_expect_completion(v_server, tag(101), GRPC_OP_OK); + cq_expect_completion(v_server, tag(101), 1); cq_verify(v_server); op = ops; @@ -166,10 +162,10 @@ static void simple_request_body(grpc_end2end_test_fixture f) { op++; GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(s, ops, op - ops, tag(102))); - cq_expect_completion(v_server, tag(102), GRPC_OP_OK); + cq_expect_completion(v_server, tag(102), 1); cq_verify(v_server); - cq_expect_completion(v_client, tag(1), GRPC_OP_OK); + cq_expect_completion(v_client, tag(1), 1); cq_verify(v_client); GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED); @@ -203,7 +199,7 @@ static void test_max_concurrent_streams(grpc_end2end_test_config config) { gpr_timespec deadline; cq_verifier *v_client; cq_verifier *v_server; - grpc_event *ev; + grpc_event ev; grpc_call_details call_details; grpc_metadata_array request_metadata_recv; grpc_metadata_array initial_metadata_recv1; @@ -303,20 +299,18 @@ static void test_max_concurrent_streams(grpc_end2end_test_config config) { GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(c2, ops, op - ops, tag(402))); - cq_expect_completion(v_server, tag(101), GRPC_OP_OK); + cq_expect_completion(v_server, tag(101), 1); cq_verify(v_server); ev = grpc_completion_queue_next(f.client_cq, GRPC_TIMEOUT_SECONDS_TO_DEADLINE(3)); - GPR_ASSERT(ev); - GPR_ASSERT(ev->type == GRPC_OP_COMPLETE); - GPR_ASSERT(ev->data.op_complete == GRPC_OP_OK); - GPR_ASSERT(ev->tag == tag(301) || ev->tag == tag(401)); + GPR_ASSERT(ev.type == GRPC_OP_COMPLETE); + GPR_ASSERT(ev.success); + GPR_ASSERT(ev.tag == tag(301) || ev.tag == tag(401)); /* The /alpha or /beta calls started above could be invoked (but NOT both); * check this here */ /* We'll get tag 303 or 403, we want 300, 400 */ - live_call = ((int)(gpr_intptr)ev->tag) - 1; - grpc_event_finish(ev); + live_call = ((int)(gpr_intptr)ev.tag) - 1; op = ops; op->op = GRPC_OP_SEND_INITIAL_METADATA; @@ -333,20 +327,20 @@ static void test_max_concurrent_streams(grpc_end2end_test_config config) { GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(s1, ops, op - ops, tag(102))); - cq_expect_completion(v_server, tag(102), GRPC_OP_OK); + cq_expect_completion(v_server, tag(102), 1); cq_verify(v_server); - cq_expect_completion(v_client, tag(live_call + 2), GRPC_OP_OK); + cq_expect_completion(v_client, tag(live_call + 2), 1); /* first request is finished, we should be able to start the second */ live_call = (live_call == 300) ? 400 : 300; - cq_expect_completion(v_client, tag(live_call + 1), GRPC_OP_OK); + cq_expect_completion(v_client, tag(live_call + 1), 1); cq_verify(v_client); GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call(f.server, &s2, &call_details, &request_metadata_recv, f.server_cq, tag(201))); - cq_expect_completion(v_server, tag(201), GRPC_OP_OK); + cq_expect_completion(v_server, tag(201), 1); cq_verify(v_server); op = ops; @@ -364,10 +358,10 @@ static void test_max_concurrent_streams(grpc_end2end_test_config config) { GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(s2, ops, op - ops, tag(202))); - cq_expect_completion(v_client, tag(live_call + 2), GRPC_OP_OK); + cq_expect_completion(v_client, tag(live_call + 2), 1); cq_verify(v_client); - cq_expect_completion(v_server, tag(202), GRPC_OP_OK); + cq_expect_completion(v_server, tag(202), 1); cq_verify(v_server); cq_verifier_destroy(v_client); diff --git a/test/core/end2end/tests/no_op.c b/test/core/end2end/tests/no_op.c index 497bdccdbd..ec38924fcf 100644 --- a/test/core/end2end/tests/no_op.c +++ b/test/core/end2end/tests/no_op.c @@ -65,14 +65,10 @@ static gpr_timespec n_seconds_time(int n) { static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); } static void drain_cq(grpc_completion_queue *cq) { - grpc_event *ev; - grpc_completion_type type; + grpc_event ev; do { ev = grpc_completion_queue_next(cq, five_seconds_time()); - GPR_ASSERT(ev); - type = ev->type; - grpc_event_finish(ev); - } while (type != GRPC_QUEUE_SHUTDOWN); + } while (ev.type != GRPC_QUEUE_SHUTDOWN); } static void shutdown_server(grpc_end2end_test_fixture *f) { diff --git a/test/core/end2end/tests/ping_pong_streaming.c b/test/core/end2end/tests/ping_pong_streaming.c index fe02f25875..6fad1f6d5f 100644 --- a/test/core/end2end/tests/ping_pong_streaming.c +++ b/test/core/end2end/tests/ping_pong_streaming.c @@ -67,14 +67,10 @@ static gpr_timespec n_seconds_time(int n) { static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); } static void drain_cq(grpc_completion_queue *cq) { - grpc_event *ev; - grpc_completion_type type; + grpc_event ev; do { ev = grpc_completion_queue_next(cq, five_seconds_time()); - GPR_ASSERT(ev); - type = ev->type; - grpc_event_finish(ev); - } while (type != GRPC_QUEUE_SHUTDOWN); + } while (ev.type != GRPC_QUEUE_SHUTDOWN); } static void shutdown_server(grpc_end2end_test_fixture *f) { @@ -157,7 +153,7 @@ static void test_pingpong_streaming(grpc_end2end_test_config config, &call_details, &request_metadata_recv, f.server_cq, tag(100))); - cq_expect_completion(v_server, tag(100), GRPC_OP_OK); + cq_expect_completion(v_server, tag(100), 1); cq_verify(v_server); op = ops; @@ -188,7 +184,7 @@ static void test_pingpong_streaming(grpc_end2end_test_config config, op++; GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(s, ops, op - ops, tag(102))); - cq_expect_completion(v_server, tag(102), GRPC_OP_OK); + cq_expect_completion(v_server, tag(102), 1); cq_verify(v_server); op = ops; @@ -197,10 +193,10 @@ static void test_pingpong_streaming(grpc_end2end_test_config config, op++; GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(s, ops, op - ops, tag(103))); - cq_expect_completion(v_server, tag(103), GRPC_OP_OK); + cq_expect_completion(v_server, tag(103), 1); cq_verify(v_server); - cq_expect_completion(v_client, tag(2), GRPC_OP_OK); + cq_expect_completion(v_client, tag(2), 1); cq_verify(v_client); grpc_byte_buffer_destroy(request_payload); @@ -225,12 +221,12 @@ static void test_pingpong_streaming(grpc_end2end_test_config config, op++; GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(s, ops, op - ops, tag(104))); - cq_expect_completion(v_client, tag(1), GRPC_OP_OK); - cq_expect_completion(v_client, tag(3), GRPC_OP_OK); + cq_expect_completion(v_client, tag(1), 1); + cq_expect_completion(v_client, tag(3), 1); cq_verify(v_client); - cq_expect_completion(v_server, tag(101), GRPC_OP_OK); - cq_expect_completion(v_server, tag(104), GRPC_OP_OK); + cq_expect_completion(v_server, tag(101), 1); + cq_expect_completion(v_server, tag(104), 1); cq_verify(v_server); grpc_call_destroy(c); diff --git a/test/core/end2end/tests/registered_call.c b/test/core/end2end/tests/registered_call.c index 05b7a1dad0..3ffcf00978 100644 --- a/test/core/end2end/tests/registered_call.c +++ b/test/core/end2end/tests/registered_call.c @@ -69,14 +69,10 @@ static gpr_timespec n_seconds_time(int n) { static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); } static void drain_cq(grpc_completion_queue *cq) { - grpc_event *ev; - grpc_completion_type type; + grpc_event ev; do { ev = grpc_completion_queue_next(cq, five_seconds_time()); - GPR_ASSERT(ev); - type = ev->type; - grpc_event_finish(ev); - } while (type != GRPC_QUEUE_SHUTDOWN); + } while (ev.type != GRPC_QUEUE_SHUTDOWN); } static void shutdown_server(grpc_end2end_test_fixture *f) { @@ -150,7 +146,7 @@ static void simple_request_body(grpc_end2end_test_fixture f, void *rc) { &call_details, &request_metadata_recv, f.server_cq, tag(101))); - cq_expect_completion(v_server, tag(101), GRPC_OP_OK); + cq_expect_completion(v_server, tag(101), 1); cq_verify(v_server); op = ops; @@ -167,10 +163,10 @@ static void simple_request_body(grpc_end2end_test_fixture f, void *rc) { op++; GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(s, ops, op - ops, tag(102))); - cq_expect_completion(v_server, tag(102), GRPC_OP_OK); + cq_expect_completion(v_server, tag(102), 1); cq_verify(v_server); - cq_expect_completion(v_client, tag(1), GRPC_OP_OK); + cq_expect_completion(v_client, tag(1), 1); cq_verify(v_client); GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED); diff --git a/test/core/end2end/tests/request_response_with_binary_metadata_and_payload.c b/test/core/end2end/tests/request_response_with_binary_metadata_and_payload.c index 0169d52059..2d65198a40 100644 --- a/test/core/end2end/tests/request_response_with_binary_metadata_and_payload.c +++ b/test/core/end2end/tests/request_response_with_binary_metadata_and_payload.c @@ -67,14 +67,10 @@ static gpr_timespec n_seconds_time(int n) { static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); } static void drain_cq(grpc_completion_queue *cq) { - grpc_event *ev; - grpc_completion_type type; + grpc_event ev; do { ev = grpc_completion_queue_next(cq, five_seconds_time()); - GPR_ASSERT(ev); - type = ev->type; - grpc_event_finish(ev); - } while (type != GRPC_QUEUE_SHUTDOWN); + } while (ev.type != GRPC_QUEUE_SHUTDOWN); } static void shutdown_server(grpc_end2end_test_fixture *f) { @@ -185,7 +181,7 @@ static void test_request_response_with_metadata_and_payload( &call_details, &request_metadata_recv, f.server_cq, tag(101))); - cq_expect_completion(v_server, tag(101), GRPC_OP_OK); + cq_expect_completion(v_server, tag(101), 1); cq_verify(v_server); op = ops; @@ -209,10 +205,10 @@ static void test_request_response_with_metadata_and_payload( op++; GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(s, ops, op - ops, tag(102))); - cq_expect_completion(v_server, tag(102), GRPC_OP_OK); + cq_expect_completion(v_server, tag(102), 1); cq_verify(v_server); - cq_expect_completion(v_client, tag(1), GRPC_OP_OK); + cq_expect_completion(v_client, tag(1), 1); cq_verify(v_client); GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED); diff --git a/test/core/end2end/tests/request_response_with_metadata_and_payload.c b/test/core/end2end/tests/request_response_with_metadata_and_payload.c index dc49242d39..db766cf38c 100644 --- a/test/core/end2end/tests/request_response_with_metadata_and_payload.c +++ b/test/core/end2end/tests/request_response_with_metadata_and_payload.c @@ -67,14 +67,10 @@ static gpr_timespec n_seconds_time(int n) { static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); } static void drain_cq(grpc_completion_queue *cq) { - grpc_event *ev; - grpc_completion_type type; + grpc_event ev; do { ev = grpc_completion_queue_next(cq, five_seconds_time()); - GPR_ASSERT(ev); - type = ev->type; - grpc_event_finish(ev); - } while (type != GRPC_QUEUE_SHUTDOWN); + } while (ev.type != GRPC_QUEUE_SHUTDOWN); } static void shutdown_server(grpc_end2end_test_fixture *f) { @@ -171,7 +167,7 @@ static void test_request_response_with_metadata_and_payload( &call_details, &request_metadata_recv, f.server_cq, tag(101))); - cq_expect_completion(v_server, tag(101), GRPC_OP_OK); + cq_expect_completion(v_server, tag(101), 1); cq_verify(v_server); op = ops; @@ -195,10 +191,10 @@ static void test_request_response_with_metadata_and_payload( op++; GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(s, ops, op - ops, tag(102))); - cq_expect_completion(v_server, tag(102), GRPC_OP_OK); + cq_expect_completion(v_server, tag(102), 1); cq_verify(v_server); - cq_expect_completion(v_client, tag(1), GRPC_OP_OK); + cq_expect_completion(v_client, tag(1), 1); cq_verify(v_client); GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED); diff --git a/test/core/end2end/tests/request_response_with_payload.c b/test/core/end2end/tests/request_response_with_payload.c index 92036590a7..6c21db3b44 100644 --- a/test/core/end2end/tests/request_response_with_payload.c +++ b/test/core/end2end/tests/request_response_with_payload.c @@ -67,14 +67,10 @@ static gpr_timespec n_seconds_time(int n) { static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); } static void drain_cq(grpc_completion_queue *cq) { - grpc_event *ev; - grpc_completion_type type; + grpc_event ev; do { ev = grpc_completion_queue_next(cq, five_seconds_time()); - GPR_ASSERT(ev); - type = ev->type; - grpc_event_finish(ev); - } while (type != GRPC_QUEUE_SHUTDOWN); + } while (ev.type != GRPC_QUEUE_SHUTDOWN); } static void shutdown_server(grpc_end2end_test_fixture *f) { @@ -163,7 +159,7 @@ static void request_response_with_payload(grpc_end2end_test_fixture f) { &call_details, &request_metadata_recv, f.server_cq, tag(101))); - cq_expect_completion(v_server, tag(101), GRPC_OP_OK); + cq_expect_completion(v_server, tag(101), 1); cq_verify(v_server); op = ops; @@ -186,10 +182,10 @@ static void request_response_with_payload(grpc_end2end_test_fixture f) { op++; GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(s, ops, op - ops, tag(102))); - cq_expect_completion(v_server, tag(102), GRPC_OP_OK); + cq_expect_completion(v_server, tag(102), 1); cq_verify(v_server); - cq_expect_completion(v_client, tag(1), GRPC_OP_OK); + cq_expect_completion(v_client, tag(1), 1); cq_verify(v_client); GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED); diff --git a/test/core/end2end/tests/request_response_with_trailing_metadata_and_payload.c b/test/core/end2end/tests/request_response_with_trailing_metadata_and_payload.c index b7834a1e6c..0c3929f422 100644 --- a/test/core/end2end/tests/request_response_with_trailing_metadata_and_payload.c +++ b/test/core/end2end/tests/request_response_with_trailing_metadata_and_payload.c @@ -170,7 +170,7 @@ static void test_request_response_with_metadata_and_payload( &call_details, &request_metadata_recv, f.server_cq, tag(101))); - cq_expect_completion(v_server, tag(101), GRPC_OP_OK); + cq_expect_completion(v_server, tag(101), 1); cq_verify(v_server); op = ops; @@ -195,10 +195,10 @@ static void test_request_response_with_metadata_and_payload( op++; GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(s, ops, op - ops, tag(102))); - cq_expect_completion(v_server, tag(102), GRPC_OP_OK); + cq_expect_completion(v_server, tag(102), 1); cq_verify(v_server); - cq_expect_completion(v_client, tag(1), GRPC_OP_OK); + cq_expect_completion(v_client, tag(1), 1); cq_verify(v_client); GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED); diff --git a/test/core/end2end/tests/request_with_large_metadata.c b/test/core/end2end/tests/request_with_large_metadata.c index c5b4e0c57e..1ed059e5cb 100644 --- a/test/core/end2end/tests/request_with_large_metadata.c +++ b/test/core/end2end/tests/request_with_large_metadata.c @@ -67,14 +67,10 @@ static gpr_timespec n_seconds_time(int n) { static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); } static void drain_cq(grpc_completion_queue *cq) { - grpc_event *ev; - grpc_completion_type type; + grpc_event ev; do { ev = grpc_completion_queue_next(cq, five_seconds_time()); - GPR_ASSERT(ev); - type = ev->type; - grpc_event_finish(ev); - } while (type != GRPC_QUEUE_SHUTDOWN); + } while (ev.type != GRPC_QUEUE_SHUTDOWN); } static void shutdown_server(grpc_end2end_test_fixture *f) { @@ -167,7 +163,7 @@ static void test_request_with_large_metadata(grpc_end2end_test_config config) { &call_details, &request_metadata_recv, f.server_cq, tag(101))); - cq_expect_completion(v_server, tag(101), GRPC_OP_OK); + cq_expect_completion(v_server, tag(101), 1); cq_verify(v_server); op = ops; @@ -187,10 +183,10 @@ static void test_request_with_large_metadata(grpc_end2end_test_config config) { op++; GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(s, ops, op - ops, tag(102))); - cq_expect_completion(v_server, tag(102), GRPC_OP_OK); + cq_expect_completion(v_server, tag(102), 1); cq_verify(v_server); - cq_expect_completion(v_client, tag(1), GRPC_OP_OK); + cq_expect_completion(v_client, tag(1), 1); cq_verify(v_client); GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED); diff --git a/test/core/end2end/tests/request_with_payload.c b/test/core/end2end/tests/request_with_payload.c index 63b7c5ee40..af5778910a 100644 --- a/test/core/end2end/tests/request_with_payload.c +++ b/test/core/end2end/tests/request_with_payload.c @@ -67,14 +67,10 @@ static gpr_timespec n_seconds_time(int n) { static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); } static void drain_cq(grpc_completion_queue *cq) { - grpc_event *ev; - grpc_completion_type type; + grpc_event ev; do { ev = grpc_completion_queue_next(cq, five_seconds_time()); - GPR_ASSERT(ev); - type = ev->type; - grpc_event_finish(ev); - } while (type != GRPC_QUEUE_SHUTDOWN); + } while (ev.type != GRPC_QUEUE_SHUTDOWN); } static void shutdown_server(grpc_end2end_test_fixture *f) { @@ -158,7 +154,7 @@ static void test_invoke_request_with_payload(grpc_end2end_test_config config) { &call_details, &request_metadata_recv, f.server_cq, tag(101))); - cq_expect_completion(v_server, tag(101), GRPC_OP_OK); + cq_expect_completion(v_server, tag(101), 1); cq_verify(v_server); op = ops; @@ -178,10 +174,10 @@ static void test_invoke_request_with_payload(grpc_end2end_test_config config) { op++; GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(s, ops, op - ops, tag(102))); - cq_expect_completion(v_server, tag(102), GRPC_OP_OK); + cq_expect_completion(v_server, tag(102), 1); cq_verify(v_server); - cq_expect_completion(v_client, tag(1), GRPC_OP_OK); + cq_expect_completion(v_client, tag(1), 1); cq_verify(v_client); GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED); diff --git a/test/core/end2end/tests/simple_delayed_request.c b/test/core/end2end/tests/simple_delayed_request.c index 0dbb35d454..030e358db4 100644 --- a/test/core/end2end/tests/simple_delayed_request.c +++ b/test/core/end2end/tests/simple_delayed_request.c @@ -55,14 +55,10 @@ static gpr_timespec n_seconds_time(int n) { static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); } static void drain_cq(grpc_completion_queue *cq) { - grpc_event *ev; - grpc_completion_type type; + grpc_event ev; do { ev = grpc_completion_queue_next(cq, five_seconds_time()); - GPR_ASSERT(ev); - type = ev->type; - grpc_event_finish(ev); - } while (type != GRPC_QUEUE_SHUTDOWN); + } while (ev.type != GRPC_QUEUE_SHUTDOWN); } static void shutdown_server(grpc_end2end_test_fixture *f) { @@ -145,7 +141,7 @@ static void simple_delayed_request_body(grpc_end2end_test_config config, &call_details, &request_metadata_recv, f->server_cq, tag(101))); - cq_expect_completion(v_server, tag(101), GRPC_OP_OK); + cq_expect_completion(v_server, tag(101), 1); cq_verify(v_server); op = ops; @@ -162,10 +158,10 @@ static void simple_delayed_request_body(grpc_end2end_test_config config, op++; GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(s, ops, op - ops, tag(102))); - cq_expect_completion(v_server, tag(102), GRPC_OP_OK); + cq_expect_completion(v_server, tag(102), 1); cq_verify(v_server); - cq_expect_completion(v_client, tag(1), GRPC_OP_OK); + cq_expect_completion(v_client, tag(1), 1); cq_verify(v_client); GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED); diff --git a/test/core/end2end/tests/simple_request.c b/test/core/end2end/tests/simple_request.c index 4d4d48a211..aa6e506d1a 100644 --- a/test/core/end2end/tests/simple_request.c +++ b/test/core/end2end/tests/simple_request.c @@ -69,14 +69,10 @@ static gpr_timespec n_seconds_time(int n) { static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); } static void drain_cq(grpc_completion_queue *cq) { - grpc_event *ev; - grpc_completion_type type; + grpc_event ev; do { ev = grpc_completion_queue_next(cq, five_seconds_time()); - GPR_ASSERT(ev); - type = ev->type; - grpc_event_finish(ev); - } while (type != GRPC_QUEUE_SHUTDOWN); + } while (ev.type != GRPC_QUEUE_SHUTDOWN); } static void shutdown_server(grpc_end2end_test_fixture *f) { @@ -151,7 +147,7 @@ static void simple_request_body(grpc_end2end_test_fixture f) { &call_details, &request_metadata_recv, f.server_cq, tag(101))); - cq_expect_completion(v_server, tag(101), GRPC_OP_OK); + cq_expect_completion(v_server, tag(101), 1); cq_verify(v_server); op = ops; @@ -168,10 +164,10 @@ static void simple_request_body(grpc_end2end_test_fixture f) { op++; GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(s, ops, op - ops, tag(102))); - cq_expect_completion(v_server, tag(102), GRPC_OP_OK); + cq_expect_completion(v_server, tag(102), 1); cq_verify(v_server); - cq_expect_completion(v_client, tag(1), GRPC_OP_OK); + cq_expect_completion(v_client, tag(1), 1); cq_verify(v_client); GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED); |