Fixing C/C++ tests.

pull/2612/head
Nicolas "Pixel" Noble 9 years ago
parent ebb514066e
commit 9a123df2cd
  1. 7
      test/core/bad_client/bad_client.c
  2. 4
      test/core/bad_client/tests/connection_prefix.c
  3. 4
      test/core/bad_client/tests/initial_settings_frame.c
  4. 4
      test/core/end2end/cq_verifier.c
  5. 29
      test/core/end2end/dualstack_socket_test.c
  6. 6
      test/core/end2end/fixtures/chttp2_fake_security.c
  7. 8
      test/core/end2end/fixtures/chttp2_fullstack.c
  8. 9
      test/core/end2end/fixtures/chttp2_fullstack_compression.c
  9. 8
      test/core/end2end/fixtures/chttp2_fullstack_uds_posix.c
  10. 8
      test/core/end2end/fixtures/chttp2_fullstack_with_poll.c
  11. 6
      test/core/end2end/fixtures/chttp2_simple_ssl_fullstack.c
  12. 6
      test/core/end2end/fixtures/chttp2_simple_ssl_fullstack_with_poll.c
  13. 6
      test/core/end2end/fixtures/chttp2_simple_ssl_with_oauth2_fullstack.c
  14. 4
      test/core/end2end/fixtures/chttp2_socket_pair.c
  15. 4
      test/core/end2end/fixtures/chttp2_socket_pair_one_byte_at_a_time.c
  16. 4
      test/core/end2end/fixtures/chttp2_socket_pair_with_grpc_trace.c
  17. 16
      test/core/end2end/multiple_server_queues_test.c
  18. 13
      test/core/end2end/no_server_test.c
  19. 11
      test/core/end2end/tests/bad_hostname.c
  20. 22
      test/core/end2end/tests/cancel_after_accept.c
  21. 22
      test/core/end2end/tests/cancel_after_accept_and_writes_closed.c
  22. 13
      test/core/end2end/tests/cancel_after_invoke.c
  23. 13
      test/core/end2end/tests/cancel_before_invoke.c
  24. 9
      test/core/end2end/tests/cancel_in_a_vacuum.c
  25. 5
      test/core/end2end/tests/cancel_test_helpers.h
  26. 21
      test/core/end2end/tests/census_simple_request.c
  27. 19
      test/core/end2end/tests/disappearing_server.c
  28. 18
      test/core/end2end/tests/early_server_shutdown_finishes_inflight_calls.c
  29. 2
      test/core/end2end/tests/early_server_shutdown_finishes_tags.c
  30. 11
      test/core/end2end/tests/empty_batch.c
  31. 18
      test/core/end2end/tests/graceful_server_shutdown.c
  32. 24
      test/core/end2end/tests/invoke_large_request.c
  33. 53
      test/core/end2end/tests/max_concurrent_streams.c
  34. 21
      test/core/end2end/tests/max_message_length.c
  35. 5
      test/core/end2end/tests/no_op.c
  36. 38
      test/core/end2end/tests/ping_pong_streaming.c
  37. 27
      test/core/end2end/tests/registered_call.c
  38. 36
      test/core/end2end/tests/request_response_with_binary_metadata_and_payload.c
  39. 32
      test/core/end2end/tests/request_response_with_metadata_and_payload.c
  40. 24
      test/core/end2end/tests/request_response_with_payload.c
  41. 26
      test/core/end2end/tests/request_response_with_payload_and_call_creds.c
  42. 36
      test/core/end2end/tests/request_response_with_trailing_metadata_and_payload.c
  43. 23
      test/core/end2end/tests/request_with_compressed_payload.c
  44. 11
      test/core/end2end/tests/request_with_flags.c
  45. 24
      test/core/end2end/tests/request_with_large_metadata.c
  46. 17
      test/core/end2end/tests/request_with_payload.c
  47. 21
      test/core/end2end/tests/server_finishes_request.c
  48. 22
      test/core/end2end/tests/simple_delayed_request.c
  49. 21
      test/core/end2end/tests/simple_request.c
  50. 21
      test/core/end2end/tests/simple_request_with_high_initial_sequence_number.c
  51. 47
      test/core/fling/client.c
  52. 46
      test/core/fling/server.c
  53. 41
      test/core/surface/completion_queue_test.c
  54. 9
      test/core/surface/lame_client_test.c

@ -102,11 +102,11 @@ void grpc_run_bad_client_test(grpc_bad_client_server_side_validator validator,
/* Create server, completion events */ /* Create server, completion events */
a.server = grpc_server_create_from_filters(NULL, 0, NULL); a.server = grpc_server_create_from_filters(NULL, 0, NULL);
a.cq = grpc_completion_queue_create(); a.cq = grpc_completion_queue_create(NULL);
gpr_event_init(&a.done_thd); gpr_event_init(&a.done_thd);
gpr_event_init(&a.done_write); gpr_event_init(&a.done_write);
a.validator = validator; a.validator = validator;
grpc_server_register_completion_queue(a.server, a.cq); grpc_server_register_completion_queue(a.server, a.cq, NULL);
grpc_server_start(a.server); grpc_server_start(a.server);
transport = grpc_create_chttp2_transport(NULL, sfd.server, mdctx, 0); transport = grpc_create_chttp2_transport(NULL, sfd.server, mdctx, 0);
server_setup_transport(&a, transport, mdctx); server_setup_transport(&a, transport, mdctx);
@ -151,7 +151,8 @@ void grpc_run_bad_client_test(grpc_bad_client_server_side_validator validator,
} }
grpc_server_shutdown_and_notify(a.server, a.cq, NULL); grpc_server_shutdown_and_notify(a.server, a.cq, NULL);
GPR_ASSERT(grpc_completion_queue_pluck(a.cq, NULL, GPR_ASSERT(grpc_completion_queue_pluck(a.cq, NULL,
GRPC_TIMEOUT_SECONDS_TO_DEADLINE(1)) GRPC_TIMEOUT_SECONDS_TO_DEADLINE(1),
NULL)
.type == GRPC_OP_COMPLETE); .type == GRPC_OP_COMPLETE);
grpc_server_destroy(a.server); grpc_server_destroy(a.server);
grpc_completion_queue_destroy(a.cq); grpc_completion_queue_destroy(a.cq);

@ -37,8 +37,8 @@
static void verifier(grpc_server *server, grpc_completion_queue *cq) { static void verifier(grpc_server *server, grpc_completion_queue *cq) {
while (grpc_server_has_open_connections(server)) { while (grpc_server_has_open_connections(server)) {
GPR_ASSERT( GPR_ASSERT(
grpc_completion_queue_next(cq, GRPC_TIMEOUT_MILLIS_TO_DEADLINE(20)) grpc_completion_queue_next(cq, GRPC_TIMEOUT_MILLIS_TO_DEADLINE(20),
.type == GRPC_QUEUE_TIMEOUT); NULL).type == GRPC_QUEUE_TIMEOUT);
} }
} }

@ -39,8 +39,8 @@
static void verifier(grpc_server *server, grpc_completion_queue *cq) { static void verifier(grpc_server *server, grpc_completion_queue *cq) {
while (grpc_server_has_open_connections(server)) { while (grpc_server_has_open_connections(server)) {
GPR_ASSERT( GPR_ASSERT(
grpc_completion_queue_next(cq, GRPC_TIMEOUT_MILLIS_TO_DEADLINE(20)) grpc_completion_queue_next(cq, GRPC_TIMEOUT_MILLIS_TO_DEADLINE(20),
.type == GRPC_QUEUE_TIMEOUT); NULL).type == GRPC_QUEUE_TIMEOUT);
} }
} }

