diff options
author | David Garcia Quintas <dgq@google.com> | 2015-08-17 14:03:50 -0700 |
---|---|---|
committer | David Garcia Quintas <dgq@google.com> | 2015-08-17 18:28:00 -0700 |
commit | 935c171ee8446a7327763608d8688b644a2436a0 (patch) | |
tree | f4646cbbf7258367a16c9f4b8a81314313cd0d5e /test | |
parent | 864d18650e007d9080257d685fc09bfbbf3a306e (diff) | |
parent | 2461bf675ec23f513569a14933609f09b4ff3854 (diff) |
Merge branch 'master' of github.com:grpc/grpc into compression-interop
Diffstat (limited to 'test')
66 files changed, 1351 insertions, 437 deletions
diff --git a/test/build/zookeeper.c b/test/build/zookeeper.c new file mode 100644 index 0000000000..7cd3d0da9e --- /dev/null +++ b/test/build/zookeeper.c @@ -0,0 +1,43 @@ +/* + * + * Copyright 2015, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +/* This is just a compilation test, to see if we have Zookeeper C client + library installed. */ + +#include <stdlib.h> +#include <zookeeper/zookeeper.h> + +int main() { + zookeeper_init(NULL, NULL, 0, 0, 0, 0); + return 0; +} diff --git a/test/core/bad_client/bad_client.c b/test/core/bad_client/bad_client.c index b050227b61..f7399770dd 100644 --- a/test/core/bad_client/bad_client.c +++ b/test/core/bad_client/bad_client.c @@ -102,11 +102,11 @@ void grpc_run_bad_client_test(grpc_bad_client_server_side_validator validator, /* Create server, completion events */ 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_write); 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); transport = grpc_create_chttp2_transport(NULL, sfd.server, mdctx, 0); 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); 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); grpc_server_destroy(a.server); grpc_completion_queue_destroy(a.cq); diff --git a/test/core/bad_client/tests/connection_prefix.c b/test/core/bad_client/tests/connection_prefix.c index 0bd86ecf55..de62e923f0 100644 --- a/test/core/bad_client/tests/connection_prefix.c +++ b/test/core/bad_client/tests/connection_prefix.c @@ -37,8 +37,8 @@ static void verifier(grpc_server *server, grpc_completion_queue *cq) { while (grpc_server_has_open_connections(server)) { GPR_ASSERT( - grpc_completion_queue_next(cq, GRPC_TIMEOUT_MILLIS_TO_DEADLINE(20)) - .type == GRPC_QUEUE_TIMEOUT); + grpc_completion_queue_next(cq, GRPC_TIMEOUT_MILLIS_TO_DEADLINE(20), + NULL).type == GRPC_QUEUE_TIMEOUT); } } diff --git a/test/core/bad_client/tests/initial_settings_frame.c b/test/core/bad_client/tests/initial_settings_frame.c index 2075602e27..28e9a39dff 100644 --- a/test/core/bad_client/tests/initial_settings_frame.c +++ b/test/core/bad_client/tests/initial_settings_frame.c @@ -39,8 +39,8 @@ static void verifier(grpc_server *server, grpc_completion_queue *cq) { while (grpc_server_has_open_connections(server)) { GPR_ASSERT( - grpc_completion_queue_next(cq, GRPC_TIMEOUT_MILLIS_TO_DEADLINE(20)) - .type == GRPC_QUEUE_TIMEOUT); + grpc_completion_queue_next(cq, GRPC_TIMEOUT_MILLIS_TO_DEADLINE(20), + NULL).type == GRPC_QUEUE_TIMEOUT); } } diff --git a/test/core/compression/compression_test.c b/test/core/compression/compression_test.c index 01349c22b5..810bcee8cc 100644 --- a/test/core/compression/compression_test.c +++ b/test/core/compression/compression_test.c @@ -42,7 +42,7 @@ static void test_compression_algorithm_parse(void) { size_t i; - const char* valid_names[] = {"none", "gzip", "deflate"}; + const char* valid_names[] = {"identity", "gzip", "deflate"}; const grpc_compression_algorithm valid_algorithms[] = { GRPC_COMPRESS_NONE, GRPC_COMPRESS_GZIP, GRPC_COMPRESS_DEFLATE}; const char* invalid_names[] = {"gzip2", "foo", "", "2gzip"}; diff --git a/test/core/end2end/cq_verifier.c b/test/core/end2end/cq_verifier.c index c28932c52b..a9ba78dfdb 100644 --- a/test/core/end2end/cq_verifier.c +++ b/test/core/end2end/cq_verifier.c @@ -226,7 +226,7 @@ void cq_verify(cq_verifier *v) { gpr_strvec_init(&have_tags); 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) { fail_no_event_received(v); break; @@ -265,7 +265,7 @@ void cq_verify_empty(cq_verifier *v) { 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) { char *s = grpc_event_string(&ev); gpr_log(GPR_ERROR, "unexpected event (expected nothing): %s", s); diff --git a/test/core/end2end/dualstack_socket_test.c b/test/core/end2end/dualstack_socket_test.c index 48a88be525..7b7dbc7472 100644 --- a/test/core/end2end/dualstack_socket_test.c +++ b/test/core/end2end/dualstack_socket_test.c @@ -53,7 +53,7 @@ static gpr_timespec ms_from_now(int ms) { static void drain_cq(grpc_completion_queue *cq) { grpc_event ev; 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); } @@ -75,6 +75,7 @@ void test_connect(const char *server_host, const char *client_host, int port, grpc_metadata_array trailing_metadata_recv; grpc_metadata_array request_metadata_recv; grpc_status_code status; + grpc_call_error error; char *details = NULL; size_t details_capacity = 0; int was_cancelled = 2; @@ -93,9 +94,9 @@ void test_connect(const char *server_host, const char *client_host, int port, grpc_call_details_init(&call_details); /* Create server. */ - cq = grpc_completion_queue_create(); - server = grpc_server_create(NULL); - grpc_server_register_completion_queue(server, cq); + cq = grpc_completion_queue_create(NULL); + server = grpc_server_create(NULL, NULL); + grpc_server_register_completion_queue(server, cq, NULL); GPR_ASSERT((got_port = grpc_server_add_insecure_http2_port( server, server_hostport)) > 0); if (port == 0) { @@ -113,7 +114,7 @@ void test_connect(const char *server_host, const char *client_host, int port, } else { gpr_join_host_port(&client_hostport, client_host, port); } - client = grpc_insecure_channel_create(client_hostport, NULL); + client = grpc_insecure_channel_create(client_hostport, NULL, NULL); gpr_log(GPR_INFO, "Testing with server=%s client=%s (expecting %s)", server_hostport, client_hostport, expect_ok ? "success" : "failure"); @@ -132,20 +133,23 @@ void test_connect(const char *server_host, const char *client_host, int port, /* Send a trivial request. */ c = grpc_channel_create_call(client, NULL, GRPC_PROPAGATE_DEFAULTS, cq, - "/foo", "foo.test.google.fr", deadline); + "/foo", "foo.test.google.fr", deadline, NULL); GPR_ASSERT(c); op = ops; op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_RECV_INITIAL_METADATA; op->data.recv_initial_metadata = &initial_metadata_recv; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; @@ -153,14 +157,16 @@ void test_connect(const char *server_host, const char *client_host, int port, op->data.recv_status_on_client.status_details = &details; op->data.recv_status_on_client.status_details_capacity = &details_capacity; op->flags = 0; + op->reserved = NULL; 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) { /* Check for a successful request. */ - GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call( - server, &s, &call_details, - &request_metadata_recv, cq, cq, tag(101))); + error = grpc_server_request_call(server, &s, &call_details, + &request_metadata_recv, cq, cq, tag(101)); + GPR_ASSERT(GRPC_CALL_OK == error); cq_expect_completion(cqv, tag(101), 1); cq_verify(cqv); @@ -179,8 +185,8 @@ void test_connect(const char *server_host, const char *client_host, int port, op->data.recv_close_on_server.cancelled = &was_cancelled; op->flags = 0; 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(1), 1); @@ -215,7 +221,8 @@ void test_connect(const char *server_host, const char *client_host, int port, /* Destroy server. */ grpc_server_shutdown_and_notify(server, 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); grpc_server_destroy(server); grpc_completion_queue_shutdown(cq); diff --git a/test/core/end2end/fixtures/chttp2_fake_security.c b/test/core/end2end/fixtures/chttp2_fake_security.c index 78b692a45d..27531ecbc3 100644 --- a/test/core/end2end/fixtures/chttp2_fake_security.c +++ b/test/core/end2end/fixtures/chttp2_fake_security.c @@ -60,7 +60,7 @@ static grpc_end2end_test_fixture chttp2_create_fixture_secure_fullstack( gpr_join_host_port(&ffd->localaddr, "localhost", port); f.fixture_data = ffd; - f.cq = grpc_completion_queue_create(); + f.cq = grpc_completion_queue_create(NULL); return f; } @@ -89,8 +89,8 @@ static void chttp2_init_server_secure_fullstack( if (f->server) { grpc_server_destroy(f->server); } - f->server = grpc_server_create(server_args); - grpc_server_register_completion_queue(f->server, f->cq); + f->server = grpc_server_create(server_args, NULL); + grpc_server_register_completion_queue(f->server, f->cq, NULL); GPR_ASSERT(grpc_server_add_secure_http2_port(f->server, ffd->localaddr, server_creds)); grpc_server_credentials_release(server_creds); diff --git a/test/core/end2end/fixtures/chttp2_fullstack.c b/test/core/end2end/fixtures/chttp2_fullstack.c index 53a6f0d7a5..0170dcf0e5 100644 --- a/test/core/end2end/fixtures/chttp2_fullstack.c +++ b/test/core/end2end/fixtures/chttp2_fullstack.c @@ -64,7 +64,7 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack( gpr_join_host_port(&ffd->localaddr, "localhost", port); f.fixture_data = ffd; - f.cq = grpc_completion_queue_create(); + f.cq = grpc_completion_queue_create(NULL); 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, grpc_channel_args *client_args) { fullstack_fixture_data *ffd = f->fixture_data; - f->client = grpc_insecure_channel_create(ffd->localaddr, client_args); + f->client = grpc_insecure_channel_create(ffd->localaddr, client_args, NULL); GPR_ASSERT(f->client); } @@ -82,8 +82,8 @@ void chttp2_init_server_fullstack(grpc_end2end_test_fixture *f, if (f->server) { grpc_server_destroy(f->server); } - f->server = grpc_server_create(server_args); - grpc_server_register_completion_queue(f->server, f->cq); + f->server = grpc_server_create(server_args, NULL); + grpc_server_register_completion_queue(f->server, f->cq, NULL); GPR_ASSERT(grpc_server_add_insecure_http2_port(f->server, ffd->localaddr)); grpc_server_start(f->server); } diff --git a/test/core/end2end/fixtures/chttp2_fullstack_compression.c b/test/core/end2end/fixtures/chttp2_fullstack_compression.c index a75075d1d4..6e7a1faf55 100644 --- a/test/core/end2end/fixtures/chttp2_fullstack_compression.c +++ b/test/core/end2end/fixtures/chttp2_fullstack_compression.c @@ -69,7 +69,7 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack_compression( memset(&f, 0, sizeof(f)); f.fixture_data = ffd; - f.cq = grpc_completion_queue_create(); + f.cq = grpc_completion_queue_create(NULL); return f; } @@ -83,7 +83,7 @@ void chttp2_init_client_fullstack_compression(grpc_end2end_test_fixture *f, ffd->client_args_compression = grpc_channel_args_set_compression_algorithm( client_args, GRPC_COMPRESS_GZIP); f->client = grpc_insecure_channel_create(ffd->localaddr, - ffd->client_args_compression); + ffd->client_args_compression, NULL); } void chttp2_init_server_fullstack_compression(grpc_end2end_test_fixture *f, @@ -97,8 +97,8 @@ void chttp2_init_server_fullstack_compression(grpc_end2end_test_fixture *f, if (f->server) { grpc_server_destroy(f->server); } - f->server = grpc_server_create(ffd->server_args_compression); - grpc_server_register_completion_queue(f->server, f->cq); + f->server = grpc_server_create(ffd->server_args_compression, NULL); + grpc_server_register_completion_queue(f->server, f->cq, NULL); GPR_ASSERT(grpc_server_add_insecure_http2_port(f->server, ffd->localaddr)); grpc_server_start(f->server); } diff --git a/test/core/end2end/fixtures/chttp2_fullstack_uds_posix.c b/test/core/end2end/fixtures/chttp2_fullstack_uds_posix.c index 20afdb868e..59d39bbb0f 100644 --- a/test/core/end2end/fixtures/chttp2_fullstack_uds_posix.c +++ b/test/core/end2end/fixtures/chttp2_fullstack_uds_posix.c @@ -70,7 +70,7 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack( unique++); f.fixture_data = ffd; - f.cq = grpc_completion_queue_create(); + f.cq = grpc_completion_queue_create(NULL); 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, grpc_channel_args *client_args) { fullstack_fixture_data *ffd = f->fixture_data; - f->client = grpc_insecure_channel_create(ffd->localaddr, client_args); + f->client = grpc_insecure_channel_create(ffd->localaddr, client_args, NULL); } 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) { grpc_server_destroy(f->server); } - f->server = grpc_server_create(server_args); - grpc_server_register_completion_queue(f->server, f->cq); + f->server = grpc_server_create(server_args, NULL); + grpc_server_register_completion_queue(f->server, f->cq, NULL); GPR_ASSERT(grpc_server_add_insecure_http2_port(f->server, ffd->localaddr)); grpc_server_start(f->server); } diff --git a/test/core/end2end/fixtures/chttp2_fullstack_uds_posix_with_poll.c b/test/core/end2end/fixtures/chttp2_fullstack_uds_posix_with_poll.c index 8491ea6970..05b9ea0949 100644 --- a/test/core/end2end/fixtures/chttp2_fullstack_uds_posix_with_poll.c +++ b/test/core/end2end/fixtures/chttp2_fullstack_uds_posix_with_poll.c @@ -70,7 +70,7 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack( unique++); f.fixture_data = ffd; - f.cq = grpc_completion_queue_create(); + f.cq = grpc_completion_queue_create(NULL); 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, grpc_channel_args *client_args) { fullstack_fixture_data *ffd = f->fixture_data; - f->client = grpc_insecure_channel_create(ffd->localaddr, client_args); + f->client = grpc_insecure_channel_create(ffd->localaddr, client_args, NULL); } 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) { grpc_server_destroy(f->server); } - f->server = grpc_server_create(server_args); - grpc_server_register_completion_queue(f->server, f->cq); + f->server = grpc_server_create(server_args, NULL); + grpc_server_register_completion_queue(f->server, f->cq, NULL); GPR_ASSERT(grpc_server_add_insecure_http2_port(f->server, ffd->localaddr)); grpc_server_start(f->server); } diff --git a/test/core/end2end/fixtures/chttp2_fullstack_with_poll.c b/test/core/end2end/fixtures/chttp2_fullstack_with_poll.c index 2a4835add1..48feefc931 100644 --- a/test/core/end2end/fixtures/chttp2_fullstack_with_poll.c +++ b/test/core/end2end/fixtures/chttp2_fullstack_with_poll.c @@ -64,7 +64,7 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack( gpr_join_host_port(&ffd->localaddr, "localhost", port); f.fixture_data = ffd; - f.cq = grpc_completion_queue_create(); + f.cq = grpc_completion_queue_create(NULL); 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, grpc_channel_args *client_args) { fullstack_fixture_data *ffd = f->fixture_data; - f->client = grpc_insecure_channel_create(ffd->localaddr, client_args); + f->client = grpc_insecure_channel_create(ffd->localaddr, client_args, NULL); } 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) { grpc_server_destroy(f->server); } - f->server = grpc_server_create(server_args); - grpc_server_register_completion_queue(f->server, f->cq); + f->server = grpc_server_create(server_args, NULL); + grpc_server_register_completion_queue(f->server, f->cq, NULL); GPR_ASSERT(grpc_server_add_insecure_http2_port(f->server, ffd->localaddr)); grpc_server_start(f->server); } diff --git a/test/core/end2end/fixtures/chttp2_fullstack_with_proxy.c b/test/core/end2end/fixtures/chttp2_fullstack_with_proxy.c index 248cc7d6e7..44083e2676 100644 --- a/test/core/end2end/fixtures/chttp2_fullstack_with_proxy.c +++ b/test/core/end2end/fixtures/chttp2_fullstack_with_proxy.c @@ -56,13 +56,13 @@ typedef struct fullstack_fixture_data { } fullstack_fixture_data; static grpc_server *create_proxy_server(const char *port) { - grpc_server *s = grpc_server_create(NULL); + grpc_server *s = grpc_server_create(NULL, NULL); GPR_ASSERT(grpc_server_add_insecure_http2_port(s, port)); return s; } static grpc_channel *create_proxy_client(const char *target) { - return grpc_insecure_channel_create(target, NULL); + return grpc_insecure_channel_create(target, NULL, NULL); } static const grpc_end2end_proxy_def proxy_def = {create_proxy_server, @@ -77,7 +77,7 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack( ffd->proxy = grpc_end2end_proxy_create(&proxy_def); f.fixture_data = ffd; - f.cq = grpc_completion_queue_create(); + f.cq = grpc_completion_queue_create(NULL); return f; } @@ -86,7 +86,7 @@ void chttp2_init_client_fullstack(grpc_end2end_test_fixture *f, grpc_channel_args *client_args) { fullstack_fixture_data *ffd = f->fixture_data; f->client = grpc_insecure_channel_create( - grpc_end2end_proxy_get_client_target(ffd->proxy), client_args); + grpc_end2end_proxy_get_client_target(ffd->proxy), client_args, NULL); GPR_ASSERT(f->client); } @@ -96,8 +96,8 @@ void chttp2_init_server_fullstack(grpc_end2end_test_fixture *f, if (f->server) { grpc_server_destroy(f->server); } - f->server = grpc_server_create(server_args); - grpc_server_register_completion_queue(f->server, f->cq); + f->server = grpc_server_create(server_args, NULL); + grpc_server_register_completion_queue(f->server, f->cq, NULL); GPR_ASSERT(grpc_server_add_insecure_http2_port( f->server, grpc_end2end_proxy_get_server_port(ffd->proxy))); grpc_server_start(f->server); diff --git a/test/core/end2end/fixtures/chttp2_simple_ssl_fullstack.c b/test/core/end2end/fixtures/chttp2_simple_ssl_fullstack.c index 9850aac69b..491a293764 100644 --- a/test/core/end2end/fixtures/chttp2_simple_ssl_fullstack.c +++ b/test/core/end2end/fixtures/chttp2_simple_ssl_fullstack.c @@ -63,7 +63,7 @@ static grpc_end2end_test_fixture chttp2_create_fixture_secure_fullstack( gpr_join_host_port(&ffd->localaddr, "localhost", port); f.fixture_data = ffd; - f.cq = grpc_completion_queue_create(); + f.cq = grpc_completion_queue_create(NULL); return f; } @@ -92,8 +92,8 @@ static void chttp2_init_server_secure_fullstack( if (f->server) { grpc_server_destroy(f->server); } - f->server = grpc_server_create(server_args); - grpc_server_register_completion_queue(f->server, f->cq); + f->server = grpc_server_create(server_args, NULL); + grpc_server_register_completion_queue(f->server, f->cq, NULL); GPR_ASSERT(grpc_server_add_secure_http2_port(f->server, ffd->localaddr, server_creds)); grpc_server_credentials_release(server_creds); diff --git a/test/core/end2end/fixtures/chttp2_simple_ssl_fullstack_with_poll.c b/test/core/end2end/fixtures/chttp2_simple_ssl_fullstack_with_poll.c index 3df2acd296..f2736cc92f 100644 --- a/test/core/end2end/fixtures/chttp2_simple_ssl_fullstack_with_poll.c +++ b/test/core/end2end/fixtures/chttp2_simple_ssl_fullstack_with_poll.c @@ -63,7 +63,7 @@ static grpc_end2end_test_fixture chttp2_create_fixture_secure_fullstack( gpr_join_host_port(&ffd->localaddr, "localhost", port); f.fixture_data = ffd; - f.cq = grpc_completion_queue_create(); + f.cq = grpc_completion_queue_create(NULL); return f; } @@ -92,8 +92,8 @@ static void chttp2_init_server_secure_fullstack( if (f->server) { grpc_server_destroy(f->server); } - f->server = grpc_server_create(server_args); - grpc_server_register_completion_queue(f->server, f->cq); + f->server = grpc_server_create(server_args, NULL); + grpc_server_register_completion_queue(f->server, f->cq, NULL); GPR_ASSERT(grpc_server_add_secure_http2_port(f->server, ffd->localaddr, server_creds)); grpc_server_credentials_release(server_creds); diff --git a/test/core/end2end/fixtures/chttp2_simple_ssl_fullstack_with_proxy.c b/test/core/end2end/fixtures/chttp2_simple_ssl_fullstack_with_proxy.c index 4d77039cac..cc0b9dbbdd 100644 --- a/test/core/end2end/fixtures/chttp2_simple_ssl_fullstack_with_proxy.c +++ b/test/core/end2end/fixtures/chttp2_simple_ssl_fullstack_with_proxy.c @@ -54,7 +54,7 @@ typedef struct fullstack_secure_fixture_data { } fullstack_secure_fixture_data; static grpc_server *create_proxy_server(const char *port) { - grpc_server *s = grpc_server_create(NULL); + grpc_server *s = grpc_server_create(NULL, NULL); grpc_ssl_pem_key_cert_pair pem_cert_key_pair = {test_server1_key, test_server1_cert}; grpc_server_credentials *ssl_creds = @@ -91,7 +91,7 @@ static grpc_end2end_test_fixture chttp2_create_fixture_secure_fullstack( ffd->proxy = grpc_end2end_proxy_create(&proxy_def); f.fixture_data = ffd; - f.cq = grpc_completion_queue_create(); + f.cq = grpc_completion_queue_create(NULL); return f; } @@ -121,8 +121,8 @@ static void chttp2_init_server_secure_fullstack( if (f->server) { grpc_server_destroy(f->server); } - f->server = grpc_server_create(server_args); - grpc_server_register_completion_queue(f->server, f->cq); + f->server = grpc_server_create(server_args, NULL); + grpc_server_register_completion_queue(f->server, f->cq, NULL); GPR_ASSERT(grpc_server_add_secure_http2_port( f->server, grpc_end2end_proxy_get_server_port(ffd->proxy), server_creds)); grpc_server_credentials_release(server_creds); diff --git a/test/core/end2end/fixtures/chttp2_simple_ssl_with_oauth2_fullstack.c b/test/core/end2end/fixtures/chttp2_simple_ssl_with_oauth2_fullstack.c index 284d5f07ae..3c35baec6b 100644 --- a/test/core/end2end/fixtures/chttp2_simple_ssl_with_oauth2_fullstack.c +++ b/test/core/end2end/fixtures/chttp2_simple_ssl_with_oauth2_fullstack.c @@ -105,7 +105,7 @@ static grpc_end2end_test_fixture chttp2_create_fixture_secure_fullstack( gpr_join_host_port(&ffd->localaddr, "localhost", port); f.fixture_data = ffd; - f.cq = grpc_completion_queue_create(); + f.cq = grpc_completion_queue_create(NULL); return f; } @@ -126,8 +126,8 @@ static void chttp2_init_server_secure_fullstack( if (f->server) { grpc_server_destroy(f->server); } - f->server = grpc_server_create(server_args); - grpc_server_register_completion_queue(f->server, f->cq); + f->server = grpc_server_create(server_args, NULL); + grpc_server_register_completion_queue(f->server, f->cq, NULL); GPR_ASSERT(grpc_server_add_secure_http2_port(f->server, ffd->localaddr, server_creds)); grpc_server_credentials_release(server_creds); diff --git a/test/core/end2end/fixtures/chttp2_socket_pair.c b/test/core/end2end/fixtures/chttp2_socket_pair.c index 807fc8e7bc..16a04fbebf 100644 --- a/test/core/end2end/fixtures/chttp2_socket_pair.c +++ b/test/core/end2end/fixtures/chttp2_socket_pair.c @@ -95,7 +95,7 @@ static grpc_end2end_test_fixture chttp2_create_fixture_socketpair( grpc_end2end_test_fixture f; memset(&f, 0, sizeof(f)); 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); @@ -123,7 +123,7 @@ static void chttp2_init_server_socketpair(grpc_end2end_test_fixture *f, grpc_transport *transport; GPR_ASSERT(!f->server); 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); transport = grpc_create_chttp2_transport(server_args, sfd->server, mdctx, 0); server_setup_transport(f, transport, mdctx); diff --git a/test/core/end2end/fixtures/chttp2_socket_pair_one_byte_at_a_time.c b/test/core/end2end/fixtures/chttp2_socket_pair_one_byte_at_a_time.c index 21d4404237..94fc36f5ec 100644 --- a/test/core/end2end/fixtures/chttp2_socket_pair_one_byte_at_a_time.c +++ b/test/core/end2end/fixtures/chttp2_socket_pair_one_byte_at_a_time.c @@ -95,7 +95,7 @@ static grpc_end2end_test_fixture chttp2_create_fixture_socketpair( grpc_end2end_test_fixture f; memset(&f, 0, sizeof(f)); 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); @@ -123,7 +123,7 @@ static void chttp2_init_server_socketpair(grpc_end2end_test_fixture *f, grpc_transport *transport; GPR_ASSERT(!f->server); 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); transport = grpc_create_chttp2_transport(server_args, sfd->server, mdctx, 0); server_setup_transport(f, transport, mdctx); diff --git a/test/core/end2end/fixtures/chttp2_socket_pair_with_grpc_trace.c b/test/core/end2end/fixtures/chttp2_socket_pair_with_grpc_trace.c index 9d798ad1d2..588c4b23e1 100644 --- a/test/core/end2end/fixtures/chttp2_socket_pair_with_grpc_trace.c +++ b/test/core/end2end/fixtures/chttp2_socket_pair_with_grpc_trace.c @@ -96,7 +96,7 @@ static grpc_end2end_test_fixture chttp2_create_fixture_socketpair( grpc_end2end_test_fixture f; memset(&f, 0, sizeof(f)); 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); @@ -124,7 +124,7 @@ static void chttp2_init_server_socketpair(grpc_end2end_test_fixture *f, grpc_transport *transport; GPR_ASSERT(!f->server); 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); transport = grpc_create_chttp2_transport(server_args, sfd->server, mdctx, 0); server_setup_transport(f, transport, mdctx); diff --git a/test/core/end2end/fixtures/proxy.c b/test/core/end2end/fixtures/proxy.c index e4f6263334..798d4e94d4 100644 --- a/test/core/end2end/fixtures/proxy.c +++ b/test/core/end2end/fixtures/proxy.c @@ -100,11 +100,11 @@ grpc_end2end_proxy *grpc_end2end_proxy_create( gpr_join_host_port(&proxy->proxy_port, "localhost", proxy_port); gpr_join_host_port(&proxy->server_port, "localhost", server_port); - proxy->cq = grpc_completion_queue_create(); + proxy->cq = grpc_completion_queue_create(NULL); proxy->server = def->create_server(proxy->proxy_port); proxy->client = def->create_client(proxy->server_port); - grpc_server_register_completion_queue(proxy->server, proxy->cq); + grpc_server_register_completion_queue(proxy->server, proxy->cq, NULL); grpc_server_start(proxy->server); gpr_thd_options_set_joinable(&opt); @@ -178,7 +178,8 @@ static void on_p2s_recv_initial_metadata(void *arg, int success) { op.data.send_initial_metadata.metadata = pc->p2s_initial_metadata.metadata; refpc(pc, "on_c2p_sent_initial_metadata"); err = grpc_call_start_batch(pc->c2p, &op, 1, - new_closure(on_c2p_sent_initial_metadata, pc)); + new_closure(on_c2p_sent_initial_metadata, pc), + NULL); GPR_ASSERT(err == GRPC_CALL_OK); } @@ -204,7 +205,7 @@ static void on_p2s_sent_message(void *arg, int success) { op.data.recv_message = &pc->c2p_msg; refpc(pc, "on_c2p_recv_msg"); err = grpc_call_start_batch(pc->c2p, &op, 1, - new_closure(on_c2p_recv_msg, pc)); + new_closure(on_c2p_recv_msg, pc), NULL); GPR_ASSERT(err == GRPC_CALL_OK); } @@ -228,14 +229,14 @@ static void on_c2p_recv_msg(void *arg, int success) { op.data.send_message = pc->c2p_msg; refpc(pc, "on_p2s_sent_message"); err = grpc_call_start_batch(pc->p2s, &op, 1, - new_closure(on_p2s_sent_message, pc)); + new_closure(on_p2s_sent_message, pc), NULL); GPR_ASSERT(err == GRPC_CALL_OK); } else { op.op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; op.flags = 0; refpc(pc, "on_p2s_sent_close"); err = grpc_call_start_batch(pc->p2s, &op, 1, - new_closure(on_p2s_sent_close, pc)); + new_closure(on_p2s_sent_close, pc), NULL); GPR_ASSERT(err == GRPC_CALL_OK); } } @@ -257,7 +258,7 @@ static void on_c2p_sent_message(void *arg, int success) { op.data.recv_message = &pc->p2s_msg; refpc(pc, "on_p2s_recv_msg"); err = grpc_call_start_batch(pc->p2s, &op, 1, - new_closure(on_p2s_recv_msg, pc)); + new_closure(on_p2s_recv_msg, pc), NULL); GPR_ASSERT(err == GRPC_CALL_OK); } @@ -275,7 +276,7 @@ static void on_p2s_recv_msg(void *arg, int success) { op.data.send_message = pc->p2s_msg; refpc(pc, "on_c2p_sent_message"); err = grpc_call_start_batch(pc->c2p, &op, 1, - new_closure(on_c2p_sent_message, pc)); + new_closure(on_c2p_sent_message, pc), NULL); GPR_ASSERT(err == GRPC_CALL_OK); } unrefpc(pc, "on_p2s_recv_msg"); @@ -303,7 +304,7 @@ static void on_p2s_status(void *arg, int success) { op.data.send_status_from_server.status_details = pc->p2s_status_details; refpc(pc, "on_c2p_sent_status"); err = grpc_call_start_batch(pc->c2p, &op, 1, - new_closure(on_c2p_sent_status, pc)); + new_closure(on_c2p_sent_status, pc), NULL); GPR_ASSERT(err == GRPC_CALL_OK); } @@ -330,7 +331,7 @@ static void on_new_call(void *arg, int success) { pc->p2s = grpc_channel_create_call( proxy->client, pc->c2p, GRPC_PROPAGATE_DEFAULTS, proxy->cq, proxy->new_call_details.method, proxy->new_call_details.host, - proxy->new_call_details.deadline); + proxy->new_call_details.deadline, NULL); gpr_ref_init(&pc->refs, 1); op.flags = 0; @@ -339,7 +340,8 @@ static void on_new_call(void *arg, int success) { op.data.recv_initial_metadata = &pc->p2s_initial_metadata; refpc(pc, "on_p2s_recv_initial_metadata"); err = grpc_call_start_batch(pc->p2s, &op, 1, - new_closure(on_p2s_recv_initial_metadata, pc)); + new_closure(on_p2s_recv_initial_metadata, pc), + NULL); GPR_ASSERT(err == GRPC_CALL_OK); op.op = GRPC_OP_SEND_INITIAL_METADATA; @@ -347,21 +349,22 @@ static void on_new_call(void *arg, int success) { op.data.send_initial_metadata.metadata = pc->c2p_initial_metadata.metadata; refpc(pc, "on_p2s_sent_initial_metadata"); err = grpc_call_start_batch(pc->p2s, &op, 1, - new_closure(on_p2s_sent_initial_metadata, pc)); + new_closure(on_p2s_sent_initial_metadata, pc), + NULL); GPR_ASSERT(err == GRPC_CALL_OK); op.op = GRPC_OP_RECV_MESSAGE; op.data.recv_message = &pc->c2p_msg; refpc(pc, "on_c2p_recv_msg"); err = grpc_call_start_batch(pc->c2p, &op, 1, - new_closure(on_c2p_recv_msg, pc)); + new_closure(on_c2p_recv_msg, pc), NULL); GPR_ASSERT(err == GRPC_CALL_OK); op.op = GRPC_OP_RECV_MESSAGE; op.data.recv_message = &pc->p2s_msg; refpc(pc, "on_p2s_recv_msg"); err = grpc_call_start_batch(pc->p2s, &op, 1, - new_closure(on_p2s_recv_msg, pc)); + new_closure(on_p2s_recv_msg, pc), NULL); GPR_ASSERT(err == GRPC_CALL_OK); op.op = GRPC_OP_RECV_STATUS_ON_CLIENT; @@ -372,15 +375,15 @@ static void on_new_call(void *arg, int success) { op.data.recv_status_on_client.status_details_capacity = &pc->p2s_status_details_capacity; refpc(pc, "on_p2s_status"); - err = - grpc_call_start_batch(pc->p2s, &op, 1, new_closure(on_p2s_status, pc)); + err = grpc_call_start_batch(pc->p2s, &op, 1, + new_closure(on_p2s_status, pc), NULL); GPR_ASSERT(err == GRPC_CALL_OK); op.op = GRPC_OP_RECV_CLOSE_ON_SERVER; op.data.recv_close_on_server.cancelled = &pc->c2p_server_cancelled; refpc(pc, "on_c2p_closed"); - err = - grpc_call_start_batch(pc->c2p, &op, 1, new_closure(on_c2p_closed, pc)); + err = grpc_call_start_batch(pc->c2p, &op, 1, + new_closure(on_c2p_closed, pc), NULL); GPR_ASSERT(err == GRPC_CALL_OK); request_call(proxy); @@ -405,7 +408,7 @@ static void thread_main(void *arg) { closure *cl; for (;;) { grpc_event ev = grpc_completion_queue_next( - proxy->cq, gpr_inf_future(GPR_CLOCK_MONOTONIC)); + proxy->cq, gpr_inf_future(GPR_CLOCK_MONOTONIC), NULL); switch (ev.type) { case GRPC_QUEUE_TIMEOUT: gpr_log(GPR_ERROR, "Should never reach here"); diff --git a/test/core/end2end/multiple_server_queues_test.c b/test/core/end2end/multiple_server_queues_test.c index 7772d14ba5..2befcd0124 100644 --- a/test/core/end2end/multiple_server_queues_test.c +++ b/test/core/end2end/multiple_server_queues_test.c @@ -41,20 +41,20 @@ int main(int argc, char **argv) { grpc_test_init(argc, argv); grpc_init(); - cq1 = grpc_completion_queue_create(); - cq2 = grpc_completion_queue_create(); - server = grpc_server_create(NULL); - grpc_server_register_completion_queue(server, cq1); + cq1 = grpc_completion_queue_create(NULL); + cq2 = grpc_completion_queue_create(NULL); + server = grpc_server_create(NULL, NULL); + grpc_server_register_completion_queue(server, cq1, NULL); grpc_server_add_insecure_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_shutdown_and_notify(server, cq2, NULL); 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(cq2); - grpc_completion_queue_next(cq1, gpr_inf_future(GPR_CLOCK_REALTIME)); - grpc_completion_queue_next(cq2, 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), NULL); grpc_server_destroy(server); grpc_completion_queue_destroy(cq1); grpc_completion_queue_destroy(cq2); diff --git a/test/core/end2end/no_server_test.c b/test/core/end2end/no_server_test.c index 6a5e12325d..6ae87288f7 100644 --- a/test/core/end2end/no_server_test.c +++ b/test/core/end2end/no_server_test.c @@ -57,18 +57,19 @@ int main(int argc, char **argv) { grpc_metadata_array_init(&trailing_metadata_recv); - cq = grpc_completion_queue_create(); + cq = grpc_completion_queue_create(NULL); cqv = cq_verifier_create(cq); /* create a call, channel to a non existant server */ - chan = grpc_insecure_channel_create("nonexistant:54321", NULL); + chan = grpc_insecure_channel_create("nonexistant:54321", NULL, NULL); call = grpc_channel_create_call(chan, NULL, GRPC_PROPAGATE_DEFAULTS, cq, - "/Foo", "nonexistant", deadline); + "/Foo", "nonexistant", deadline, NULL); op = ops; op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; @@ -76,9 +77,10 @@ int main(int argc, char **argv) { op->data.recv_status_on_client.status_details = &details; op->data.recv_status_on_client.status_details_capacity = &details_capacity; op->flags = 0; + op->reserved = NULL; op++; 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 */ cq_expect_completion(cqv, tag(1), 1); cq_verify(cqv); @@ -86,8 +88,8 @@ int main(int argc, char **argv) { GPR_ASSERT(status == GRPC_STATUS_DEADLINE_EXCEEDED); grpc_completion_queue_shutdown(cq); - while (grpc_completion_queue_next(cq, gpr_inf_future(GPR_CLOCK_REALTIME)) - .type != GRPC_QUEUE_SHUTDOWN) + while (grpc_completion_queue_next(cq, gpr_inf_future(GPR_CLOCK_REALTIME), + NULL).type != GRPC_QUEUE_SHUTDOWN) ; grpc_completion_queue_destroy(cq); grpc_call_destroy(call); diff --git a/test/core/end2end/tests/bad_hostname.c b/test/core/end2end/tests/bad_hostname.c index 501db89b7b..61bbbe4855 100644 --- a/test/core/end2end/tests/bad_hostname.c +++ b/test/core/end2end/tests/bad_hostname.c @@ -70,7 +70,7 @@ static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); } static void drain_cq(grpc_completion_queue *cq) { grpc_event ev; 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); } @@ -78,7 +78,8 @@ static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; grpc_server_shutdown_and_notify(f->server, 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); grpc_server_destroy(f->server); f->server = NULL; @@ -110,11 +111,12 @@ static void simple_request_body(grpc_end2end_test_fixture f) { grpc_metadata_array request_metadata_recv; grpc_call_details call_details; grpc_status_code status; + grpc_call_error error; char *details = NULL; size_t details_capacity = 0; c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "slartibartfast.local", deadline); + "/foo", "slartibartfast.local", deadline, NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -126,13 +128,16 @@ static void simple_request_body(grpc_end2end_test_fixture f) { op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_RECV_INITIAL_METADATA; op->data.recv_initial_metadata = &initial_metadata_recv; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; @@ -140,8 +145,10 @@ static void simple_request_body(grpc_end2end_test_fixture f) { op->data.recv_status_on_client.status_details = &details; op->data.recv_status_on_client.status_details_capacity = &details_capacity; op->flags = 0; + op->reserved = NULL; 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_verify(cqv); diff --git a/test/core/end2end/tests/cancel_after_accept.c b/test/core/end2end/tests/cancel_after_accept.c index 2e166b8412..3715166348 100644 --- a/test/core/end2end/tests/cancel_after_accept.c +++ b/test/core/end2end/tests/cancel_after_accept.c @@ -69,7 +69,7 @@ static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); } static void drain_cq(grpc_completion_queue *cq) { grpc_event ev; 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); } @@ -77,7 +77,8 @@ static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; grpc_server_shutdown_and_notify(f->server, 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); grpc_server_destroy(f->server); 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_call_details call_details; grpc_status_code status; + grpc_call_error error; char *details = NULL; size_t details_capacity = 0; 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; c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr", deadline); + "/foo", "foo.test.google.fr", deadline, NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -142,28 +144,34 @@ static void test_cancel_after_accept(grpc_end2end_test_config config, op->data.recv_status_on_client.status_details = &details; op->data.recv_status_on_client.status_details_capacity = &details_capacity; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_SEND_MESSAGE; op->data.send_message = request_payload; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_RECV_INITIAL_METADATA; op->data.recv_initial_metadata = &initial_metadata_recv; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_RECV_MESSAGE; op->data.recv_message = &response_payload_recv; op->flags = 0; + op->reserved = NULL; 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, &call_details, - &request_metadata_recv, f.cq, f.cq, tag(2))); + error = grpc_server_request_call(f.server, &s, &call_details, + &request_metadata_recv, f.cq, f.cq, tag(2)); + GPR_ASSERT(GRPC_CALL_OK == error); cq_expect_completion(cqv, tag(2), 1); cq_verify(cqv); @@ -171,22 +179,27 @@ static void test_cancel_after_accept(grpc_end2end_test_config config, op->op = GRPC_OP_RECV_MESSAGE; op->data.recv_message = &request_payload_recv; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_SEND_MESSAGE; op->data.send_message = response_payload; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; op->data.recv_close_on_server.cancelled = &was_cancelled; op->flags = 0; + op->reserved = NULL; 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(1), 1); diff --git a/test/core/end2end/tests/cancel_after_accept_and_writes_closed.c b/test/core/end2end/tests/cancel_after_accept_and_writes_closed.c index 171c1874cc..ffb267c236 100644 --- a/test/core/end2end/tests/cancel_after_accept_and_writes_closed.c +++ b/test/core/end2end/tests/cancel_after_accept_and_writes_closed.c @@ -69,7 +69,7 @@ static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); } static void drain_cq(grpc_completion_queue *cq) { grpc_event ev; 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); } @@ -77,7 +77,8 @@ static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; grpc_server_shutdown_and_notify(f->server, 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); grpc_server_destroy(f->server); f->server = NULL; @@ -114,6 +115,7 @@ static void test_cancel_after_accept_and_writes_closed( grpc_metadata_array request_metadata_recv; grpc_call_details call_details; grpc_status_code status; + grpc_call_error error; char *details = NULL; size_t details_capacity = 0; grpc_byte_buffer *request_payload_recv = NULL; @@ -127,7 +129,7 @@ static void test_cancel_after_accept_and_writes_closed( int was_cancelled = 2; c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr", deadline); + "/foo", "foo.test.google.fr", deadline, NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -142,31 +144,38 @@ static void test_cancel_after_accept_and_writes_closed( op->data.recv_status_on_client.status_details = &details; op->data.recv_status_on_client.status_details_capacity = &details_capacity; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_SEND_MESSAGE; op->data.send_message = request_payload; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_RECV_INITIAL_METADATA; op->data.recv_initial_metadata = &initial_metadata_recv; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_RECV_MESSAGE; op->data.recv_message = &response_payload_recv; op->flags = 0; + op->reserved = NULL; 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, &call_details, - &request_metadata_recv, f.cq, f.cq, tag(2))); + error = grpc_server_request_call(f.server, &s, &call_details, + &request_metadata_recv, f.cq, f.cq, tag(2)); + GPR_ASSERT(GRPC_CALL_OK == error); cq_expect_completion(cqv, tag(2), 1); cq_verify(cqv); @@ -174,22 +183,27 @@ static void test_cancel_after_accept_and_writes_closed( op->op = GRPC_OP_RECV_MESSAGE; op->data.recv_message = &request_payload_recv; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; op->data.recv_close_on_server.cancelled = &was_cancelled; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_SEND_MESSAGE; op->data.send_message = response_payload; op->flags = 0; + op->reserved = NULL; 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(1), 1); diff --git a/test/core/end2end/tests/cancel_after_invoke.c b/test/core/end2end/tests/cancel_after_invoke.c index 186cd44a43..7e984da591 100644 --- a/test/core/end2end/tests/cancel_after_invoke.c +++ b/test/core/end2end/tests/cancel_after_invoke.c @@ -70,7 +70,7 @@ static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); } static void drain_cq(grpc_completion_queue *cq) { grpc_event ev; 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); } @@ -78,7 +78,8 @@ static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; grpc_server_shutdown_and_notify(f->server, 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); grpc_server_destroy(f->server); 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_call_details call_details; grpc_status_code status; + grpc_call_error error; char *details = NULL; size_t details_capacity = 0; 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); c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr", deadline); + "/foo", "foo.test.google.fr", deadline, NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -137,29 +139,36 @@ static void test_cancel_after_invoke(grpc_end2end_test_config config, op->data.recv_status_on_client.status_details = &details; op->data.recv_status_on_client.status_details_capacity = &details_capacity; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_SEND_MESSAGE; op->data.send_message = request_payload; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_RECV_INITIAL_METADATA; op->data.recv_initial_metadata = &initial_metadata_recv; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_RECV_MESSAGE; op->data.recv_message = &response_payload_recv; op->flags = 0; + op->reserved = NULL; 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_verify(cqv); diff --git a/test/core/end2end/tests/cancel_before_invoke.c b/test/core/end2end/tests/cancel_before_invoke.c index b511908b4f..06e6602681 100644 --- a/test/core/end2end/tests/cancel_before_invoke.c +++ b/test/core/end2end/tests/cancel_before_invoke.c @@ -68,7 +68,7 @@ static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); } static void drain_cq(grpc_completion_queue *cq) { grpc_event ev; 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); } @@ -76,7 +76,8 @@ static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; grpc_server_shutdown_and_notify(f->server, 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); grpc_server_destroy(f->server); 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_call_details call_details; grpc_status_code status; + grpc_call_error error; char *details = NULL; size_t details_capacity = 0; 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); c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr", deadline); + "/foo", "foo.test.google.fr", deadline, NULL); 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(&trailing_metadata_recv); @@ -137,27 +139,34 @@ static void test_cancel_before_invoke(grpc_end2end_test_config config, op->data.recv_status_on_client.status_details = &details; op->data.recv_status_on_client.status_details_capacity = &details_capacity; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_SEND_MESSAGE; op->data.send_message = request_payload; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_RECV_INITIAL_METADATA; op->data.recv_initial_metadata = &initial_metadata_recv; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_RECV_MESSAGE; op->data.recv_message = &response_payload_recv; op->flags = 0; + op->reserved = NULL; 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_verify(cqv); diff --git a/test/core/end2end/tests/cancel_in_a_vacuum.c b/test/core/end2end/tests/cancel_in_a_vacuum.c index 7645410184..f57a44caa4 100644 --- a/test/core/end2end/tests/cancel_in_a_vacuum.c +++ b/test/core/end2end/tests/cancel_in_a_vacuum.c @@ -69,7 +69,7 @@ static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); } static void drain_cq(grpc_completion_queue *cq) { grpc_event ev; 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); } @@ -77,7 +77,8 @@ static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; grpc_server_shutdown_and_notify(f->server, 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); grpc_server_destroy(f->server); 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); c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr", deadline); + "/foo", "foo.test.google.fr", deadline, NULL); 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); diff --git a/test/core/end2end/tests/cancel_test_helpers.h b/test/core/end2end/tests/cancel_test_helpers.h index 8345c07904..6ea822fa9a 100644 --- a/test/core/end2end/tests/cancel_test_helpers.h +++ b/test/core/end2end/tests/cancel_test_helpers.h @@ -36,12 +36,13 @@ typedef struct { 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; const char *expect_details; } 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; } diff --git a/test/core/end2end/tests/census_simple_request.c b/test/core/end2end/tests/census_simple_request.c index 2142dde921..8f615dec20 100644 --- a/test/core/end2end/tests/census_simple_request.c +++ b/test/core/end2end/tests/census_simple_request.c @@ -67,7 +67,8 @@ static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; grpc_server_shutdown_and_notify(f->server, 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); grpc_server_destroy(f->server); f->server = NULL; @@ -82,7 +83,7 @@ static void shutdown_client(grpc_end2end_test_fixture *f) { static void drain_cq(grpc_completion_queue *cq) { grpc_event ev; 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); } @@ -107,12 +108,14 @@ static void test_body(grpc_end2end_test_fixture f) { grpc_metadata_array request_metadata_recv; grpc_call_details call_details; grpc_status_code status; + grpc_call_error error; char *details = NULL; size_t details_capacity = 0; int was_cancelled = 2; c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr:1234", deadline); + "/foo", "foo.test.google.fr:1234", deadline, + NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -124,13 +127,16 @@ static void test_body(grpc_end2end_test_fixture f) { op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_RECV_INITIAL_METADATA; op->data.recv_initial_metadata = &initial_metadata_recv; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; @@ -138,12 +144,15 @@ static void test_body(grpc_end2end_test_fixture f) { op->data.recv_status_on_client.status_details = &details; op->data.recv_status_on_client.status_details_capacity = &details_capacity; op->flags = 0; + op->reserved = NULL; 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, &call_details, - &request_metadata_recv, f.cq, f.cq, tag(101))); + error = grpc_server_request_call(f.server, &s, &call_details, + &request_metadata_recv, f.cq, f.cq, + tag(101)); + GPR_ASSERT(GRPC_CALL_OK == error); cq_expect_completion(cqv, tag(101), 1); cq_verify(cqv); @@ -151,18 +160,22 @@ static void test_body(grpc_end2end_test_fixture f) { op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_SEND_STATUS_FROM_SERVER; op->data.send_status_from_server.trailing_metadata_count = 0; op->data.send_status_from_server.status = GRPC_STATUS_UNIMPLEMENTED; op->data.send_status_from_server.status_details = "xyz"; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; op->data.recv_close_on_server.cancelled = &was_cancelled; op->flags = 0; + op->reserved = NULL; 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(1), 1); diff --git a/test/core/end2end/tests/default_host.c b/test/core/end2end/tests/default_host.c index 920449f4fa..5cbf26b94f 100644 --- a/test/core/end2end/tests/default_host.c +++ b/test/core/end2end/tests/default_host.c @@ -70,7 +70,7 @@ static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); } static void drain_cq(grpc_completion_queue *cq) { grpc_event ev; 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); } @@ -78,7 +78,8 @@ static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; grpc_server_shutdown_and_notify(f->server, 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); grpc_server_destroy(f->server); f->server = NULL; @@ -111,13 +112,14 @@ static void simple_request_body(grpc_end2end_test_fixture f) { grpc_metadata_array request_metadata_recv; grpc_call_details call_details; grpc_status_code status; + grpc_call_error error; char *details = NULL; size_t details_capacity = 0; int was_cancelled = 2; char *peer; c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", NULL, deadline); + "/foo", NULL, deadline, NULL); GPR_ASSERT(c); peer = grpc_call_get_peer(c); @@ -149,11 +151,13 @@ static void simple_request_body(grpc_end2end_test_fixture f) { op->data.recv_status_on_client.status_details_capacity = &details_capacity; op->flags = 0; 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(error == GRPC_CALL_OK); - GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call( - f.server, &s, &call_details, - &request_metadata_recv, f.cq, f.cq, tag(101))); + error = grpc_server_request_call(f.server, &s, &call_details, + &request_metadata_recv, f.cq, f.cq, + tag(101)); + GPR_ASSERT(error == GRPC_CALL_OK); cq_expect_completion(cqv, tag(101), 1); cq_verify(cqv); @@ -181,7 +185,8 @@ static void simple_request_body(grpc_end2end_test_fixture f) { op->data.recv_close_on_server.cancelled = &was_cancelled; op->flags = 0; 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(error == GRPC_CALL_OK); cq_expect_completion(cqv, tag(102), 1); cq_expect_completion(cqv, tag(1), 1); diff --git a/test/core/end2end/tests/disappearing_server.c b/test/core/end2end/tests/disappearing_server.c index 94bed336e8..0b98424c25 100644 --- a/test/core/end2end/tests/disappearing_server.c +++ b/test/core/end2end/tests/disappearing_server.c @@ -56,7 +56,7 @@ static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); } static void drain_cq(grpc_completion_queue *cq) { grpc_event ev; 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); } @@ -93,12 +93,14 @@ static void do_request_and_shutdown_server(grpc_end2end_test_fixture *f, grpc_metadata_array request_metadata_recv; grpc_call_details call_details; grpc_status_code status; + grpc_call_error error; char *details = NULL; size_t details_capacity = 0; int was_cancelled = 2; c = grpc_channel_create_call(f->client, NULL, GRPC_PROPAGATE_DEFAULTS, f->cq, - "/foo", "foo.test.google.fr:1234", deadline); + "/foo", "foo.test.google.fr:1234", deadline, + NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -110,13 +112,16 @@ static void do_request_and_shutdown_server(grpc_end2end_test_fixture *f, op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_RECV_INITIAL_METADATA; op->data.recv_initial_metadata = &initial_metadata_recv; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; @@ -124,13 +129,15 @@ static void do_request_and_shutdown_server(grpc_end2end_test_fixture *f, op->data.recv_status_on_client.status_details = &details; op->data.recv_status_on_client.status_details_capacity = &details_capacity; op->flags = 0; + op->reserved = NULL; 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, - &call_details, - &request_metadata_recv, - f->cq, f->cq, tag(101))); + error = grpc_server_request_call(f->server, &s, &call_details, + &request_metadata_recv, f->cq, f->cq, + tag(101)); + GPR_ASSERT(GRPC_CALL_OK == error); cq_expect_completion(cqv, tag(101), 1); cq_verify(cqv); @@ -142,18 +149,22 @@ static void do_request_and_shutdown_server(grpc_end2end_test_fixture *f, op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_SEND_STATUS_FROM_SERVER; op->data.send_status_from_server.trailing_metadata_count = 0; op->data.send_status_from_server.status = GRPC_STATUS_UNIMPLEMENTED; op->data.send_status_from_server.status_details = "xyz"; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; op->data.recv_close_on_server.cancelled = &was_cancelled; op->flags = 0; + op->reserved = NULL; 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(1), 1); diff --git a/test/core/end2end/tests/early_server_shutdown_finishes_inflight_calls.c b/test/core/end2end/tests/early_server_shutdown_finishes_inflight_calls.c index 36cbe8067b..a5683129c1 100644 --- a/test/core/end2end/tests/early_server_shutdown_finishes_inflight_calls.c +++ b/test/core/end2end/tests/early_server_shutdown_finishes_inflight_calls.c @@ -68,7 +68,7 @@ static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); } static void drain_cq(grpc_completion_queue *cq) { grpc_event ev; 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); } @@ -101,12 +101,13 @@ static void test_early_server_shutdown_finishes_inflight_calls( grpc_metadata_array request_metadata_recv; grpc_call_details call_details; grpc_status_code status; + grpc_call_error error; char *details = NULL; size_t details_capacity = 0; int was_cancelled = 2; c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr", deadline); + "/foo", "foo.test.google.fr", deadline, NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -119,13 +120,16 @@ static void test_early_server_shutdown_finishes_inflight_calls( op->data.send_initial_metadata.count = 0; op->data.send_initial_metadata.metadata = NULL; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_RECV_INITIAL_METADATA; op->data.recv_initial_metadata = &initial_metadata_recv; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; @@ -133,12 +137,15 @@ static void test_early_server_shutdown_finishes_inflight_calls( op->data.recv_status_on_client.status_details = &details; op->data.recv_status_on_client.status_details_capacity = &details_capacity; op->flags = 0; + op->reserved = NULL; 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, &call_details, - &request_metadata_recv, f.cq, f.cq, tag(101))); + error = grpc_server_request_call(f.server, &s, &call_details, + &request_metadata_recv, f.cq, f.cq, + tag(101)); + GPR_ASSERT(GRPC_CALL_OK == error); cq_expect_completion(cqv, tag(101), 1); cq_verify(cqv); @@ -146,8 +153,10 @@ static void test_early_server_shutdown_finishes_inflight_calls( op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; op->data.recv_close_on_server.cancelled = &was_cancelled; op->flags = 0; + op->reserved = NULL; 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 */ grpc_server_shutdown_and_notify(f.server, f.cq, tag(1000)); diff --git a/test/core/end2end/tests/early_server_shutdown_finishes_tags.c b/test/core/end2end/tests/early_server_shutdown_finishes_tags.c index fc03cb01a8..9b678a1754 100644 --- a/test/core/end2end/tests/early_server_shutdown_finishes_tags.c +++ b/test/core/end2end/tests/early_server_shutdown_finishes_tags.c @@ -68,7 +68,7 @@ static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); } static void drain_cq(grpc_completion_queue *cq) { grpc_event ev; 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); } diff --git a/test/core/end2end/tests/empty_batch.c b/test/core/end2end/tests/empty_batch.c index 138c6b07c5..feb2f18166 100644 --- a/test/core/end2end/tests/empty_batch.c +++ b/test/core/end2end/tests/empty_batch.c @@ -70,7 +70,7 @@ static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); } static void drain_cq(grpc_completion_queue *cq) { grpc_event ev; 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); } @@ -78,7 +78,8 @@ static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; grpc_server_shutdown_and_notify(f->server, 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); grpc_server_destroy(f->server); f->server = NULL; @@ -103,13 +104,15 @@ static void empty_batch_body(grpc_end2end_test_fixture f) { grpc_call *c; gpr_timespec deadline = five_seconds_time(); cq_verifier *cqv = cq_verifier_create(f.cq); + grpc_call_error error; grpc_op *op = NULL; c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr", deadline); + "/foo", "foo.test.google.fr", deadline, NULL); 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_verify(cqv); diff --git a/test/core/end2end/tests/graceful_server_shutdown.c b/test/core/end2end/tests/graceful_server_shutdown.c index 23efa0304f..9ec9430d47 100644 --- a/test/core/end2end/tests/graceful_server_shutdown.c +++ b/test/core/end2end/tests/graceful_server_shutdown.c @@ -68,7 +68,7 @@ static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); } static void drain_cq(grpc_completion_queue *cq) { grpc_event ev; 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); } @@ -108,12 +108,13 @@ static void test_early_server_shutdown_finishes_inflight_calls( grpc_metadata_array request_metadata_recv; grpc_call_details call_details; grpc_status_code status; + grpc_call_error error; char *details = NULL; size_t details_capacity = 0; int was_cancelled = 2; c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr", deadline); + "/foo", "foo.test.google.fr", deadline, NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -126,13 +127,16 @@ static void test_early_server_shutdown_finishes_inflight_calls( op->data.send_initial_metadata.count = 0; op->data.send_initial_metadata.metadata = NULL; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_RECV_INITIAL_METADATA; op->data.recv_initial_metadata = &initial_metadata_recv; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; @@ -140,12 +144,15 @@ static void test_early_server_shutdown_finishes_inflight_calls( op->data.recv_status_on_client.status_details = &details; op->data.recv_status_on_client.status_details_capacity = &details_capacity; op->flags = 0; + op->reserved = NULL; 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, &call_details, - &request_metadata_recv, f.cq, f.cq, tag(101))); + error = grpc_server_request_call(f.server, &s, &call_details, + &request_metadata_recv, f.cq, f.cq, + tag(101)); + GPR_ASSERT(GRPC_CALL_OK == error); cq_expect_completion(cqv, tag(101), 1); cq_verify(cqv); @@ -157,18 +164,22 @@ static void test_early_server_shutdown_finishes_inflight_calls( op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_SEND_STATUS_FROM_SERVER; op->data.send_status_from_server.trailing_metadata_count = 0; op->data.send_status_from_server.status = GRPC_STATUS_UNIMPLEMENTED; op->data.send_status_from_server.status_details = "xyz"; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; op->data.recv_close_on_server.cancelled = &was_cancelled; op->flags = 0; + op->reserved = NULL; 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(0xdead), 1); diff --git a/test/core/end2end/tests/invoke_large_request.c b/test/core/end2end/tests/invoke_large_request.c index e32645e2ba..5fe369ea45 100644 --- a/test/core/end2end/tests/invoke_large_request.c +++ b/test/core/end2end/tests/invoke_large_request.c @@ -66,7 +66,7 @@ static gpr_timespec n_seconds_time(int n) { static void drain_cq(grpc_completion_queue *cq) { grpc_event ev; 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); } @@ -74,7 +74,8 @@ static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; grpc_server_shutdown_and_notify(f->server, 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); grpc_server_destroy(f->server); 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_call_details call_details; grpc_status_code status; + grpc_call_error error; char *details = NULL; size_t details_capacity = 0; int was_cancelled = 2; c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr", deadline); + "/foo", "foo.test.google.fr", deadline, NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -141,21 +143,26 @@ static void test_invoke_large_request(grpc_end2end_test_config config) { op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_SEND_MESSAGE; op->data.send_message = request_payload; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_RECV_INITIAL_METADATA; op->data.recv_initial_metadata = &initial_metadata_recv; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_RECV_MESSAGE; op->data.recv_message = &response_payload_recv; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; @@ -163,12 +170,15 @@ static void test_invoke_large_request(grpc_end2end_test_config config) { op->data.recv_status_on_client.status_details = &details; op->data.recv_status_on_client.status_details_capacity = &details_capacity; op->flags = 0; + op->reserved = NULL; 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, &call_details, - &request_metadata_recv, f.cq, f.cq, tag(101))); + error = grpc_server_request_call(f.server, &s, &call_details, + &request_metadata_recv, f.cq, f.cq, + tag(101)); + GPR_ASSERT(GRPC_CALL_OK == error); cq_expect_completion(cqv, tag(101), 1); cq_verify(cqv); @@ -176,12 +186,15 @@ static void test_invoke_large_request(grpc_end2end_test_config config) { op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_RECV_MESSAGE; op->data.recv_message = &request_payload_recv; op->flags = 0; + op->reserved = NULL; 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_verify(cqv); @@ -190,18 +203,22 @@ static void test_invoke_large_request(grpc_end2end_test_config config) { op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; op->data.recv_close_on_server.cancelled = &was_cancelled; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_SEND_MESSAGE; op->data.send_message = response_payload; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_SEND_STATUS_FROM_SERVER; op->data.send_status_from_server.trailing_metadata_count = 0; op->data.send_status_from_server.status = GRPC_STATUS_UNIMPLEMENTED; op->data.send_status_from_server.status_details = "xyz"; op->flags = 0; + op->reserved = NULL; 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(1), 1); diff --git a/test/core/end2end/tests/max_concurrent_streams.c b/test/core/end2end/tests/max_concurrent_streams.c index 049c028835..203d98d100 100644 --- a/test/core/end2end/tests/max_concurrent_streams.c +++ b/test/core/end2end/tests/max_concurrent_streams.c @@ -68,7 +68,7 @@ static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); } static void drain_cq(grpc_completion_queue *cq) { grpc_event ev; 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); } @@ -76,7 +76,8 @@ static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; grpc_server_shutdown_and_notify(f->server, 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); grpc_server_destroy(f->server); f->server = NULL; @@ -109,12 +110,14 @@ static void simple_request_body(grpc_end2end_test_fixture f) { grpc_metadata_array request_metadata_recv; grpc_call_details call_details; grpc_status_code status; + grpc_call_error error; char *details = NULL; size_t details_capacity = 0; int was_cancelled = 2; c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr:1234", deadline); + "/foo", "foo.test.google.fr:1234", deadline, + NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -126,13 +129,16 @@ static void simple_request_body(grpc_end2end_test_fixture f) { op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_RECV_INITIAL_METADATA; op->data.recv_initial_metadata = &initial_metadata_recv; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; @@ -140,12 +146,15 @@ static void simple_request_body(grpc_end2end_test_fixture f) { op->data.recv_status_on_client.status_details = &details; op->data.recv_status_on_client.status_details_capacity = &details_capacity; op->flags = 0; + op->reserved = NULL; 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, &call_details, - &request_metadata_recv, f.cq, f.cq, tag(101))); + error = grpc_server_request_call(f.server, &s, &call_details, + &request_metadata_recv, f.cq, f.cq, + tag(101)); + GPR_ASSERT(GRPC_CALL_OK == error); cq_expect_completion(cqv, tag(101), 1); cq_verify(cqv); @@ -153,18 +162,22 @@ static void simple_request_body(grpc_end2end_test_fixture f) { op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_SEND_STATUS_FROM_SERVER; op->data.send_status_from_server.trailing_metadata_count = 0; op->data.send_status_from_server.status = GRPC_STATUS_UNIMPLEMENTED; op->data.send_status_from_server.status_details = "xyz"; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; op->data.recv_close_on_server.cancelled = &was_cancelled; op->flags = 0; + op->reserved = NULL; 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(1), 1); @@ -207,6 +220,7 @@ static void test_max_concurrent_streams(grpc_end2end_test_config config) { grpc_metadata_array initial_metadata_recv2; grpc_metadata_array trailing_metadata_recv2; grpc_status_code status1; + grpc_call_error error; char *details1 = NULL; size_t details_capacity1 = 0; grpc_status_code status2; @@ -245,10 +259,12 @@ static void test_max_concurrent_streams(grpc_end2end_test_config config) { the first completes */ deadline = n_seconds_time(1000); c1 = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/alpha", "foo.test.google.fr:1234", deadline); + "/alpha", "foo.test.google.fr:1234", deadline, + NULL); GPR_ASSERT(c1); c2 = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/beta", "foo.test.google.fr:1234", deadline); + "/beta", "foo.test.google.fr:1234", deadline, + NULL); GPR_ASSERT(c2); GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call( @@ -259,12 +275,14 @@ static void test_max_concurrent_streams(grpc_end2end_test_config config) { op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; op->flags = 0; + op->reserved = NULL; op++; - GPR_ASSERT(GRPC_CALL_OK == - grpc_call_start_batch(c1, ops, op - ops, tag(301))); + error = grpc_call_start_batch(c1, ops, op - ops, tag(301), NULL); + GPR_ASSERT(GRPC_CALL_OK == error); op = ops; op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; @@ -273,24 +291,28 @@ static void test_max_concurrent_streams(grpc_end2end_test_config config) { op->data.recv_status_on_client.status_details = &details1; op->data.recv_status_on_client.status_details_capacity = &details_capacity1; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_RECV_INITIAL_METADATA; op->data.recv_initial_metadata = &initial_metadata_recv1; op->flags = 0; + op->reserved = NULL; op++; - GPR_ASSERT(GRPC_CALL_OK == - grpc_call_start_batch(c1, ops, op - ops, tag(302))); + error = grpc_call_start_batch(c1, ops, op - ops, tag(302), NULL); + GPR_ASSERT(GRPC_CALL_OK == error); op = ops; op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; op->flags = 0; + op->reserved = NULL; op++; - GPR_ASSERT(GRPC_CALL_OK == - grpc_call_start_batch(c2, ops, op - ops, tag(401))); + error = grpc_call_start_batch(c2, ops, op - ops, tag(401), NULL); + GPR_ASSERT(GRPC_CALL_OK == error); op = ops; op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; @@ -299,19 +321,22 @@ static void test_max_concurrent_streams(grpc_end2end_test_config config) { op->data.recv_status_on_client.status_details = &details2; op->data.recv_status_on_client.status_details_capacity = &details_capacity2; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_RECV_INITIAL_METADATA; op->data.recv_initial_metadata = &initial_metadata_recv1; op->flags = 0; + op->reserved = NULL; op++; - GPR_ASSERT(GRPC_CALL_OK == - grpc_call_start_batch(c2, ops, op - ops, tag(402))); + error = grpc_call_start_batch(c2, ops, op - ops, tag(402), NULL); + GPR_ASSERT(GRPC_CALL_OK == error); got_client_start = 0; got_server_start = 0; live_call = -1; 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.success); if (ev.tag == tag(101)) { @@ -334,19 +359,22 @@ static void test_max_concurrent_streams(grpc_end2end_test_config config) { op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; op->data.recv_close_on_server.cancelled = &was_cancelled; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_SEND_STATUS_FROM_SERVER; op->data.send_status_from_server.trailing_metadata_count = 0; op->data.send_status_from_server.status = GRPC_STATUS_UNIMPLEMENTED; op->data.send_status_from_server.status_details = "xyz"; op->flags = 0; + op->reserved = NULL; op++; - GPR_ASSERT(GRPC_CALL_OK == - grpc_call_start_batch(s1, ops, op - ops, tag(102))); + error = grpc_call_start_batch(s1, ops, op - ops, tag(102), NULL); + GPR_ASSERT(GRPC_CALL_OK == error); cq_expect_completion(cqv, tag(102), 1); cq_expect_completion(cqv, tag(live_call + 2), 1); @@ -365,19 +393,22 @@ static void test_max_concurrent_streams(grpc_end2end_test_config config) { op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; op->data.recv_close_on_server.cancelled = &was_cancelled; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_SEND_STATUS_FROM_SERVER; op->data.send_status_from_server.trailing_metadata_count = 0; op->data.send_status_from_server.status = GRPC_STATUS_UNIMPLEMENTED; op->data.send_status_from_server.status_details = "xyz"; op->flags = 0; + op->reserved = NULL; op++; - GPR_ASSERT(GRPC_CALL_OK == - grpc_call_start_batch(s2, ops, op - ops, tag(202))); + error = grpc_call_start_batch(s2, ops, op - ops, tag(202), NULL); + GPR_ASSERT(GRPC_CALL_OK == error); cq_expect_completion(cqv, tag(live_call + 2), 1); cq_expect_completion(cqv, tag(202), 1); diff --git a/test/core/end2end/tests/max_message_length.c b/test/core/end2end/tests/max_message_length.c index feea49c68f..dd30e68f42 100644 --- a/test/core/end2end/tests/max_message_length.c +++ b/test/core/end2end/tests/max_message_length.c @@ -68,7 +68,7 @@ static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); } static void drain_cq(grpc_completion_queue *cq) { grpc_event ev; 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); } @@ -76,7 +76,8 @@ static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; grpc_server_shutdown_and_notify(f->server, 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); grpc_server_destroy(f->server); 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_call_details call_details; grpc_status_code status; + grpc_call_error error; char *details = NULL; size_t details_capacity = 0; 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, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, "/foo", "foo.test.google.fr:1234", - gpr_inf_future(GPR_CLOCK_REALTIME)); + gpr_inf_future(GPR_CLOCK_REALTIME), NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -142,17 +144,21 @@ static void test_max_message_length(grpc_end2end_test_config config) { op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_SEND_MESSAGE; op->data.send_message = request_payload; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_RECV_INITIAL_METADATA; op->data.recv_initial_metadata = &initial_metadata_recv; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; @@ -160,12 +166,15 @@ static void test_max_message_length(grpc_end2end_test_config config) { op->data.recv_status_on_client.status_details = &details; op->data.recv_status_on_client.status_details_capacity = &details_capacity; op->flags = 0; + op->reserved = NULL; 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, &call_details, - &request_metadata_recv, f.cq, f.cq, tag(101))); + error = grpc_server_request_call(f.server, &s, &call_details, + &request_metadata_recv, f.cq, f.cq, + tag(101)); + GPR_ASSERT(GRPC_CALL_OK == error); cq_expect_completion(cqv, tag(101), 1); cq_verify(cqv); @@ -173,8 +182,10 @@ static void test_max_message_length(grpc_end2end_test_config config) { op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; op->data.recv_close_on_server.cancelled = &was_cancelled; op->flags = 0; + op->reserved = NULL; 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(1), 1); diff --git a/test/core/end2end/tests/no_op.c b/test/core/end2end/tests/no_op.c index 8ead664758..565d4ea280 100644 --- a/test/core/end2end/tests/no_op.c +++ b/test/core/end2end/tests/no_op.c @@ -68,7 +68,7 @@ static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); } static void drain_cq(grpc_completion_queue *cq) { grpc_event ev; 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); } @@ -76,7 +76,8 @@ static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; grpc_server_shutdown_and_notify(f->server, 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); grpc_server_destroy(f->server); f->server = NULL; diff --git a/test/core/end2end/tests/ping_pong_streaming.c b/test/core/end2end/tests/ping_pong_streaming.c index 0ae611b518..e19f115e40 100644 --- a/test/core/end2end/tests/ping_pong_streaming.c +++ b/test/core/end2end/tests/ping_pong_streaming.c @@ -68,7 +68,7 @@ static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); } static void drain_cq(grpc_completion_queue *cq) { grpc_event ev; 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); } @@ -76,7 +76,8 @@ static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; grpc_server_shutdown_and_notify(f->server, 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); grpc_server_destroy(f->server); f->server = NULL; @@ -113,6 +114,7 @@ static void test_pingpong_streaming(grpc_end2end_test_config config, grpc_metadata_array request_metadata_recv; grpc_call_details call_details; grpc_status_code status; + grpc_call_error error; char *details = NULL; size_t details_capacity = 0; int was_cancelled = 2; @@ -125,7 +127,8 @@ static void test_pingpong_streaming(grpc_end2end_test_config config, gpr_slice response_payload_slice = gpr_slice_from_copied_string("hello you"); c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr:1234", deadline); + "/foo", "foo.test.google.fr:1234", deadline, + NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -137,10 +140,12 @@ static void test_pingpong_streaming(grpc_end2end_test_config config, op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_RECV_INITIAL_METADATA; op->data.recv_initial_metadata = &initial_metadata_recv; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; @@ -148,12 +153,15 @@ static void test_pingpong_streaming(grpc_end2end_test_config config, op->data.recv_status_on_client.status_details = &details; op->data.recv_status_on_client.status_details_capacity = &details_capacity; op->flags = 0; + op->reserved = NULL; 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, &call_details, - &request_metadata_recv, f.cq, f.cq, tag(100))); + error = grpc_server_request_call(f.server, &s, &call_details, + &request_metadata_recv, f.cq, f.cq, + tag(100)); + GPR_ASSERT(GRPC_CALL_OK == error); cq_expect_completion(cqv, tag(100), 1); cq_verify(cqv); @@ -161,12 +169,15 @@ static void test_pingpong_streaming(grpc_end2end_test_config config, op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; op->data.recv_close_on_server.cancelled = &was_cancelled; op->flags = 0; + op->reserved = NULL; 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++) { request_payload = grpc_raw_byte_buffer_create(&request_payload_slice, 1); @@ -176,20 +187,24 @@ static void test_pingpong_streaming(grpc_end2end_test_config config, op->op = GRPC_OP_SEND_MESSAGE; op->data.send_message = request_payload; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_RECV_MESSAGE; op->data.recv_message = &response_payload_recv; op->flags = 0; + op->reserved = NULL; 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->op = GRPC_OP_RECV_MESSAGE; op->data.recv_message = &request_payload_recv; op->flags = 0; + op->reserved = NULL; 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_verify(cqv); @@ -197,9 +212,10 @@ static void test_pingpong_streaming(grpc_end2end_test_config config, op->op = GRPC_OP_SEND_MESSAGE; op->data.send_message = response_payload; op->flags = 0; + op->reserved = NULL; 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(2), 1); cq_verify(cqv); @@ -216,8 +232,10 @@ static void test_pingpong_streaming(grpc_end2end_test_config config, op = ops; op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; op->flags = 0; + op->reserved = NULL; 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->op = GRPC_OP_SEND_STATUS_FROM_SERVER; @@ -225,8 +243,10 @@ static void test_pingpong_streaming(grpc_end2end_test_config config, op->data.send_status_from_server.status = GRPC_STATUS_UNIMPLEMENTED; op->data.send_status_from_server.status_details = "xyz"; op->flags = 0; + op->reserved = NULL; 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(3), 1); diff --git a/test/core/end2end/tests/registered_call.c b/test/core/end2end/tests/registered_call.c index ffc4cd40a0..1ef595ee56 100644 --- a/test/core/end2end/tests/registered_call.c +++ b/test/core/end2end/tests/registered_call.c @@ -70,7 +70,7 @@ static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); } static void drain_cq(grpc_completion_queue *cq) { grpc_event ev; 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); } @@ -78,7 +78,8 @@ static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; grpc_server_shutdown_and_notify(f->server, 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); grpc_server_destroy(f->server); f->server = NULL; @@ -111,12 +112,13 @@ static void simple_request_body(grpc_end2end_test_fixture f, void *rc) { grpc_metadata_array request_metadata_recv; grpc_call_details call_details; grpc_status_code status; + grpc_call_error error; char *details = NULL; size_t details_capacity = 0; int was_cancelled = 2; c = grpc_channel_create_registered_call( - f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, rc, deadline); + f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, rc, deadline, NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -128,13 +130,16 @@ static void simple_request_body(grpc_end2end_test_fixture f, void *rc) { op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_RECV_INITIAL_METADATA; op->data.recv_initial_metadata = &initial_metadata_recv; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; @@ -142,12 +147,15 @@ static void simple_request_body(grpc_end2end_test_fixture f, void *rc) { op->data.recv_status_on_client.status_details = &details; op->data.recv_status_on_client.status_details_capacity = &details_capacity; op->flags = 0; + op->reserved = NULL; 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, &call_details, - &request_metadata_recv, f.cq, f.cq, tag(101))); + error = grpc_server_request_call(f.server, &s, &call_details, + &request_metadata_recv, f.cq, f.cq, + tag(101)); + GPR_ASSERT(GRPC_CALL_OK == error); cq_expect_completion(cqv, tag(101), 1); cq_verify(cqv); @@ -155,18 +163,22 @@ static void simple_request_body(grpc_end2end_test_fixture f, void *rc) { op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_SEND_STATUS_FROM_SERVER; op->data.send_status_from_server.trailing_metadata_count = 0; op->data.send_status_from_server.status = GRPC_STATUS_UNIMPLEMENTED; op->data.send_status_from_server.status_details = "xyz"; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; op->data.recv_close_on_server.cancelled = &was_cancelled; op->flags = 0; + op->reserved = NULL; 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(1), 1); @@ -194,7 +206,8 @@ static void test_invoke_simple_request(grpc_end2end_test_config config) { grpc_end2end_test_fixture f = begin_test(config, "test_invoke_simple_request", NULL, NULL); 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); end_test(&f); @@ -206,7 +219,8 @@ static void test_invoke_10_simple_requests(grpc_end2end_test_config config) { grpc_end2end_test_fixture f = begin_test(config, "test_invoke_10_simple_requests", NULL, NULL); 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++) { simple_request_body(f, rc); diff --git a/test/core/end2end/tests/request_response_with_binary_metadata_and_payload.c b/test/core/end2end/tests/request_response_with_binary_metadata_and_payload.c index 600642e6a7..de6f460795 100644 --- a/test/core/end2end/tests/request_response_with_binary_metadata_and_payload.c +++ b/test/core/end2end/tests/request_response_with_binary_metadata_and_payload.c @@ -68,7 +68,7 @@ static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); } static void drain_cq(grpc_completion_queue *cq) { grpc_event ev; 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); } @@ -76,7 +76,8 @@ static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; grpc_server_shutdown_and_notify(f->server, 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); grpc_server_destroy(f->server); f->server = NULL; @@ -113,20 +114,24 @@ static void test_request_response_with_metadata_and_payload( {"key1-bin", "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc", 13, - {{NULL, NULL, NULL}}}, + 0, + {{NULL, NULL, NULL, NULL}}}, {"key2-bin", "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d", 14, - {{NULL, NULL, NULL}}}}; + 0, + {{NULL, NULL, NULL, NULL}}}}; grpc_metadata meta_s[2] = { {"key3-bin", "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee", 15, - {{NULL, NULL, NULL}}}, + 0, + {{NULL, NULL, NULL, NULL}}}, {"key4-bin", "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff", 16, - {{NULL, NULL, NULL}}}}; + 0, + {{NULL, NULL, NULL, NULL}}}}; grpc_end2end_test_fixture f = begin_test( config, "test_request_response_with_metadata_and_payload", NULL, NULL); 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_call_details call_details; grpc_status_code status; + grpc_call_error error; char *details = NULL; size_t details_capacity = 0; int was_cancelled = 2; c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr", deadline); + "/foo", "foo.test.google.fr", deadline, NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -157,21 +163,26 @@ static void test_request_response_with_metadata_and_payload( op->data.send_initial_metadata.count = 2; op->data.send_initial_metadata.metadata = meta_c; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_SEND_MESSAGE; op->data.send_message = request_payload; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_RECV_INITIAL_METADATA; op->data.recv_initial_metadata = &initial_metadata_recv; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_RECV_MESSAGE; op->data.recv_message = &response_payload_recv; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; @@ -179,12 +190,15 @@ static void test_request_response_with_metadata_and_payload( op->data.recv_status_on_client.status_details = &details; op->data.recv_status_on_client.status_details_capacity = &details_capacity; op->flags = 0; + op->reserved = NULL; 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, &call_details, - &request_metadata_recv, f.cq, f.cq, tag(101))); + error = grpc_server_request_call(f.server, &s, &call_details, + &request_metadata_recv, f.cq, f.cq, + tag(101)); + GPR_ASSERT(GRPC_CALL_OK == error); cq_expect_completion(cqv, tag(101), 1); cq_verify(cqv); @@ -193,12 +207,15 @@ static void test_request_response_with_metadata_and_payload( op->data.send_initial_metadata.count = 2; op->data.send_initial_metadata.metadata = meta_s; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_RECV_MESSAGE; op->data.recv_message = &request_payload_recv; op->flags = 0; + op->reserved = NULL; 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_verify(cqv); @@ -207,18 +224,22 @@ static void test_request_response_with_metadata_and_payload( op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; op->data.recv_close_on_server.cancelled = &was_cancelled; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_SEND_MESSAGE; op->data.send_message = response_payload; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_SEND_STATUS_FROM_SERVER; op->data.send_status_from_server.trailing_metadata_count = 0; op->data.send_status_from_server.status = GRPC_STATUS_OK; op->data.send_status_from_server.status_details = "xyz"; op->flags = 0; + op->reserved = NULL; 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(1), 1); diff --git a/test/core/end2end/tests/request_response_with_metadata_and_payload.c b/test/core/end2end/tests/request_response_with_metadata_and_payload.c index 7e8cce10f4..b6196ab46e 100644 --- a/test/core/end2end/tests/request_response_with_metadata_and_payload.c +++ b/test/core/end2end/tests/request_response_with_metadata_and_payload.c @@ -68,7 +68,7 @@ static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); } static void drain_cq(grpc_completion_queue *cq) { grpc_event ev; 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); } @@ -76,7 +76,8 @@ static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; grpc_server_shutdown_and_notify(f->server, 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); grpc_server_destroy(f->server); f->server = NULL; @@ -109,10 +110,10 @@ static void test_request_response_with_metadata_and_payload( grpc_byte_buffer *response_payload = grpc_raw_byte_buffer_create(&response_payload_slice, 1); gpr_timespec deadline = five_seconds_time(); - grpc_metadata meta_c[2] = {{"key1", "val1", 4, {{NULL, NULL, NULL}}}, - {"key2", "val2", 4, {{NULL, NULL, NULL}}}}; - grpc_metadata meta_s[2] = {{"KeY3", "val3", 4, {{NULL, NULL, NULL}}}, - {"KeY4", "val4", 4, {{NULL, NULL, NULL}}}}; + grpc_metadata meta_c[2] = {{"key1", "val1", 4, 0, {{NULL, NULL, NULL, NULL}}}, + {"key2", "val2", 4, 0, {{NULL, NULL, NULL, NULL}}}}; + grpc_metadata meta_s[2] = {{"KeY3", "val3", 4, 0, {{NULL, NULL, NULL, NULL}}}, + {"KeY4", "val4", 4, 0, {{NULL, NULL, NULL, NULL}}}}; grpc_end2end_test_fixture f = begin_test( config, "test_request_response_with_metadata_and_payload", NULL, NULL); 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_call_details call_details; grpc_status_code status; + grpc_call_error error; char *details = NULL; size_t details_capacity = 0; int was_cancelled = 2; c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr", deadline); + "/foo", "foo.test.google.fr", deadline, NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -143,21 +145,26 @@ static void test_request_response_with_metadata_and_payload( op->data.send_initial_metadata.count = 2; op->data.send_initial_metadata.metadata = meta_c; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_SEND_MESSAGE; op->data.send_message = request_payload; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_RECV_INITIAL_METADATA; op->data.recv_initial_metadata = &initial_metadata_recv; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_RECV_MESSAGE; op->data.recv_message = &response_payload_recv; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; @@ -165,12 +172,15 @@ static void test_request_response_with_metadata_and_payload( op->data.recv_status_on_client.status_details = &details; op->data.recv_status_on_client.status_details_capacity = &details_capacity; op->flags = 0; + op->reserved = NULL; 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, &call_details, - &request_metadata_recv, f.cq, f.cq, tag(101))); + error = grpc_server_request_call(f.server, &s, &call_details, + &request_metadata_recv, f.cq, f.cq, + tag(101)); + GPR_ASSERT(GRPC_CALL_OK == error); cq_expect_completion(cqv, tag(101), 1); cq_verify(cqv); @@ -179,12 +189,15 @@ static void test_request_response_with_metadata_and_payload( op->data.send_initial_metadata.count = 2; op->data.send_initial_metadata.metadata = meta_s; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_RECV_MESSAGE; op->data.recv_message = &request_payload_recv; op->flags = 0; + op->reserved = NULL; 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_verify(cqv); @@ -193,18 +206,22 @@ static void test_request_response_with_metadata_and_payload( op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; op->data.recv_close_on_server.cancelled = &was_cancelled; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_SEND_MESSAGE; op->data.send_message = response_payload; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_SEND_STATUS_FROM_SERVER; op->data.send_status_from_server.trailing_metadata_count = 0; op->data.send_status_from_server.status = GRPC_STATUS_OK; op->data.send_status_from_server.status_details = "xyz"; op->flags = 0; + op->reserved = NULL; 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(1), 1); diff --git a/test/core/end2end/tests/request_response_with_payload.c b/test/core/end2end/tests/request_response_with_payload.c index 55323895fb..0a45a482a3 100644 --- a/test/core/end2end/tests/request_response_with_payload.c +++ b/test/core/end2end/tests/request_response_with_payload.c @@ -68,7 +68,7 @@ static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); } static void drain_cq(grpc_completion_queue *cq) { grpc_event ev; 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); } @@ -76,7 +76,8 @@ static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; grpc_server_shutdown_and_notify(f->server, 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); grpc_server_destroy(f->server); 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_call_details call_details; grpc_status_code status; + grpc_call_error error; char *details = NULL; size_t details_capacity = 0; int was_cancelled = 2; c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr", deadline); + "/foo", "foo.test.google.fr", deadline, NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -134,21 +136,26 @@ static void request_response_with_payload(grpc_end2end_test_fixture f) { op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_SEND_MESSAGE; op->data.send_message = request_payload; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_RECV_INITIAL_METADATA; op->data.recv_initial_metadata = &initial_metadata_recv; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_RECV_MESSAGE; op->data.recv_message = &response_payload_recv; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; @@ -156,12 +163,15 @@ static void request_response_with_payload(grpc_end2end_test_fixture f) { op->data.recv_status_on_client.status_details = &details; op->data.recv_status_on_client.status_details_capacity = &details_capacity; op->flags = 0; + op->reserved = NULL; 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, &call_details, - &request_metadata_recv, f.cq, f.cq, tag(101))); + error = grpc_server_request_call(f.server, &s, &call_details, + &request_metadata_recv, f.cq, f.cq, + tag(101)); + GPR_ASSERT(GRPC_CALL_OK == error); cq_expect_completion(cqv, tag(101), 1); cq_verify(cqv); @@ -169,12 +179,15 @@ static void request_response_with_payload(grpc_end2end_test_fixture f) { op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_RECV_MESSAGE; op->data.recv_message = &request_payload_recv; op->flags = 0; + op->reserved = NULL; 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_verify(cqv); @@ -183,18 +196,22 @@ static void request_response_with_payload(grpc_end2end_test_fixture f) { op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; op->data.recv_close_on_server.cancelled = &was_cancelled; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_SEND_MESSAGE; op->data.send_message = response_payload; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_SEND_STATUS_FROM_SERVER; op->data.send_status_from_server.trailing_metadata_count = 0; op->data.send_status_from_server.status = GRPC_STATUS_OK; op->data.send_status_from_server.status_details = "xyz"; op->flags = 0; + op->reserved = NULL; 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(1), 1); diff --git a/test/core/end2end/tests/request_response_with_payload_and_call_creds.c b/test/core/end2end/tests/request_response_with_payload_and_call_creds.c index 342dfa03f6..8e0bc4e2ae 100644 --- a/test/core/end2end/tests/request_response_with_payload_and_call_creds.c +++ b/test/core/end2end/tests/request_response_with_payload_and_call_creds.c @@ -86,7 +86,7 @@ static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); } static void drain_cq(grpc_completion_queue *cq) { grpc_event ev; 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); } @@ -94,7 +94,8 @@ static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; grpc_server_shutdown_and_notify(f->server, 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); grpc_server_destroy(f->server); f->server = NULL; @@ -139,7 +140,7 @@ static void test_call_creds_failure(grpc_end2end_test_config config) { begin_test(config, "test_call_creds_failure", 0); gpr_timespec deadline = five_seconds_time(); c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr", deadline); + "/foo", "foo.test.google.fr", deadline, NULL); GPR_ASSERT(c); /* Try with credentials unfit to be set on a call (channel creds). */ @@ -176,6 +177,7 @@ static void request_response_with_payload_and_call_creds( grpc_byte_buffer *response_payload_recv = NULL; grpc_call_details call_details; grpc_status_code status; + grpc_call_error error; char *details = NULL; size_t details_capacity = 0; int was_cancelled = 2; @@ -187,7 +189,7 @@ static void request_response_with_payload_and_call_creds( cqv = cq_verifier_create(f.cq); c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr", deadline); + "/foo", "foo.test.google.fr", deadline, NULL); GPR_ASSERT(c); creds = grpc_iam_credentials_create(iam_token, iam_selector); GPR_ASSERT(creds != NULL); @@ -217,21 +219,26 @@ static void request_response_with_payload_and_call_creds( op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_SEND_MESSAGE; op->data.send_message = request_payload; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_RECV_INITIAL_METADATA; op->data.recv_initial_metadata = &initial_metadata_recv; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_RECV_MESSAGE; op->data.recv_message = &response_payload_recv; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; @@ -239,12 +246,15 @@ static void request_response_with_payload_and_call_creds( op->data.recv_status_on_client.status_details = &details; op->data.recv_status_on_client.status_details_capacity = &details_capacity; op->flags = 0; + op->reserved = NULL; 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, &call_details, - &request_metadata_recv, f.cq, f.cq, tag(101))); + error = grpc_server_request_call(f.server, &s, &call_details, + &request_metadata_recv, f.cq, f.cq, + tag(101)); + GPR_ASSERT(GRPC_CALL_OK == error); cq_expect_completion(cqv, tag(101), 1); cq_verify(cqv); s_auth_context = grpc_call_auth_context(s); @@ -264,12 +274,15 @@ static void request_response_with_payload_and_call_creds( op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_RECV_MESSAGE; op->data.recv_message = &request_payload_recv; op->flags = 0; + op->reserved = NULL; 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_verify(cqv); @@ -278,18 +291,22 @@ static void request_response_with_payload_and_call_creds( op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; op->data.recv_close_on_server.cancelled = &was_cancelled; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_SEND_MESSAGE; op->data.send_message = response_payload; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_SEND_STATUS_FROM_SERVER; op->data.send_status_from_server.trailing_metadata_count = 0; op->data.send_status_from_server.status = GRPC_STATUS_OK; op->data.send_status_from_server.status_details = "xyz"; op->flags = 0; + op->reserved = NULL; 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(1), 1); @@ -389,6 +406,7 @@ static void test_request_with_server_rejecting_client_creds( grpc_metadata_array request_metadata_recv; grpc_call_details call_details; grpc_status_code status; + grpc_call_error error; char *details = NULL; size_t details_capacity = 0; grpc_byte_buffer *response_payload_recv = NULL; @@ -401,7 +419,7 @@ static void test_request_with_server_rejecting_client_creds( cqv = cq_verifier_create(f.cq); c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr", deadline); + "/foo", "foo.test.google.fr", deadline, NULL); GPR_ASSERT(c); creds = grpc_iam_credentials_create(iam_token, iam_selector); @@ -441,7 +459,8 @@ static void test_request_with_server_rejecting_client_creds( op->data.recv_message = &response_payload_recv; op->flags = 0; 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(error == GRPC_CALL_OK); cq_expect_completion(cqv, tag(1), 1); cq_verify(cqv); diff --git a/test/core/end2end/tests/request_response_with_trailing_metadata_and_payload.c b/test/core/end2end/tests/request_response_with_trailing_metadata_and_payload.c index 26be4ef643..83744a8e24 100644 --- a/test/core/end2end/tests/request_response_with_trailing_metadata_and_payload.c +++ b/test/core/end2end/tests/request_response_with_trailing_metadata_and_payload.c @@ -68,7 +68,7 @@ static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); } static void drain_cq(grpc_completion_queue *cq) { grpc_event ev; 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); } @@ -76,7 +76,8 @@ static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; grpc_server_shutdown_and_notify(f->server, 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); grpc_server_destroy(f->server); f->server = NULL; @@ -109,12 +110,12 @@ static void test_request_response_with_metadata_and_payload( grpc_byte_buffer *response_payload = grpc_raw_byte_buffer_create(&response_payload_slice, 1); gpr_timespec deadline = five_seconds_time(); - grpc_metadata meta_c[2] = {{"key1", "val1", 4, {{NULL, NULL, NULL}}}, - {"key2", "val2", 4, {{NULL, NULL, NULL}}}}; - grpc_metadata meta_s[2] = {{"key3", "val3", 4, {{NULL, NULL, NULL}}}, - {"key4", "val4", 4, {{NULL, NULL, NULL}}}}; - grpc_metadata meta_t[2] = {{"key5", "val5", 4, {{NULL, NULL, NULL}}}, - {"key6", "val6", 4, {{NULL, NULL, NULL}}}}; + grpc_metadata meta_c[2] = {{"key1", "val1", 4, 0, {{NULL, NULL, NULL, NULL}}}, + {"key2", "val2", 4, 0, {{NULL, NULL, NULL, NULL}}}}; + grpc_metadata meta_s[2] = {{"key3", "val3", 4, 0, {{NULL, NULL, NULL, NULL}}}, + {"key4", "val4", 4, 0, {{NULL, NULL, NULL, NULL}}}}; + grpc_metadata meta_t[2] = {{"key5", "val5", 4, 0, {{NULL, NULL, NULL, NULL}}}, + {"key6", "val6", 4, 0, {{NULL, NULL, NULL, NULL}}}}; grpc_end2end_test_fixture f = begin_test( config, "test_request_response_with_metadata_and_payload", NULL, NULL); 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_call_details call_details; grpc_status_code status; + grpc_call_error error; char *details = NULL; size_t details_capacity = 0; int was_cancelled = 2; c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr", deadline); + "/foo", "foo.test.google.fr", deadline, NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -145,21 +147,26 @@ static void test_request_response_with_metadata_and_payload( op->data.send_initial_metadata.count = 2; op->data.send_initial_metadata.metadata = meta_c; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_SEND_MESSAGE; op->data.send_message = request_payload; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_RECV_INITIAL_METADATA; op->data.recv_initial_metadata = &initial_metadata_recv; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_RECV_MESSAGE; op->data.recv_message = &response_payload_recv; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; @@ -167,12 +174,15 @@ static void test_request_response_with_metadata_and_payload( op->data.recv_status_on_client.status_details = &details; op->data.recv_status_on_client.status_details_capacity = &details_capacity; op->flags = 0; + op->reserved = NULL; 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, &call_details, - &request_metadata_recv, f.cq, f.cq, tag(101))); + error = grpc_server_request_call(f.server, &s, &call_details, + &request_metadata_recv, f.cq, f.cq, + tag(101)); + GPR_ASSERT(GRPC_CALL_OK == error); cq_expect_completion(cqv, tag(101), 1); cq_verify(cqv); @@ -181,12 +191,15 @@ static void test_request_response_with_metadata_and_payload( op->data.send_initial_metadata.count = 2; op->data.send_initial_metadata.metadata = meta_s; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_RECV_MESSAGE; op->data.recv_message = &request_payload_recv; op->flags = 0; + op->reserved = NULL; 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_verify(cqv); @@ -195,10 +208,12 @@ static void test_request_response_with_metadata_and_payload( op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; op->data.recv_close_on_server.cancelled = &was_cancelled; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_SEND_MESSAGE; op->data.send_message = response_payload; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_SEND_STATUS_FROM_SERVER; op->data.send_status_from_server.trailing_metadata_count = 2; @@ -206,8 +221,10 @@ static void test_request_response_with_metadata_and_payload( op->data.send_status_from_server.status = GRPC_STATUS_OK; op->data.send_status_from_server.status_details = "xyz"; op->flags = 0; + op->reserved = NULL; 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(1), 1); diff --git a/test/core/end2end/tests/request_with_compressed_payload.c b/test/core/end2end/tests/request_with_compressed_payload.c index fe6014a42a..cb8b3381d6 100644 --- a/test/core/end2end/tests/request_with_compressed_payload.c +++ b/test/core/end2end/tests/request_with_compressed_payload.c @@ -73,7 +73,7 @@ static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); } static void drain_cq(grpc_completion_queue *cq) { grpc_event ev; 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); } @@ -81,7 +81,8 @@ static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; grpc_server_shutdown_and_notify(f->server, 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); grpc_server_destroy(f->server); f->server = NULL; @@ -124,6 +125,7 @@ static void request_with_payload_template( grpc_byte_buffer *request_payload_recv = NULL; grpc_call_details call_details; grpc_status_code status; + grpc_call_error error; char *details = NULL; size_t details_capacity = 0; int was_cancelled = 2; @@ -143,7 +145,7 @@ static void request_with_payload_template( cqv = cq_verifier_create(f.cq); c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr", deadline); + "/foo", "foo.test.google.fr", deadline, NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -160,17 +162,21 @@ static void request_with_payload_template( op->data.send_initial_metadata.count = 0; } op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_SEND_MESSAGE; op->data.send_message = request_payload; op->flags = send_flags_bitmask; + op->reserved = NULL; op++; op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_RECV_INITIAL_METADATA; op->data.recv_initial_metadata = &initial_metadata_recv; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; @@ -178,13 +184,15 @@ static void request_with_payload_template( op->data.recv_status_on_client.status_details = &details; op->data.recv_status_on_client.status_details_capacity = &details_capacity; op->flags = 0; + op->reserved = NULL; 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, &call_details, - &request_metadata_recv, f.cq, - f.cq, tag(101))); + error = grpc_server_request_call(f.server, &s, &call_details, + &request_metadata_recv, f.cq, + f.cq, tag(101)); + GPR_ASSERT(GRPC_CALL_OK == error); cq_expect_completion(cqv, tag(101), 1); cq_verify(cqv); @@ -200,12 +208,15 @@ static void request_with_payload_template( op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_RECV_MESSAGE; op->data.recv_message = &request_payload_recv; op->flags = 0; + op->reserved = NULL; 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_verify(cqv); @@ -214,14 +225,17 @@ static void request_with_payload_template( op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; op->data.recv_close_on_server.cancelled = &was_cancelled; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_SEND_STATUS_FROM_SERVER; op->data.send_status_from_server.trailing_metadata_count = 0; op->data.send_status_from_server.status = GRPC_STATUS_OK; op->data.send_status_from_server.status_details = "xyz"; op->flags = 0; + op->reserved = NULL; 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(1), 1); @@ -295,12 +309,12 @@ static void test_invoke_request_with_compressed_payload_md_override( sizeof(gzip_compression_override.internal_data)); none_compression_override.key = GRPC_COMPRESS_REQUEST_ALGORITHM_KEY; - none_compression_override.value = "none"; + none_compression_override.value = "identity"; none_compression_override.value_length = 4; memset(&none_compression_override.internal_data, 0, sizeof(none_compression_override.internal_data)); - /* Channel default NONE, call override to GZIP */ + /* Channel default NONE (aka IDENTITY), call override to GZIP */ request_with_payload_template( config, "test_invoke_request_with_compressed_payload_md_override_1", 0, GRPC_COMPRESS_NONE, GRPC_COMPRESS_GZIP, &gzip_compression_override); @@ -310,7 +324,7 @@ static void test_invoke_request_with_compressed_payload_md_override( config, "test_invoke_request_with_compressed_payload_md_override_2", 0, GRPC_COMPRESS_DEFLATE, GRPC_COMPRESS_GZIP, &gzip_compression_override); - /* Channel default DEFLATE, call override to NONE */ + /* Channel default DEFLATE, call override to NONE (aka IDENTITY) */ request_with_payload_template( config, "test_invoke_request_with_compressed_payload_md_override_3", 0, GRPC_COMPRESS_DEFLATE, GRPC_COMPRESS_NONE, &none_compression_override); diff --git a/test/core/end2end/tests/request_with_flags.c b/test/core/end2end/tests/request_with_flags.c index 37c4825c8b..3255f14457 100644 --- a/test/core/end2end/tests/request_with_flags.c +++ b/test/core/end2end/tests/request_with_flags.c @@ -69,7 +69,7 @@ static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); } static void drain_cq(grpc_completion_queue *cq) { grpc_event ev; 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); } @@ -77,7 +77,8 @@ static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; grpc_server_shutdown_and_notify(f->server, 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); grpc_server_destroy(f->server); f->server = NULL; @@ -117,12 +118,13 @@ static void test_invoke_request_with_flags( grpc_byte_buffer *request_payload_recv = NULL; grpc_call_details call_details; grpc_status_code status; + grpc_call_error error; char *details = NULL; size_t details_capacity = 0; grpc_call_error expectation; c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr", deadline); + "/foo", "foo.test.google.fr", deadline, NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -134,17 +136,21 @@ static void test_invoke_request_with_flags( op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; op->flags = flags_for_op[op->op]; + op->reserved = NULL; op++; op->op = GRPC_OP_SEND_MESSAGE; op->data.send_message = request_payload; op->flags = flags_for_op[op->op]; + op->reserved = NULL; op++; op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; op->flags = flags_for_op[op->op]; + op->reserved = NULL; op++; op->op = GRPC_OP_RECV_INITIAL_METADATA; op->data.recv_initial_metadata = &initial_metadata_recv; op->flags = flags_for_op[op->op]; + op->reserved = NULL; op++; op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; @@ -152,9 +158,11 @@ static void test_invoke_request_with_flags( op->data.recv_status_on_client.status_details = &details; op->data.recv_status_on_client.status_details_capacity = &details_capacity; op->flags = flags_for_op[op->op]; + op->reserved = NULL; op++; 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) { cq_expect_completion(cqv, tag(1), 1); diff --git a/test/core/end2end/tests/request_with_large_metadata.c b/test/core/end2end/tests/request_with_large_metadata.c index 9ea8273ab0..5b43caf18c 100644 --- a/test/core/end2end/tests/request_with_large_metadata.c +++ b/test/core/end2end/tests/request_with_large_metadata.c @@ -68,7 +68,7 @@ static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); } static void drain_cq(grpc_completion_queue *cq) { grpc_event ev; 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); } @@ -76,7 +76,8 @@ static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; grpc_server_shutdown_and_notify(f->server, 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); grpc_server_destroy(f->server); 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_call_details call_details; grpc_status_code status; + grpc_call_error error; char *details = NULL; size_t details_capacity = 0; int was_cancelled = 2; const int large_size = 64 * 1024; c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr", deadline); + "/foo", "foo.test.google.fr", deadline, NULL); GPR_ASSERT(c); meta.key = "key"; @@ -142,17 +144,21 @@ static void test_request_with_large_metadata(grpc_end2end_test_config config) { op->data.send_initial_metadata.count = 1; op->data.send_initial_metadata.metadata = &meta; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_SEND_MESSAGE; op->data.send_message = request_payload; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_RECV_INITIAL_METADATA; op->data.recv_initial_metadata = &initial_metadata_recv; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; @@ -160,12 +166,15 @@ static void test_request_with_large_metadata(grpc_end2end_test_config config) { op->data.recv_status_on_client.status_details = &details; op->data.recv_status_on_client.status_details_capacity = &details_capacity; op->flags = 0; + op->reserved = NULL; 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, &call_details, - &request_metadata_recv, f.cq, f.cq, tag(101))); + error = grpc_server_request_call(f.server, &s, &call_details, + &request_metadata_recv, f.cq, f.cq, + tag(101)); + GPR_ASSERT(GRPC_CALL_OK == error); cq_expect_completion(cqv, tag(101), 1); cq_verify(cqv); @@ -173,12 +182,15 @@ static void test_request_with_large_metadata(grpc_end2end_test_config config) { op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_RECV_MESSAGE; op->data.recv_message = &request_payload_recv; op->flags = 0; + op->reserved = NULL; 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_verify(cqv); @@ -187,14 +199,17 @@ static void test_request_with_large_metadata(grpc_end2end_test_config config) { op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; op->data.recv_close_on_server.cancelled = &was_cancelled; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_SEND_STATUS_FROM_SERVER; op->data.send_status_from_server.trailing_metadata_count = 0; op->data.send_status_from_server.status = GRPC_STATUS_OK; op->data.send_status_from_server.status_details = "xyz"; op->flags = 0; + op->reserved = NULL; 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(1), 1); diff --git a/test/core/end2end/tests/request_with_payload.c b/test/core/end2end/tests/request_with_payload.c index 6b5f173f01..c0013fb60f 100644 --- a/test/core/end2end/tests/request_with_payload.c +++ b/test/core/end2end/tests/request_with_payload.c @@ -68,7 +68,7 @@ static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); } static void drain_cq(grpc_completion_queue *cq) { grpc_event ev; 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); } @@ -76,7 +76,8 @@ static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; grpc_server_shutdown_and_notify(f->server, 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); grpc_server_destroy(f->server); 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_call_details call_details; grpc_status_code status; + grpc_call_error error; char *details = NULL; size_t details_capacity = 0; int was_cancelled = 2; c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr", deadline); + "/foo", "foo.test.google.fr", deadline, NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -133,17 +135,21 @@ static void test_invoke_request_with_payload(grpc_end2end_test_config config) { op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_SEND_MESSAGE; op->data.send_message = request_payload; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_RECV_INITIAL_METADATA; op->data.recv_initial_metadata = &initial_metadata_recv; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; @@ -151,8 +157,10 @@ static void test_invoke_request_with_payload(grpc_end2end_test_config config) { op->data.recv_status_on_client.status_details = &details; op->data.recv_status_on_client.status_details_capacity = &details_capacity; op->flags = 0; + op->reserved = NULL; 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, &call_details, @@ -164,12 +172,15 @@ static void test_invoke_request_with_payload(grpc_end2end_test_config config) { op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_RECV_MESSAGE; op->data.recv_message = &request_payload_recv; op->flags = 0; + op->reserved = NULL; 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_verify(cqv); @@ -178,14 +189,17 @@ static void test_invoke_request_with_payload(grpc_end2end_test_config config) { op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; op->data.recv_close_on_server.cancelled = &was_cancelled; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_SEND_STATUS_FROM_SERVER; op->data.send_status_from_server.trailing_metadata_count = 0; op->data.send_status_from_server.status = GRPC_STATUS_OK; op->data.send_status_from_server.status_details = "xyz"; op->flags = 0; + op->reserved = NULL; 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(1), 1); diff --git a/test/core/end2end/tests/server_finishes_request.c b/test/core/end2end/tests/server_finishes_request.c index 661c099d93..ab2f575263 100644 --- a/test/core/end2end/tests/server_finishes_request.c +++ b/test/core/end2end/tests/server_finishes_request.c @@ -70,7 +70,7 @@ static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); } static void drain_cq(grpc_completion_queue *cq) { grpc_event ev; 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); } @@ -78,7 +78,8 @@ static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; grpc_server_shutdown_and_notify(f->server, 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); grpc_server_destroy(f->server); f->server = NULL; @@ -111,12 +112,14 @@ static void simple_request_body(grpc_end2end_test_fixture f) { grpc_metadata_array request_metadata_recv; grpc_call_details call_details; grpc_status_code status; + grpc_call_error error; char *details = NULL; size_t details_capacity = 0; int was_cancelled = 2; c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr:1234", deadline); + "/foo", "foo.test.google.fr:1234", deadline, + NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -128,10 +131,12 @@ static void simple_request_body(grpc_end2end_test_fixture f) { op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_RECV_INITIAL_METADATA; op->data.recv_initial_metadata = &initial_metadata_recv; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; @@ -139,12 +144,15 @@ static void simple_request_body(grpc_end2end_test_fixture f) { op->data.recv_status_on_client.status_details = &details; op->data.recv_status_on_client.status_details_capacity = &details_capacity; op->flags = 0; + op->reserved = NULL; 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, &call_details, - &request_metadata_recv, f.cq, f.cq, tag(101))); + error = grpc_server_request_call(f.server, &s, &call_details, + &request_metadata_recv, f.cq, f.cq, + tag(101)); + GPR_ASSERT(GRPC_CALL_OK == error); cq_expect_completion(cqv, tag(101), 1); cq_verify(cqv); @@ -152,18 +160,22 @@ static void simple_request_body(grpc_end2end_test_fixture f) { op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_SEND_STATUS_FROM_SERVER; op->data.send_status_from_server.trailing_metadata_count = 0; op->data.send_status_from_server.status = GRPC_STATUS_UNIMPLEMENTED; op->data.send_status_from_server.status_details = "xyz"; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; op->data.recv_close_on_server.cancelled = &was_cancelled; op->flags = 0; + op->reserved = NULL; 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(1), 1); diff --git a/test/core/end2end/tests/simple_delayed_request.c b/test/core/end2end/tests/simple_delayed_request.c index 82d2bf9657..277aa2596e 100644 --- a/test/core/end2end/tests/simple_delayed_request.c +++ b/test/core/end2end/tests/simple_delayed_request.c @@ -56,7 +56,7 @@ static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); } static void drain_cq(grpc_completion_queue *cq) { grpc_event ev; 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); } @@ -64,7 +64,8 @@ static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; grpc_server_shutdown_and_notify(f->server, 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); grpc_server_destroy(f->server); 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_call_details call_details; grpc_status_code status; + grpc_call_error error; char *details = NULL; size_t details_capacity = 0; 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); c = grpc_channel_create_call(f->client, NULL, GRPC_PROPAGATE_DEFAULTS, f->cq, - "/foo", "foo.test.google.fr", deadline); + "/foo", "foo.test.google.fr", deadline, NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -120,13 +122,16 @@ static void simple_delayed_request_body(grpc_end2end_test_config config, op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_RECV_INITIAL_METADATA; op->data.recv_initial_metadata = &initial_metadata_recv; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; @@ -134,15 +139,17 @@ static void simple_delayed_request_body(grpc_end2end_test_config config, op->data.recv_status_on_client.status_details = &details; op->data.recv_status_on_client.status_details_capacity = &details_capacity; op->flags = 0; + op->reserved = NULL; 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); - GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call(f->server, &s, - &call_details, - &request_metadata_recv, - f->cq, f->cq, tag(101))); + error = grpc_server_request_call(f->server, &s, &call_details, + &request_metadata_recv, f->cq, f->cq, + tag(101)); + GPR_ASSERT(GRPC_CALL_OK == error); cq_expect_completion(cqv, tag(101), 1); cq_verify(cqv); @@ -150,18 +157,22 @@ static void simple_delayed_request_body(grpc_end2end_test_config config, op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_SEND_STATUS_FROM_SERVER; op->data.send_status_from_server.trailing_metadata_count = 0; op->data.send_status_from_server.status = GRPC_STATUS_UNIMPLEMENTED; op->data.send_status_from_server.status_details = "xyz"; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; op->data.recv_close_on_server.cancelled = &was_cancelled; op->flags = 0; + op->reserved = NULL; 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(1), 1); diff --git a/test/core/end2end/tests/simple_request.c b/test/core/end2end/tests/simple_request.c index d60a63e682..d3d2f27560 100644 --- a/test/core/end2end/tests/simple_request.c +++ b/test/core/end2end/tests/simple_request.c @@ -70,7 +70,7 @@ static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); } static void drain_cq(grpc_completion_queue *cq) { grpc_event ev; 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); } @@ -78,7 +78,8 @@ static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; grpc_server_shutdown_and_notify(f->server, 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); grpc_server_destroy(f->server); f->server = NULL; @@ -111,13 +112,15 @@ static void simple_request_body(grpc_end2end_test_fixture f) { grpc_metadata_array request_metadata_recv; grpc_call_details call_details; grpc_status_code status; + grpc_call_error error; char *details = NULL; size_t details_capacity = 0; int was_cancelled = 2; char *peer; c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr:1234", deadline); + "/foo", "foo.test.google.fr:1234", deadline, + NULL); GPR_ASSERT(c); peer = grpc_call_get_peer(c); @@ -134,13 +137,16 @@ static void simple_request_body(grpc_end2end_test_fixture f) { op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_RECV_INITIAL_METADATA; op->data.recv_initial_metadata = &initial_metadata_recv; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; @@ -148,12 +154,15 @@ static void simple_request_body(grpc_end2end_test_fixture f) { op->data.recv_status_on_client.status_details = &details; op->data.recv_status_on_client.status_details_capacity = &details_capacity; op->flags = 0; + op->reserved = NULL; 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, &call_details, - &request_metadata_recv, f.cq, f.cq, tag(101))); + error = grpc_server_request_call(f.server, &s, &call_details, + &request_metadata_recv, f.cq, f.cq, + tag(101)); + GPR_ASSERT(GRPC_CALL_OK == error); cq_expect_completion(cqv, tag(101), 1); cq_verify(cqv); @@ -170,18 +179,22 @@ static void simple_request_body(grpc_end2end_test_fixture f) { op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_SEND_STATUS_FROM_SERVER; op->data.send_status_from_server.trailing_metadata_count = 0; op->data.send_status_from_server.status = GRPC_STATUS_UNIMPLEMENTED; op->data.send_status_from_server.status_details = "xyz"; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; op->data.recv_close_on_server.cancelled = &was_cancelled; op->flags = 0; + op->reserved = NULL; 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(1), 1); diff --git a/test/core/end2end/tests/simple_request_with_high_initial_sequence_number.c b/test/core/end2end/tests/simple_request_with_high_initial_sequence_number.c index 2244e22416..4fc206cbfc 100644 --- a/test/core/end2end/tests/simple_request_with_high_initial_sequence_number.c +++ b/test/core/end2end/tests/simple_request_with_high_initial_sequence_number.c @@ -70,7 +70,7 @@ static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); } static void drain_cq(grpc_completion_queue *cq) { grpc_event ev; 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); } @@ -78,7 +78,8 @@ static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; grpc_server_shutdown_and_notify(f->server, 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); grpc_server_destroy(f->server); f->server = NULL; @@ -111,12 +112,14 @@ static void simple_request_body(grpc_end2end_test_fixture f) { grpc_metadata_array request_metadata_recv; grpc_call_details call_details; grpc_status_code status; + grpc_call_error error; char *details = NULL; size_t details_capacity = 0; int was_cancelled = 2; c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr:1234", deadline); + "/foo", "foo.test.google.fr:1234", deadline, + NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -128,13 +131,16 @@ static void simple_request_body(grpc_end2end_test_fixture f) { op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_RECV_INITIAL_METADATA; op->data.recv_initial_metadata = &initial_metadata_recv; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; @@ -142,12 +148,15 @@ static void simple_request_body(grpc_end2end_test_fixture f) { op->data.recv_status_on_client.status_details = &details; op->data.recv_status_on_client.status_details_capacity = &details_capacity; op->flags = 0; + op->reserved = NULL; 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, &call_details, - &request_metadata_recv, f.cq, f.cq, tag(101))); + error = grpc_server_request_call(f.server, &s, &call_details, + &request_metadata_recv, f.cq, f.cq, + tag(101)); + GPR_ASSERT(GRPC_CALL_OK == error); cq_expect_completion(cqv, tag(101), 1); cq_verify(cqv); @@ -155,18 +164,22 @@ static void simple_request_body(grpc_end2end_test_fixture f) { op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_SEND_STATUS_FROM_SERVER; op->data.send_status_from_server.trailing_metadata_count = 0; op->data.send_status_from_server.status = GRPC_STATUS_UNIMPLEMENTED; op->data.send_status_from_server.status_details = "xyz"; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; op->data.recv_close_on_server.cancelled = &was_cancelled; op->flags = 0; + op->reserved = NULL; 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(1), 1); diff --git a/test/core/fling/client.c b/test/core/fling/client.c index 17b737c9dd..54c9274510 100644 --- a/test/core/fling/client.c +++ b/test/core/fling/client.c @@ -91,24 +91,25 @@ static void init_ping_pong_request(void) { static void step_ping_pong_request(void) { call = grpc_channel_create_call(channel, NULL, GRPC_PROPAGATE_DEFAULTS, cq, "/Reflector/reflectUnary", "localhost", - gpr_inf_future(GPR_CLOCK_REALTIME)); + gpr_inf_future(GPR_CLOCK_REALTIME), NULL); GPR_ASSERT(GRPC_CALL_OK == - grpc_call_start_batch(call, ops, op - ops, (void *)1)); - grpc_completion_queue_next(cq, 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), NULL); grpc_call_destroy(call); grpc_byte_buffer_destroy(response_payload_recv); call = NULL; } static void init_ping_pong_stream(void) { + grpc_call_error error; call = grpc_channel_create_call(channel, NULL, GRPC_PROPAGATE_DEFAULTS, cq, "/Reflector/reflectStream", "localhost", - gpr_inf_future(GPR_CLOCK_REALTIME)); + gpr_inf_future(GPR_CLOCK_REALTIME), NULL); stream_init_op.op = GRPC_OP_SEND_INITIAL_METADATA; stream_init_op.data.send_initial_metadata.count = 0; - GPR_ASSERT(GRPC_CALL_OK == - grpc_call_start_batch(call, &stream_init_op, 1, (void *)1)); - grpc_completion_queue_next(cq, gpr_inf_future(GPR_CLOCK_REALTIME)); + error = grpc_call_start_batch(call, &stream_init_op, 1, (void *)1, NULL); + GPR_ASSERT(GRPC_CALL_OK == error); + grpc_completion_queue_next(cq, gpr_inf_future(GPR_CLOCK_REALTIME), NULL); grpc_metadata_array_init(&initial_metadata_recv); @@ -119,9 +120,10 @@ static void init_ping_pong_stream(void) { } static void step_ping_pong_stream(void) { - GPR_ASSERT(GRPC_CALL_OK == - grpc_call_start_batch(call, stream_step_ops, 2, (void *)1)); - grpc_completion_queue_next(cq, gpr_inf_future(GPR_CLOCK_REALTIME)); + grpc_call_error error; + error = grpc_call_start_batch(call, stream_step_ops, 2, (void *)1, NULL); + 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); } @@ -152,6 +154,7 @@ int main(int argc, char **argv) { int secure = 0; char *target = "localhost:443"; gpr_cmdline *cl; + grpc_event event; char *scenario_name = "ping-pong-request"; scenario sc = {NULL, NULL, NULL}; @@ -183,8 +186,8 @@ int main(int argc, char **argv) { return 1; } - channel = grpc_insecure_channel_create(target, NULL); - cq = grpc_completion_queue_create(); + channel = grpc_insecure_channel_create(target, NULL, NULL); + cq = grpc_completion_queue_create(NULL); the_buffer = grpc_raw_byte_buffer_create(&slice, payload_size); histogram = gpr_histogram_create(0.01, 60e9); @@ -210,9 +213,10 @@ int main(int argc, char **argv) { grpc_channel_destroy(channel); grpc_completion_queue_shutdown(cq); - while (grpc_completion_queue_next(cq, gpr_inf_future(GPR_CLOCK_REALTIME)) - .type != GRPC_QUEUE_SHUTDOWN) - ; + do { + 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_byte_buffer_destroy(the_buffer); gpr_slice_unref(slice); diff --git a/test/core/fling/server.c b/test/core/fling/server.c index f445c68178..2873e4af4b 100644 --- a/test/core/fling/server.c +++ b/test/core/fling/server.c @@ -97,6 +97,7 @@ static void request_call(void) { static void handle_unary_method(void) { grpc_op *op; + grpc_call_error error; 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++; - GPR_ASSERT(GRPC_CALL_OK == - grpc_call_start_batch(call, unary_ops, op - unary_ops, - tag(FLING_SERVER_BATCH_OPS_FOR_UNARY))); + error = grpc_call_start_batch(call, unary_ops, op - unary_ops, + tag(FLING_SERVER_BATCH_OPS_FOR_UNARY), NULL); + GPR_ASSERT(GRPC_CALL_OK == error); } 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); metadata_send_op.op = GRPC_OP_SEND_INITIAL_METADATA; metadata_send_op.data.send_initial_metadata.count = 0; - GPR_ASSERT(GRPC_CALL_OK == - grpc_call_start_batch( - call, &metadata_send_op, 1, - tag(FLING_SERVER_SEND_INIT_METADATA_FOR_STREAMING))); + error = grpc_call_start_batch(call, &metadata_send_op, 1, tagarg, NULL); + + GPR_ASSERT(GRPC_CALL_OK == error); } static void start_read_op(int t) { + grpc_call_error error; /* Starting read at server */ read_op.op = GRPC_OP_RECV_MESSAGE; 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) { + grpc_call_error error; + void *tagarg = tag(FLING_SERVER_WRITE_FOR_STREAMING); /* Starting write at server */ write_op.op = GRPC_OP_SEND_MESSAGE; if (payload_buffer == NULL) { gpr_log(GPR_INFO, "NULL payload buffer !!!"); } write_op.data.send_message = payload_buffer; - GPR_ASSERT(GRPC_CALL_OK == - grpc_call_start_batch(call, &write_op, 1, - tag(FLING_SERVER_WRITE_FOR_STREAMING))); + error = grpc_call_start_batch(call, &write_op, 1, tagarg, NULL); + GPR_ASSERT(GRPC_CALL_OK == error); } 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].data.send_status_from_server.status = GRPC_STATUS_OK; 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].data.recv_close_on_server.cancelled = &was_cancelled; - GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch( - call, status_op, 2, - tag(FLING_SERVER_SEND_STATUS_FOR_STREAMING))); + error = grpc_call_start_batch(call, status_op, 2, tagarg, NULL); + GPR_ASSERT(GRPC_CALL_OK == error); } /* 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); - cq = grpc_completion_queue_create(); + cq = grpc_completion_queue_create(NULL); if (secure) { grpc_ssl_pem_key_cert_pair pem_key_cert_pair = {test_server1_key, test_server1_cert}; grpc_server_credentials *ssl_creds = grpc_ssl_server_credentials_create(NULL, &pem_key_cert_pair, 1, 0); - server = grpc_server_create(NULL); + server = grpc_server_create(NULL, NULL); GPR_ASSERT(grpc_server_add_secure_http2_port(server, addr, ssl_creds)); grpc_server_credentials_release(ssl_creds); } else { - server = grpc_server_create(NULL); + server = grpc_server_create(NULL, NULL); GPR_ASSERT(grpc_server_add_insecure_http2_port(server, addr)); } - grpc_server_register_completion_queue(server, cq); + grpc_server_register_completion_queue(server, cq, NULL); grpc_server_start(server); gpr_free(addr_buf); @@ -235,14 +241,14 @@ int main(int argc, char **argv) { gpr_log(GPR_INFO, "Shutting down due to SIGINT"); grpc_server_shutdown_and_notify(server, cq, tag(1000)); 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); grpc_completion_queue_shutdown(cq); shutdown_started = 1; } ev = grpc_completion_queue_next( 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; switch (ev.type) { case GRPC_OP_COMPLETE: diff --git a/test/core/iomgr/udp_server_test.c b/test/core/iomgr/udp_server_test.c new file mode 100644 index 0000000000..74b78958b0 --- /dev/null +++ b/test/core/iomgr/udp_server_test.c @@ -0,0 +1,178 @@ +/* + * + * Copyright 2015, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "src/core/iomgr/udp_server.h" +#include "src/core/iomgr/iomgr.h" +#include <grpc/support/log.h> +#include <grpc/support/sync.h> +#include <grpc/support/time.h> +#include "test/core/util/test_config.h" + +#include <sys/socket.h> +#include <netinet/in.h> +#include <string.h> +#include <unistd.h> + +#define LOG_TEST(x) gpr_log(GPR_INFO, "%s", #x) + +static grpc_pollset g_pollset; +static int g_number_of_reads = 0; +static int g_number_of_bytes_read = 0; + +static void on_connect(void *arg, grpc_endpoint *udp) { +} + +static void on_read(int fd, grpc_udp_server_cb new_transport_cb, void *cb_arg) { + char read_buffer[512]; + int byte_count; + + gpr_mu_lock(GRPC_POLLSET_MU(&g_pollset)); + byte_count = recv(fd, read_buffer, sizeof(read_buffer), 0); + + g_number_of_reads++; + g_number_of_bytes_read += byte_count; + + grpc_pollset_kick(&g_pollset, NULL); + gpr_mu_unlock(GRPC_POLLSET_MU(&g_pollset)); +} + +static void test_no_op(void) { + grpc_udp_server *s = grpc_udp_server_create(); + grpc_udp_server_destroy(s, NULL, NULL); +} + +static void test_no_op_with_start(void) { + grpc_udp_server *s = grpc_udp_server_create(); + LOG_TEST("test_no_op_with_start"); + grpc_udp_server_start(s, NULL, 0, on_connect, NULL); + grpc_udp_server_destroy(s, NULL, NULL); +} + +static void test_no_op_with_port(void) { + struct sockaddr_in addr; + grpc_udp_server *s = grpc_udp_server_create(); + LOG_TEST("test_no_op_with_port"); + + memset(&addr, 0, sizeof(addr)); + addr.sin_family = AF_INET; + GPR_ASSERT(grpc_udp_server_add_port(s, (struct sockaddr *)&addr, sizeof(addr), + on_read)); + + grpc_udp_server_destroy(s, NULL, NULL); +} + +static void test_no_op_with_port_and_start(void) { + struct sockaddr_in addr; + grpc_udp_server *s = grpc_udp_server_create(); + LOG_TEST("test_no_op_with_port_and_start"); + + memset(&addr, 0, sizeof(addr)); + addr.sin_family = AF_INET; + GPR_ASSERT(grpc_udp_server_add_port(s, (struct sockaddr *)&addr, sizeof(addr), + on_read)); + + grpc_udp_server_start(s, NULL, 0, on_connect, NULL); + + grpc_udp_server_destroy(s, NULL, NULL); +} + +static void test_receive(int number_of_clients) { + struct sockaddr_storage addr; + socklen_t addr_len = sizeof(addr); + int clifd, svrfd; + grpc_udp_server *s = grpc_udp_server_create(); + int i; + int number_of_reads_before; + gpr_timespec deadline; + grpc_pollset *pollsets[1]; + LOG_TEST("test_receive"); + gpr_log(GPR_INFO, "clients=%d", number_of_clients); + + g_number_of_bytes_read = 0; + + memset(&addr, 0, sizeof(addr)); + addr.ss_family = AF_INET; + GPR_ASSERT(grpc_udp_server_add_port(s, (struct sockaddr *)&addr, addr_len, on_read)); + + svrfd = grpc_udp_server_get_fd(s, 0); + GPR_ASSERT(svrfd >= 0); + GPR_ASSERT(getsockname(svrfd, (struct sockaddr *)&addr, &addr_len) == 0); + GPR_ASSERT(addr_len <= sizeof(addr)); + + pollsets[0] = &g_pollset; + grpc_udp_server_start(s, pollsets, 1, on_connect, NULL); + + gpr_mu_lock(GRPC_POLLSET_MU(&g_pollset)); + + for (i = 0; i < number_of_clients; i++) { + deadline = GRPC_TIMEOUT_SECONDS_TO_DEADLINE(4000); + + number_of_reads_before = g_number_of_reads; + /* Create a socket, send a packet to the UDP server. */ + clifd = socket(addr.ss_family, SOCK_DGRAM, 0); + GPR_ASSERT(clifd >= 0); + GPR_ASSERT(connect(clifd, (struct sockaddr *)&addr, addr_len) == 0); + GPR_ASSERT(5 == write(clifd, "hello", 5)); + while (g_number_of_reads == number_of_reads_before && + gpr_time_cmp(deadline, gpr_now(deadline.clock_type)) > 0) { + grpc_pollset_worker worker; + grpc_pollset_work(&g_pollset, &worker, deadline); + } + GPR_ASSERT(g_number_of_reads == number_of_reads_before + 1); + close(clifd); + } + GPR_ASSERT(g_number_of_bytes_read == 5 * number_of_clients); + + gpr_mu_unlock(GRPC_POLLSET_MU(&g_pollset)); + + grpc_udp_server_destroy(s, NULL, NULL); +} + +static void destroy_pollset(void *p) { grpc_pollset_destroy(p); } + +int main(int argc, char **argv) { + grpc_test_init(argc, argv); + grpc_iomgr_init(); + grpc_pollset_init(&g_pollset); + + test_no_op(); + test_no_op_with_start(); + test_no_op_with_port(); + test_no_op_with_port_and_start(); + test_receive(1); + test_receive(10); + + grpc_pollset_shutdown(&g_pollset, destroy_pollset, &g_pollset); + grpc_iomgr_shutdown(); + return 0; +} diff --git a/test/core/surface/completion_queue_test.c b/test/core/surface/completion_queue_test.c index 0e59ea4b22..0741ab920d 100644 --- a/test/core/surface/completion_queue_test.c +++ b/test/core/surface/completion_queue_test.c @@ -52,7 +52,7 @@ static void *create_test_tag(void) { static void shutdown_and_destroy(grpc_completion_queue *cc) { grpc_event ev; 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); 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 */ static void test_no_op(void) { 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) { grpc_completion_queue *cc; + grpc_event event; LOG_TEST("test_wait_empty"); - cc = grpc_completion_queue_create(); - GPR_ASSERT(grpc_completion_queue_next(cc, gpr_now(GPR_CLOCK_REALTIME)).type == - GRPC_QUEUE_TIMEOUT); + cc = grpc_completion_queue_create(NULL); + event = grpc_completion_queue_next(cc, gpr_now(GPR_CLOCK_REALTIME), NULL); + GPR_ASSERT(event.type == GRPC_QUEUE_TIMEOUT); shutdown_and_destroy(cc); } @@ -84,12 +85,12 @@ static void test_cq_end_op(void) { LOG_TEST("test_cq_end_op"); - cc = grpc_completion_queue_create(); + cc = grpc_completion_queue_create(NULL); grpc_cq_begin_op(cc); 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.tag == tag); GPR_ASSERT(ev.success); @@ -99,23 +100,27 @@ static void test_cq_end_op(void) { static void test_shutdown_then_next_polling(void) { grpc_completion_queue *cc; + grpc_event event; LOG_TEST("test_shutdown_then_next_polling"); - cc = grpc_completion_queue_create(); + cc = grpc_completion_queue_create(NULL); grpc_completion_queue_shutdown(cc); - GPR_ASSERT(grpc_completion_queue_next(cc, gpr_inf_past(GPR_CLOCK_REALTIME)) - .type == GRPC_QUEUE_SHUTDOWN); + event = grpc_completion_queue_next(cc, gpr_inf_past(GPR_CLOCK_REALTIME), + NULL); + GPR_ASSERT(event.type == GRPC_QUEUE_SHUTDOWN); grpc_completion_queue_destroy(cc); } static void test_shutdown_then_next_with_timeout(void) { grpc_completion_queue *cc; + grpc_event event; LOG_TEST("test_shutdown_then_next_with_timeout"); - cc = grpc_completion_queue_create(); + cc = grpc_completion_queue_create(NULL); grpc_completion_queue_shutdown(cc); - GPR_ASSERT(grpc_completion_queue_next(cc, gpr_inf_future(GPR_CLOCK_REALTIME)) - .type == GRPC_QUEUE_SHUTDOWN); + event = grpc_completion_queue_next(cc, gpr_inf_future(GPR_CLOCK_REALTIME), + NULL); + GPR_ASSERT(event.type == GRPC_QUEUE_SHUTDOWN); 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++) { grpc_cq_begin_op(cc); @@ -145,7 +150,7 @@ static void test_pluck(void) { for (i = 0; i < GPR_ARRAY_SIZE(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]); } @@ -157,7 +162,7 @@ static void test_pluck(void) { for (i = 0; i < GPR_ARRAY_SIZE(tags); i++) { 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]); } @@ -229,7 +234,7 @@ static void consumer_thread(void *arg) { gpr_log(GPR_INFO, "consumer %d phase 2", opt->id); 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) { case GRPC_OP_COMPLETE: 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_event phase1 = 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 total_consumed = 0; static int optid = 101; diff --git a/test/core/surface/lame_client_test.c b/test/core/surface/lame_client_test.c index 5e6c9ae15c..216eeca8e1 100644 --- a/test/core/surface/lame_client_test.c +++ b/test/core/surface/lame_client_test.c @@ -49,6 +49,7 @@ int main(int argc, char **argv) { grpc_op *op; grpc_metadata_array trailing_metadata_recv; grpc_status_code status; + grpc_call_error error; char *details = NULL; size_t details_capacity = 0; @@ -59,10 +60,11 @@ int main(int argc, char **argv) { chan = grpc_lame_client_channel_create("lampoon:national"); GPR_ASSERT(chan); - cq = grpc_completion_queue_create(); + cq = grpc_completion_queue_create(NULL); call = grpc_channel_create_call(chan, NULL, GRPC_PROPAGATE_DEFAULTS, cq, "/Foo", "anywhere", - GRPC_TIMEOUT_SECONDS_TO_DEADLINE(100)); + GRPC_TIMEOUT_SECONDS_TO_DEADLINE(100), + NULL); GPR_ASSERT(call); cqv = cq_verifier_create(cq); @@ -70,6 +72,7 @@ int main(int argc, char **argv) { op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; op->flags = 0; + op->reserved = NULL; op++; op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; @@ -77,9 +80,10 @@ int main(int argc, char **argv) { op->data.recv_status_on_client.status_details = &details; op->data.recv_status_on_client.status_details_capacity = &details_capacity; op->flags = 0; + op->reserved = NULL; op++; - GPR_ASSERT(GRPC_CALL_OK == - grpc_call_start_batch(call, ops, op - ops, tag(1))); + error = grpc_call_start_batch(call, ops, op - ops, tag(1), NULL); + GPR_ASSERT(GRPC_CALL_OK == error); /* the call should immediately fail */ cq_expect_completion(cqv, tag(1), 1); diff --git a/test/cpp/end2end/async_end2end_test.cc b/test/cpp/end2end/async_end2end_test.cc index 9b53bdc999..f00d19ed6c 100644 --- a/test/cpp/end2end/async_end2end_test.cc +++ b/test/cpp/end2end/async_end2end_test.cc @@ -666,6 +666,28 @@ TEST_F(AsyncEnd2endTest, ServerCheckDone) { EXPECT_TRUE(recv_status.ok()); } +TEST_F(AsyncEnd2endTest, UnimplementedRpc) { + std::shared_ptr<ChannelInterface> channel = CreateChannel( + server_address_.str(), InsecureCredentials(), ChannelArguments()); + std::unique_ptr<grpc::cpp::test::util::UnimplementedService::Stub> stub; + stub = + std::move(grpc::cpp::test::util::UnimplementedService::NewStub(channel)); + EchoRequest send_request; + EchoResponse recv_response; + Status recv_status; + + ClientContext cli_ctx; + send_request.set_message("Hello"); + std::unique_ptr<ClientAsyncResponseReader<EchoResponse> > response_reader( + stub->AsyncUnimplemented(&cli_ctx, send_request, cq_.get())); + + response_reader->Finish(&recv_response, &recv_status, tag(4)); + Verifier().Expect(4, false).Verify(cq_.get()); + + EXPECT_EQ(StatusCode::UNIMPLEMENTED, recv_status.error_code()); + EXPECT_EQ("", recv_status.error_message()); +} + } // namespace } // namespace testing } // namespace grpc diff --git a/test/cpp/end2end/end2end_test.cc b/test/cpp/end2end/end2end_test.cc index 37669815c6..3827cdf730 100644 --- a/test/cpp/end2end/end2end_test.cc +++ b/test/cpp/end2end/end2end_test.cc @@ -290,13 +290,17 @@ class End2endTest : public ::testing::TestWithParam<bool> { if (proxy_server_) proxy_server_->Shutdown(); } - void ResetStub(bool use_proxy) { + void ResetChannel() { SslCredentialsOptions ssl_opts = {test_root_cert, "", ""}; ChannelArguments args; args.SetSslTargetNameOverride("foo.test.google.fr"); args.SetString(GRPC_ARG_SECONDARY_USER_AGENT_STRING, "end2end_test"); channel_ = CreateChannel(server_address_.str(), SslCredentials(ssl_opts), args); + } + + void ResetStub(bool use_proxy) { + ResetChannel(); if (use_proxy) { proxy_service_.reset(new Proxy(channel_)); int port = grpc_pick_unused_port_or_die(); @@ -930,6 +934,23 @@ TEST_F(End2endTest, ChannelState) { EXPECT_EQ(GRPC_CHANNEL_CONNECTING, channel_->GetState(false)); } +// Talking to a non-existing service. +TEST_F(End2endTest, NonExistingService) { + ResetChannel(); + std::unique_ptr<grpc::cpp::test::util::UnimplementedService::Stub> stub; + stub = + std::move(grpc::cpp::test::util::UnimplementedService::NewStub(channel_)); + + EchoRequest request; + EchoResponse response; + request.set_message("Hello"); + + ClientContext context; + Status s = stub->Unimplemented(&context, request, &response); + EXPECT_EQ(StatusCode::UNIMPLEMENTED, s.error_code()); + EXPECT_EQ("", s.error_message()); +} + INSTANTIATE_TEST_CASE_P(End2end, End2endTest, ::testing::Values(false, true)); } // namespace testing diff --git a/test/cpp/end2end/zookeeper_test.cc b/test/cpp/end2end/zookeeper_test.cc new file mode 100644 index 0000000000..a48c497d9a --- /dev/null +++ b/test/cpp/end2end/zookeeper_test.cc @@ -0,0 +1,223 @@ +/* + * + * Copyright 2015, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "test/core/util/test_config.h" +#include "test/core/util/port.h" +#include "test/cpp/util/echo.grpc.pb.h" +#include "src/core/support/env.h" +#include <grpc++/channel_arguments.h> +#include <grpc++/channel_interface.h> +#include <grpc++/client_context.h> +#include <grpc++/create_channel.h> +#include <grpc++/credentials.h> +#include <grpc++/server.h> +#include <grpc++/server_builder.h> +#include <grpc++/server_context.h> +#include <grpc++/server_credentials.h> +#include <grpc++/status.h> +#include <gtest/gtest.h> +#include <grpc/grpc.h> +#include <grpc/grpc_zookeeper.h> +#include <zookeeper/zookeeper.h> + +using grpc::cpp::test::util::EchoRequest; +using grpc::cpp::test::util::EchoResponse; + +namespace grpc { +namespace testing { + +class ZookeeperTestServiceImpl + : public ::grpc::cpp::test::util::TestService::Service { + public: + Status Echo(ServerContext* context, const EchoRequest* request, + EchoResponse* response) GRPC_OVERRIDE { + response->set_message(request->message()); + return Status::OK; + } +}; + +class ZookeeperTest : public ::testing::Test { + protected: + ZookeeperTest() {} + + void SetUp() GRPC_OVERRIDE { + SetUpZookeeper(); + + // Sets up two servers + int port1 = grpc_pick_unused_port_or_die(); + server1_ = SetUpServer(port1); + + int port2 = grpc_pick_unused_port_or_die(); + server2_ = SetUpServer(port2); + + // Registers service /test in zookeeper + RegisterService("/test", "test"); + + // Registers service instance /test/1 in zookeeper + string value = + "{\"host\":\"localhost\",\"port\":\"" + to_string(port1) + "\"}"; + RegisterService("/test/1", value); + + // Registers service instance /test/2 in zookeeper + value = + "{\"host\":\"localhost\",\"port\":\"" + to_string(port2) + "\"}"; + RegisterService("/test/2", value); + } + + // Requires zookeeper server running + void SetUpZookeeper() { + // Finds zookeeper server address in environment + // Default is localhost:2181 + zookeeper_address_ = "localhost:2181"; + char* addr = gpr_getenv("GRPC_ZOOKEEPER_SERVER_TEST"); + if (addr != NULL) { + string addr_str(addr); + zookeeper_address_ = addr_str; + gpr_free(addr); + } + gpr_log(GPR_DEBUG, zookeeper_address_.c_str()); + + // Connects to zookeeper server + zoo_set_debug_level(ZOO_LOG_LEVEL_WARN); + zookeeper_handle_ = + zookeeper_init(zookeeper_address_.c_str(), NULL, 15000, 0, 0, 0); + GPR_ASSERT(zookeeper_handle_ != NULL); + + // Registers zookeeper name resolver in grpc + grpc_zookeeper_register(); + } + + std::unique_ptr<Server> SetUpServer(const int port) { + string server_address = "localhost:" + to_string(port); + + ServerBuilder builder; + builder.AddListeningPort(server_address, InsecureServerCredentials()); + builder.RegisterService(&service_); + std::unique_ptr<Server> server = builder.BuildAndStart(); + return server; + } + + void RegisterService(const string& name, const string& value) { + char* path = (char*)gpr_malloc(name.size()); + + int status = zoo_exists(zookeeper_handle_, name.c_str(), 0, NULL); + if (status == ZNONODE) { + status = + zoo_create(zookeeper_handle_, name.c_str(), value.c_str(), + value.size(), &ZOO_OPEN_ACL_UNSAFE, 0, path, name.size()); + } else { + status = zoo_set(zookeeper_handle_, name.c_str(), value.c_str(), + value.size(), -1); + } + gpr_free(path); + GPR_ASSERT(status == 0); + } + + void DeleteService(const string& name) { + int status = zoo_delete(zookeeper_handle_, name.c_str(), -1); + GPR_ASSERT(status == 0); + } + + void ChangeZookeeperState() { + server1_->Shutdown(); + DeleteService("/test/1"); + } + + void TearDown() GRPC_OVERRIDE { + server1_->Shutdown(); + server2_->Shutdown(); + zookeeper_close(zookeeper_handle_); + } + + void ResetStub() { + string target = "zookeeper://" + zookeeper_address_ + "/test"; + channel_ = CreateChannel(target, InsecureCredentials(), ChannelArguments()); + stub_ = std::move(grpc::cpp::test::util::TestService::NewStub(channel_)); + } + + string to_string(const int number) { + std::stringstream strs; + strs << number; + return strs.str(); + } + + std::shared_ptr<ChannelInterface> channel_; + std::unique_ptr<grpc::cpp::test::util::TestService::Stub> stub_; + std::unique_ptr<Server> server1_; + std::unique_ptr<Server> server2_; + ZookeeperTestServiceImpl service_; + zhandle_t* zookeeper_handle_; + string zookeeper_address_; +}; + +// Tests zookeeper state change between two RPCs +// TODO(ctiller): leaked objects in this test +TEST_F(ZookeeperTest, ZookeeperStateChangeTwoRpc) { + ResetStub(); + + // First RPC + EchoRequest request1; + EchoResponse response1; + ClientContext context1; + context1.set_authority("test"); + request1.set_message("Hello"); + Status s1 = stub_->Echo(&context1, request1, &response1); + EXPECT_EQ(response1.message(), request1.message()); + EXPECT_TRUE(s1.ok()); + + // Zookeeper state changes + gpr_log(GPR_DEBUG, "Zookeeper state change"); + ChangeZookeeperState(); + // Waits for re-resolving addresses + // TODO(ctiller): RPC will probably fail if not waiting + sleep(1); + + // Second RPC + EchoRequest request2; + EchoResponse response2; + ClientContext context2; + context2.set_authority("test"); + request2.set_message("World"); + Status s2 = stub_->Echo(&context2, request2, &response2); + EXPECT_EQ(response2.message(), request2.message()); + EXPECT_TRUE(s2.ok()); +} + +} // namespace testing +} // namespace grpc + +int main(int argc, char** argv) { + grpc_test_init(argc, argv); + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} diff --git a/test/cpp/util/echo.proto b/test/cpp/util/echo.proto index 6bb09316b4..8ea2f59897 100644 --- a/test/cpp/util/echo.proto +++ b/test/cpp/util/echo.proto @@ -41,3 +41,7 @@ service TestService { rpc BidiStream(stream EchoRequest) returns (stream EchoResponse); rpc Unimplemented(EchoRequest) returns (EchoResponse); } + +service UnimplementedService { + rpc Unimplemented(EchoRequest) returns (EchoResponse); +} |