@ -226,7 +226,7 @@ void cq_verify(cq_verifier *v) {
gpr_strvec_init(&have_tags); gpr_strvec_init(&have_tags);
while (v->expect.next != &v->expect) { while (v->expect.next != &v->expect) {
ev = grpc_completion_queue_next(v->cq, deadline); ev = grpc_completion_queue_next(v->cq, deadline, NULL);
if (ev.type == GRPC_QUEUE_TIMEOUT) { if (ev.type == GRPC_QUEUE_TIMEOUT) {
fail_no_event_received(v); fail_no_event_received(v);
break; break;
@ -265,7 +265,7 @@ void cq_verify_empty(cq_verifier *v) {
GPR_ASSERT(v->expect.next == &v->expect && "expectation queue must be empty"); GPR_ASSERT(v->expect.next == &v->expect && "expectation queue must be empty");
ev = grpc_completion_queue_next(v->cq, deadline); ev = grpc_completion_queue_next(v->cq, deadline, NULL);
if (ev.type != GRPC_QUEUE_TIMEOUT) { if (ev.type != GRPC_QUEUE_TIMEOUT) {
char *s = grpc_event_string(&ev); char *s = grpc_event_string(&ev);
gpr_log(GPR_ERROR, "unexpected event (expected nothing): %s", s); gpr_log(GPR_ERROR, "unexpected event (expected nothing): %s", s);

@ -52,7 +52,7 @@ static gpr_timespec ms_from_now(int ms) {
static void drain_cq(grpc_completion_queue *cq) { static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev; grpc_event ev;
do { do {
ev = grpc_completion_queue_next(cq, ms_from_now(5000)); ev = grpc_completion_queue_next(cq, ms_from_now(5000), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN); } while (ev.type != GRPC_QUEUE_SHUTDOWN);
} }
@ -74,6 +74,7 @@ void test_connect(const char *server_host, const char *client_host, int port,
grpc_metadata_array trailing_metadata_recv; grpc_metadata_array trailing_metadata_recv;
grpc_metadata_array request_metadata_recv; grpc_metadata_array request_metadata_recv;
grpc_status_code status; grpc_status_code status;
grpc_call_error error;
char *details = NULL; char *details = NULL;
size_t details_capacity = 0; size_t details_capacity = 0;
int was_cancelled = 2; int was_cancelled = 2;
@ -91,9 +92,9 @@ void test_connect(const char *server_host, const char *client_host, int port,
grpc_call_details_init(&call_details); grpc_call_details_init(&call_details);
/* Create server. */ /* Create server. */
cq = grpc_completion_queue_create(); cq = grpc_completion_queue_create(NULL);
server = grpc_server_create(NULL); server = grpc_server_create(NULL, NULL);
grpc_server_register_completion_queue(server, cq); grpc_server_register_completion_queue(server, cq, NULL);
GPR_ASSERT((got_port = grpc_server_add_http2_port(server, server_hostport)) > GPR_ASSERT((got_port = grpc_server_add_http2_port(server, server_hostport)) >
0); 0);
if (port == 0) { if (port == 0) {
@ -106,7 +107,7 @@ void test_connect(const char *server_host, const char *client_host, int port,
/* Create client. */ /* Create client. */
gpr_join_host_port(&client_hostport, client_host, port); gpr_join_host_port(&client_hostport, client_host, port);
client = grpc_channel_create(client_hostport, NULL); client = grpc_channel_create(client_hostport, NULL, NULL);
gpr_log(GPR_INFO, "Testing with server=%s client=%s (expecting %s)", gpr_log(GPR_INFO, "Testing with server=%s client=%s (expecting %s)",
server_hostport, client_hostport, expect_ok ? "success" : "failure"); server_hostport, client_hostport, expect_ok ? "success" : "failure");
@ -125,7 +126,7 @@ void test_connect(const char *server_host, const char *client_host, int port,
/* Send a trivial request. */ /* Send a trivial request. */
c = grpc_channel_create_call(client, cq, "/foo", "foo.test.google.fr", c = grpc_channel_create_call(client, cq, "/foo", "foo.test.google.fr",
deadline); deadline, NULL);
GPR_ASSERT(c); GPR_ASSERT(c);
op = ops; op = ops;
@ -147,13 +148,14 @@ void test_connect(const char *server_host, const char *client_host, int port,
op->data.recv_status_on_client.status_details_capacity = &details_capacity; op->data.recv_status_on_client.status_details_capacity = &details_capacity;
op->flags = 0; op->flags = 0;
op++; op++;
GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(c, ops, op - ops, tag(1))); error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL);
GPR_ASSERT(GRPC_CALL_OK == error);
if (expect_ok) { if (expect_ok) {
/* Check for a successful request. */ /* Check for a successful request. */
GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call( error = grpc_server_request_call(server, &s, &call_details,
server, &s, &call_details, &request_metadata_recv, cq, cq, tag(101));
&request_metadata_recv, cq, cq, tag(101))); GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(101), 1); cq_expect_completion(cqv, tag(101), 1);
cq_verify(cqv); cq_verify(cqv);
@ -172,8 +174,8 @@ void test_connect(const char *server_host, const char *client_host, int port,
op->data.recv_close_on_server.cancelled = &was_cancelled; op->data.recv_close_on_server.cancelled = &was_cancelled;
op->flags = 0; op->flags = 0;
op++; op++;
GPR_ASSERT(GRPC_CALL_OK == error = grpc_call_start_batch(s, ops, op - ops, tag(102), NULL);
grpc_call_start_batch(s, ops, op - ops, tag(102))); GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(102), 1); cq_expect_completion(cqv, tag(102), 1);
cq_expect_completion(cqv, tag(1), 1); cq_expect_completion(cqv, tag(1), 1);
@ -204,7 +206,8 @@ void test_connect(const char *server_host, const char *client_host, int port,
/* Destroy server. */ /* Destroy server. */
grpc_server_shutdown_and_notify(server, cq, tag(1000)); grpc_server_shutdown_and_notify(server, cq, tag(1000));
GPR_ASSERT(grpc_completion_queue_pluck(cq, tag(1000), GPR_ASSERT(grpc_completion_queue_pluck(cq, tag(1000),
GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5)) GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5),
NULL)
.type == GRPC_OP_COMPLETE); .type == GRPC_OP_COMPLETE);
grpc_server_destroy(server); grpc_server_destroy(server);
grpc_completion_queue_shutdown(cq); grpc_completion_queue_shutdown(cq);

@ -60,7 +60,7 @@ static grpc_end2end_test_fixture chttp2_create_fixture_secure_fullstack(
gpr_join_host_port(&ffd->localaddr, "localhost", port); gpr_join_host_port(&ffd->localaddr, "localhost", port);
f.fixture_data = ffd; f.fixture_data = ffd;
f.cq = grpc_completion_queue_create(); f.cq = grpc_completion_queue_create(NULL);
return f; return f;
} }
@ -81,8 +81,8 @@ static void chttp2_init_server_secure_fullstack(
if (f->server) { if (f->server) {
grpc_server_destroy(f->server); grpc_server_destroy(f->server);
} }
f->server = grpc_server_create(server_args); f->server = grpc_server_create(server_args, NULL);
grpc_server_register_completion_queue(f->server, f->cq); grpc_server_register_completion_queue(f->server, f->cq, NULL);
GPR_ASSERT(grpc_server_add_secure_http2_port(f->server, ffd->localaddr, GPR_ASSERT(grpc_server_add_secure_http2_port(f->server, ffd->localaddr,
server_creds)); server_creds));
grpc_server_credentials_release(server_creds); grpc_server_credentials_release(server_creds);

@ -64,7 +64,7 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack(
gpr_join_host_port(&ffd->localaddr, "localhost", port); gpr_join_host_port(&ffd->localaddr, "localhost", port);
f.fixture_data = ffd; f.fixture_data = ffd;
f.cq = grpc_completion_queue_create(); f.cq = grpc_completion_queue_create(NULL);
return f; return f;
} }
@ -72,7 +72,7 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack(
void chttp2_init_client_fullstack(grpc_end2end_test_fixture *f, void chttp2_init_client_fullstack(grpc_end2end_test_fixture *f,
grpc_channel_args *client_args) { grpc_channel_args *client_args) {
fullstack_fixture_data *ffd = f->fixture_data; fullstack_fixture_data *ffd = f->fixture_data;
f->client = grpc_channel_create(ffd->localaddr, client_args); f->client = grpc_channel_create(ffd->localaddr, client_args, NULL);
GPR_ASSERT(f->client); GPR_ASSERT(f->client);
} }
@ -82,8 +82,8 @@ void chttp2_init_server_fullstack(grpc_end2end_test_fixture *f,
if (f->server) { if (f->server) {
grpc_server_destroy(f->server); grpc_server_destroy(f->server);
} }
f->server = grpc_server_create(server_args); f->server = grpc_server_create(server_args, NULL);
grpc_server_register_completion_queue(f->server, f->cq); grpc_server_register_completion_queue(f->server, f->cq, NULL);
GPR_ASSERT(grpc_server_add_http2_port(f->server, ffd->localaddr)); GPR_ASSERT(grpc_server_add_http2_port(f->server, ffd->localaddr));
grpc_server_start(f->server); grpc_server_start(f->server);
} }

@ -69,7 +69,7 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack_compression(
memset(&f, 0, sizeof(f)); memset(&f, 0, sizeof(f));
f.fixture_data = ffd; f.fixture_data = ffd;
f.cq = grpc_completion_queue_create(); f.cq = grpc_completion_queue_create(NULL);
return f; return f;
} }
@ -82,7 +82,8 @@ void chttp2_init_client_fullstack_compression(grpc_end2end_test_fixture *f,
} }
ffd->client_args_compression = grpc_channel_args_set_compression_algorithm( ffd->client_args_compression = grpc_channel_args_set_compression_algorithm(
client_args, GRPC_COMPRESS_GZIP); client_args, GRPC_COMPRESS_GZIP);
f->client = grpc_channel_create(ffd->localaddr, ffd->client_args_compression); f->client = grpc_channel_create(ffd->localaddr, ffd->client_args_compression,
NULL);
} }
void chttp2_init_server_fullstack_compression(grpc_end2end_test_fixture *f, void chttp2_init_server_fullstack_compression(grpc_end2end_test_fixture *f,
@ -96,8 +97,8 @@ void chttp2_init_server_fullstack_compression(grpc_end2end_test_fixture *f,
if (f->server) { if (f->server) {
grpc_server_destroy(f->server); grpc_server_destroy(f->server);
} }
f->server = grpc_server_create(ffd->server_args_compression); f->server = grpc_server_create(ffd->server_args_compression, NULL);
grpc_server_register_completion_queue(f->server, f->cq); grpc_server_register_completion_queue(f->server, f->cq, NULL);
GPR_ASSERT(grpc_server_add_http2_port(f->server, ffd->localaddr)); GPR_ASSERT(grpc_server_add_http2_port(f->server, ffd->localaddr));
grpc_server_start(f->server); grpc_server_start(f->server);
} }

@ -70,7 +70,7 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack(
unique++); unique++);
f.fixture_data = ffd; f.fixture_data = ffd;
f.cq = grpc_completion_queue_create(); f.cq = grpc_completion_queue_create(NULL);
return f; return f;
} }
@ -78,7 +78,7 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack(
void chttp2_init_client_fullstack(grpc_end2end_test_fixture *f, void chttp2_init_client_fullstack(grpc_end2end_test_fixture *f,
grpc_channel_args *client_args) { grpc_channel_args *client_args) {
fullstack_fixture_data *ffd = f->fixture_data; fullstack_fixture_data *ffd = f->fixture_data;
f->client = grpc_channel_create(ffd->localaddr, client_args); f->client = grpc_channel_create(ffd->localaddr, client_args, NULL);
} }
void chttp2_init_server_fullstack(grpc_end2end_test_fixture *f, void chttp2_init_server_fullstack(grpc_end2end_test_fixture *f,
@ -87,8 +87,8 @@ void chttp2_init_server_fullstack(grpc_end2end_test_fixture *f,
if (f->server) { if (f->server) {
grpc_server_destroy(f->server); grpc_server_destroy(f->server);
} }
f->server = grpc_server_create(server_args); f->server = grpc_server_create(server_args, NULL);
grpc_server_register_completion_queue(f->server, f->cq); grpc_server_register_completion_queue(f->server, f->cq, NULL);
GPR_ASSERT(grpc_server_add_http2_port(f->server, ffd->localaddr)); GPR_ASSERT(grpc_server_add_http2_port(f->server, ffd->localaddr));
grpc_server_start(f->server); grpc_server_start(f->server);
} }

@ -64,7 +64,7 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack(
gpr_join_host_port(&ffd->localaddr, "localhost", port); gpr_join_host_port(&ffd->localaddr, "localhost", port);
f.fixture_data = ffd; f.fixture_data = ffd;
f.cq = grpc_completion_queue_create(); f.cq = grpc_completion_queue_create(NULL);
return f; return f;
} }
@ -72,7 +72,7 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack(
void chttp2_init_client_fullstack(grpc_end2end_test_fixture *f, void chttp2_init_client_fullstack(grpc_end2end_test_fixture *f,
grpc_channel_args *client_args) { grpc_channel_args *client_args) {
fullstack_fixture_data *ffd = f->fixture_data; fullstack_fixture_data *ffd = f->fixture_data;
f->client = grpc_channel_create(ffd->localaddr, client_args); f->client = grpc_channel_create(ffd->localaddr, client_args, NULL);
} }
void chttp2_init_server_fullstack(grpc_end2end_test_fixture *f, void chttp2_init_server_fullstack(grpc_end2end_test_fixture *f,
@ -81,8 +81,8 @@ void chttp2_init_server_fullstack(grpc_end2end_test_fixture *f,
if (f->server) { if (f->server) {
grpc_server_destroy(f->server); grpc_server_destroy(f->server);
} }
f->server = grpc_server_create(server_args); f->server = grpc_server_create(server_args, NULL);
grpc_server_register_completion_queue(f->server, f->cq); grpc_server_register_completion_queue(f->server, f->cq, NULL);
GPR_ASSERT(grpc_server_add_http2_port(f->server, ffd->localaddr)); GPR_ASSERT(grpc_server_add_http2_port(f->server, ffd->localaddr));
grpc_server_start(f->server); grpc_server_start(f->server);
} }

@ -63,7 +63,7 @@ static grpc_end2end_test_fixture chttp2_create_fixture_secure_fullstack(
gpr_join_host_port(&ffd->localaddr, "localhost", port); gpr_join_host_port(&ffd->localaddr, "localhost", port);
f.fixture_data = ffd; f.fixture_data = ffd;
f.cq = grpc_completion_queue_create(); f.cq = grpc_completion_queue_create(NULL);
return f; return f;
} }
@ -84,8 +84,8 @@ static void chttp2_init_server_secure_fullstack(
if (f->server) { if (f->server) {
grpc_server_destroy(f->server); grpc_server_destroy(f->server);
} }
f->server = grpc_server_create(server_args); f->server = grpc_server_create(server_args, NULL);
grpc_server_register_completion_queue(f->server, f->cq); grpc_server_register_completion_queue(f->server, f->cq, NULL);
GPR_ASSERT(grpc_server_add_secure_http2_port(f->server, ffd->localaddr, GPR_ASSERT(grpc_server_add_secure_http2_port(f->server, ffd->localaddr,
server_creds)); server_creds));
grpc_server_credentials_release(server_creds); grpc_server_credentials_release(server_creds);

@ -63,7 +63,7 @@ static grpc_end2end_test_fixture chttp2_create_fixture_secure_fullstack(
gpr_join_host_port(&ffd->localaddr, "localhost", port); gpr_join_host_port(&ffd->localaddr, "localhost", port);
f.fixture_data = ffd; f.fixture_data = ffd;
f.cq = grpc_completion_queue_create(); f.cq = grpc_completion_queue_create(NULL);
return f; return f;
} }
@ -84,8 +84,8 @@ static void chttp2_init_server_secure_fullstack(
if (f->server) { if (f->server) {
grpc_server_destroy(f->server); grpc_server_destroy(f->server);
} }
f->server = grpc_server_create(server_args); f->server = grpc_server_create(server_args, NULL);
grpc_server_register_completion_queue(f->server, f->cq); grpc_server_register_completion_queue(f->server, f->cq, NULL);
GPR_ASSERT(grpc_server_add_secure_http2_port(f->server, ffd->localaddr, GPR_ASSERT(grpc_server_add_secure_http2_port(f->server, ffd->localaddr,
server_creds)); server_creds));
grpc_server_credentials_release(server_creds); grpc_server_credentials_release(server_creds);

@ -61,7 +61,7 @@ static grpc_end2end_test_fixture chttp2_create_fixture_secure_fullstack(
gpr_join_host_port(&ffd->localaddr, "localhost", port); gpr_join_host_port(&ffd->localaddr, "localhost", port);
f.fixture_data = ffd; f.fixture_data = ffd;
f.cq = grpc_completion_queue_create(); f.cq = grpc_completion_queue_create(NULL);
return f; return f;
} }
@ -82,8 +82,8 @@ static void chttp2_init_server_secure_fullstack(
if (f->server) { if (f->server) {
grpc_server_destroy(f->server); grpc_server_destroy(f->server);
} }
f->server = grpc_server_create(server_args); f->server = grpc_server_create(server_args, NULL);
grpc_server_register_completion_queue(f->server, f->cq); grpc_server_register_completion_queue(f->server, f->cq, NULL);
GPR_ASSERT(grpc_server_add_secure_http2_port(f->server, ffd->localaddr, GPR_ASSERT(grpc_server_add_secure_http2_port(f->server, ffd->localaddr,
server_creds)); server_creds));
grpc_server_credentials_release(server_creds); grpc_server_credentials_release(server_creds);

@ -95,7 +95,7 @@ static grpc_end2end_test_fixture chttp2_create_fixture_socketpair(
grpc_end2end_test_fixture f; grpc_end2end_test_fixture f;
memset(&f, 0, sizeof(f)); memset(&f, 0, sizeof(f));
f.fixture_data = sfd; f.fixture_data = sfd;
f.cq = grpc_completion_queue_create(); f.cq = grpc_completion_queue_create(NULL);
*sfd = grpc_iomgr_create_endpoint_pair("fixture", 65536); *sfd = grpc_iomgr_create_endpoint_pair("fixture", 65536);
@ -123,7 +123,7 @@ static void chttp2_init_server_socketpair(grpc_end2end_test_fixture *f,
grpc_transport *transport; grpc_transport *transport;
GPR_ASSERT(!f->server); GPR_ASSERT(!f->server);
f->server = grpc_server_create_from_filters(NULL, 0, server_args); f->server = grpc_server_create_from_filters(NULL, 0, server_args);
grpc_server_register_completion_queue(f->server, f->cq); grpc_server_register_completion_queue(f->server, f->cq, NULL);
grpc_server_start(f->server); grpc_server_start(f->server);
transport = grpc_create_chttp2_transport(server_args, sfd->server, mdctx, 0); transport = grpc_create_chttp2_transport(server_args, sfd->server, mdctx, 0);
server_setup_transport(f, transport, mdctx); server_setup_transport(f, transport, mdctx);

@ -95,7 +95,7 @@ static grpc_end2end_test_fixture chttp2_create_fixture_socketpair(
grpc_end2end_test_fixture f; grpc_end2end_test_fixture f;
memset(&f, 0, sizeof(f)); memset(&f, 0, sizeof(f));
f.fixture_data = sfd; f.fixture_data = sfd;
f.cq = grpc_completion_queue_create(); f.cq = grpc_completion_queue_create(NULL);
*sfd = grpc_iomgr_create_endpoint_pair("fixture", 1); *sfd = grpc_iomgr_create_endpoint_pair("fixture", 1);
@ -123,7 +123,7 @@ static void chttp2_init_server_socketpair(grpc_end2end_test_fixture *f,
grpc_transport *transport; grpc_transport *transport;
GPR_ASSERT(!f->server); GPR_ASSERT(!f->server);
f->server = grpc_server_create_from_filters(NULL, 0, server_args); f->server = grpc_server_create_from_filters(NULL, 0, server_args);
grpc_server_register_completion_queue(f->server, f->cq); grpc_server_register_completion_queue(f->server, f->cq, NULL);
grpc_server_start(f->server); grpc_server_start(f->server);
transport = grpc_create_chttp2_transport(server_args, sfd->server, mdctx, 0); transport = grpc_create_chttp2_transport(server_args, sfd->server, mdctx, 0);
server_setup_transport(f, transport, mdctx); server_setup_transport(f, transport, mdctx);

@ -96,7 +96,7 @@ static grpc_end2end_test_fixture chttp2_create_fixture_socketpair(
grpc_end2end_test_fixture f; grpc_end2end_test_fixture f;
memset(&f, 0, sizeof(f)); memset(&f, 0, sizeof(f));
f.fixture_data = sfd; f.fixture_data = sfd;
f.cq = grpc_completion_queue_create(); f.cq = grpc_completion_queue_create(NULL);
*sfd = grpc_iomgr_create_endpoint_pair("fixture", 65536); *sfd = grpc_iomgr_create_endpoint_pair("fixture", 65536);
@ -124,7 +124,7 @@ static void chttp2_init_server_socketpair(grpc_end2end_test_fixture *f,
grpc_transport *transport; grpc_transport *transport;
GPR_ASSERT(!f->server); GPR_ASSERT(!f->server);
f->server = grpc_server_create_from_filters(NULL, 0, server_args); f->server = grpc_server_create_from_filters(NULL, 0, server_args);
grpc_server_register_completion_queue(f->server, f->cq); grpc_server_register_completion_queue(f->server, f->cq, NULL);
grpc_server_start(f->server); grpc_server_start(f->server);
transport = grpc_create_chttp2_transport(server_args, sfd->server, mdctx, 0); transport = grpc_create_chttp2_transport(server_args, sfd->server, mdctx, 0);
server_setup_transport(f, transport, mdctx); server_setup_transport(f, transport, mdctx);

@ -41,20 +41,20 @@ int main(int argc, char **argv) {
grpc_test_init(argc, argv); grpc_test_init(argc, argv);
grpc_init(); grpc_init();
cq1 = grpc_completion_queue_create(); cq1 = grpc_completion_queue_create(NULL);
cq2 = grpc_completion_queue_create(); cq2 = grpc_completion_queue_create(NULL);
server = grpc_server_create(NULL); server = grpc_server_create(NULL, NULL);
grpc_server_register_completion_queue(server, cq1); grpc_server_register_completion_queue(server, cq1, NULL);
grpc_server_add_http2_port(server, "[::]:0"); grpc_server_add_http2_port(server, "[::]:0");
grpc_server_register_completion_queue(server, cq2); grpc_server_register_completion_queue(server, cq2, NULL);
grpc_server_start(server); grpc_server_start(server);
grpc_server_shutdown_and_notify(server, cq2, NULL); grpc_server_shutdown_and_notify(server, cq2, NULL);
grpc_completion_queue_next( grpc_completion_queue_next(
cq2, gpr_inf_future(GPR_CLOCK_REALTIME)); /* cue queue hang */ cq2, gpr_inf_future(GPR_CLOCK_REALTIME), NULL); /* cue queue hang */
grpc_completion_queue_shutdown(cq1); grpc_completion_queue_shutdown(cq1);
grpc_completion_queue_shutdown(cq2); grpc_completion_queue_shutdown(cq2);
grpc_completion_queue_next(cq1, gpr_inf_future(GPR_CLOCK_REALTIME)); grpc_completion_queue_next(cq1, gpr_inf_future(GPR_CLOCK_REALTIME), NULL);
grpc_completion_queue_next(cq2, gpr_inf_future(GPR_CLOCK_REALTIME)); grpc_completion_queue_next(cq2, gpr_inf_future(GPR_CLOCK_REALTIME), NULL);
grpc_server_destroy(server); grpc_server_destroy(server);
grpc_completion_queue_destroy(cq1); grpc_completion_queue_destroy(cq1);
grpc_completion_queue_destroy(cq2); grpc_completion_queue_destroy(cq2);

@ -57,12 +57,13 @@ int main(int argc, char **argv) {
grpc_metadata_array_init(&trailing_metadata_recv); grpc_metadata_array_init(&trailing_metadata_recv);
cq = grpc_completion_queue_create(); cq = grpc_completion_queue_create(NULL);
cqv = cq_verifier_create(cq); cqv = cq_verifier_create(cq);
/* create a call, channel to a non existant server */ /* create a call, channel to a non existant server */
chan = grpc_channel_create("nonexistant:54321", NULL); chan = grpc_channel_create("nonexistant:54321", NULL, NULL);
call = grpc_channel_create_call(chan, cq, "/Foo", "nonexistant", deadline); call = grpc_channel_create_call(chan, cq, "/Foo", "nonexistant", deadline,
NULL);
op = ops; op = ops;
op->op = GRPC_OP_SEND_INITIAL_METADATA; op->op = GRPC_OP_SEND_INITIAL_METADATA;
@ -77,7 +78,7 @@ int main(int argc, char **argv) {
op->flags = 0; op->flags = 0;
op++; op++;
GPR_ASSERT(GRPC_CALL_OK == GPR_ASSERT(GRPC_CALL_OK ==
grpc_call_start_batch(call, ops, op - ops, tag(1))); grpc_call_start_batch(call, ops, op - ops, tag(1), NULL));
/* verify that all tags get completed */ /* verify that all tags get completed */
cq_expect_completion(cqv, tag(1), 1); cq_expect_completion(cqv, tag(1), 1);
cq_verify(cqv); cq_verify(cqv);
@ -85,8 +86,8 @@ int main(int argc, char **argv) {
GPR_ASSERT(status == GRPC_STATUS_DEADLINE_EXCEEDED); GPR_ASSERT(status == GRPC_STATUS_DEADLINE_EXCEEDED);
grpc_completion_queue_shutdown(cq); grpc_completion_queue_shutdown(cq);
while (grpc_completion_queue_next(cq, gpr_inf_future(GPR_CLOCK_REALTIME)) while (grpc_completion_queue_next(cq, gpr_inf_future(GPR_CLOCK_REALTIME),
.type != GRPC_QUEUE_SHUTDOWN) NULL).type != GRPC_QUEUE_SHUTDOWN)
; ;
grpc_completion_queue_destroy(cq); grpc_completion_queue_destroy(cq);
grpc_call_destroy(call); grpc_call_destroy(call);

@ -70,7 +70,7 @@ static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static void drain_cq(grpc_completion_queue *cq) { static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev; grpc_event ev;
do { do {
ev = grpc_completion_queue_next(cq, five_seconds_time()); ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN); } while (ev.type != GRPC_QUEUE_SHUTDOWN);
} }
@ -78,7 +78,8 @@ static void shutdown_server(grpc_end2end_test_fixture *f) {
if (!f->server) return; if (!f->server) return;
grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000));
GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000), GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000),
GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5)) GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5),
NULL)
.type == GRPC_OP_COMPLETE); .type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server); grpc_server_destroy(f->server);
f->server = NULL; f->server = NULL;
@ -110,11 +111,12 @@ static void simple_request_body(grpc_end2end_test_fixture f) {
grpc_metadata_array request_metadata_recv; grpc_metadata_array request_metadata_recv;
grpc_call_details call_details; grpc_call_details call_details;
grpc_status_code status; grpc_status_code status;
grpc_call_error error;
char *details = NULL; char *details = NULL;
size_t details_capacity = 0; size_t details_capacity = 0;
c = grpc_channel_create_call(f.client, f.cq, "/foo", "slartibartfast.local", c = grpc_channel_create_call(f.client, f.cq, "/foo", "slartibartfast.local",
deadline); deadline, NULL);
GPR_ASSERT(c); GPR_ASSERT(c);
grpc_metadata_array_init(&initial_metadata_recv); grpc_metadata_array_init(&initial_metadata_recv);
@ -141,7 +143,8 @@ static void simple_request_body(grpc_end2end_test_fixture f) {
op->data.recv_status_on_client.status_details_capacity = &details_capacity; op->data.recv_status_on_client.status_details_capacity = &details_capacity;
op->flags = 0; op->flags = 0;
op++; op++;
GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(c, ops, op - ops, tag(1))); error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL);
GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(1), 1); cq_expect_completion(cqv, tag(1), 1);
cq_verify(cqv); cq_verify(cqv);

@ -69,7 +69,7 @@ static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static void drain_cq(grpc_completion_queue *cq) { static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev; grpc_event ev;
do { do {
ev = grpc_completion_queue_next(cq, five_seconds_time()); ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN); } while (ev.type != GRPC_QUEUE_SHUTDOWN);
} }
@ -77,7 +77,8 @@ static void shutdown_server(grpc_end2end_test_fixture *f) {
if (!f->server) return; if (!f->server) return;
grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000));
GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000), GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000),
GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5)) GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5),
NULL)
.type == GRPC_OP_COMPLETE); .type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server); grpc_server_destroy(f->server);
f->server = NULL; f->server = NULL;
@ -114,6 +115,7 @@ static void test_cancel_after_accept(grpc_end2end_test_config config,
grpc_metadata_array request_metadata_recv; grpc_metadata_array request_metadata_recv;
grpc_call_details call_details; grpc_call_details call_details;
grpc_status_code status; grpc_status_code status;
grpc_call_error error;
char *details = NULL; char *details = NULL;
size_t details_capacity = 0; size_t details_capacity = 0;
grpc_byte_buffer *request_payload_recv = NULL; grpc_byte_buffer *request_payload_recv = NULL;
@ -127,7 +129,7 @@ static void test_cancel_after_accept(grpc_end2end_test_config config,
int was_cancelled = 2; int was_cancelled = 2;
c = grpc_channel_create_call(f.client, f.cq, "/foo", "foo.test.google.fr", c = grpc_channel_create_call(f.client, f.cq, "/foo", "foo.test.google.fr",
deadline); deadline, NULL);
GPR_ASSERT(c); GPR_ASSERT(c);
grpc_metadata_array_init(&initial_metadata_recv); grpc_metadata_array_init(&initial_metadata_recv);
@ -159,11 +161,12 @@ static void test_cancel_after_accept(grpc_end2end_test_config config,
op->data.recv_message = &response_payload_recv; op->data.recv_message = &response_payload_recv;
op->flags = 0; op->flags = 0;
op++; op++;
GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(c, ops, op - ops, tag(1))); error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL);
GPR_ASSERT(GRPC_CALL_OK == error);
GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call( error = grpc_server_request_call(f.server, &s, &call_details,
f.server, &s, &call_details, &request_metadata_recv, f.cq, f.cq, tag(2));
&request_metadata_recv, f.cq, f.cq, tag(2))); GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(2), 1); cq_expect_completion(cqv, tag(2), 1);
cq_verify(cqv); cq_verify(cqv);
@ -184,9 +187,10 @@ static void test_cancel_after_accept(grpc_end2end_test_config config,
op->data.recv_close_on_server.cancelled = &was_cancelled; op->data.recv_close_on_server.cancelled = &was_cancelled;
op->flags = 0; op->flags = 0;
op++; op++;
GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(s, ops, op - ops, tag(3))); error = grpc_call_start_batch(s, ops, op - ops, tag(3), NULL);
GPR_ASSERT(GRPC_CALL_OK == error);
GPR_ASSERT(GRPC_CALL_OK == mode.initiate_cancel(c)); GPR_ASSERT(GRPC_CALL_OK == mode.initiate_cancel(c, NULL));
cq_expect_completion(cqv, tag(3), 1); cq_expect_completion(cqv, tag(3), 1);
cq_expect_completion(cqv, tag(1), 1); cq_expect_completion(cqv, tag(1), 1);

@ -69,7 +69,7 @@ static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static void drain_cq(grpc_completion_queue *cq) { static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev; grpc_event ev;
do { do {
ev = grpc_completion_queue_next(cq, five_seconds_time()); ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN); } while (ev.type != GRPC_QUEUE_SHUTDOWN);
} }
@ -77,7 +77,8 @@ static void shutdown_server(grpc_end2end_test_fixture *f) {
if (!f->server) return; if (!f->server) return;
grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000));
GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000), GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000),
GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5)) GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5),
NULL)
.type == GRPC_OP_COMPLETE); .type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server); grpc_server_destroy(f->server);
f->server = NULL; f->server = NULL;
@ -114,6 +115,7 @@ static void test_cancel_after_accept_and_writes_closed(
grpc_metadata_array request_metadata_recv; grpc_metadata_array request_metadata_recv;
grpc_call_details call_details; grpc_call_details call_details;
grpc_status_code status; grpc_status_code status;
grpc_call_error error;
char *details = NULL; char *details = NULL;
size_t details_capacity = 0; size_t details_capacity = 0;
grpc_byte_buffer *request_payload_recv = NULL; grpc_byte_buffer *request_payload_recv = NULL;
@ -127,7 +129,7 @@ static void test_cancel_after_accept_and_writes_closed(
int was_cancelled = 2; int was_cancelled = 2;
c = grpc_channel_create_call(f.client, f.cq, "/foo", "foo.test.google.fr", c = grpc_channel_create_call(f.client, f.cq, "/foo", "foo.test.google.fr",
deadline); deadline, NULL);
GPR_ASSERT(c); GPR_ASSERT(c);
grpc_metadata_array_init(&initial_metadata_recv); grpc_metadata_array_init(&initial_metadata_recv);
@ -162,11 +164,12 @@ static void test_cancel_after_accept_and_writes_closed(
op->data.recv_message = &response_payload_recv; op->data.recv_message = &response_payload_recv;
op->flags = 0; op->flags = 0;
op++; op++;
GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(c, ops, op - ops, tag(1))); error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL);
GPR_ASSERT(GRPC_CALL_OK == error);
GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call( error = grpc_server_request_call(f.server, &s, &call_details,
f.server, &s, &call_details, &request_metadata_recv, f.cq, f.cq, tag(2));
&request_metadata_recv, f.cq, f.cq, tag(2))); GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(2), 1); cq_expect_completion(cqv, tag(2), 1);
cq_verify(cqv); cq_verify(cqv);
@ -187,9 +190,10 @@ static void test_cancel_after_accept_and_writes_closed(
op->data.send_message = response_payload; op->data.send_message = response_payload;
op->flags = 0; op->flags = 0;
op++; op++;
GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(s, ops, op - ops, tag(3))); error = grpc_call_start_batch(s, ops, op - ops, tag(3), NULL);
GPR_ASSERT(GRPC_CALL_OK == error);
GPR_ASSERT(GRPC_CALL_OK == mode.initiate_cancel(c)); GPR_ASSERT(GRPC_CALL_OK == mode.initiate_cancel(c, NULL));
cq_expect_completion(cqv, tag(3), 1); cq_expect_completion(cqv, tag(3), 1);
cq_expect_completion(cqv, tag(1), 1); cq_expect_completion(cqv, tag(1), 1);

@ -70,7 +70,7 @@ static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static void drain_cq(grpc_completion_queue *cq) { static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev; grpc_event ev;
do { do {
ev = grpc_completion_queue_next(cq, five_seconds_time()); ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN); } while (ev.type != GRPC_QUEUE_SHUTDOWN);
} }
@ -78,7 +78,8 @@ static void shutdown_server(grpc_end2end_test_fixture *f) {
if (!f->server) return; if (!f->server) return;
grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000));
GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000), GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000),
GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5)) GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5),
NULL)
.type == GRPC_OP_COMPLETE); .type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server); grpc_server_destroy(f->server);
f->server = NULL; f->server = NULL;
@ -114,6 +115,7 @@ static void test_cancel_after_invoke(grpc_end2end_test_config config,
grpc_metadata_array request_metadata_recv; grpc_metadata_array request_metadata_recv;
grpc_call_details call_details; grpc_call_details call_details;
grpc_status_code status; grpc_status_code status;
grpc_call_error error;
char *details = NULL; char *details = NULL;
size_t details_capacity = 0; size_t details_capacity = 0;
grpc_byte_buffer *response_payload_recv = NULL; grpc_byte_buffer *response_payload_recv = NULL;
@ -122,7 +124,7 @@ static void test_cancel_after_invoke(grpc_end2end_test_config config,
grpc_raw_byte_buffer_create(&request_payload_slice, 1); grpc_raw_byte_buffer_create(&request_payload_slice, 1);
c = grpc_channel_create_call(f.client, f.cq, "/foo", "foo.test.google.fr", c = grpc_channel_create_call(f.client, f.cq, "/foo", "foo.test.google.fr",
deadline); deadline, NULL);
GPR_ASSERT(c); GPR_ASSERT(c);
grpc_metadata_array_init(&initial_metadata_recv); grpc_metadata_array_init(&initial_metadata_recv);
@ -157,9 +159,10 @@ static void test_cancel_after_invoke(grpc_end2end_test_config config,
op->data.recv_message = &response_payload_recv; op->data.recv_message = &response_payload_recv;
op->flags = 0; op->flags = 0;
op++; op++;
GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(c, ops, test_ops, tag(1))); error = grpc_call_start_batch(c, ops, test_ops, tag(1), NULL);
GPR_ASSERT(GRPC_CALL_OK == error);
GPR_ASSERT(GRPC_CALL_OK == mode.initiate_cancel(c)); GPR_ASSERT(GRPC_CALL_OK == mode.initiate_cancel(c, NULL));
cq_expect_completion(cqv, tag(1), 1); cq_expect_completion(cqv, tag(1), 1);
cq_verify(cqv); cq_verify(cqv);

@ -68,7 +68,7 @@ static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static void drain_cq(grpc_completion_queue *cq) { static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev; grpc_event ev;
do { do {
ev = grpc_completion_queue_next(cq, five_seconds_time()); ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN); } while (ev.type != GRPC_QUEUE_SHUTDOWN);
} }
@ -76,7 +76,8 @@ static void shutdown_server(grpc_end2end_test_fixture *f) {
if (!f->server) return; if (!f->server) return;
grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000));
GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000), GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000),
GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5)) GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5),
NULL)
.type == GRPC_OP_COMPLETE); .type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server); grpc_server_destroy(f->server);
f->server = NULL; f->server = NULL;
@ -112,6 +113,7 @@ static void test_cancel_before_invoke(grpc_end2end_test_config config,
grpc_metadata_array request_metadata_recv; grpc_metadata_array request_metadata_recv;
grpc_call_details call_details; grpc_call_details call_details;
grpc_status_code status; grpc_status_code status;
grpc_call_error error;
char *details = NULL; char *details = NULL;
size_t details_capacity = 0; size_t details_capacity = 0;
grpc_byte_buffer *response_payload_recv = NULL; grpc_byte_buffer *response_payload_recv = NULL;
@ -120,10 +122,10 @@ static void test_cancel_before_invoke(grpc_end2end_test_config config,
grpc_raw_byte_buffer_create(&request_payload_slice, 1); grpc_raw_byte_buffer_create(&request_payload_slice, 1);
c = grpc_channel_create_call(f.client, f.cq, "/foo", "foo.test.google.fr", c = grpc_channel_create_call(f.client, f.cq, "/foo", "foo.test.google.fr",
deadline); deadline, NULL);
GPR_ASSERT(c); GPR_ASSERT(c);
GPR_ASSERT(GRPC_CALL_OK == grpc_call_cancel(c)); GPR_ASSERT(GRPC_CALL_OK == grpc_call_cancel(c, NULL));
grpc_metadata_array_init(&initial_metadata_recv); grpc_metadata_array_init(&initial_metadata_recv);
grpc_metadata_array_init(&trailing_metadata_recv); grpc_metadata_array_init(&trailing_metadata_recv);
@ -157,7 +159,8 @@ static void test_cancel_before_invoke(grpc_end2end_test_config config,
op->data.recv_message = &response_payload_recv; op->data.recv_message = &response_payload_recv;
op->flags = 0; op->flags = 0;
op++; op++;
GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(c, ops, test_ops, tag(1))); error = grpc_call_start_batch(c, ops, test_ops, tag(1), NULL);
GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(1), 1); cq_expect_completion(cqv, tag(1), 1);
cq_verify(cqv); cq_verify(cqv);

@ -69,7 +69,7 @@ static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static void drain_cq(grpc_completion_queue *cq) { static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev; grpc_event ev;
do { do {
ev = grpc_completion_queue_next(cq, five_seconds_time()); ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN); } while (ev.type != GRPC_QUEUE_SHUTDOWN);
} }
@ -77,7 +77,8 @@ static void shutdown_server(grpc_end2end_test_fixture *f) {
if (!f->server) return; if (!f->server) return;
grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000));
GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000), GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000),
GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5)) GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5),
NULL)
.type == GRPC_OP_COMPLETE); .type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server); grpc_server_destroy(f->server);
f->server = NULL; f->server = NULL;
@ -108,10 +109,10 @@ static void test_cancel_in_a_vacuum(grpc_end2end_test_config config,
cq_verifier *v_client = cq_verifier_create(f.cq); cq_verifier *v_client = cq_verifier_create(f.cq);
c = grpc_channel_create_call(f.client, f.cq, "/foo", "foo.test.google.fr", c = grpc_channel_create_call(f.client, f.cq, "/foo", "foo.test.google.fr",
deadline); deadline, NULL);
GPR_ASSERT(c); GPR_ASSERT(c);
GPR_ASSERT(GRPC_CALL_OK == mode.initiate_cancel(c)); GPR_ASSERT(GRPC_CALL_OK == mode.initiate_cancel(c, NULL));
grpc_call_destroy(c); grpc_call_destroy(c);

@ -36,12 +36,13 @@
typedef struct { typedef struct {
const char *name; const char *name;
grpc_call_error (*initiate_cancel)(grpc_call *call); grpc_call_error (*initiate_cancel)(grpc_call *call, void *reserved);
grpc_status_code expect_status; grpc_status_code expect_status;
const char *expect_details; const char *expect_details;
} cancellation_mode; } cancellation_mode;
static grpc_call_error wait_for_deadline(grpc_call *call) { static grpc_call_error wait_for_deadline(grpc_call *call, void *reserved) {
(void) reserved;
return GRPC_CALL_OK; return GRPC_CALL_OK;
} }

@ -67,7 +67,8 @@ static void shutdown_server(grpc_end2end_test_fixture *f) {
if (!f->server) return; if (!f->server) return;
grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000));
GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000), GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000),
GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5)) GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5),
NULL)
.type == GRPC_OP_COMPLETE); .type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server); grpc_server_destroy(f->server);
f->server = NULL; f->server = NULL;
@ -82,7 +83,7 @@ static void shutdown_client(grpc_end2end_test_fixture *f) {
static void drain_cq(grpc_completion_queue *cq) { static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev; grpc_event ev;
do { do {
ev = grpc_completion_queue_next(cq, n_seconds_time(5)); ev = grpc_completion_queue_next(cq, n_seconds_time(5), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN); } while (ev.type != GRPC_QUEUE_SHUTDOWN);
} }
@ -107,12 +108,13 @@ static void test_body(grpc_end2end_test_fixture f) {
grpc_metadata_array request_metadata_recv; grpc_metadata_array request_metadata_recv;
grpc_call_details call_details; grpc_call_details call_details;
grpc_status_code status; grpc_status_code status;
grpc_call_error error;
char *details = NULL; char *details = NULL;
size_t details_capacity = 0; size_t details_capacity = 0;
int was_cancelled = 2; int was_cancelled = 2;
c = grpc_channel_create_call(f.client, f.cq, "/foo", c = grpc_channel_create_call(f.client, f.cq, "/foo",
"foo.test.google.fr:1234", deadline); "foo.test.google.fr:1234", deadline, NULL);
GPR_ASSERT(c); GPR_ASSERT(c);
grpc_metadata_array_init(&initial_metadata_recv); grpc_metadata_array_init(&initial_metadata_recv);
@ -139,11 +141,13 @@ static void test_body(grpc_end2end_test_fixture f) {
op->data.recv_status_on_client.status_details_capacity = &details_capacity; op->data.recv_status_on_client.status_details_capacity = &details_capacity;
op->flags = 0; op->flags = 0;
op++; op++;
GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(c, ops, op - ops, tag(1))); error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL);
GPR_ASSERT(GRPC_CALL_OK == error);
GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call( error = grpc_server_request_call(f.server, &s, &call_details,
f.server, &s, &call_details, &request_metadata_recv, f.cq, f.cq,
&request_metadata_recv, f.cq, f.cq, tag(101))); tag(101));
GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(101), 1); cq_expect_completion(cqv, tag(101), 1);
cq_verify(cqv); cq_verify(cqv);
@ -162,7 +166,8 @@ static void test_body(grpc_end2end_test_fixture f) {
op->data.recv_close_on_server.cancelled = &was_cancelled; op->data.recv_close_on_server.cancelled = &was_cancelled;
op->flags = 0; op->flags = 0;
op++; op++;
GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(s, ops, op - ops, tag(102))); error = grpc_call_start_batch(s, ops, op - ops, tag(102), NULL);
GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(102), 1); cq_expect_completion(cqv, tag(102), 1);
cq_expect_completion(cqv, tag(1), 1); cq_expect_completion(cqv, tag(1), 1);

@ -56,7 +56,7 @@ static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static void drain_cq(grpc_completion_queue *cq) { static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev; grpc_event ev;
do { do {
ev = grpc_completion_queue_next(cq, five_seconds_time()); ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN); } while (ev.type != GRPC_QUEUE_SHUTDOWN);
} }
@ -93,12 +93,13 @@ static void do_request_and_shutdown_server(grpc_end2end_test_fixture *f,
grpc_metadata_array request_metadata_recv; grpc_metadata_array request_metadata_recv;
grpc_call_details call_details; grpc_call_details call_details;
grpc_status_code status; grpc_status_code status;
grpc_call_error error;
char *details = NULL; char *details = NULL;
size_t details_capacity = 0; size_t details_capacity = 0;
int was_cancelled = 2; int was_cancelled = 2;
c = grpc_channel_create_call(f->client, f->cq, "/foo", c = grpc_channel_create_call(f->client, f->cq, "/foo",
"foo.test.google.fr:1234", deadline); "foo.test.google.fr:1234", deadline, NULL);
GPR_ASSERT(c); GPR_ASSERT(c);
grpc_metadata_array_init(&initial_metadata_recv); grpc_metadata_array_init(&initial_metadata_recv);
@ -125,12 +126,13 @@ static void do_request_and_shutdown_server(grpc_end2end_test_fixture *f,
op->data.recv_status_on_client.status_details_capacity = &details_capacity; op->data.recv_status_on_client.status_details_capacity = &details_capacity;
op->flags = 0; op->flags = 0;
op++; op++;
GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(c, ops, op - ops, tag(1))); error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL);
GPR_ASSERT(GRPC_CALL_OK == error);
GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call(f->server, &s, error = grpc_server_request_call(f->server, &s, &call_details,
&call_details, &request_metadata_recv, f->cq, f->cq,
&request_metadata_recv, tag(101));
f->cq, f->cq, tag(101))); GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(101), 1); cq_expect_completion(cqv, tag(101), 1);
cq_verify(cqv); cq_verify(cqv);
@ -153,7 +155,8 @@ static void do_request_and_shutdown_server(grpc_end2end_test_fixture *f,
op->data.recv_close_on_server.cancelled = &was_cancelled; op->data.recv_close_on_server.cancelled = &was_cancelled;
op->flags = 0; op->flags = 0;
op++; op++;
GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(s, ops, op - ops, tag(102))); error = grpc_call_start_batch(s, ops, op - ops, tag(102), NULL);
GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(102), 1); cq_expect_completion(cqv, tag(102), 1);
cq_expect_completion(cqv, tag(1), 1); cq_expect_completion(cqv, tag(1), 1);

@ -68,7 +68,7 @@ static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static void drain_cq(grpc_completion_queue *cq) { static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev; grpc_event ev;
do { do {
ev = grpc_completion_queue_next(cq, five_seconds_time()); ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN); } while (ev.type != GRPC_QUEUE_SHUTDOWN);
} }
@ -101,12 +101,13 @@ static void test_early_server_shutdown_finishes_inflight_calls(
grpc_metadata_array request_metadata_recv; grpc_metadata_array request_metadata_recv;
grpc_call_details call_details; grpc_call_details call_details;
grpc_status_code status; grpc_status_code status;
grpc_call_error error;
char *details = NULL; char *details = NULL;
size_t details_capacity = 0; size_t details_capacity = 0;
int was_cancelled = 2; int was_cancelled = 2;
c = grpc_channel_create_call(f.client, f.cq, "/foo", "foo.test.google.fr", c = grpc_channel_create_call(f.client, f.cq, "/foo", "foo.test.google.fr",
deadline); deadline, NULL);
GPR_ASSERT(c); GPR_ASSERT(c);
grpc_metadata_array_init(&initial_metadata_recv); grpc_metadata_array_init(&initial_metadata_recv);
@ -134,11 +135,13 @@ static void test_early_server_shutdown_finishes_inflight_calls(
op->data.recv_status_on_client.status_details_capacity = &details_capacity; op->data.recv_status_on_client.status_details_capacity = &details_capacity;
op->flags = 0; op->flags = 0;
op++; op++;
GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(c, ops, op - ops, tag(1))); error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL);
GPR_ASSERT(GRPC_CALL_OK == error);
GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call( error = grpc_server_request_call(f.server, &s, &call_details,
f.server, &s, &call_details, &request_metadata_recv, f.cq, f.cq,
&request_metadata_recv, f.cq, f.cq, tag(101))); tag(101));
GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(101), 1); cq_expect_completion(cqv, tag(101), 1);
cq_verify(cqv); cq_verify(cqv);
@ -147,7 +150,8 @@ static void test_early_server_shutdown_finishes_inflight_calls(
op->data.recv_close_on_server.cancelled = &was_cancelled; op->data.recv_close_on_server.cancelled = &was_cancelled;
op->flags = 0; op->flags = 0;
op++; op++;
GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(s, ops, op - ops, tag(102))); error = grpc_call_start_batch(s, ops, op - ops, tag(102), NULL);
GPR_ASSERT(GRPC_CALL_OK == error);
/* shutdown and destroy the server */ /* shutdown and destroy the server */
grpc_server_shutdown_and_notify(f.server, f.cq, tag(1000)); grpc_server_shutdown_and_notify(f.server, f.cq, tag(1000));

@ -68,7 +68,7 @@ static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static void drain_cq(grpc_completion_queue *cq) { static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev; grpc_event ev;
do { do {
ev = grpc_completion_queue_next(cq, five_seconds_time()); ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN); } while (ev.type != GRPC_QUEUE_SHUTDOWN);
} }

@ -70,7 +70,7 @@ static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static void drain_cq(grpc_completion_queue *cq) { static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev; grpc_event ev;
do { do {
ev = grpc_completion_queue_next(cq, five_seconds_time()); ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN); } while (ev.type != GRPC_QUEUE_SHUTDOWN);
} }
@ -78,7 +78,8 @@ static void shutdown_server(grpc_end2end_test_fixture *f) {
if (!f->server) return; if (!f->server) return;
grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000));
GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000), GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000),
GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5)) GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5),
NULL)
.type == GRPC_OP_COMPLETE); .type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server); grpc_server_destroy(f->server);
f->server = NULL; f->server = NULL;
@ -103,13 +104,15 @@ static void empty_batch_body(grpc_end2end_test_fixture f) {
grpc_call *c; grpc_call *c;
gpr_timespec deadline = five_seconds_time(); gpr_timespec deadline = five_seconds_time();
cq_verifier *cqv = cq_verifier_create(f.cq); cq_verifier *cqv = cq_verifier_create(f.cq);
grpc_call_error error;
grpc_op *op = NULL; grpc_op *op = NULL;
c = grpc_channel_create_call(f.client, f.cq, "/foo", "foo.test.google.fr", c = grpc_channel_create_call(f.client, f.cq, "/foo", "foo.test.google.fr",
deadline); deadline, NULL);
GPR_ASSERT(c); GPR_ASSERT(c);
GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(c, op, 0, tag(1))); error = grpc_call_start_batch(c, op, 0, tag(1), NULL);
GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(1), 1); cq_expect_completion(cqv, tag(1), 1);
cq_verify(cqv); cq_verify(cqv);

@ -68,7 +68,7 @@ static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static void drain_cq(grpc_completion_queue *cq) { static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev; grpc_event ev;
do { do {
ev = grpc_completion_queue_next(cq, five_seconds_time()); ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN); } while (ev.type != GRPC_QUEUE_SHUTDOWN);
} }
@ -108,12 +108,13 @@ static void test_early_server_shutdown_finishes_inflight_calls(
grpc_metadata_array request_metadata_recv; grpc_metadata_array request_metadata_recv;
grpc_call_details call_details; grpc_call_details call_details;
grpc_status_code status; grpc_status_code status;
grpc_call_error error;
char *details = NULL; char *details = NULL;
size_t details_capacity = 0; size_t details_capacity = 0;
int was_cancelled = 2; int was_cancelled = 2;
c = grpc_channel_create_call(f.client, f.cq, "/foo", "foo.test.google.fr", c = grpc_channel_create_call(f.client, f.cq, "/foo", "foo.test.google.fr",
deadline); deadline, NULL);
GPR_ASSERT(c); GPR_ASSERT(c);
grpc_metadata_array_init(&initial_metadata_recv); grpc_metadata_array_init(&initial_metadata_recv);
@ -141,11 +142,13 @@ static void test_early_server_shutdown_finishes_inflight_calls(
op->data.recv_status_on_client.status_details_capacity = &details_capacity; op->data.recv_status_on_client.status_details_capacity = &details_capacity;
op->flags = 0; op->flags = 0;
op++; op++;
GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(c, ops, op - ops, tag(1))); error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL);
GPR_ASSERT(GRPC_CALL_OK == error);
GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call( error = grpc_server_request_call(f.server, &s, &call_details,
f.server, &s, &call_details, &request_metadata_recv, f.cq, f.cq,
&request_metadata_recv, f.cq, f.cq, tag(101))); tag(101));
GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(101), 1); cq_expect_completion(cqv, tag(101), 1);
cq_verify(cqv); cq_verify(cqv);
@ -168,7 +171,8 @@ static void test_early_server_shutdown_finishes_inflight_calls(
op->data.recv_close_on_server.cancelled = &was_cancelled; op->data.recv_close_on_server.cancelled = &was_cancelled;
op->flags = 0; op->flags = 0;
op++; op++;
GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(s, ops, op - ops, tag(102))); error = grpc_call_start_batch(s, ops, op - ops, tag(102), NULL);
GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(102), 1); cq_expect_completion(cqv, tag(102), 1);
cq_expect_completion(cqv, tag(0xdead), 1); cq_expect_completion(cqv, tag(0xdead), 1);

@ -66,7 +66,7 @@ static gpr_timespec n_seconds_time(int n) {
static void drain_cq(grpc_completion_queue *cq) { static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev; grpc_event ev;
do { do {
ev = grpc_completion_queue_next(cq, n_seconds_time(5)); ev = grpc_completion_queue_next(cq, n_seconds_time(5), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN); } while (ev.type != GRPC_QUEUE_SHUTDOWN);
} }
@ -74,7 +74,8 @@ static void shutdown_server(grpc_end2end_test_fixture *f) {
if (!f->server) return; if (!f->server) return;
grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000));
GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000), GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000),
GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5)) GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5),
NULL)
.type == GRPC_OP_COMPLETE); .type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server); grpc_server_destroy(f->server);
f->server = NULL; f->server = NULL;
@ -124,12 +125,13 @@ static void test_invoke_large_request(grpc_end2end_test_config config) {
grpc_byte_buffer *response_payload_recv = NULL; grpc_byte_buffer *response_payload_recv = NULL;
grpc_call_details call_details; grpc_call_details call_details;
grpc_status_code status; grpc_status_code status;
grpc_call_error error;
char *details = NULL; char *details = NULL;
size_t details_capacity = 0; size_t details_capacity = 0;
int was_cancelled = 2; int was_cancelled = 2;
c = grpc_channel_create_call(f.client, f.cq, "/foo", "foo.test.google.fr", c = grpc_channel_create_call(f.client, f.cq, "/foo", "foo.test.google.fr",
deadline); deadline, NULL);
GPR_ASSERT(c); GPR_ASSERT(c);
grpc_metadata_array_init(&initial_metadata_recv); grpc_metadata_array_init(&initial_metadata_recv);
@ -164,11 +166,13 @@ static void test_invoke_large_request(grpc_end2end_test_config config) {
op->data.recv_status_on_client.status_details_capacity = &details_capacity; op->data.recv_status_on_client.status_details_capacity = &details_capacity;
op->flags = 0; op->flags = 0;
op++; op++;
GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(c, ops, op - ops, tag(1))); error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL);
GPR_ASSERT(GRPC_CALL_OK == error);
GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call( error = grpc_server_request_call(f.server, &s, &call_details,
f.server, &s, &call_details, &request_metadata_recv, f.cq, f.cq,
&request_metadata_recv, f.cq, f.cq, tag(101))); tag(101));
GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(101), 1); cq_expect_completion(cqv, tag(101), 1);
cq_verify(cqv); cq_verify(cqv);
@ -181,7 +185,8 @@ static void test_invoke_large_request(grpc_end2end_test_config config) {
op->data.recv_message = &request_payload_recv; op->data.recv_message = &request_payload_recv;
op->flags = 0; op->flags = 0;
op++; op++;
GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(s, ops, op - ops, tag(102))); error = grpc_call_start_batch(s, ops, op - ops, tag(102), NULL);
GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(102), 1); cq_expect_completion(cqv, tag(102), 1);
cq_verify(cqv); cq_verify(cqv);
@ -201,7 +206,8 @@ static void test_invoke_large_request(grpc_end2end_test_config config) {
op->data.send_status_from_server.status_details = "xyz"; op->data.send_status_from_server.status_details = "xyz";
op->flags = 0; op->flags = 0;
op++; op++;
GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(s, ops, op - ops, tag(103))); error = grpc_call_start_batch(s, ops, op - ops, tag(103), NULL);
GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(103), 1); cq_expect_completion(cqv, tag(103), 1);
cq_expect_completion(cqv, tag(1), 1); cq_expect_completion(cqv, tag(1), 1);

@ -68,7 +68,7 @@ static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static void drain_cq(grpc_completion_queue *cq) { static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev; grpc_event ev;
do { do {
ev = grpc_completion_queue_next(cq, five_seconds_time()); ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN); } while (ev.type != GRPC_QUEUE_SHUTDOWN);
} }
@ -76,7 +76,8 @@ static void shutdown_server(grpc_end2end_test_fixture *f) {
if (!f->server) return; if (!f->server) return;
grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000));
GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000), GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000),
GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5)) GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5),
NULL)
.type == GRPC_OP_COMPLETE); .type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server); grpc_server_destroy(f->server);
f->server = NULL; f->server = NULL;
@ -109,12 +110,13 @@ static void simple_request_body(grpc_end2end_test_fixture f) {
grpc_metadata_array request_metadata_recv; grpc_metadata_array request_metadata_recv;
grpc_call_details call_details; grpc_call_details call_details;
grpc_status_code status; grpc_status_code status;
grpc_call_error error;
char *details = NULL; char *details = NULL;
size_t details_capacity = 0; size_t details_capacity = 0;
int was_cancelled = 2; int was_cancelled = 2;
c = grpc_channel_create_call(f.client, f.cq, "/foo", c = grpc_channel_create_call(f.client, f.cq, "/foo",
"foo.test.google.fr:1234", deadline); "foo.test.google.fr:1234", deadline, NULL);
GPR_ASSERT(c); GPR_ASSERT(c);
grpc_metadata_array_init(&initial_metadata_recv); grpc_metadata_array_init(&initial_metadata_recv);
@ -141,11 +143,13 @@ static void simple_request_body(grpc_end2end_test_fixture f) {
op->data.recv_status_on_client.status_details_capacity = &details_capacity; op->data.recv_status_on_client.status_details_capacity = &details_capacity;
op->flags = 0; op->flags = 0;
op++; op++;
GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(c, ops, op - ops, tag(1))); error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL);
GPR_ASSERT(GRPC_CALL_OK == error);
GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call( error = grpc_server_request_call(f.server, &s, &call_details,
f.server, &s, &call_details, &request_metadata_recv, f.cq, f.cq,
&request_metadata_recv, f.cq, f.cq, tag(101))); tag(101));
GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(101), 1); cq_expect_completion(cqv, tag(101), 1);
cq_verify(cqv); cq_verify(cqv);
@ -164,7 +168,8 @@ static void simple_request_body(grpc_end2end_test_fixture f) {
op->data.recv_close_on_server.cancelled = &was_cancelled; op->data.recv_close_on_server.cancelled = &was_cancelled;
op->flags = 0; op->flags = 0;
op++; op++;
GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(s, ops, op - ops, tag(102))); error = grpc_call_start_batch(s, ops, op - ops, tag(102), NULL);
GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(102), 1); cq_expect_completion(cqv, tag(102), 1);
cq_expect_completion(cqv, tag(1), 1); cq_expect_completion(cqv, tag(1), 1);
@ -207,6 +212,7 @@ static void test_max_concurrent_streams(grpc_end2end_test_config config) {
grpc_metadata_array initial_metadata_recv2; grpc_metadata_array initial_metadata_recv2;
grpc_metadata_array trailing_metadata_recv2; grpc_metadata_array trailing_metadata_recv2;
grpc_status_code status1; grpc_status_code status1;
grpc_call_error error;
char *details1 = NULL; char *details1 = NULL;
size_t details_capacity1 = 0; size_t details_capacity1 = 0;
grpc_status_code status2; grpc_status_code status2;
@ -245,10 +251,10 @@ static void test_max_concurrent_streams(grpc_end2end_test_config config) {
the first completes */ the first completes */
deadline = n_seconds_time(1000); deadline = n_seconds_time(1000);
c1 = grpc_channel_create_call(f.client, f.cq, "/alpha", c1 = grpc_channel_create_call(f.client, f.cq, "/alpha",
"foo.test.google.fr:1234", deadline); "foo.test.google.fr:1234", deadline, NULL);
GPR_ASSERT(c1); GPR_ASSERT(c1);
c2 = grpc_channel_create_call(f.client, f.cq, "/beta", c2 = grpc_channel_create_call(f.client, f.cq, "/beta",
"foo.test.google.fr:1234", deadline); "foo.test.google.fr:1234", deadline, NULL);
GPR_ASSERT(c2); GPR_ASSERT(c2);
GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call( GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call(
@ -263,8 +269,8 @@ static void test_max_concurrent_streams(grpc_end2end_test_config config) {
op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT;
op->flags = 0; op->flags = 0;
op++; op++;
GPR_ASSERT(GRPC_CALL_OK == error = grpc_call_start_batch(c1, ops, op - ops, tag(301), NULL);
grpc_call_start_batch(c1, ops, op - ops, tag(301))); GPR_ASSERT(GRPC_CALL_OK == error);
op = ops; op = ops;
op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; op->op = GRPC_OP_RECV_STATUS_ON_CLIENT;
@ -278,8 +284,8 @@ static void test_max_concurrent_streams(grpc_end2end_test_config config) {
op->data.recv_initial_metadata = &initial_metadata_recv1; op->data.recv_initial_metadata = &initial_metadata_recv1;
op->flags = 0; op->flags = 0;
op++; op++;
GPR_ASSERT(GRPC_CALL_OK == error = grpc_call_start_batch(c1, ops, op - ops, tag(302), NULL);
grpc_call_start_batch(c1, ops, op - ops, tag(302))); GPR_ASSERT(GRPC_CALL_OK == error);
op = ops; op = ops;
op->op = GRPC_OP_SEND_INITIAL_METADATA; op->op = GRPC_OP_SEND_INITIAL_METADATA;
@ -289,8 +295,8 @@ static void test_max_concurrent_streams(grpc_end2end_test_config config) {
op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT;
op->flags = 0; op->flags = 0;
op++; op++;
GPR_ASSERT(GRPC_CALL_OK == error = grpc_call_start_batch(c2, ops, op - ops, tag(401), NULL);
grpc_call_start_batch(c2, ops, op - ops, tag(401))); GPR_ASSERT(GRPC_CALL_OK == error);
op = ops; op = ops;
op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; op->op = GRPC_OP_RECV_STATUS_ON_CLIENT;
@ -304,14 +310,15 @@ static void test_max_concurrent_streams(grpc_end2end_test_config config) {
op->data.recv_initial_metadata = &initial_metadata_recv1; op->data.recv_initial_metadata = &initial_metadata_recv1;
op->flags = 0; op->flags = 0;
op++; op++;
GPR_ASSERT(GRPC_CALL_OK == error = grpc_call_start_batch(c2, ops, op - ops, tag(402), NULL);
grpc_call_start_batch(c2, ops, op - ops, tag(402))); GPR_ASSERT(GRPC_CALL_OK == error);
got_client_start = 0; got_client_start = 0;
got_server_start = 0; got_server_start = 0;
live_call = -1; live_call = -1;
while (!got_client_start || !got_server_start) { while (!got_client_start || !got_server_start) {
ev = grpc_completion_queue_next(f.cq, GRPC_TIMEOUT_SECONDS_TO_DEADLINE(3)); ev = grpc_completion_queue_next(f.cq, GRPC_TIMEOUT_SECONDS_TO_DEADLINE(3),
NULL);
GPR_ASSERT(ev.type == GRPC_OP_COMPLETE); GPR_ASSERT(ev.type == GRPC_OP_COMPLETE);
GPR_ASSERT(ev.success); GPR_ASSERT(ev.success);
if (ev.tag == tag(101)) { if (ev.tag == tag(101)) {
@ -345,8 +352,8 @@ static void test_max_concurrent_streams(grpc_end2end_test_config config) {
op->data.send_status_from_server.status_details = "xyz"; op->data.send_status_from_server.status_details = "xyz";
op->flags = 0; op->flags = 0;
op++; op++;
GPR_ASSERT(GRPC_CALL_OK == error = grpc_call_start_batch(s1, ops, op - ops, tag(102), NULL);
grpc_call_start_batch(s1, ops, op - ops, tag(102))); GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(102), 1); cq_expect_completion(cqv, tag(102), 1);
cq_expect_completion(cqv, tag(live_call + 2), 1); cq_expect_completion(cqv, tag(live_call + 2), 1);
@ -376,8 +383,8 @@ static void test_max_concurrent_streams(grpc_end2end_test_config config) {
op->data.send_status_from_server.status_details = "xyz"; op->data.send_status_from_server.status_details = "xyz";
op->flags = 0; op->flags = 0;
op++; op++;
GPR_ASSERT(GRPC_CALL_OK == error = grpc_call_start_batch(s2, ops, op - ops, tag(202), NULL);
grpc_call_start_batch(s2, ops, op - ops, tag(202))); GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(live_call + 2), 1); cq_expect_completion(cqv, tag(live_call + 2), 1);
cq_expect_completion(cqv, tag(202), 1); cq_expect_completion(cqv, tag(202), 1);

@ -68,7 +68,7 @@ static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static void drain_cq(grpc_completion_queue *cq) { static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev; grpc_event ev;
do { do {
ev = grpc_completion_queue_next(cq, five_seconds_time()); ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN); } while (ev.type != GRPC_QUEUE_SHUTDOWN);
} }
@ -76,7 +76,8 @@ static void shutdown_server(grpc_end2end_test_fixture *f) {
if (!f->server) return; if (!f->server) return;
grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000));
GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000), GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000),
GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5)) GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5),
NULL)
.type == GRPC_OP_COMPLETE); .type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server); grpc_server_destroy(f->server);
f->server = NULL; f->server = NULL;
@ -114,6 +115,7 @@ static void test_max_message_length(grpc_end2end_test_config config) {
grpc_metadata_array request_metadata_recv; grpc_metadata_array request_metadata_recv;
grpc_call_details call_details; grpc_call_details call_details;
grpc_status_code status; grpc_status_code status;
grpc_call_error error;
char *details = NULL; char *details = NULL;
size_t details_capacity = 0; size_t details_capacity = 0;
int was_cancelled = 2; int was_cancelled = 2;
@ -130,7 +132,7 @@ static void test_max_message_length(grpc_end2end_test_config config) {
c = grpc_channel_create_call(f.client, f.cq, "/foo", c = grpc_channel_create_call(f.client, f.cq, "/foo",
"foo.test.google.fr:1234", "foo.test.google.fr:1234",
gpr_inf_future(GPR_CLOCK_REALTIME)); gpr_inf_future(GPR_CLOCK_REALTIME), NULL);
GPR_ASSERT(c); GPR_ASSERT(c);
grpc_metadata_array_init(&initial_metadata_recv); grpc_metadata_array_init(&initial_metadata_recv);
@ -161,11 +163,13 @@ static void test_max_message_length(grpc_end2end_test_config config) {
op->data.recv_status_on_client.status_details_capacity = &details_capacity; op->data.recv_status_on_client.status_details_capacity = &details_capacity;
op->flags = 0; op->flags = 0;
op++; op++;
GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(c, ops, op - ops, tag(1))); error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL);
GPR_ASSERT(GRPC_CALL_OK == error);
GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call( error = grpc_server_request_call(f.server, &s, &call_details,
f.server, &s, &call_details, &request_metadata_recv, f.cq, f.cq,
&request_metadata_recv, f.cq, f.cq, tag(101))); tag(101));
GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(101), 1); cq_expect_completion(cqv, tag(101), 1);
cq_verify(cqv); cq_verify(cqv);
@ -174,7 +178,8 @@ static void test_max_message_length(grpc_end2end_test_config config) {
op->data.recv_close_on_server.cancelled = &was_cancelled; op->data.recv_close_on_server.cancelled = &was_cancelled;
op->flags = 0; op->flags = 0;
op++; op++;
GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(s, ops, op - ops, tag(102))); error = grpc_call_start_batch(s, ops, op - ops, tag(102), NULL);
GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(102), 1); cq_expect_completion(cqv, tag(102), 1);
cq_expect_completion(cqv, tag(1), 1); cq_expect_completion(cqv, tag(1), 1);

@ -68,7 +68,7 @@ static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static void drain_cq(grpc_completion_queue *cq) { static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev; grpc_event ev;
do { do {
ev = grpc_completion_queue_next(cq, five_seconds_time()); ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN); } while (ev.type != GRPC_QUEUE_SHUTDOWN);
} }
@ -76,7 +76,8 @@ static void shutdown_server(grpc_end2end_test_fixture *f) {
if (!f->server) return; if (!f->server) return;
grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000));
GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000), GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000),
GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5)) GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5),
NULL)
.type == GRPC_OP_COMPLETE); .type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server); grpc_server_destroy(f->server);
f->server = NULL; f->server = NULL;

@ -68,7 +68,7 @@ static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static void drain_cq(grpc_completion_queue *cq) { static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev; grpc_event ev;
do { do {
ev = grpc_completion_queue_next(cq, five_seconds_time()); ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN); } while (ev.type != GRPC_QUEUE_SHUTDOWN);
} }
@ -76,7 +76,8 @@ static void shutdown_server(grpc_end2end_test_fixture *f) {
if (!f->server) return; if (!f->server) return;
grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000));
GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000), GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000),
GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5)) GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5),
NULL)
.type == GRPC_OP_COMPLETE); .type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server); grpc_server_destroy(f->server);
f->server = NULL; f->server = NULL;
@ -113,6 +114,7 @@ static void test_pingpong_streaming(grpc_end2end_test_config config,
grpc_metadata_array request_metadata_recv; grpc_metadata_array request_metadata_recv;
grpc_call_details call_details; grpc_call_details call_details;
grpc_status_code status; grpc_status_code status;
grpc_call_error error;
char *details = NULL; char *details = NULL;
size_t details_capacity = 0; size_t details_capacity = 0;
int was_cancelled = 2; int was_cancelled = 2;
@ -125,7 +127,7 @@ static void test_pingpong_streaming(grpc_end2end_test_config config,
gpr_slice response_payload_slice = gpr_slice_from_copied_string("hello you"); gpr_slice response_payload_slice = gpr_slice_from_copied_string("hello you");
c = grpc_channel_create_call(f.client, f.cq, "/foo", c = grpc_channel_create_call(f.client, f.cq, "/foo",
"foo.test.google.fr:1234", deadline); "foo.test.google.fr:1234", deadline, NULL);
GPR_ASSERT(c); GPR_ASSERT(c);
grpc_metadata_array_init(&initial_metadata_recv); grpc_metadata_array_init(&initial_metadata_recv);
@ -149,11 +151,13 @@ static void test_pingpong_streaming(grpc_end2end_test_config config,
op->data.recv_status_on_client.status_details_capacity = &details_capacity; op->data.recv_status_on_client.status_details_capacity = &details_capacity;
op->flags = 0; op->flags = 0;
op++; op++;
GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(c, ops, op - ops, tag(1))); error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL);
GPR_ASSERT(GRPC_CALL_OK == error);
GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call( error = grpc_server_request_call(f.server, &s, &call_details,
f.server, &s, &call_details, &request_metadata_recv, f.cq, f.cq,
&request_metadata_recv, f.cq, f.cq, tag(100))); tag(100));
GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(100), 1); cq_expect_completion(cqv, tag(100), 1);
cq_verify(cqv); cq_verify(cqv);
@ -166,7 +170,8 @@ static void test_pingpong_streaming(grpc_end2end_test_config config,
op->data.recv_close_on_server.cancelled = &was_cancelled; op->data.recv_close_on_server.cancelled = &was_cancelled;
op->flags = 0; op->flags = 0;
op++; op++;
GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(s, ops, op - ops, tag(101))); error = grpc_call_start_batch(s, ops, op - ops, tag(101), NULL);
GPR_ASSERT(GRPC_CALL_OK == error);
for (i = 0; i < messages; i++) { for (i = 0; i < messages; i++) {
request_payload = grpc_raw_byte_buffer_create(&request_payload_slice, 1); request_payload = grpc_raw_byte_buffer_create(&request_payload_slice, 1);
@ -181,15 +186,16 @@ static void test_pingpong_streaming(grpc_end2end_test_config config,
op->data.recv_message = &response_payload_recv; op->data.recv_message = &response_payload_recv;
op->flags = 0; op->flags = 0;
op++; op++;
GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(c, ops, op - ops, tag(2))); error = grpc_call_start_batch(c, ops, op - ops, tag(2), NULL);
GPR_ASSERT(GRPC_CALL_OK == error);
op = ops; op = ops;
op->op = GRPC_OP_RECV_MESSAGE; op->op = GRPC_OP_RECV_MESSAGE;
op->data.recv_message = &request_payload_recv; op->data.recv_message = &request_payload_recv;
op->flags = 0; op->flags = 0;
op++; op++;
GPR_ASSERT(GRPC_CALL_OK == error = grpc_call_start_batch(s, ops, op - ops, tag(102), NULL);
grpc_call_start_batch(s, ops, op - ops, tag(102))); GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(102), 1); cq_expect_completion(cqv, tag(102), 1);
cq_verify(cqv); cq_verify(cqv);
@ -198,8 +204,8 @@ static void test_pingpong_streaming(grpc_end2end_test_config config,
op->data.send_message = response_payload; op->data.send_message = response_payload;
op->flags = 0; op->flags = 0;
op++; op++;
GPR_ASSERT(GRPC_CALL_OK == error = grpc_call_start_batch(s, ops, op - ops, tag(103), NULL);
grpc_call_start_batch(s, ops, op - ops, tag(103))); GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(103), 1); cq_expect_completion(cqv, tag(103), 1);
cq_expect_completion(cqv, tag(2), 1); cq_expect_completion(cqv, tag(2), 1);
cq_verify(cqv); cq_verify(cqv);
@ -217,7 +223,8 @@ static void test_pingpong_streaming(grpc_end2end_test_config config,
op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT;
op->flags = 0; op->flags = 0;
op++; op++;
GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(c, ops, op - ops, tag(3))); error = grpc_call_start_batch(c, ops, op - ops, tag(3), NULL);
GPR_ASSERT(GRPC_CALL_OK == error);
op = ops; op = ops;
op->op = GRPC_OP_SEND_STATUS_FROM_SERVER; op->op = GRPC_OP_SEND_STATUS_FROM_SERVER;
@ -226,7 +233,8 @@ static void test_pingpong_streaming(grpc_end2end_test_config config,
op->data.send_status_from_server.status_details = "xyz"; op->data.send_status_from_server.status_details = "xyz";
op->flags = 0; op->flags = 0;
op++; op++;
GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(s, ops, op - ops, tag(104))); error = grpc_call_start_batch(s, ops, op - ops, tag(104), NULL);
GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(1), 1); cq_expect_completion(cqv, tag(1), 1);
cq_expect_completion(cqv, tag(3), 1); cq_expect_completion(cqv, tag(3), 1);

@ -70,7 +70,7 @@ static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static void drain_cq(grpc_completion_queue *cq) { static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev; grpc_event ev;
do { do {
ev = grpc_completion_queue_next(cq, five_seconds_time()); ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN); } while (ev.type != GRPC_QUEUE_SHUTDOWN);
} }
@ -78,7 +78,8 @@ static void shutdown_server(grpc_end2end_test_fixture *f) {
if (!f->server) return; if (!f->server) return;
grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000));
GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000), GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000),
GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5)) GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5),
NULL)
.type == GRPC_OP_COMPLETE); .type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server); grpc_server_destroy(f->server);
f->server = NULL; f->server = NULL;
@ -111,11 +112,12 @@ static void simple_request_body(grpc_end2end_test_fixture f, void *rc) {
grpc_metadata_array request_metadata_recv; grpc_metadata_array request_metadata_recv;
grpc_call_details call_details; grpc_call_details call_details;
grpc_status_code status; grpc_status_code status;
grpc_call_error error;
char *details = NULL; char *details = NULL;
size_t details_capacity = 0; size_t details_capacity = 0;
int was_cancelled = 2; int was_cancelled = 2;
c = grpc_channel_create_registered_call(f.client, f.cq, rc, deadline); c = grpc_channel_create_registered_call(f.client, f.cq, rc, deadline, NULL);
GPR_ASSERT(c); GPR_ASSERT(c);
grpc_metadata_array_init(&initial_metadata_recv); grpc_metadata_array_init(&initial_metadata_recv);
@ -142,11 +144,13 @@ static void simple_request_body(grpc_end2end_test_fixture f, void *rc) {
op->data.recv_status_on_client.status_details_capacity = &details_capacity; op->data.recv_status_on_client.status_details_capacity = &details_capacity;
op->flags = 0; op->flags = 0;
op++; op++;
GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(c, ops, op - ops, tag(1))); error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL);
GPR_ASSERT(GRPC_CALL_OK == error);
GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call( error = grpc_server_request_call(f.server, &s, &call_details,
f.server, &s, &call_details, &request_metadata_recv, f.cq, f.cq,
&request_metadata_recv, f.cq, f.cq, tag(101))); tag(101));
GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(101), 1); cq_expect_completion(cqv, tag(101), 1);
cq_verify(cqv); cq_verify(cqv);
@ -165,7 +169,8 @@ static void simple_request_body(grpc_end2end_test_fixture f, void *rc) {
op->data.recv_close_on_server.cancelled = &was_cancelled; op->data.recv_close_on_server.cancelled = &was_cancelled;
op->flags = 0; op->flags = 0;
op++; op++;
GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(s, ops, op - ops, tag(102))); error = grpc_call_start_batch(s, ops, op - ops, tag(102), NULL);
GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(102), 1); cq_expect_completion(cqv, tag(102), 1);
cq_expect_completion(cqv, tag(1), 1); cq_expect_completion(cqv, tag(1), 1);
@ -193,7 +198,8 @@ static void test_invoke_simple_request(grpc_end2end_test_config config) {
grpc_end2end_test_fixture f = grpc_end2end_test_fixture f =
begin_test(config, "test_invoke_simple_request", NULL, NULL); begin_test(config, "test_invoke_simple_request", NULL, NULL);
void *rc = void *rc =
grpc_channel_register_call(f.client, "/foo", "foo.test.google.fr:1234"); grpc_channel_register_call(f.client, "/foo", "foo.test.google.fr:1234",
NULL);
simple_request_body(f, rc); simple_request_body(f, rc);
end_test(&f); end_test(&f);
@ -205,7 +211,8 @@ static void test_invoke_10_simple_requests(grpc_end2end_test_config config) {
grpc_end2end_test_fixture f = grpc_end2end_test_fixture f =
begin_test(config, "test_invoke_10_simple_requests", NULL, NULL); begin_test(config, "test_invoke_10_simple_requests", NULL, NULL);
void *rc = void *rc =
grpc_channel_register_call(f.client, "/foo", "foo.test.google.fr:1234"); grpc_channel_register_call(f.client, "/foo", "foo.test.google.fr:1234",
NULL);
for (i = 0; i < 10; i++) { for (i = 0; i < 10; i++) {
simple_request_body(f, rc); simple_request_body(f, rc);

@ -68,7 +68,7 @@ static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static void drain_cq(grpc_completion_queue *cq) { static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev; grpc_event ev;
do { do {
ev = grpc_completion_queue_next(cq, five_seconds_time()); ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN); } while (ev.type != GRPC_QUEUE_SHUTDOWN);
} }
@ -76,7 +76,8 @@ static void shutdown_server(grpc_end2end_test_fixture *f) {
if (!f->server) return; if (!f->server) return;
grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000));
GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000), GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000),
GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5)) GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5),
NULL)
.type == GRPC_OP_COMPLETE); .type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server); grpc_server_destroy(f->server);
f->server = NULL; f->server = NULL;
@ -113,20 +114,24 @@ static void test_request_response_with_metadata_and_payload(
{"key1-bin", {"key1-bin",
"\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc", "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc",
13, 13,
{{NULL, NULL, NULL}}}, 0,
{{NULL, NULL, NULL, NULL}}},
{"key2-bin", {"key2-bin",
"\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d", "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d",
14, 14,
{{NULL, NULL, NULL}}}}; 0,
{{NULL, NULL, NULL, NULL}}}};
grpc_metadata meta_s[2] = { grpc_metadata meta_s[2] = {
{"key3-bin", {"key3-bin",
"\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee", "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee",
15, 15,
{{NULL, NULL, NULL}}}, 0,
{{NULL, NULL, NULL, NULL}}},
{"key4-bin", {"key4-bin",
"\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff", "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff",
16, 16,
{{NULL, NULL, NULL}}}}; 0,
{{NULL, NULL, NULL, NULL}}}};
grpc_end2end_test_fixture f = begin_test( grpc_end2end_test_fixture f = begin_test(
config, "test_request_response_with_metadata_and_payload", NULL, NULL); config, "test_request_response_with_metadata_and_payload", NULL, NULL);
cq_verifier *cqv = cq_verifier_create(f.cq); cq_verifier *cqv = cq_verifier_create(f.cq);
@ -139,12 +144,13 @@ static void test_request_response_with_metadata_and_payload(
grpc_byte_buffer *response_payload_recv = NULL; grpc_byte_buffer *response_payload_recv = NULL;
grpc_call_details call_details; grpc_call_details call_details;
grpc_status_code status; grpc_status_code status;
grpc_call_error error;
char *details = NULL; char *details = NULL;
size_t details_capacity = 0; size_t details_capacity = 0;
int was_cancelled = 2; int was_cancelled = 2;
c = grpc_channel_create_call(f.client, f.cq, "/foo", "foo.test.google.fr", c = grpc_channel_create_call(f.client, f.cq, "/foo", "foo.test.google.fr",
deadline); deadline, NULL);
GPR_ASSERT(c); GPR_ASSERT(c);
grpc_metadata_array_init(&initial_metadata_recv); grpc_metadata_array_init(&initial_metadata_recv);
@ -180,11 +186,13 @@ static void test_request_response_with_metadata_and_payload(
op->data.recv_status_on_client.status_details_capacity = &details_capacity; op->data.recv_status_on_client.status_details_capacity = &details_capacity;
op->flags = 0; op->flags = 0;
op++; op++;
GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(c, ops, op - ops, tag(1))); error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL);
GPR_ASSERT(GRPC_CALL_OK == error);
GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call( error = grpc_server_request_call(f.server, &s, &call_details,
f.server, &s, &call_details, &request_metadata_recv, f.cq, f.cq,
&request_metadata_recv, f.cq, f.cq, tag(101))); tag(101));
GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(101), 1); cq_expect_completion(cqv, tag(101), 1);
cq_verify(cqv); cq_verify(cqv);
@ -198,7 +206,8 @@ static void test_request_response_with_metadata_and_payload(
op->data.recv_message = &request_payload_recv; op->data.recv_message = &request_payload_recv;
op->flags = 0; op->flags = 0;
op++; op++;
GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(s, ops, op - ops, tag(102))); error = grpc_call_start_batch(s, ops, op - ops, tag(102), NULL);
GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(102), 1); cq_expect_completion(cqv, tag(102), 1);
cq_verify(cqv); cq_verify(cqv);
@ -218,7 +227,8 @@ static void test_request_response_with_metadata_and_payload(
op->data.send_status_from_server.status_details = "xyz"; op->data.send_status_from_server.status_details = "xyz";
op->flags = 0; op->flags = 0;
op++; op++;
GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(s, ops, op - ops, tag(103))); error = grpc_call_start_batch(s, ops, op - ops, tag(103), NULL);
GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(103), 1); cq_expect_completion(cqv, tag(103), 1);
cq_expect_completion(cqv, tag(1), 1); cq_expect_completion(cqv, tag(1), 1);

@ -68,7 +68,7 @@ static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static void drain_cq(grpc_completion_queue *cq) { static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev; grpc_event ev;
do { do {
ev = grpc_completion_queue_next(cq, five_seconds_time()); ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN); } while (ev.type != GRPC_QUEUE_SHUTDOWN);
} }
@ -76,7 +76,8 @@ static void shutdown_server(grpc_end2end_test_fixture *f) {
if (!f->server) return; if (!f->server) return;
grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000));
GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000), GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000),
GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5)) GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5),
NULL)
.type == GRPC_OP_COMPLETE); .type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server); grpc_server_destroy(f->server);
f->server = NULL; f->server = NULL;
@ -109,10 +110,10 @@ static void test_request_response_with_metadata_and_payload(
grpc_byte_buffer *response_payload = grpc_byte_buffer *response_payload =
grpc_raw_byte_buffer_create(&response_payload_slice, 1); grpc_raw_byte_buffer_create(&response_payload_slice, 1);
gpr_timespec deadline = five_seconds_time(); gpr_timespec deadline = five_seconds_time();
grpc_metadata meta_c[2] = {{"key1", "val1", 4, {{NULL, NULL, NULL}}}, grpc_metadata meta_c[2] = {{"key1", "val1", 4, 0, {{NULL, NULL, NULL, NULL}}},
{"key2", "val2", 4, {{NULL, NULL, NULL}}}}; {"key2", "val2", 4, 0, {{NULL, NULL, NULL, NULL}}}};
grpc_metadata meta_s[2] = {{"key3", "val3", 4, {{NULL, NULL, NULL}}}, grpc_metadata meta_s[2] = {{"key3", "val3", 4, 0, {{NULL, NULL, NULL, NULL}}},
{"key4", "val4", 4, {{NULL, NULL, NULL}}}}; {"key4", "val4", 4, 0, {{NULL, NULL, NULL, NULL}}}};
grpc_end2end_test_fixture f = begin_test( grpc_end2end_test_fixture f = begin_test(
config, "test_request_response_with_metadata_and_payload", NULL, NULL); config, "test_request_response_with_metadata_and_payload", NULL, NULL);
cq_verifier *cqv = cq_verifier_create(f.cq); cq_verifier *cqv = cq_verifier_create(f.cq);
@ -125,12 +126,13 @@ static void test_request_response_with_metadata_and_payload(
grpc_byte_buffer *response_payload_recv = NULL; grpc_byte_buffer *response_payload_recv = NULL;
grpc_call_details call_details; grpc_call_details call_details;
grpc_status_code status; grpc_status_code status;
grpc_call_error error;
char *details = NULL; char *details = NULL;
size_t details_capacity = 0; size_t details_capacity = 0;
int was_cancelled = 2; int was_cancelled = 2;
c = grpc_channel_create_call(f.client, f.cq, "/foo", "foo.test.google.fr", c = grpc_channel_create_call(f.client, f.cq, "/foo", "foo.test.google.fr",
deadline); deadline, NULL);
GPR_ASSERT(c); GPR_ASSERT(c);
grpc_metadata_array_init(&initial_metadata_recv); grpc_metadata_array_init(&initial_metadata_recv);
@ -166,11 +168,13 @@ static void test_request_response_with_metadata_and_payload(
op->data.recv_status_on_client.status_details_capacity = &details_capacity; op->data.recv_status_on_client.status_details_capacity = &details_capacity;
op->flags = 0; op->flags = 0;
op++; op++;
GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(c, ops, op - ops, tag(1))); error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL);
GPR_ASSERT(GRPC_CALL_OK == error);
GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call( error = grpc_server_request_call(f.server, &s, &call_details,
f.server, &s, &call_details, &request_metadata_recv, f.cq, f.cq,
&request_metadata_recv, f.cq, f.cq, tag(101))); tag(101));
GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(101), 1); cq_expect_completion(cqv, tag(101), 1);
cq_verify(cqv); cq_verify(cqv);
@ -184,7 +188,8 @@ static void test_request_response_with_metadata_and_payload(
op->data.recv_message = &request_payload_recv; op->data.recv_message = &request_payload_recv;
op->flags = 0; op->flags = 0;
op++; op++;
GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(s, ops, op - ops, tag(102))); error = grpc_call_start_batch(s, ops, op - ops, tag(102), NULL);
GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(102), 1); cq_expect_completion(cqv, tag(102), 1);
cq_verify(cqv); cq_verify(cqv);
@ -204,7 +209,8 @@ static void test_request_response_with_metadata_and_payload(
op->data.send_status_from_server.status_details = "xyz"; op->data.send_status_from_server.status_details = "xyz";
op->flags = 0; op->flags = 0;
op++; op++;
GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(s, ops, op - ops, tag(103))); error = grpc_call_start_batch(s, ops, op - ops, tag(103), NULL);
GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(103), 1); cq_expect_completion(cqv, tag(103), 1);
cq_expect_completion(cqv, tag(1), 1); cq_expect_completion(cqv, tag(1), 1);

@ -68,7 +68,7 @@ static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static void drain_cq(grpc_completion_queue *cq) { static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev; grpc_event ev;
do { do {
ev = grpc_completion_queue_next(cq, five_seconds_time()); ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN); } while (ev.type != GRPC_QUEUE_SHUTDOWN);
} }
@ -76,7 +76,8 @@ static void shutdown_server(grpc_end2end_test_fixture *f) {
if (!f->server) return; if (!f->server) return;
grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000));
GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000), GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000),
GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5)) GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5),
NULL)
.type == GRPC_OP_COMPLETE); .type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server); grpc_server_destroy(f->server);
f->server = NULL; f->server = NULL;
@ -117,12 +118,13 @@ static void request_response_with_payload(grpc_end2end_test_fixture f) {
grpc_byte_buffer *response_payload_recv = NULL; grpc_byte_buffer *response_payload_recv = NULL;
grpc_call_details call_details; grpc_call_details call_details;
grpc_status_code status; grpc_status_code status;
grpc_call_error error;
char *details = NULL; char *details = NULL;
size_t details_capacity = 0; size_t details_capacity = 0;
int was_cancelled = 2; int was_cancelled = 2;
c = grpc_channel_create_call(f.client, f.cq, "/foo", "foo.test.google.fr", c = grpc_channel_create_call(f.client, f.cq, "/foo", "foo.test.google.fr",
deadline); deadline, NULL);
GPR_ASSERT(c); GPR_ASSERT(c);
grpc_metadata_array_init(&initial_metadata_recv); grpc_metadata_array_init(&initial_metadata_recv);
@ -157,11 +159,13 @@ static void request_response_with_payload(grpc_end2end_test_fixture f) {
op->data.recv_status_on_client.status_details_capacity = &details_capacity; op->data.recv_status_on_client.status_details_capacity = &details_capacity;
op->flags = 0; op->flags = 0;
op++; op++;
GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(c, ops, op - ops, tag(1))); error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL);
GPR_ASSERT(GRPC_CALL_OK == error);
GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call( error = grpc_server_request_call(f.server, &s, &call_details,
f.server, &s, &call_details, &request_metadata_recv, f.cq, f.cq,
&request_metadata_recv, f.cq, f.cq, tag(101))); tag(101));
GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(101), 1); cq_expect_completion(cqv, tag(101), 1);
cq_verify(cqv); cq_verify(cqv);
@ -174,7 +178,8 @@ static void request_response_with_payload(grpc_end2end_test_fixture f) {
op->data.recv_message = &request_payload_recv; op->data.recv_message = &request_payload_recv;
op->flags = 0; op->flags = 0;
op++; op++;
GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(s, ops, op - ops, tag(102))); error = grpc_call_start_batch(s, ops, op - ops, tag(102), NULL);
GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(102), 1); cq_expect_completion(cqv, tag(102), 1);
cq_verify(cqv); cq_verify(cqv);
@ -194,7 +199,8 @@ static void request_response_with_payload(grpc_end2end_test_fixture f) {
op->data.send_status_from_server.status_details = "xyz"; op->data.send_status_from_server.status_details = "xyz";
op->flags = 0; op->flags = 0;
op++; op++;
GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(s, ops, op - ops, tag(103))); error = grpc_call_start_batch(s, ops, op - ops, tag(103), NULL);
GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(103), 1); cq_expect_completion(cqv, tag(103), 1);
cq_expect_completion(cqv, tag(1), 1); cq_expect_completion(cqv, tag(1), 1);

@ -78,7 +78,7 @@ static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static void drain_cq(grpc_completion_queue *cq) { static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev; grpc_event ev;
do { do {
ev = grpc_completion_queue_next(cq, five_seconds_time()); ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN); } while (ev.type != GRPC_QUEUE_SHUTDOWN);
} }
@ -86,7 +86,8 @@ static void shutdown_server(grpc_end2end_test_fixture *f) {
if (!f->server) return; if (!f->server) return;
grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000));
GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000), GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000),
GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5)) GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5),
NULL)
.type == GRPC_OP_COMPLETE); .type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server); grpc_server_destroy(f->server);
f->server = NULL; f->server = NULL;
@ -131,7 +132,7 @@ static void test_call_creds_failure(grpc_end2end_test_config config) {
begin_test(config, "test_call_creds_failure", NULL, NULL); begin_test(config, "test_call_creds_failure", NULL, NULL);
gpr_timespec deadline = five_seconds_time(); gpr_timespec deadline = five_seconds_time();
c = grpc_channel_create_call(f.client, f.cq, "/foo", "foo.test.google.fr", c = grpc_channel_create_call(f.client, f.cq, "/foo", "foo.test.google.fr",
deadline); deadline, NULL);
GPR_ASSERT(c); GPR_ASSERT(c);
/* Try with credentials unfit to be set on a call (channel creds). */ /* Try with credentials unfit to be set on a call (channel creds). */
@ -169,6 +170,7 @@ static void request_response_with_payload_and_call_creds(
grpc_byte_buffer *response_payload_recv = NULL; grpc_byte_buffer *response_payload_recv = NULL;
grpc_call_details call_details; grpc_call_details call_details;
grpc_status_code status; grpc_status_code status;
grpc_call_error error;
char *details = NULL; char *details = NULL;
size_t details_capacity = 0; size_t details_capacity = 0;
int was_cancelled = 2; int was_cancelled = 2;
@ -176,7 +178,7 @@ static void request_response_with_payload_and_call_creds(
grpc_auth_context *s_auth_context = NULL; grpc_auth_context *s_auth_context = NULL;
c = grpc_channel_create_call(f.client, f.cq, "/foo", "foo.test.google.fr", c = grpc_channel_create_call(f.client, f.cq, "/foo", "foo.test.google.fr",
deadline); deadline, NULL);
GPR_ASSERT(c); GPR_ASSERT(c);
creds = grpc_iam_credentials_create(iam_token, iam_selector); creds = grpc_iam_credentials_create(iam_token, iam_selector);
GPR_ASSERT(creds != NULL); GPR_ASSERT(creds != NULL);
@ -229,11 +231,13 @@ static void request_response_with_payload_and_call_creds(
op->data.recv_status_on_client.status_details_capacity = &details_capacity; op->data.recv_status_on_client.status_details_capacity = &details_capacity;
op->flags = 0; op->flags = 0;
op++; op++;
GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(c, ops, op - ops, tag(1))); error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL);
GPR_ASSERT(GRPC_CALL_OK == error);
GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call( error = grpc_server_request_call(f.server, &s, &call_details,
f.server, &s, &call_details, &request_metadata_recv, f.cq, f.cq,
&request_metadata_recv, f.cq, f.cq, tag(101))); tag(101));
GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(101), 1); cq_expect_completion(cqv, tag(101), 1);
cq_verify(cqv); cq_verify(cqv);
s_auth_context = grpc_call_auth_context(s); s_auth_context = grpc_call_auth_context(s);
@ -253,7 +257,8 @@ static void request_response_with_payload_and_call_creds(
op->data.recv_message = &request_payload_recv; op->data.recv_message = &request_payload_recv;
op->flags = 0; op->flags = 0;
op++; op++;
GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(s, ops, op - ops, tag(102))); error = grpc_call_start_batch(s, ops, op - ops, tag(102), NULL);
GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(102), 1); cq_expect_completion(cqv, tag(102), 1);
cq_verify(cqv); cq_verify(cqv);
@ -273,7 +278,8 @@ static void request_response_with_payload_and_call_creds(
op->data.send_status_from_server.status_details = "xyz"; op->data.send_status_from_server.status_details = "xyz";
op->flags = 0; op->flags = 0;
op++; op++;
GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(s, ops, op - ops, tag(103))); error = grpc_call_start_batch(s, ops, op - ops, tag(103), NULL);
GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(103), 1); cq_expect_completion(cqv, tag(103), 1);
cq_expect_completion(cqv, tag(1), 1); cq_expect_completion(cqv, tag(1), 1);

@ -68,7 +68,7 @@ static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static void drain_cq(grpc_completion_queue *cq) { static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev; grpc_event ev;
do { do {
ev = grpc_completion_queue_next(cq, five_seconds_time()); ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN); } while (ev.type != GRPC_QUEUE_SHUTDOWN);
} }
@ -76,7 +76,8 @@ static void shutdown_server(grpc_end2end_test_fixture *f) {
if (!f->server) return; if (!f->server) return;
grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000));
GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000), GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000),
GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5)) GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5),
NULL)
.type == GRPC_OP_COMPLETE); .type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server); grpc_server_destroy(f->server);
f->server = NULL; f->server = NULL;
@ -109,12 +110,12 @@ static void test_request_response_with_metadata_and_payload(
grpc_byte_buffer *response_payload = grpc_byte_buffer *response_payload =
grpc_raw_byte_buffer_create(&response_payload_slice, 1); grpc_raw_byte_buffer_create(&response_payload_slice, 1);
gpr_timespec deadline = five_seconds_time(); gpr_timespec deadline = five_seconds_time();
grpc_metadata meta_c[2] = {{"key1", "val1", 4, {{NULL, NULL, NULL}}}, grpc_metadata meta_c[2] = {{"key1", "val1", 4, 0, {{NULL, NULL, NULL, NULL}}},
{"key2", "val2", 4, {{NULL, NULL, NULL}}}}; {"key2", "val2", 4, 0, {{NULL, NULL, NULL, NULL}}}};
grpc_metadata meta_s[2] = {{"key3", "val3", 4, {{NULL, NULL, NULL}}}, grpc_metadata meta_s[2] = {{"key3", "val3", 4, 0, {{NULL, NULL, NULL, NULL}}},
{"key4", "val4", 4, {{NULL, NULL, NULL}}}}; {"key4", "val4", 4, 0, {{NULL, NULL, NULL, NULL}}}};
grpc_metadata meta_t[2] = {{"key5", "val5", 4, {{NULL, NULL, NULL}}}, grpc_metadata meta_t[2] = {{"key5", "val5", 4, 0, {{NULL, NULL, NULL, NULL}}},
{"key6", "val6", 4, {{NULL, NULL, NULL}}}}; {"key6", "val6", 4, 0, {{NULL, NULL, NULL, NULL}}}};
grpc_end2end_test_fixture f = begin_test( grpc_end2end_test_fixture f = begin_test(
config, "test_request_response_with_metadata_and_payload", NULL, NULL); config, "test_request_response_with_metadata_and_payload", NULL, NULL);
cq_verifier *cqv = cq_verifier_create(f.cq); cq_verifier *cqv = cq_verifier_create(f.cq);
@ -127,12 +128,13 @@ static void test_request_response_with_metadata_and_payload(
grpc_byte_buffer *response_payload_recv = NULL; grpc_byte_buffer *response_payload_recv = NULL;
grpc_call_details call_details; grpc_call_details call_details;
grpc_status_code status; grpc_status_code status;
grpc_call_error error;
char *details = NULL; char *details = NULL;
size_t details_capacity = 0; size_t details_capacity = 0;
int was_cancelled = 2; int was_cancelled = 2;
c = grpc_channel_create_call(f.client, f.cq, "/foo", "foo.test.google.fr", c = grpc_channel_create_call(f.client, f.cq, "/foo", "foo.test.google.fr",
deadline); deadline, NULL);
GPR_ASSERT(c); GPR_ASSERT(c);
grpc_metadata_array_init(&initial_metadata_recv); grpc_metadata_array_init(&initial_metadata_recv);
@ -168,11 +170,13 @@ static void test_request_response_with_metadata_and_payload(
op->data.recv_status_on_client.status_details_capacity = &details_capacity; op->data.recv_status_on_client.status_details_capacity = &details_capacity;
op->flags = 0; op->flags = 0;
op++; op++;
GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(c, ops, op - ops, tag(1))); error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL);
GPR_ASSERT(GRPC_CALL_OK == error);
GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call( error = grpc_server_request_call(f.server, &s, &call_details,
f.server, &s, &call_details, &request_metadata_recv, f.cq, f.cq,
&request_metadata_recv, f.cq, f.cq, tag(101))); tag(101));
GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(101), 1); cq_expect_completion(cqv, tag(101), 1);
cq_verify(cqv); cq_verify(cqv);
@ -186,7 +190,8 @@ static void test_request_response_with_metadata_and_payload(
op->data.recv_message = &request_payload_recv; op->data.recv_message = &request_payload_recv;
op->flags = 0; op->flags = 0;
op++; op++;
GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(s, ops, op - ops, tag(102))); error = grpc_call_start_batch(s, ops, op - ops, tag(102), NULL);
GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(102), 1); cq_expect_completion(cqv, tag(102), 1);
cq_verify(cqv); cq_verify(cqv);
@ -207,7 +212,8 @@ static void test_request_response_with_metadata_and_payload(
op->data.send_status_from_server.status_details = "xyz"; op->data.send_status_from_server.status_details = "xyz";
op->flags = 0; op->flags = 0;
op++; op++;
GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(s, ops, op - ops, tag(103))); error = grpc_call_start_batch(s, ops, op - ops, tag(103), NULL);
GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(103), 1); cq_expect_completion(cqv, tag(103), 1);
cq_expect_completion(cqv, tag(1), 1); cq_expect_completion(cqv, tag(1), 1);

@ -72,7 +72,7 @@ static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static void drain_cq(grpc_completion_queue *cq) { static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev; grpc_event ev;
do { do {
ev = grpc_completion_queue_next(cq, five_seconds_time()); ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN); } while (ev.type != GRPC_QUEUE_SHUTDOWN);
} }
@ -80,7 +80,8 @@ static void shutdown_server(grpc_end2end_test_fixture *f) {
if (!f->server) return; if (!f->server) return;
grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000));
GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000), GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000),
GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5)) GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5),
NULL)
.type == GRPC_OP_COMPLETE); .type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server); grpc_server_destroy(f->server);
f->server = NULL; f->server = NULL;
@ -123,6 +124,7 @@ static void request_with_payload_template(
grpc_byte_buffer *request_payload_recv = NULL; grpc_byte_buffer *request_payload_recv = NULL;
grpc_call_details call_details; grpc_call_details call_details;
grpc_status_code status; grpc_status_code status;
grpc_call_error error;
char *details = NULL; char *details = NULL;
size_t details_capacity = 0; size_t details_capacity = 0;
int was_cancelled = 2; int was_cancelled = 2;
@ -142,7 +144,7 @@ static void request_with_payload_template(
cqv = cq_verifier_create(f.cq); cqv = cq_verifier_create(f.cq);
c = grpc_channel_create_call(f.client, f.cq, "/foo", c = grpc_channel_create_call(f.client, f.cq, "/foo",
"foo.test.google.fr", deadline); "foo.test.google.fr", deadline, NULL);
GPR_ASSERT(c); GPR_ASSERT(c);
grpc_metadata_array_init(&initial_metadata_recv); grpc_metadata_array_init(&initial_metadata_recv);
@ -178,12 +180,13 @@ static void request_with_payload_template(
op->data.recv_status_on_client.status_details_capacity = &details_capacity; op->data.recv_status_on_client.status_details_capacity = &details_capacity;
op->flags = 0; op->flags = 0;
op++; op++;
GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(c, ops, op - ops, tag(1))); error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL);
GPR_ASSERT(GRPC_CALL_OK == error);
GPR_ASSERT(GRPC_CALL_OK == error = grpc_server_request_call(f.server, &s, &call_details,
grpc_server_request_call(f.server, &s, &call_details,
&request_metadata_recv, f.cq, &request_metadata_recv, f.cq,
f.cq, tag(101))); f.cq, tag(101));
GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(101), 1); cq_expect_completion(cqv, tag(101), 1);
cq_verify(cqv); cq_verify(cqv);
@ -196,7 +199,8 @@ static void request_with_payload_template(
op->data.recv_message = &request_payload_recv; op->data.recv_message = &request_payload_recv;
op->flags = 0; op->flags = 0;
op++; op++;
GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(s, ops, op - ops, tag(102))); error = grpc_call_start_batch(s, ops, op - ops, tag(102), NULL);
GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(102), 1); cq_expect_completion(cqv, tag(102), 1);
cq_verify(cqv); cq_verify(cqv);
@ -212,7 +216,8 @@ static void request_with_payload_template(
op->data.send_status_from_server.status_details = "xyz"; op->data.send_status_from_server.status_details = "xyz";
op->flags = 0; op->flags = 0;
op++; op++;
GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(s, ops, op - ops, tag(103))); error = grpc_call_start_batch(s, ops, op - ops, tag(103), NULL);
GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(103), 1); cq_expect_completion(cqv, tag(103), 1);
cq_expect_completion(cqv, tag(1), 1); cq_expect_completion(cqv, tag(1), 1);

@ -69,7 +69,7 @@ static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static void drain_cq(grpc_completion_queue *cq) { static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev; grpc_event ev;
do { do {
ev = grpc_completion_queue_next(cq, five_seconds_time()); ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN); } while (ev.type != GRPC_QUEUE_SHUTDOWN);
} }
@ -77,7 +77,8 @@ static void shutdown_server(grpc_end2end_test_fixture *f) {
if (!f->server) return; if (!f->server) return;
grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000));
GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000), GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000),
GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5)) GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5),
NULL)
.type == GRPC_OP_COMPLETE); .type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server); grpc_server_destroy(f->server);
f->server = NULL; f->server = NULL;
@ -117,12 +118,13 @@ static void test_invoke_request_with_flags(
grpc_byte_buffer *request_payload_recv = NULL; grpc_byte_buffer *request_payload_recv = NULL;
grpc_call_details call_details; grpc_call_details call_details;
grpc_status_code status; grpc_status_code status;
grpc_call_error error;
char *details = NULL; char *details = NULL;
size_t details_capacity = 0; size_t details_capacity = 0;
grpc_call_error expectation; grpc_call_error expectation;
c = grpc_channel_create_call(f.client, f.cq, "/foo", "foo.test.google.fr", c = grpc_channel_create_call(f.client, f.cq, "/foo", "foo.test.google.fr",
deadline); deadline, NULL);
GPR_ASSERT(c); GPR_ASSERT(c);
grpc_metadata_array_init(&initial_metadata_recv); grpc_metadata_array_init(&initial_metadata_recv);
@ -154,7 +156,8 @@ static void test_invoke_request_with_flags(
op->flags = flags_for_op[op->op]; op->flags = flags_for_op[op->op];
op++; op++;
expectation = call_start_batch_expected_result; expectation = call_start_batch_expected_result;
GPR_ASSERT(expectation == grpc_call_start_batch(c, ops, op - ops, tag(1))); error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL);
GPR_ASSERT(expectation == error);
if (expectation == GRPC_CALL_OK) { if (expectation == GRPC_CALL_OK) {
cq_expect_completion(cqv, tag(1), 1); cq_expect_completion(cqv, tag(1), 1);

@ -68,7 +68,7 @@ static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static void drain_cq(grpc_completion_queue *cq) { static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev; grpc_event ev;
do { do {
ev = grpc_completion_queue_next(cq, five_seconds_time()); ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN); } while (ev.type != GRPC_QUEUE_SHUTDOWN);
} }
@ -76,7 +76,8 @@ static void shutdown_server(grpc_end2end_test_fixture *f) {
if (!f->server) return; if (!f->server) return;
grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000));
GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000), GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000),
GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5)) GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5),
NULL)
.type == GRPC_OP_COMPLETE); .type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server); grpc_server_destroy(f->server);
f->server = NULL; f->server = NULL;
@ -117,13 +118,14 @@ static void test_request_with_large_metadata(grpc_end2end_test_config config) {
grpc_byte_buffer *request_payload_recv = NULL; grpc_byte_buffer *request_payload_recv = NULL;
grpc_call_details call_details; grpc_call_details call_details;
grpc_status_code status; grpc_status_code status;
grpc_call_error error;
char *details = NULL; char *details = NULL;
size_t details_capacity = 0; size_t details_capacity = 0;
int was_cancelled = 2; int was_cancelled = 2;
const int large_size = 64 * 1024; const int large_size = 64 * 1024;
c = grpc_channel_create_call(f.client, f.cq, "/foo", "foo.test.google.fr", c = grpc_channel_create_call(f.client, f.cq, "/foo", "foo.test.google.fr",
deadline); deadline, NULL);
GPR_ASSERT(c); GPR_ASSERT(c);
meta.key = "key"; meta.key = "key";
@ -161,11 +163,13 @@ static void test_request_with_large_metadata(grpc_end2end_test_config config) {
op->data.recv_status_on_client.status_details_capacity = &details_capacity; op->data.recv_status_on_client.status_details_capacity = &details_capacity;
op->flags = 0; op->flags = 0;
op++; op++;
GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(c, ops, op - ops, tag(1))); error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL);
GPR_ASSERT(GRPC_CALL_OK == error);
GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call( error = grpc_server_request_call(f.server, &s, &call_details,
f.server, &s, &call_details, &request_metadata_recv, f.cq, f.cq,
&request_metadata_recv, f.cq, f.cq, tag(101))); tag(101));
GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(101), 1); cq_expect_completion(cqv, tag(101), 1);
cq_verify(cqv); cq_verify(cqv);
@ -178,7 +182,8 @@ static void test_request_with_large_metadata(grpc_end2end_test_config config) {
op->data.recv_message = &request_payload_recv; op->data.recv_message = &request_payload_recv;
op->flags = 0; op->flags = 0;
op++; op++;
GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(s, ops, op - ops, tag(102))); error = grpc_call_start_batch(s, ops, op - ops, tag(102), NULL);
GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(102), 1); cq_expect_completion(cqv, tag(102), 1);
cq_verify(cqv); cq_verify(cqv);
@ -194,7 +199,8 @@ static void test_request_with_large_metadata(grpc_end2end_test_config config) {
op->data.send_status_from_server.status_details = "xyz"; op->data.send_status_from_server.status_details = "xyz";
op->flags = 0; op->flags = 0;
op++; op++;
GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(s, ops, op - ops, tag(103))); error = grpc_call_start_batch(s, ops, op - ops, tag(103), NULL);
GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(103), 1); cq_expect_completion(cqv, tag(103), 1);
cq_expect_completion(cqv, tag(1), 1); cq_expect_completion(cqv, tag(1), 1);

@ -68,7 +68,7 @@ static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static void drain_cq(grpc_completion_queue *cq) { static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev; grpc_event ev;
do { do {
ev = grpc_completion_queue_next(cq, five_seconds_time()); ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN); } while (ev.type != GRPC_QUEUE_SHUTDOWN);
} }
@ -76,7 +76,8 @@ static void shutdown_server(grpc_end2end_test_fixture *f) {
if (!f->server) return; if (!f->server) return;
grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000));
GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000), GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000),
GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5)) GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5),
NULL)
.type == GRPC_OP_COMPLETE); .type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server); grpc_server_destroy(f->server);
f->server = NULL; f->server = NULL;
@ -116,12 +117,13 @@ static void test_invoke_request_with_payload(grpc_end2end_test_config config) {
grpc_byte_buffer *request_payload_recv = NULL; grpc_byte_buffer *request_payload_recv = NULL;
grpc_call_details call_details; grpc_call_details call_details;
grpc_status_code status; grpc_status_code status;
grpc_call_error error;
char *details = NULL; char *details = NULL;
size_t details_capacity = 0; size_t details_capacity = 0;
int was_cancelled = 2; int was_cancelled = 2;
c = grpc_channel_create_call(f.client, f.cq, "/foo", "foo.test.google.fr", c = grpc_channel_create_call(f.client, f.cq, "/foo", "foo.test.google.fr",
deadline); deadline, NULL);
GPR_ASSERT(c); GPR_ASSERT(c);
grpc_metadata_array_init(&initial_metadata_recv); grpc_metadata_array_init(&initial_metadata_recv);
@ -152,7 +154,8 @@ static void test_invoke_request_with_payload(grpc_end2end_test_config config) {
op->data.recv_status_on_client.status_details_capacity = &details_capacity; op->data.recv_status_on_client.status_details_capacity = &details_capacity;
op->flags = 0; op->flags = 0;
op++; op++;
GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(c, ops, op - ops, tag(1))); error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL);
GPR_ASSERT(GRPC_CALL_OK == error);
GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call( GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call(
f.server, &s, &call_details, f.server, &s, &call_details,
@ -169,7 +172,8 @@ static void test_invoke_request_with_payload(grpc_end2end_test_config config) {
op->data.recv_message = &request_payload_recv; op->data.recv_message = &request_payload_recv;
op->flags = 0; op->flags = 0;
op++; op++;
GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(s, ops, op - ops, tag(102))); error = grpc_call_start_batch(s, ops, op - ops, tag(102), NULL);
GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(102), 1); cq_expect_completion(cqv, tag(102), 1);
cq_verify(cqv); cq_verify(cqv);
@ -185,7 +189,8 @@ static void test_invoke_request_with_payload(grpc_end2end_test_config config) {
op->data.send_status_from_server.status_details = "xyz"; op->data.send_status_from_server.status_details = "xyz";
op->flags = 0; op->flags = 0;
op++; op++;
GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(s, ops, op - ops, tag(103))); error = grpc_call_start_batch(s, ops, op - ops, tag(103), NULL);
GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(103), 1); cq_expect_completion(cqv, tag(103), 1);
cq_expect_completion(cqv, tag(1), 1); cq_expect_completion(cqv, tag(1), 1);

@ -70,7 +70,7 @@ static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static void drain_cq(grpc_completion_queue *cq) { static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev; grpc_event ev;
do { do {
ev = grpc_completion_queue_next(cq, five_seconds_time()); ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN); } while (ev.type != GRPC_QUEUE_SHUTDOWN);
} }
@ -78,7 +78,8 @@ static void shutdown_server(grpc_end2end_test_fixture *f) {
if (!f->server) return; if (!f->server) return;
grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000));
GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000), GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000),
GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5)) GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5),
NULL)
.type == GRPC_OP_COMPLETE); .type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server); grpc_server_destroy(f->server);
f->server = NULL; f->server = NULL;
@ -111,12 +112,13 @@ static void simple_request_body(grpc_end2end_test_fixture f) {
grpc_metadata_array request_metadata_recv; grpc_metadata_array request_metadata_recv;
grpc_call_details call_details; grpc_call_details call_details;
grpc_status_code status; grpc_status_code status;
grpc_call_error error;
char *details = NULL; char *details = NULL;
size_t details_capacity = 0; size_t details_capacity = 0;
int was_cancelled = 2; int was_cancelled = 2;
c = grpc_channel_create_call(f.client, f.cq, "/foo", c = grpc_channel_create_call(f.client, f.cq, "/foo",
"foo.test.google.fr:1234", deadline); "foo.test.google.fr:1234", deadline, NULL);
GPR_ASSERT(c); GPR_ASSERT(c);
grpc_metadata_array_init(&initial_metadata_recv); grpc_metadata_array_init(&initial_metadata_recv);
@ -140,11 +142,13 @@ static void simple_request_body(grpc_end2end_test_fixture f) {
op->data.recv_status_on_client.status_details_capacity = &details_capacity; op->data.recv_status_on_client.status_details_capacity = &details_capacity;
op->flags = 0; op->flags = 0;
op++; op++;
GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(c, ops, op - ops, tag(1))); error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL);
GPR_ASSERT(GRPC_CALL_OK == error);
GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call( error = grpc_server_request_call(f.server, &s, &call_details,
f.server, &s, &call_details, &request_metadata_recv, f.cq, f.cq,
&request_metadata_recv, f.cq, f.cq, tag(101))); tag(101));
GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(101), 1); cq_expect_completion(cqv, tag(101), 1);
cq_verify(cqv); cq_verify(cqv);
@ -163,7 +167,8 @@ static void simple_request_body(grpc_end2end_test_fixture f) {
op->data.recv_close_on_server.cancelled = &was_cancelled; op->data.recv_close_on_server.cancelled = &was_cancelled;
op->flags = 0; op->flags = 0;
op++; op++;
GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(s, ops, op - ops, tag(102))); error = grpc_call_start_batch(s, ops, op - ops, tag(102), NULL);
GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(102), 1); cq_expect_completion(cqv, tag(102), 1);
cq_expect_completion(cqv, tag(1), 1); cq_expect_completion(cqv, tag(1), 1);

@ -56,7 +56,7 @@ static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static void drain_cq(grpc_completion_queue *cq) { static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev; grpc_event ev;
do { do {
ev = grpc_completion_queue_next(cq, five_seconds_time()); ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN); } while (ev.type != GRPC_QUEUE_SHUTDOWN);
} }
@ -64,7 +64,8 @@ static void shutdown_server(grpc_end2end_test_fixture *f) {
if (!f->server) return; if (!f->server) return;
grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000));
GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000), GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000),
GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5)) GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5),
NULL)
.type == GRPC_OP_COMPLETE); .type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server); grpc_server_destroy(f->server);
f->server = NULL; f->server = NULL;
@ -101,6 +102,7 @@ static void simple_delayed_request_body(grpc_end2end_test_config config,
grpc_metadata_array request_metadata_recv; grpc_metadata_array request_metadata_recv;
grpc_call_details call_details; grpc_call_details call_details;
grpc_status_code status; grpc_status_code status;
grpc_call_error error;
char *details = NULL; char *details = NULL;
size_t details_capacity = 0; size_t details_capacity = 0;
int was_cancelled = 2; int was_cancelled = 2;
@ -108,7 +110,7 @@ static void simple_delayed_request_body(grpc_end2end_test_config config,
config.init_client(f, client_args); config.init_client(f, client_args);
c = grpc_channel_create_call(f->client, f->cq, "/foo", "foo.test.google.fr", c = grpc_channel_create_call(f->client, f->cq, "/foo", "foo.test.google.fr",
deadline); deadline, NULL);
GPR_ASSERT(c); GPR_ASSERT(c);
grpc_metadata_array_init(&initial_metadata_recv); grpc_metadata_array_init(&initial_metadata_recv);
@ -135,14 +137,15 @@ static void simple_delayed_request_body(grpc_end2end_test_config config,
op->data.recv_status_on_client.status_details_capacity = &details_capacity; op->data.recv_status_on_client.status_details_capacity = &details_capacity;
op->flags = 0; op->flags = 0;
op++; op++;
GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(c, ops, op - ops, tag(1))); error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL);
GPR_ASSERT(GRPC_CALL_OK == error);
config.init_server(f, server_args); config.init_server(f, server_args);
GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call(f->server, &s, error = grpc_server_request_call(f->server, &s, &call_details,
&call_details, &request_metadata_recv, f->cq, f->cq,
&request_metadata_recv, tag(101));
f->cq, f->cq, tag(101))); GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(101), 1); cq_expect_completion(cqv, tag(101), 1);
cq_verify(cqv); cq_verify(cqv);
@ -161,7 +164,8 @@ static void simple_delayed_request_body(grpc_end2end_test_config config,
op->data.recv_close_on_server.cancelled = &was_cancelled; op->data.recv_close_on_server.cancelled = &was_cancelled;
op->flags = 0; op->flags = 0;
op++; op++;
GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(s, ops, op - ops, tag(102))); error = grpc_call_start_batch(s, ops, op - ops, tag(102), NULL);
GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(102), 1); cq_expect_completion(cqv, tag(102), 1);
cq_expect_completion(cqv, tag(1), 1); cq_expect_completion(cqv, tag(1), 1);

@ -70,7 +70,7 @@ static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static void drain_cq(grpc_completion_queue *cq) { static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev; grpc_event ev;
do { do {
ev = grpc_completion_queue_next(cq, five_seconds_time()); ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN); } while (ev.type != GRPC_QUEUE_SHUTDOWN);
} }
@ -78,7 +78,8 @@ static void shutdown_server(grpc_end2end_test_fixture *f) {
if (!f->server) return; if (!f->server) return;
grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000));
GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000), GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000),
GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5)) GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5),
NULL)
.type == GRPC_OP_COMPLETE); .type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server); grpc_server_destroy(f->server);
f->server = NULL; f->server = NULL;
@ -111,12 +112,13 @@ static void simple_request_body(grpc_end2end_test_fixture f) {
grpc_metadata_array request_metadata_recv; grpc_metadata_array request_metadata_recv;
grpc_call_details call_details; grpc_call_details call_details;
grpc_status_code status; grpc_status_code status;
grpc_call_error error;
char *details = NULL; char *details = NULL;
size_t details_capacity = 0; size_t details_capacity = 0;
int was_cancelled = 2; int was_cancelled = 2;
c = grpc_channel_create_call(f.client, f.cq, "/foo", c = grpc_channel_create_call(f.client, f.cq, "/foo",
"foo.test.google.fr:1234", deadline); "foo.test.google.fr:1234", deadline, NULL);
GPR_ASSERT(c); GPR_ASSERT(c);
grpc_metadata_array_init(&initial_metadata_recv); grpc_metadata_array_init(&initial_metadata_recv);
@ -143,11 +145,13 @@ static void simple_request_body(grpc_end2end_test_fixture f) {
op->data.recv_status_on_client.status_details_capacity = &details_capacity; op->data.recv_status_on_client.status_details_capacity = &details_capacity;
op->flags = 0; op->flags = 0;
op++; op++;
GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(c, ops, op - ops, tag(1))); error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL);
GPR_ASSERT(GRPC_CALL_OK == error);
GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call( error = grpc_server_request_call(f.server, &s, &call_details,
f.server, &s, &call_details, &request_metadata_recv, f.cq, f.cq,
&request_metadata_recv, f.cq, f.cq, tag(101))); tag(101));
GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(101), 1); cq_expect_completion(cqv, tag(101), 1);
cq_verify(cqv); cq_verify(cqv);
@ -166,7 +170,8 @@ static void simple_request_body(grpc_end2end_test_fixture f) {
op->data.recv_close_on_server.cancelled = &was_cancelled; op->data.recv_close_on_server.cancelled = &was_cancelled;
op->flags = 0; op->flags = 0;
op++; op++;
GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(s, ops, op - ops, tag(102))); error = grpc_call_start_batch(s, ops, op - ops, tag(102), NULL);
GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(102), 1); cq_expect_completion(cqv, tag(102), 1);
cq_expect_completion(cqv, tag(1), 1); cq_expect_completion(cqv, tag(1), 1);

@ -70,7 +70,7 @@ static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static void drain_cq(grpc_completion_queue *cq) { static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev; grpc_event ev;
do { do {
ev = grpc_completion_queue_next(cq, five_seconds_time()); ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN); } while (ev.type != GRPC_QUEUE_SHUTDOWN);
} }
@ -78,7 +78,8 @@ static void shutdown_server(grpc_end2end_test_fixture *f) {
if (!f->server) return; if (!f->server) return;
grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000));
GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000), GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000),
GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5)) GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5),
NULL)
.type == GRPC_OP_COMPLETE); .type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server); grpc_server_destroy(f->server);
f->server = NULL; f->server = NULL;
@ -111,12 +112,13 @@ static void simple_request_body(grpc_end2end_test_fixture f) {
grpc_metadata_array request_metadata_recv; grpc_metadata_array request_metadata_recv;
grpc_call_details call_details; grpc_call_details call_details;
grpc_status_code status; grpc_status_code status;
grpc_call_error error;
char *details = NULL; char *details = NULL;
size_t details_capacity = 0; size_t details_capacity = 0;
int was_cancelled = 2; int was_cancelled = 2;
c = grpc_channel_create_call(f.client, f.cq, "/foo", c = grpc_channel_create_call(f.client, f.cq, "/foo",
"foo.test.google.fr:1234", deadline); "foo.test.google.fr:1234", deadline, NULL);
GPR_ASSERT(c); GPR_ASSERT(c);
grpc_metadata_array_init(&initial_metadata_recv); grpc_metadata_array_init(&initial_metadata_recv);
@ -143,11 +145,13 @@ static void simple_request_body(grpc_end2end_test_fixture f) {
op->data.recv_status_on_client.status_details_capacity = &details_capacity; op->data.recv_status_on_client.status_details_capacity = &details_capacity;
op->flags = 0; op->flags = 0;
op++; op++;
GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(c, ops, op - ops, tag(1))); error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL);
GPR_ASSERT(GRPC_CALL_OK == error);
GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call( error = grpc_server_request_call(f.server, &s, &call_details,
f.server, &s, &call_details, &request_metadata_recv, f.cq, f.cq,
&request_metadata_recv, f.cq, f.cq, tag(101))); tag(101));
GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(101), 1); cq_expect_completion(cqv, tag(101), 1);
cq_verify(cqv); cq_verify(cqv);
@ -166,7 +170,8 @@ static void simple_request_body(grpc_end2end_test_fixture f) {
op->data.recv_close_on_server.cancelled = &was_cancelled; op->data.recv_close_on_server.cancelled = &was_cancelled;
op->flags = 0; op->flags = 0;
op++; op++;
GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(s, ops, op - ops, tag(102))); error = grpc_call_start_batch(s, ops, op - ops, tag(102), NULL);
GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(102), 1); cq_expect_completion(cqv, tag(102), 1);
cq_expect_completion(cqv, tag(1), 1); cq_expect_completion(cqv, tag(1), 1);

@ -89,26 +89,30 @@ static void init_ping_pong_request(void) {
} }
static void step_ping_pong_request(void) { static void step_ping_pong_request(void) {
call = grpc_call_error error;
grpc_channel_create_call(channel, cq, "/Reflector/reflectUnary", call = grpc_channel_create_call(channel, cq, "/Reflector/reflectUnary",
"localhost", gpr_inf_future(GPR_CLOCK_REALTIME)); "localhost",
GPR_ASSERT(GRPC_CALL_OK == gpr_inf_future(GPR_CLOCK_REALTIME),
grpc_call_start_batch(call, ops, op - ops, (void *)1)); NULL);
grpc_completion_queue_next(cq, gpr_inf_future(GPR_CLOCK_REALTIME)); error = grpc_call_start_batch(call, ops, op - ops, (void *)1, NULL);
GPR_ASSERT(GRPC_CALL_OK == error);
grpc_completion_queue_next(cq, gpr_inf_future(GPR_CLOCK_REALTIME), NULL);
grpc_call_destroy(call); grpc_call_destroy(call);
grpc_byte_buffer_destroy(response_payload_recv); grpc_byte_buffer_destroy(response_payload_recv);
call = NULL; call = NULL;
} }
static void init_ping_pong_stream(void) { static void init_ping_pong_stream(void) {
call = grpc_call_error error;
grpc_channel_create_call(channel, cq, "/Reflector/reflectStream", call = grpc_channel_create_call(channel, cq, "/Reflector/reflectStream",
"localhost", gpr_inf_future(GPR_CLOCK_REALTIME)); "localhost",
gpr_inf_future(GPR_CLOCK_REALTIME),
NULL);
stream_init_op.op = GRPC_OP_SEND_INITIAL_METADATA; stream_init_op.op = GRPC_OP_SEND_INITIAL_METADATA;
stream_init_op.data.send_initial_metadata.count = 0; stream_init_op.data.send_initial_metadata.count = 0;
GPR_ASSERT(GRPC_CALL_OK == error = grpc_call_start_batch(call, &stream_init_op, 1, (void *)1, NULL);
grpc_call_start_batch(call, &stream_init_op, 1, (void *)1)); GPR_ASSERT(GRPC_CALL_OK == error);
grpc_completion_queue_next(cq, gpr_inf_future(GPR_CLOCK_REALTIME)); grpc_completion_queue_next(cq, gpr_inf_future(GPR_CLOCK_REALTIME), NULL);
grpc_metadata_array_init(&initial_metadata_recv); grpc_metadata_array_init(&initial_metadata_recv);
@ -119,9 +123,10 @@ static void init_ping_pong_stream(void) {
} }
static void step_ping_pong_stream(void) { static void step_ping_pong_stream(void) {
GPR_ASSERT(GRPC_CALL_OK == grpc_call_error error;
grpc_call_start_batch(call, stream_step_ops, 2, (void *)1)); error = grpc_call_start_batch(call, stream_step_ops, 2, (void *)1, NULL);
grpc_completion_queue_next(cq, gpr_inf_future(GPR_CLOCK_REALTIME)); GPR_ASSERT(GRPC_CALL_OK == error);
grpc_completion_queue_next(cq, gpr_inf_future(GPR_CLOCK_REALTIME), NULL);
grpc_byte_buffer_destroy(response_payload_recv); grpc_byte_buffer_destroy(response_payload_recv);
} }
@ -152,6 +157,7 @@ int main(int argc, char **argv) {
int secure = 0; int secure = 0;
char *target = "localhost:443"; char *target = "localhost:443";
gpr_cmdline *cl; gpr_cmdline *cl;
grpc_event event;
char *scenario_name = "ping-pong-request"; char *scenario_name = "ping-pong-request";
scenario sc = {NULL, NULL, NULL}; scenario sc = {NULL, NULL, NULL};
@ -183,8 +189,8 @@ int main(int argc, char **argv) {
return 1; return 1;
} }
channel = grpc_channel_create(target, NULL); channel = grpc_channel_create(target, NULL, NULL);
cq = grpc_completion_queue_create(); cq = grpc_completion_queue_create(NULL);
the_buffer = grpc_raw_byte_buffer_create(&slice, payload_size); the_buffer = grpc_raw_byte_buffer_create(&slice, payload_size);
histogram = gpr_histogram_create(0.01, 60e9); histogram = gpr_histogram_create(0.01, 60e9);
@ -210,9 +216,10 @@ int main(int argc, char **argv) {
grpc_channel_destroy(channel); grpc_channel_destroy(channel);
grpc_completion_queue_shutdown(cq); grpc_completion_queue_shutdown(cq);
while (grpc_completion_queue_next(cq, gpr_inf_future(GPR_CLOCK_REALTIME)) do {
.type != GRPC_QUEUE_SHUTDOWN) event = grpc_completion_queue_next(cq, gpr_inf_future(GPR_CLOCK_REALTIME),
; NULL);
} while (event.type != GRPC_QUEUE_SHUTDOWN);
grpc_completion_queue_destroy(cq); grpc_completion_queue_destroy(cq);
grpc_byte_buffer_destroy(the_buffer); grpc_byte_buffer_destroy(the_buffer);
gpr_slice_unref(slice); gpr_slice_unref(slice);

@ -97,6 +97,7 @@ static void request_call(void) {
static void handle_unary_method(void) { static void handle_unary_method(void) {
grpc_op *op; grpc_op *op;
grpc_call_error error;
grpc_metadata_array_init(&initial_metadata_send); grpc_metadata_array_init(&initial_metadata_send);
@ -122,41 +123,47 @@ static void handle_unary_method(void) {
op->data.recv_close_on_server.cancelled = &was_cancelled; op->data.recv_close_on_server.cancelled = &was_cancelled;
op++; op++;
GPR_ASSERT(GRPC_CALL_OK == error = grpc_call_start_batch(call, unary_ops, op - unary_ops,
grpc_call_start_batch(call, unary_ops, op - unary_ops, tag(FLING_SERVER_BATCH_OPS_FOR_UNARY), NULL);
tag(FLING_SERVER_BATCH_OPS_FOR_UNARY))); GPR_ASSERT(GRPC_CALL_OK == error);
} }
static void send_initial_metadata(void) { static void send_initial_metadata(void) {
grpc_call_error error;
void *tagarg = tag(FLING_SERVER_SEND_INIT_METADATA_FOR_STREAMING);
grpc_metadata_array_init(&initial_metadata_send); grpc_metadata_array_init(&initial_metadata_send);
metadata_send_op.op = GRPC_OP_SEND_INITIAL_METADATA; metadata_send_op.op = GRPC_OP_SEND_INITIAL_METADATA;
metadata_send_op.data.send_initial_metadata.count = 0; metadata_send_op.data.send_initial_metadata.count = 0;
GPR_ASSERT(GRPC_CALL_OK == error = grpc_call_start_batch(call, &metadata_send_op, 1, tagarg, NULL);
grpc_call_start_batch(
call, &metadata_send_op, 1, GPR_ASSERT(GRPC_CALL_OK == error);
tag(FLING_SERVER_SEND_INIT_METADATA_FOR_STREAMING)));
} }
static void start_read_op(int t) { static void start_read_op(int t) {
grpc_call_error error;
/* Starting read at server */ /* Starting read at server */
read_op.op = GRPC_OP_RECV_MESSAGE; read_op.op = GRPC_OP_RECV_MESSAGE;
read_op.data.recv_message = &payload_buffer; read_op.data.recv_message = &payload_buffer;
GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(call, &read_op, 1, tag(t))); error = grpc_call_start_batch(call, &read_op, 1, tag(t), NULL);
GPR_ASSERT(GRPC_CALL_OK == error);
} }
static void start_write_op(void) { static void start_write_op(void) {
grpc_call_error error;
void *tagarg = tag(FLING_SERVER_WRITE_FOR_STREAMING);
/* Starting write at server */ /* Starting write at server */
write_op.op = GRPC_OP_SEND_MESSAGE; write_op.op = GRPC_OP_SEND_MESSAGE;
if (payload_buffer == NULL) { if (payload_buffer == NULL) {
gpr_log(GPR_INFO, "NULL payload buffer !!!"); gpr_log(GPR_INFO, "NULL payload buffer !!!");
} }
write_op.data.send_message = payload_buffer; write_op.data.send_message = payload_buffer;
GPR_ASSERT(GRPC_CALL_OK == error = grpc_call_start_batch(call, &write_op, 1, tagarg, NULL);
grpc_call_start_batch(call, &write_op, 1, GPR_ASSERT(GRPC_CALL_OK == error);
tag(FLING_SERVER_WRITE_FOR_STREAMING)));
} }
static void start_send_status(void) { static void start_send_status(void) {
grpc_call_error error;
void *tagarg = tag(FLING_SERVER_SEND_STATUS_FOR_STREAMING);
status_op[0].op = GRPC_OP_SEND_STATUS_FROM_SERVER; status_op[0].op = GRPC_OP_SEND_STATUS_FROM_SERVER;
status_op[0].data.send_status_from_server.status = GRPC_STATUS_OK; status_op[0].data.send_status_from_server.status = GRPC_STATUS_OK;
status_op[0].data.send_status_from_server.trailing_metadata_count = 0; status_op[0].data.send_status_from_server.trailing_metadata_count = 0;
@ -164,9 +171,8 @@ static void start_send_status(void) {
status_op[1].op = GRPC_OP_RECV_CLOSE_ON_SERVER; status_op[1].op = GRPC_OP_RECV_CLOSE_ON_SERVER;
status_op[1].data.recv_close_on_server.cancelled = &was_cancelled; status_op[1].data.recv_close_on_server.cancelled = &was_cancelled;
GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch( error = grpc_call_start_batch(call, status_op, 2, tagarg, NULL);
call, status_op, 2, GPR_ASSERT(GRPC_CALL_OK == error);
tag(FLING_SERVER_SEND_STATUS_FOR_STREAMING)));
} }
/* We have some sort of deadlock, so let's not exit gracefully for now. /* We have some sort of deadlock, so let's not exit gracefully for now.
@ -205,20 +211,20 @@ int main(int argc, char **argv) {
} }
gpr_log(GPR_INFO, "creating server on: %s", addr); gpr_log(GPR_INFO, "creating server on: %s", addr);
cq = grpc_completion_queue_create(); cq = grpc_completion_queue_create(NULL);
if (secure) { if (secure) {
grpc_ssl_pem_key_cert_pair pem_key_cert_pair = {test_server1_key, grpc_ssl_pem_key_cert_pair pem_key_cert_pair = {test_server1_key,
test_server1_cert}; test_server1_cert};
grpc_server_credentials *ssl_creds = grpc_server_credentials *ssl_creds =
grpc_ssl_server_credentials_create(NULL, &pem_key_cert_pair, 1); grpc_ssl_server_credentials_create(NULL, &pem_key_cert_pair, 1);
server = grpc_server_create(NULL); server = grpc_server_create(NULL, NULL);
GPR_ASSERT(grpc_server_add_secure_http2_port(server, addr, ssl_creds)); GPR_ASSERT(grpc_server_add_secure_http2_port(server, addr, ssl_creds));
grpc_server_credentials_release(ssl_creds); grpc_server_credentials_release(ssl_creds);
} else { } else {
server = grpc_server_create(NULL); server = grpc_server_create(NULL, NULL);
GPR_ASSERT(grpc_server_add_http2_port(server, addr)); GPR_ASSERT(grpc_server_add_http2_port(server, addr));
} }
grpc_server_register_completion_queue(server, cq); grpc_server_register_completion_queue(server, cq, NULL);
grpc_server_start(server); grpc_server_start(server);
gpr_free(addr_buf); gpr_free(addr_buf);
@ -235,14 +241,14 @@ int main(int argc, char **argv) {
gpr_log(GPR_INFO, "Shutting down due to SIGINT"); gpr_log(GPR_INFO, "Shutting down due to SIGINT");
grpc_server_shutdown_and_notify(server, cq, tag(1000)); grpc_server_shutdown_and_notify(server, cq, tag(1000));
GPR_ASSERT(grpc_completion_queue_pluck( GPR_ASSERT(grpc_completion_queue_pluck(
cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5)) cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL)
.type == GRPC_OP_COMPLETE); .type == GRPC_OP_COMPLETE);
grpc_completion_queue_shutdown(cq); grpc_completion_queue_shutdown(cq);
shutdown_started = 1; shutdown_started = 1;
} }
ev = grpc_completion_queue_next( ev = grpc_completion_queue_next(
cq, gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), cq, gpr_time_add(gpr_now(GPR_CLOCK_REALTIME),
gpr_time_from_micros(1000000, GPR_TIMESPAN))); gpr_time_from_micros(1000000, GPR_TIMESPAN)), NULL);
s = ev.tag; s = ev.tag;
switch (ev.type) { switch (ev.type) {
case GRPC_OP_COMPLETE: case GRPC_OP_COMPLETE:

@ -52,7 +52,7 @@ static void *create_test_tag(void) {
static void shutdown_and_destroy(grpc_completion_queue *cc) { static void shutdown_and_destroy(grpc_completion_queue *cc) {
grpc_event ev; grpc_event ev;
grpc_completion_queue_shutdown(cc); grpc_completion_queue_shutdown(cc);
ev = grpc_completion_queue_next(cc, gpr_inf_past(GPR_CLOCK_REALTIME)); ev = grpc_completion_queue_next(cc, gpr_inf_past(GPR_CLOCK_REALTIME), NULL);
GPR_ASSERT(ev.type == GRPC_QUEUE_SHUTDOWN); GPR_ASSERT(ev.type == GRPC_QUEUE_SHUTDOWN);
grpc_completion_queue_destroy(cc); grpc_completion_queue_destroy(cc);
} }
@ -60,17 +60,18 @@ static void shutdown_and_destroy(grpc_completion_queue *cc) {
/* ensure we can create and destroy a completion channel */ /* ensure we can create and destroy a completion channel */
static void test_no_op(void) { static void test_no_op(void) {
LOG_TEST("test_no_op"); LOG_TEST("test_no_op");
shutdown_and_destroy(grpc_completion_queue_create()); shutdown_and_destroy(grpc_completion_queue_create(NULL));
} }
static void test_wait_empty(void) { static void test_wait_empty(void) {
grpc_completion_queue *cc; grpc_completion_queue *cc;
grpc_event event;
LOG_TEST("test_wait_empty"); LOG_TEST("test_wait_empty");
cc = grpc_completion_queue_create(); cc = grpc_completion_queue_create(NULL);
GPR_ASSERT(grpc_completion_queue_next(cc, gpr_now(GPR_CLOCK_REALTIME)).type == event = grpc_completion_queue_next(cc, gpr_now(GPR_CLOCK_REALTIME), NULL);
GRPC_QUEUE_TIMEOUT); GPR_ASSERT(event.type == GRPC_QUEUE_TIMEOUT);
shutdown_and_destroy(cc); shutdown_and_destroy(cc);
} }
@ -84,12 +85,12 @@ static void test_cq_end_op(void) {
LOG_TEST("test_cq_end_op"); LOG_TEST("test_cq_end_op");
cc = grpc_completion_queue_create(); cc = grpc_completion_queue_create(NULL);
grpc_cq_begin_op(cc); grpc_cq_begin_op(cc);
grpc_cq_end_op(cc, tag, 1, do_nothing_end_completion, NULL, &completion); grpc_cq_end_op(cc, tag, 1, do_nothing_end_completion, NULL, &completion);
ev = grpc_completion_queue_next(cc, gpr_inf_past(GPR_CLOCK_REALTIME)); ev = grpc_completion_queue_next(cc, gpr_inf_past(GPR_CLOCK_REALTIME), 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);
@ -99,23 +100,27 @@ static void test_cq_end_op(void) {
static void test_shutdown_then_next_polling(void) { static void test_shutdown_then_next_polling(void) {
grpc_completion_queue *cc; grpc_completion_queue *cc;
grpc_event event;
LOG_TEST("test_shutdown_then_next_polling"); LOG_TEST("test_shutdown_then_next_polling");
cc = grpc_completion_queue_create(); cc = grpc_completion_queue_create(NULL);
grpc_completion_queue_shutdown(cc); grpc_completion_queue_shutdown(cc);
GPR_ASSERT(grpc_completion_queue_next(cc, gpr_inf_past(GPR_CLOCK_REALTIME)) event = grpc_completion_queue_next(cc, gpr_inf_past(GPR_CLOCK_REALTIME),
.type == GRPC_QUEUE_SHUTDOWN); NULL);
GPR_ASSERT(event.type == GRPC_QUEUE_SHUTDOWN);
grpc_completion_queue_destroy(cc); grpc_completion_queue_destroy(cc);
} }
static void test_shutdown_then_next_with_timeout(void) { static void test_shutdown_then_next_with_timeout(void) {
grpc_completion_queue *cc; grpc_completion_queue *cc;
grpc_event event;
LOG_TEST("test_shutdown_then_next_with_timeout"); LOG_TEST("test_shutdown_then_next_with_timeout");
cc = grpc_completion_queue_create(); cc = grpc_completion_queue_create(NULL);
grpc_completion_queue_shutdown(cc); grpc_completion_queue_shutdown(cc);
GPR_ASSERT(grpc_completion_queue_next(cc, gpr_inf_future(GPR_CLOCK_REALTIME)) event = grpc_completion_queue_next(cc, gpr_inf_future(GPR_CLOCK_REALTIME),
.type == GRPC_QUEUE_SHUTDOWN); NULL);
GPR_ASSERT(event.type == GRPC_QUEUE_SHUTDOWN);
grpc_completion_queue_destroy(cc); grpc_completion_queue_destroy(cc);
} }
@ -135,7 +140,7 @@ static void test_pluck(void) {
} }
} }
cc = grpc_completion_queue_create(); cc = grpc_completion_queue_create(NULL);
for (i = 0; i < GPR_ARRAY_SIZE(tags); i++) { for (i = 0; i < GPR_ARRAY_SIZE(tags); i++) {
grpc_cq_begin_op(cc); grpc_cq_begin_op(cc);
@ -145,7 +150,7 @@ static void test_pluck(void) {
for (i = 0; i < GPR_ARRAY_SIZE(tags); i++) { for (i = 0; i < GPR_ARRAY_SIZE(tags); i++) {
ev = grpc_completion_queue_pluck(cc, tags[i], ev = grpc_completion_queue_pluck(cc, tags[i],
gpr_inf_past(GPR_CLOCK_REALTIME)); gpr_inf_past(GPR_CLOCK_REALTIME), NULL);
GPR_ASSERT(ev.tag == tags[i]); GPR_ASSERT(ev.tag == tags[i]);
} }
@ -157,7 +162,7 @@ static void test_pluck(void) {
for (i = 0; i < GPR_ARRAY_SIZE(tags); i++) { for (i = 0; i < GPR_ARRAY_SIZE(tags); i++) {
ev = grpc_completion_queue_pluck(cc, tags[GPR_ARRAY_SIZE(tags) - i - 1], ev = grpc_completion_queue_pluck(cc, tags[GPR_ARRAY_SIZE(tags) - i - 1],
gpr_inf_past(GPR_CLOCK_REALTIME)); gpr_inf_past(GPR_CLOCK_REALTIME), NULL);
GPR_ASSERT(ev.tag == tags[GPR_ARRAY_SIZE(tags) - i - 1]); GPR_ASSERT(ev.tag == tags[GPR_ARRAY_SIZE(tags) - i - 1]);
} }
@ -229,7 +234,7 @@ static void consumer_thread(void *arg) {
gpr_log(GPR_INFO, "consumer %d phase 2", opt->id); gpr_log(GPR_INFO, "consumer %d phase 2", opt->id);
for (;;) { for (;;) {
ev = grpc_completion_queue_next(opt->cc, ten_seconds_time()); ev = grpc_completion_queue_next(opt->cc, ten_seconds_time(), NULL);
switch (ev.type) { switch (ev.type) {
case GRPC_OP_COMPLETE: case GRPC_OP_COMPLETE:
GPR_ASSERT(ev.success); GPR_ASSERT(ev.success);
@ -251,7 +256,7 @@ static void test_threading(int producers, int consumers) {
gpr_malloc((producers + consumers) * sizeof(test_thread_options)); gpr_malloc((producers + consumers) * sizeof(test_thread_options));
gpr_event phase1 = GPR_EVENT_INIT; gpr_event phase1 = GPR_EVENT_INIT;
gpr_event phase2 = GPR_EVENT_INIT; gpr_event phase2 = GPR_EVENT_INIT;
grpc_completion_queue *cc = grpc_completion_queue_create(); grpc_completion_queue *cc = grpc_completion_queue_create(NULL);
int i; int i;
int total_consumed = 0; int total_consumed = 0;
static int optid = 101; static int optid = 101;

@ -49,6 +49,7 @@ int main(int argc, char **argv) {
grpc_op *op; grpc_op *op;
grpc_metadata_array trailing_metadata_recv; grpc_metadata_array trailing_metadata_recv;
grpc_status_code status; grpc_status_code status;
grpc_call_error error;
char *details = NULL; char *details = NULL;
size_t details_capacity = 0; size_t details_capacity = 0;
@ -59,9 +60,9 @@ int main(int argc, char **argv) {
chan = grpc_lame_client_channel_create(); chan = grpc_lame_client_channel_create();
GPR_ASSERT(chan); GPR_ASSERT(chan);
cq = grpc_completion_queue_create(); cq = grpc_completion_queue_create(NULL);
call = grpc_channel_create_call(chan, cq, "/Foo", "anywhere", call = grpc_channel_create_call(chan, cq, "/Foo", "anywhere",
GRPC_TIMEOUT_SECONDS_TO_DEADLINE(100)); GRPC_TIMEOUT_SECONDS_TO_DEADLINE(100), NULL);
GPR_ASSERT(call); GPR_ASSERT(call);
cqv = cq_verifier_create(cq); cqv = cq_verifier_create(cq);
@ -77,8 +78,8 @@ int main(int argc, char **argv) {
op->data.recv_status_on_client.status_details_capacity = &details_capacity; op->data.recv_status_on_client.status_details_capacity = &details_capacity;
op->flags = 0; op->flags = 0;
op++; op++;
GPR_ASSERT(GRPC_CALL_OK == error = grpc_call_start_batch(call, ops, op - ops, tag(1), NULL);
grpc_call_start_batch(call, ops, op - ops, tag(1))); GPR_ASSERT(GRPC_CALL_OK == error);
/* the call should immediately fail */ /* the call should immediately fail */
cq_expect_completion(cqv, tag(1), 1); cq_expect_completion(cqv, tag(1), 1);

Loading…
Cancel
Save