aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorGravatar Sree Kuchibhotla <sreecha@users.noreply.github.com>2017-04-14 07:59:18 -0700
committerGravatar GitHub <noreply@github.com>2017-04-14 07:59:18 -0700
commitb81fb794a397b053df0d4bed7b1525a0ff51535f (patch)
tree45a4df4c665d7de3e04363af5ec6176427abc8f8 /test
parent90bb7bddd138bac7126b01bfcb31fa9beff7d2fb (diff)
parent0e5fa9ebcd69746c2f27339a7cc13c3da2cde012 (diff)
Merge pull request #9972 from sreecha/cq_create_api_changes
Completion Queue creation API changes (C-Core and C++ only)
Diffstat (limited to 'test')
-rw-r--r--test/core/bad_client/bad_client.c10
-rw-r--r--test/core/bad_ssl/bad_ssl_test.c2
-rw-r--r--test/core/bad_ssl/server_common.c15
-rw-r--r--test/core/client_channel/lb_policies_test.c17
-rw-r--r--test/core/end2end/bad_server_response_test.c2
-rw-r--r--test/core/end2end/connection_refused_test.c2
-rw-r--r--test/core/end2end/dualstack_socket_test.c12
-rw-r--r--test/core/end2end/end2end_tests.h1
-rw-r--r--test/core/end2end/fixtures/h2_census.c3
-rw-r--r--test/core/end2end/fixtures/h2_compress.c3
-rw-r--r--test/core/end2end/fixtures/h2_fakesec.c3
-rw-r--r--test/core/end2end/fixtures/h2_fd.c3
-rw-r--r--test/core/end2end/fixtures/h2_full+pipe.c3
-rw-r--r--test/core/end2end/fixtures/h2_full+trace.c3
-rw-r--r--test/core/end2end/fixtures/h2_full.c3
-rw-r--r--test/core/end2end/fixtures/h2_http_proxy.c3
-rw-r--r--test/core/end2end/fixtures/h2_load_reporting.c3
-rw-r--r--test/core/end2end/fixtures/h2_oauth2.c3
-rw-r--r--test/core/end2end/fixtures/h2_proxy.c3
-rw-r--r--test/core/end2end/fixtures/h2_sockpair+trace.c3
-rw-r--r--test/core/end2end/fixtures/h2_sockpair.c3
-rw-r--r--test/core/end2end/fixtures/h2_sockpair_1byte.c3
-rw-r--r--test/core/end2end/fixtures/h2_ssl.c3
-rw-r--r--test/core/end2end/fixtures/h2_ssl_cert.c11
-rw-r--r--test/core/end2end/fixtures/h2_ssl_proxy.c3
-rw-r--r--test/core/end2end/fixtures/h2_uds.c3
-rw-r--r--test/core/end2end/fixtures/proxy.c2
-rw-r--r--test/core/end2end/fuzzers/api_fuzzer.c2
-rw-r--r--test/core/end2end/fuzzers/client_fuzzer.c2
-rw-r--r--test/core/end2end/fuzzers/server_fuzzer.c2
-rw-r--r--test/core/end2end/goaway_server_test.c2
-rw-r--r--test/core/end2end/invalid_call_argument_test.c9
-rw-r--r--test/core/end2end/multiple_server_queues_test.c27
-rw-r--r--test/core/end2end/no_server_test.c2
-rw-r--r--test/core/end2end/tests/authority_not_supported.c8
-rw-r--r--test/core/end2end/tests/bad_hostname.c8
-rw-r--r--test/core/end2end/tests/bad_ping.c1
-rw-r--r--test/core/end2end/tests/binary_metadata.c8
-rw-r--r--test/core/end2end/tests/call_creds.c8
-rw-r--r--test/core/end2end/tests/cancel_after_accept.c8
-rw-r--r--test/core/end2end/tests/cancel_after_client_done.c8
-rw-r--r--test/core/end2end/tests/cancel_after_invoke.c8
-rw-r--r--test/core/end2end/tests/cancel_before_invoke.c8
-rw-r--r--test/core/end2end/tests/cancel_in_a_vacuum.c8
-rw-r--r--test/core/end2end/tests/cancel_with_status.c8
-rw-r--r--test/core/end2end/tests/compressed_payload.c8
-rw-r--r--test/core/end2end/tests/connectivity.c3
-rw-r--r--test/core/end2end/tests/default_host.c8
-rw-r--r--test/core/end2end/tests/disappearing_server.c3
-rw-r--r--test/core/end2end/tests/empty_batch.c8
-rw-r--r--test/core/end2end/tests/filter_call_init_fails.c8
-rw-r--r--test/core/end2end/tests/filter_causes_close.c8
-rw-r--r--test/core/end2end/tests/filter_latency.c8
-rw-r--r--test/core/end2end/tests/graceful_server_shutdown.c2
-rw-r--r--test/core/end2end/tests/high_initial_seqno.c8
-rw-r--r--test/core/end2end/tests/hpack_size.c8
-rw-r--r--test/core/end2end/tests/idempotent_request.c8
-rw-r--r--test/core/end2end/tests/invoke_large_request.c8
-rw-r--r--test/core/end2end/tests/keepalive_timeout.c6
-rw-r--r--test/core/end2end/tests/large_metadata.c8
-rw-r--r--test/core/end2end/tests/load_reporting_hook.c8
-rw-r--r--test/core/end2end/tests/max_concurrent_streams.c8
-rw-r--r--test/core/end2end/tests/max_connection_age.c1
-rw-r--r--test/core/end2end/tests/max_connection_idle.c1
-rw-r--r--test/core/end2end/tests/max_message_length.c8
-rw-r--r--test/core/end2end/tests/negative_deadline.c8
-rw-r--r--test/core/end2end/tests/network_status_change.c8
-rw-r--r--test/core/end2end/tests/no_logging.c8
-rw-r--r--test/core/end2end/tests/no_op.c8
-rw-r--r--test/core/end2end/tests/payload.c8
-rw-r--r--test/core/end2end/tests/ping.c3
-rw-r--r--test/core/end2end/tests/ping_pong_streaming.c8
-rw-r--r--test/core/end2end/tests/registered_call.c8
-rw-r--r--test/core/end2end/tests/request_with_flags.c8
-rw-r--r--test/core/end2end/tests/request_with_payload.c8
-rw-r--r--test/core/end2end/tests/resource_quota_server.c8
-rw-r--r--test/core/end2end/tests/server_finishes_request.c8
-rw-r--r--test/core/end2end/tests/shutdown_finishes_calls.c2
-rw-r--r--test/core/end2end/tests/shutdown_finishes_tags.c2
-rw-r--r--test/core/end2end/tests/simple_cacheable_request.c8
-rw-r--r--test/core/end2end/tests/simple_delayed_request.c8
-rw-r--r--test/core/end2end/tests/simple_metadata.c8
-rw-r--r--test/core/end2end/tests/simple_request.c8
-rw-r--r--test/core/end2end/tests/streaming_error_response.c8
-rw-r--r--test/core/end2end/tests/trailing_metadata.c8
-rw-r--r--test/core/end2end/tests/write_buffering.c8
-rw-r--r--test/core/end2end/tests/write_buffering_at_end.c8
-rw-r--r--test/core/fling/client.c2
-rw-r--r--test/core/fling/server.c17
-rw-r--r--test/core/handshake/client_ssl.c3
-rw-r--r--test/core/handshake/server_ssl.c2
-rw-r--r--test/core/memory_usage/client.c2
-rw-r--r--test/core/memory_usage/server.c15
-rw-r--r--test/core/surface/alarm_test.c2
-rw-r--r--test/core/surface/completion_queue_test.c241
-rw-r--r--test/core/surface/completion_queue_threading_test.c23
-rw-r--r--test/core/surface/concurrent_connectivity_test.c4
-rw-r--r--test/core/surface/lame_client_test.c2
-rw-r--r--test/core/surface/sequential_connectivity_test.c5
-rw-r--r--test/core/surface/server_chttp2_test.c2
-rw-r--r--test/core/surface/server_test.c6
-rw-r--r--test/cpp/grpclb/grpclb_test.cc15
-rw-r--r--test/cpp/microbenchmarks/bm_call_create.cc4
-rw-r--r--test/cpp/microbenchmarks/bm_cq.cc16
-rw-r--r--test/cpp/microbenchmarks/bm_cq_multiple_threads.cc2
105 files changed, 612 insertions, 290 deletions
diff --git a/test/core/bad_client/bad_client.c b/test/core/bad_client/bad_client.c
index ff2c4df58d..8dbc5aa861 100644
--- a/test/core/bad_client/bad_client.c
+++ b/test/core/bad_client/bad_client.c
@@ -104,6 +104,7 @@ void grpc_run_bad_client_test(
grpc_slice_buffer outgoing;
grpc_closure done_write_closure;
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_completion_queue *shutdown_cq;
hex = gpr_dump(client_payload, client_payload_length,
GPR_DUMP_HEX | GPR_DUMP_ASCII);
@@ -121,7 +122,7 @@ void grpc_run_bad_client_test(
/* Create server, completion events */
a.server = grpc_server_create(NULL, NULL);
- a.cq = grpc_completion_queue_create(NULL);
+ a.cq = grpc_completion_queue_create_for_next(NULL);
gpr_event_init(&a.done_thd);
gpr_event_init(&a.done_write);
a.validator = server_validator;
@@ -194,10 +195,13 @@ void grpc_run_bad_client_test(
grpc_endpoint_destroy(&exec_ctx, sfd.client);
grpc_exec_ctx_finish(&exec_ctx);
}
- grpc_server_shutdown_and_notify(a.server, a.cq, NULL);
+
+ shutdown_cq = grpc_completion_queue_create_for_pluck(NULL);
+ grpc_server_shutdown_and_notify(a.server, shutdown_cq, NULL);
GPR_ASSERT(grpc_completion_queue_pluck(
- a.cq, NULL, grpc_timeout_seconds_to_deadline(1), NULL)
+ shutdown_cq, NULL, grpc_timeout_seconds_to_deadline(1), NULL)
.type == GRPC_OP_COMPLETE);
+ grpc_completion_queue_destroy(shutdown_cq);
grpc_server_destroy(a.server);
grpc_completion_queue_destroy(a.cq);
grpc_slice_buffer_destroy_internal(&exec_ctx, &outgoing);
diff --git a/test/core/bad_ssl/bad_ssl_test.c b/test/core/bad_ssl/bad_ssl_test.c
index bd85585706..b961ffacd7 100644
--- a/test/core/bad_ssl/bad_ssl_test.c
+++ b/test/core/bad_ssl/bad_ssl_test.c
@@ -61,7 +61,7 @@ static void run_test(const char *target, size_t nops) {
grpc_status_code status;
grpc_call_error error;
gpr_timespec deadline = grpc_timeout_seconds_to_deadline(5);
- grpc_completion_queue *cq = grpc_completion_queue_create(NULL);
+ grpc_completion_queue *cq = grpc_completion_queue_create_for_next(NULL);
cq_verifier *cqv = cq_verifier_create(cq);
grpc_op ops[6];
diff --git a/test/core/bad_ssl/server_common.c b/test/core/bad_ssl/server_common.c
index 6a4313eafd..0ec14676c6 100644
--- a/test/core/bad_ssl/server_common.c
+++ b/test/core/bad_ssl/server_common.c
@@ -66,7 +66,9 @@ void bad_ssl_run(grpc_server *server) {
grpc_call *s = NULL;
grpc_call_details call_details;
grpc_metadata_array request_metadata_recv;
- grpc_completion_queue *cq = grpc_completion_queue_create(NULL);
+
+ grpc_completion_queue *cq = grpc_completion_queue_create_for_next(NULL);
+ grpc_completion_queue *shutdown_cq;
grpc_call_details_init(&call_details);
grpc_metadata_array_init(&request_metadata_recv);
@@ -82,10 +84,13 @@ void bad_ssl_run(grpc_server *server) {
while (!shutdown_finished) {
if (got_sigint && !shutdown_started) {
gpr_log(GPR_INFO, "Shutting down due to SIGINT");
- grpc_server_shutdown_and_notify(server, cq, NULL);
- GPR_ASSERT(grpc_completion_queue_pluck(
- cq, NULL, grpc_timeout_seconds_to_deadline(5), NULL)
- .type == GRPC_OP_COMPLETE);
+ shutdown_cq = grpc_completion_queue_create_for_pluck(NULL);
+ grpc_server_shutdown_and_notify(server, shutdown_cq, NULL);
+ GPR_ASSERT(
+ grpc_completion_queue_pluck(shutdown_cq, NULL,
+ grpc_timeout_seconds_to_deadline(5), NULL)
+ .type == GRPC_OP_COMPLETE);
+ grpc_completion_queue_destroy(shutdown_cq);
grpc_completion_queue_shutdown(cq);
shutdown_started = 1;
}
diff --git a/test/core/client_channel/lb_policies_test.c b/test/core/client_channel/lb_policies_test.c
index e03492f80e..3c8e6dd5a2 100644
--- a/test/core/client_channel/lb_policies_test.c
+++ b/test/core/client_channel/lb_policies_test.c
@@ -59,6 +59,7 @@ typedef struct servers_fixture {
grpc_server **servers;
grpc_call **server_calls;
grpc_completion_queue *cq;
+ grpc_completion_queue *shutdown_cq;
char **servers_hostports;
grpc_metadata_array *request_metadata_recv;
} servers_fixture;
@@ -146,10 +147,10 @@ static void drain_cq(grpc_completion_queue *cq) {
static void kill_server(const servers_fixture *f, size_t i) {
gpr_log(GPR_INFO, "KILLING SERVER %" PRIuPTR, i);
GPR_ASSERT(f->servers[i] != NULL);
- grpc_server_shutdown_and_notify(f->servers[i], f->cq, tag(10000));
- GPR_ASSERT(
- grpc_completion_queue_pluck(f->cq, tag(10000), n_millis_time(5000), NULL)
- .type == GRPC_OP_COMPLETE);
+ grpc_server_shutdown_and_notify(f->servers[i], f->shutdown_cq, tag(10000));
+ GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(10000),
+ n_millis_time(5000), NULL)
+ .type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->servers[i]);
f->servers[i] = NULL;
}
@@ -196,7 +197,8 @@ static servers_fixture *setup_servers(const char *server_host,
/* Create servers. */
f->servers = gpr_malloc(sizeof(grpc_server *) * num_servers);
f->servers_hostports = gpr_malloc(sizeof(char *) * num_servers);
- f->cq = grpc_completion_queue_create(NULL);
+ f->cq = grpc_completion_queue_create_for_next(NULL);
+ f->shutdown_cq = grpc_completion_queue_create_for_pluck(NULL);
for (i = 0; i < num_servers; i++) {
grpc_metadata_array_init(&f->request_metadata_recv[i]);
gpr_join_host_port(&f->servers_hostports[i], server_host,
@@ -212,8 +214,8 @@ static void teardown_servers(servers_fixture *f) {
/* Destroy server. */
for (i = 0; i < f->num_servers; i++) {
if (f->servers[i] == NULL) continue;
- grpc_server_shutdown_and_notify(f->servers[i], f->cq, tag(10000));
- GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(10000),
+ grpc_server_shutdown_and_notify(f->servers[i], f->shutdown_cq, tag(10000));
+ GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(10000),
n_millis_time(5000), NULL)
.type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->servers[i]);
@@ -221,6 +223,7 @@ static void teardown_servers(servers_fixture *f) {
grpc_completion_queue_shutdown(f->cq);
drain_cq(f->cq);
grpc_completion_queue_destroy(f->cq);
+ grpc_completion_queue_destroy(f->shutdown_cq);
gpr_free(f->servers);
diff --git a/test/core/end2end/bad_server_response_test.c b/test/core/end2end/bad_server_response_test.c
index c37a292af9..1537caf943 100644
--- a/test/core/end2end/bad_server_response_test.c
+++ b/test/core/end2end/bad_server_response_test.c
@@ -178,7 +178,7 @@ static void start_rpc(int target_port, grpc_status_code expected_status,
cq_verifier *cqv;
grpc_slice details;
- state.cq = grpc_completion_queue_create(NULL);
+ state.cq = grpc_completion_queue_create_for_next(NULL);
cqv = cq_verifier_create(state.cq);
gpr_join_host_port(&state.target, "127.0.0.1", target_port);
state.channel = grpc_insecure_channel_create(state.target, NULL, NULL);
diff --git a/test/core/end2end/connection_refused_test.c b/test/core/end2end/connection_refused_test.c
index 6ded12ad48..7fecadbb86 100644
--- a/test/core/end2end/connection_refused_test.c
+++ b/test/core/end2end/connection_refused_test.c
@@ -68,7 +68,7 @@ static void run_test(bool wait_for_ready, bool use_service_config) {
grpc_metadata_array_init(&trailing_metadata_recv);
- cq = grpc_completion_queue_create(NULL);
+ cq = grpc_completion_queue_create_for_next(NULL);
cqv = cq_verifier_create(cq);
/* if using service config, create channel args */
diff --git a/test/core/end2end/dualstack_socket_test.c b/test/core/end2end/dualstack_socket_test.c
index 3623bd7be8..c61ea6d260 100644
--- a/test/core/end2end/dualstack_socket_test.c
+++ b/test/core/end2end/dualstack_socket_test.c
@@ -76,6 +76,7 @@ void test_connect(const char *server_host, const char *client_host, int port,
grpc_channel *client;
grpc_server *server;
grpc_completion_queue *cq;
+ grpc_completion_queue *shutdown_cq;
grpc_call *c;
grpc_call *s;
cq_verifier *cqv;
@@ -107,7 +108,7 @@ 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(NULL);
+ cq = grpc_completion_queue_create_for_next(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(
@@ -259,11 +260,14 @@ void test_connect(const char *server_host, const char *client_host, int port,
grpc_channel_destroy(client);
/* 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), NULL)
+ shutdown_cq = grpc_completion_queue_create_for_pluck(NULL);
+ grpc_server_shutdown_and_notify(server, shutdown_cq, tag(1000));
+ GPR_ASSERT(grpc_completion_queue_pluck(shutdown_cq, tag(1000),
+ grpc_timeout_seconds_to_deadline(5),
+ NULL)
.type == GRPC_OP_COMPLETE);
grpc_server_destroy(server);
+ grpc_completion_queue_destroy(shutdown_cq);
grpc_completion_queue_shutdown(cq);
drain_cq(cq);
grpc_completion_queue_destroy(cq);
diff --git a/test/core/end2end/end2end_tests.h b/test/core/end2end/end2end_tests.h
index cdb26a67e9..4d98bddbd8 100644
--- a/test/core/end2end/end2end_tests.h
+++ b/test/core/end2end/end2end_tests.h
@@ -53,6 +53,7 @@ typedef struct grpc_end2end_test_config grpc_end2end_test_config;
struct grpc_end2end_test_fixture {
grpc_completion_queue *cq;
+ grpc_completion_queue *shutdown_cq;
grpc_server *server;
grpc_channel *client;
void *fixture_data;
diff --git a/test/core/end2end/fixtures/h2_census.c b/test/core/end2end/fixtures/h2_census.c
index 7f906fa72b..e8af03a52b 100644
--- a/test/core/end2end/fixtures/h2_census.c
+++ b/test/core/end2end/fixtures/h2_census.c
@@ -65,7 +65,8 @@ 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(NULL);
+ f.cq = grpc_completion_queue_create_for_next(NULL);
+ f.shutdown_cq = grpc_completion_queue_create_for_pluck(NULL);
return f;
}
diff --git a/test/core/end2end/fixtures/h2_compress.c b/test/core/end2end/fixtures/h2_compress.c
index ba8092e96e..49fcd9e9d3 100644
--- a/test/core/end2end/fixtures/h2_compress.c
+++ b/test/core/end2end/fixtures/h2_compress.c
@@ -69,7 +69,8 @@ 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(NULL);
+ f.cq = grpc_completion_queue_create_for_next(NULL);
+ f.shutdown_cq = grpc_completion_queue_create_for_pluck(NULL);
return f;
}
diff --git a/test/core/end2end/fixtures/h2_fakesec.c b/test/core/end2end/fixtures/h2_fakesec.c
index c9747913c2..5969b110e6 100644
--- a/test/core/end2end/fixtures/h2_fakesec.c
+++ b/test/core/end2end/fixtures/h2_fakesec.c
@@ -60,7 +60,8 @@ 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(NULL);
+ f.cq = grpc_completion_queue_create_for_next(NULL);
+ f.shutdown_cq = grpc_completion_queue_create_for_pluck(NULL);
return f;
}
diff --git a/test/core/end2end/fixtures/h2_fd.c b/test/core/end2end/fixtures/h2_fd.c
index 223fadc386..53888dbc5b 100644
--- a/test/core/end2end/fixtures/h2_fd.c
+++ b/test/core/end2end/fixtures/h2_fd.c
@@ -70,7 +70,8 @@ static grpc_end2end_test_fixture chttp2_create_fixture_socketpair(
grpc_end2end_test_fixture f;
memset(&f, 0, sizeof(f));
f.fixture_data = fixture_data;
- f.cq = grpc_completion_queue_create(NULL);
+ f.cq = grpc_completion_queue_create_for_next(NULL);
+ f.shutdown_cq = grpc_completion_queue_create_for_pluck(NULL);
create_sockets(fixture_data->fd_pair);
diff --git a/test/core/end2end/fixtures/h2_full+pipe.c b/test/core/end2end/fixtures/h2_full+pipe.c
index 8d7a1f0cfe..cee48af66f 100644
--- a/test/core/end2end/fixtures/h2_full+pipe.c
+++ b/test/core/end2end/fixtures/h2_full+pipe.c
@@ -70,7 +70,8 @@ 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(NULL);
+ f.cq = grpc_completion_queue_create_for_next(NULL);
+ f.shutdown_cq = grpc_completion_queue_create_for_pluck(NULL);
return f;
}
diff --git a/test/core/end2end/fixtures/h2_full+trace.c b/test/core/end2end/fixtures/h2_full+trace.c
index 477bfdd5bb..57047bc57b 100644
--- a/test/core/end2end/fixtures/h2_full+trace.c
+++ b/test/core/end2end/fixtures/h2_full+trace.c
@@ -70,7 +70,8 @@ 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(NULL);
+ f.cq = grpc_completion_queue_create_for_next(NULL);
+ f.shutdown_cq = grpc_completion_queue_create_for_pluck(NULL);
return f;
}
diff --git a/test/core/end2end/fixtures/h2_full.c b/test/core/end2end/fixtures/h2_full.c
index ccb1e2ac02..f18d314c1f 100644
--- a/test/core/end2end/fixtures/h2_full.c
+++ b/test/core/end2end/fixtures/h2_full.c
@@ -64,7 +64,8 @@ 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(NULL);
+ f.cq = grpc_completion_queue_create_for_next(NULL);
+ f.shutdown_cq = grpc_completion_queue_create_for_pluck(NULL);
return f;
}
diff --git a/test/core/end2end/fixtures/h2_http_proxy.c b/test/core/end2end/fixtures/h2_http_proxy.c
index 850b3e720b..aec874b1fa 100644
--- a/test/core/end2end/fixtures/h2_http_proxy.c
+++ b/test/core/end2end/fixtures/h2_http_proxy.c
@@ -69,7 +69,8 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack(
ffd->proxy = grpc_end2end_http_proxy_create();
f.fixture_data = ffd;
- f.cq = grpc_completion_queue_create(NULL);
+ f.cq = grpc_completion_queue_create_for_next(NULL);
+ f.shutdown_cq = grpc_completion_queue_create_for_pluck(NULL);
return f;
}
diff --git a/test/core/end2end/fixtures/h2_load_reporting.c b/test/core/end2end/fixtures/h2_load_reporting.c
index 70d6f9e605..8e9c885759 100644
--- a/test/core/end2end/fixtures/h2_load_reporting.c
+++ b/test/core/end2end/fixtures/h2_load_reporting.c
@@ -67,7 +67,8 @@ static grpc_end2end_test_fixture chttp2_create_fixture_load_reporting(
gpr_join_host_port(&ffd->localaddr, "localhost", port);
f.fixture_data = ffd;
- f.cq = grpc_completion_queue_create(NULL);
+ f.cq = grpc_completion_queue_create_for_next(NULL);
+ f.shutdown_cq = grpc_completion_queue_create_for_pluck(NULL);
return f;
}
diff --git a/test/core/end2end/fixtures/h2_oauth2.c b/test/core/end2end/fixtures/h2_oauth2.c
index 3351652858..c94f1f6239 100644
--- a/test/core/end2end/fixtures/h2_oauth2.c
+++ b/test/core/end2end/fixtures/h2_oauth2.c
@@ -113,7 +113,8 @@ 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(NULL);
+ f.cq = grpc_completion_queue_create_for_next(NULL);
+ f.shutdown_cq = grpc_completion_queue_create_for_pluck(NULL);
return f;
}
diff --git a/test/core/end2end/fixtures/h2_proxy.c b/test/core/end2end/fixtures/h2_proxy.c
index f0b9f77653..3d33d5860d 100644
--- a/test/core/end2end/fixtures/h2_proxy.c
+++ b/test/core/end2end/fixtures/h2_proxy.c
@@ -79,7 +79,8 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack(
ffd->proxy = grpc_end2end_proxy_create(&proxy_def, client_args, server_args);
f.fixture_data = ffd;
- f.cq = grpc_completion_queue_create(NULL);
+ f.cq = grpc_completion_queue_create_for_next(NULL);
+ f.shutdown_cq = grpc_completion_queue_create_for_pluck(NULL);
return f;
}
diff --git a/test/core/end2end/fixtures/h2_sockpair+trace.c b/test/core/end2end/fixtures/h2_sockpair+trace.c
index 8dfc1129f5..f3e12200f8 100644
--- a/test/core/end2end/fixtures/h2_sockpair+trace.c
+++ b/test/core/end2end/fixtures/h2_sockpair+trace.c
@@ -94,7 +94,8 @@ 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(NULL);
+ f.cq = grpc_completion_queue_create_for_next(NULL);
+ f.shutdown_cq = grpc_completion_queue_create_for_pluck(NULL);
*sfd = grpc_iomgr_create_endpoint_pair("fixture", NULL);
diff --git a/test/core/end2end/fixtures/h2_sockpair.c b/test/core/end2end/fixtures/h2_sockpair.c
index 661d83efee..4e60d03a9c 100644
--- a/test/core/end2end/fixtures/h2_sockpair.c
+++ b/test/core/end2end/fixtures/h2_sockpair.c
@@ -88,7 +88,8 @@ 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(NULL);
+ f.cq = grpc_completion_queue_create_for_next(NULL);
+ f.shutdown_cq = grpc_completion_queue_create_for_pluck(NULL);
*sfd = grpc_iomgr_create_endpoint_pair("fixture", NULL);
diff --git a/test/core/end2end/fixtures/h2_sockpair_1byte.c b/test/core/end2end/fixtures/h2_sockpair_1byte.c
index 26e068ed7d..8714266655 100644
--- a/test/core/end2end/fixtures/h2_sockpair_1byte.c
+++ b/test/core/end2end/fixtures/h2_sockpair_1byte.c
@@ -88,7 +88,8 @@ 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(NULL);
+ f.cq = grpc_completion_queue_create_for_next(NULL);
+ f.shutdown_cq = grpc_completion_queue_create_for_pluck(NULL);
grpc_arg a[] = {{.key = GRPC_ARG_TCP_READ_CHUNK_SIZE,
.type = GRPC_ARG_INTEGER,
diff --git a/test/core/end2end/fixtures/h2_ssl.c b/test/core/end2end/fixtures/h2_ssl.c
index cf44cd093c..c6a1ca09f8 100644
--- a/test/core/end2end/fixtures/h2_ssl.c
+++ b/test/core/end2end/fixtures/h2_ssl.c
@@ -64,7 +64,8 @@ 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(NULL);
+ f.cq = grpc_completion_queue_create_for_next(NULL);
+ f.shutdown_cq = grpc_completion_queue_create_for_pluck(NULL);
return f;
}
diff --git a/test/core/end2end/fixtures/h2_ssl_cert.c b/test/core/end2end/fixtures/h2_ssl_cert.c
index f62331eea3..7aa0e16bf6 100644
--- a/test/core/end2end/fixtures/h2_ssl_cert.c
+++ b/test/core/end2end/fixtures/h2_ssl_cert.c
@@ -67,7 +67,8 @@ 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(NULL);
+ f.cq = grpc_completion_queue_create_for_next(NULL);
+ f.shutdown_cq = grpc_completion_queue_create_for_pluck(NULL);
return f;
}
@@ -289,9 +290,10 @@ static void drain_cq(grpc_completion_queue *cq) {
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), NULL)
+ grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000));
+ GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000),
+ grpc_timeout_seconds_to_deadline(5),
+ NULL)
.type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server);
f->server = NULL;
@@ -310,6 +312,7 @@ static void end_test(grpc_end2end_test_fixture *f) {
grpc_completion_queue_shutdown(f->cq);
drain_cq(f->cq);
grpc_completion_queue_destroy(f->cq);
+ grpc_completion_queue_destroy(f->shutdown_cq);
}
static void simple_request_body(grpc_end2end_test_fixture f,
diff --git a/test/core/end2end/fixtures/h2_ssl_proxy.c b/test/core/end2end/fixtures/h2_ssl_proxy.c
index 740b075bf6..9a6c9f558f 100644
--- a/test/core/end2end/fixtures/h2_ssl_proxy.c
+++ b/test/core/end2end/fixtures/h2_ssl_proxy.c
@@ -100,7 +100,8 @@ static grpc_end2end_test_fixture chttp2_create_fixture_secure_fullstack(
ffd->proxy = grpc_end2end_proxy_create(&proxy_def, client_args, server_args);
f.fixture_data = ffd;
- f.cq = grpc_completion_queue_create(NULL);
+ f.cq = grpc_completion_queue_create_for_next(NULL);
+ f.shutdown_cq = grpc_completion_queue_create_for_pluck(NULL);
return f;
}
diff --git a/test/core/end2end/fixtures/h2_uds.c b/test/core/end2end/fixtures/h2_uds.c
index 316bfb8541..de1b8eb5df 100644
--- a/test/core/end2end/fixtures/h2_uds.c
+++ b/test/core/end2end/fixtures/h2_uds.c
@@ -70,7 +70,8 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack(
unique++);
f.fixture_data = ffd;
- f.cq = grpc_completion_queue_create(NULL);
+ f.cq = grpc_completion_queue_create_for_next(NULL);
+ f.shutdown_cq = grpc_completion_queue_create_for_pluck(NULL);
return f;
}
diff --git a/test/core/end2end/fixtures/proxy.c b/test/core/end2end/fixtures/proxy.c
index cee053e8c5..b8b1e5c6c9 100644
--- a/test/core/end2end/fixtures/proxy.c
+++ b/test/core/end2end/fixtures/proxy.c
@@ -104,7 +104,7 @@ grpc_end2end_proxy *grpc_end2end_proxy_create(const grpc_end2end_proxy_def *def,
gpr_log(GPR_DEBUG, "PROXY ADDR:%s BACKEND:%s", proxy->proxy_port,
proxy->server_port);
- proxy->cq = grpc_completion_queue_create(NULL);
+ proxy->cq = grpc_completion_queue_create_for_next(NULL);
proxy->server = def->create_server(proxy->proxy_port, server_args);
proxy->client = def->create_client(proxy->server_port, client_args);
diff --git a/test/core/end2end/fuzzers/api_fuzzer.c b/test/core/end2end/fuzzers/api_fuzzer.c
index 0ec5a23d5d..8b8983ee17 100644
--- a/test/core/end2end/fuzzers/api_fuzzer.c
+++ b/test/core/end2end/fuzzers/api_fuzzer.c
@@ -735,7 +735,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
g_active_call = new_call(NULL, ROOT);
g_resource_quota = grpc_resource_quota_create("api_fuzzer");
- grpc_completion_queue *cq = grpc_completion_queue_create(NULL);
+ grpc_completion_queue *cq = grpc_completion_queue_create_for_next(NULL);
while (!is_eof(&inp) || g_channel != NULL || g_server != NULL ||
pending_channel_watches > 0 || pending_pings > 0 ||
diff --git a/test/core/end2end/fuzzers/client_fuzzer.c b/test/core/end2end/fuzzers/client_fuzzer.c
index e7e7dbefd0..bc322e45a3 100644
--- a/test/core/end2end/fuzzers/client_fuzzer.c
+++ b/test/core/end2end/fuzzers/client_fuzzer.c
@@ -65,7 +65,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
grpc_mock_endpoint_create(discard_write, resource_quota);
grpc_resource_quota_unref_internal(&exec_ctx, resource_quota);
- grpc_completion_queue *cq = grpc_completion_queue_create(NULL);
+ grpc_completion_queue *cq = grpc_completion_queue_create_for_next(NULL);
grpc_transport *transport =
grpc_create_chttp2_transport(&exec_ctx, NULL, mock_endpoint, 1);
grpc_chttp2_transport_start_reading(&exec_ctx, transport, NULL);
diff --git a/test/core/end2end/fuzzers/server_fuzzer.c b/test/core/end2end/fuzzers/server_fuzzer.c
index 186542d4b2..97b436cdf9 100644
--- a/test/core/end2end/fuzzers/server_fuzzer.c
+++ b/test/core/end2end/fuzzers/server_fuzzer.c
@@ -67,7 +67,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
grpc_slice_from_copied_buffer((const char *)data, size));
grpc_server *server = grpc_server_create(NULL, NULL);
- grpc_completion_queue *cq = grpc_completion_queue_create(NULL);
+ grpc_completion_queue *cq = grpc_completion_queue_create_for_next(NULL);
grpc_server_register_completion_queue(server, cq, NULL);
// TODO(ctiller): add registered methods (one for POST, one for PUT)
// void *registered_method =
diff --git a/test/core/end2end/goaway_server_test.c b/test/core/end2end/goaway_server_test.c
index 22d93b321a..a028fb7f5c 100644
--- a/test/core/end2end/goaway_server_test.c
+++ b/test/core/end2end/goaway_server_test.c
@@ -129,7 +129,7 @@ int main(int argc, char **argv) {
grpc_metadata_array_init(&request_metadata2);
grpc_call_details_init(&request_details2);
- cq = grpc_completion_queue_create(NULL);
+ cq = grpc_completion_queue_create_for_next(NULL);
cqv = cq_verifier_create(cq);
/* reserve two ports */
diff --git a/test/core/end2end/invalid_call_argument_test.c b/test/core/end2end/invalid_call_argument_test.c
index bfd8e6fefa..e89e59767f 100644
--- a/test/core/end2end/invalid_call_argument_test.c
+++ b/test/core/end2end/invalid_call_argument_test.c
@@ -75,7 +75,7 @@ static void prepare_test(int is_client) {
grpc_metadata_array_init(&g_state.initial_metadata_recv);
grpc_metadata_array_init(&g_state.trailing_metadata_recv);
g_state.deadline = grpc_timeout_seconds_to_deadline(2);
- g_state.cq = grpc_completion_queue_create(NULL);
+ g_state.cq = grpc_completion_queue_create_for_next(NULL);
g_state.cqv = cq_verifier_create(g_state.cq);
g_state.details = grpc_empty_slice();
memset(g_state.ops, 0, sizeof(g_state.ops));
@@ -125,6 +125,7 @@ static void prepare_test(int is_client) {
}
static void cleanup_test() {
+ grpc_completion_queue *shutdown_cq;
grpc_call_destroy(g_state.call);
cq_verifier_destroy(g_state.cqv);
grpc_channel_destroy(g_state.chan);
@@ -133,12 +134,14 @@ static void cleanup_test() {
grpc_metadata_array_destroy(&g_state.trailing_metadata_recv);
if (!g_state.is_client) {
+ shutdown_cq = grpc_completion_queue_create_for_pluck(NULL);
grpc_call_destroy(g_state.server_call);
- grpc_server_shutdown_and_notify(g_state.server, g_state.cq, tag(1000));
- GPR_ASSERT(grpc_completion_queue_pluck(g_state.cq, tag(1000),
+ grpc_server_shutdown_and_notify(g_state.server, shutdown_cq, tag(1000));
+ GPR_ASSERT(grpc_completion_queue_pluck(shutdown_cq, tag(1000),
grpc_timeout_seconds_to_deadline(5),
NULL)
.type == GRPC_OP_COMPLETE);
+ grpc_completion_queue_destroy(shutdown_cq);
grpc_server_destroy(g_state.server);
grpc_call_details_destroy(&g_state.call_details);
grpc_metadata_array_destroy(&g_state.server_initial_metadata_recv);
diff --git a/test/core/end2end/multiple_server_queues_test.c b/test/core/end2end/multiple_server_queues_test.c
index 5e2eaf4ae9..4696ecd813 100644
--- a/test/core/end2end/multiple_server_queues_test.c
+++ b/test/core/end2end/multiple_server_queues_test.c
@@ -37,27 +37,50 @@
int main(int argc, char **argv) {
grpc_completion_queue *cq1;
grpc_completion_queue *cq2;
+ grpc_completion_queue *cq3;
+ grpc_completion_queue_attributes attr;
+
grpc_server *server;
grpc_test_init(argc, argv);
grpc_init();
- cq1 = grpc_completion_queue_create(NULL);
- cq2 = grpc_completion_queue_create(NULL);
+
+ attr.version = 1;
+ attr.cq_completion_type = GRPC_CQ_NEXT;
+ attr.cq_polling_type = GRPC_CQ_DEFAULT_POLLING;
+ cq1 = grpc_completion_queue_create(
+ grpc_completion_queue_factory_lookup(&attr), &attr, NULL);
+
+ attr.cq_polling_type = GRPC_CQ_NON_LISTENING;
+ cq2 = grpc_completion_queue_create(
+ grpc_completion_queue_factory_lookup(&attr), &attr, NULL);
+
+ attr.cq_polling_type = GRPC_CQ_NON_POLLING;
+ cq3 = grpc_completion_queue_create(
+ grpc_completion_queue_factory_lookup(&attr), &attr, 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, NULL);
+ grpc_server_register_completion_queue(server, cq3, NULL);
+
grpc_server_start(server);
grpc_server_shutdown_and_notify(server, cq2, NULL);
grpc_completion_queue_next(cq2, gpr_inf_future(GPR_CLOCK_REALTIME),
NULL); /* cue queue hang */
grpc_completion_queue_shutdown(cq1);
grpc_completion_queue_shutdown(cq2);
+ grpc_completion_queue_shutdown(cq3);
+
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_completion_queue_next(cq3, gpr_inf_future(GPR_CLOCK_REALTIME), NULL);
+
grpc_server_destroy(server);
grpc_completion_queue_destroy(cq1);
grpc_completion_queue_destroy(cq2);
+ grpc_completion_queue_destroy(cq3);
grpc_shutdown();
return 0;
}
diff --git a/test/core/end2end/no_server_test.c b/test/core/end2end/no_server_test.c
index 26d26d8f7a..dd18b0c692 100644
--- a/test/core/end2end/no_server_test.c
+++ b/test/core/end2end/no_server_test.c
@@ -59,7 +59,7 @@ int main(int argc, char **argv) {
grpc_metadata_array_init(&trailing_metadata_recv);
- cq = grpc_completion_queue_create(NULL);
+ cq = grpc_completion_queue_create_for_next(NULL);
cqv = cq_verifier_create(cq);
/* create a call, channel to a non existant server */
diff --git a/test/core/end2end/tests/authority_not_supported.c b/test/core/end2end/tests/authority_not_supported.c
index 192a20d400..f9298f1fa7 100644
--- a/test/core/end2end/tests/authority_not_supported.c
+++ b/test/core/end2end/tests/authority_not_supported.c
@@ -74,9 +74,10 @@ static void drain_cq(grpc_completion_queue *cq) {
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), NULL)
+ grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000));
+ GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000),
+ grpc_timeout_seconds_to_deadline(5),
+ NULL)
.type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server);
f->server = NULL;
@@ -95,6 +96,7 @@ static void end_test(grpc_end2end_test_fixture *f) {
grpc_completion_queue_shutdown(f->cq);
drain_cq(f->cq);
grpc_completion_queue_destroy(f->cq);
+ grpc_completion_queue_destroy(f->shutdown_cq);
}
/* Request/response with metadata and payload.*/
diff --git a/test/core/end2end/tests/bad_hostname.c b/test/core/end2end/tests/bad_hostname.c
index c63c9c78ad..72a44d0de5 100644
--- a/test/core/end2end/tests/bad_hostname.c
+++ b/test/core/end2end/tests/bad_hostname.c
@@ -76,9 +76,10 @@ static void drain_cq(grpc_completion_queue *cq) {
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), NULL)
+ grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000));
+ GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000),
+ grpc_timeout_seconds_to_deadline(5),
+ NULL)
.type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server);
f->server = NULL;
@@ -97,6 +98,7 @@ static void end_test(grpc_end2end_test_fixture *f) {
grpc_completion_queue_shutdown(f->cq);
drain_cq(f->cq);
grpc_completion_queue_destroy(f->cq);
+ grpc_completion_queue_destroy(f->shutdown_cq);
}
static void simple_request_body(grpc_end2end_test_fixture f) {
diff --git a/test/core/end2end/tests/bad_ping.c b/test/core/end2end/tests/bad_ping.c
index 01a6aeaa04..38cd1dfa84 100644
--- a/test/core/end2end/tests/bad_ping.c
+++ b/test/core/end2end/tests/bad_ping.c
@@ -75,6 +75,7 @@ static void end_test(grpc_end2end_test_fixture *f) {
grpc_completion_queue_shutdown(f->cq);
drain_cq(f->cq);
grpc_completion_queue_destroy(f->cq);
+ grpc_completion_queue_destroy(f->shutdown_cq);
}
static void test_bad_ping(grpc_end2end_test_config config) {
diff --git a/test/core/end2end/tests/binary_metadata.c b/test/core/end2end/tests/binary_metadata.c
index 9cb17c9d42..2bddd053d6 100644
--- a/test/core/end2end/tests/binary_metadata.c
+++ b/test/core/end2end/tests/binary_metadata.c
@@ -74,9 +74,10 @@ static void drain_cq(grpc_completion_queue *cq) {
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), NULL)
+ grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000));
+ GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000),
+ grpc_timeout_seconds_to_deadline(5),
+ NULL)
.type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server);
f->server = NULL;
@@ -95,6 +96,7 @@ static void end_test(grpc_end2end_test_fixture *f) {
grpc_completion_queue_shutdown(f->cq);
drain_cq(f->cq);
grpc_completion_queue_destroy(f->cq);
+ grpc_completion_queue_destroy(f->shutdown_cq);
}
/* Request/response with metadata and payload.*/
diff --git a/test/core/end2end/tests/call_creds.c b/test/core/end2end/tests/call_creds.c
index d65073fbbe..9ec9701f9c 100644
--- a/test/core/end2end/tests/call_creds.c
+++ b/test/core/end2end/tests/call_creds.c
@@ -92,9 +92,10 @@ static void drain_cq(grpc_completion_queue *cq) {
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), NULL)
+ grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000));
+ GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000),
+ 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 end_test(grpc_end2end_test_fixture *f) {
grpc_completion_queue_shutdown(f->cq);
drain_cq(f->cq);
grpc_completion_queue_destroy(f->cq);
+ grpc_completion_queue_destroy(f->shutdown_cq);
}
static void print_auth_context(int is_client, const grpc_auth_context *ctx) {
diff --git a/test/core/end2end/tests/cancel_after_accept.c b/test/core/end2end/tests/cancel_after_accept.c
index bda061ccb8..7946865a83 100644
--- a/test/core/end2end/tests/cancel_after_accept.c
+++ b/test/core/end2end/tests/cancel_after_accept.c
@@ -81,9 +81,10 @@ static void drain_cq(grpc_completion_queue *cq) {
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), NULL)
+ grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000));
+ GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000),
+ grpc_timeout_seconds_to_deadline(5),
+ NULL)
.type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server);
f->server = NULL;
@@ -102,6 +103,7 @@ static void end_test(grpc_end2end_test_fixture *f) {
grpc_completion_queue_shutdown(f->cq);
drain_cq(f->cq);
grpc_completion_queue_destroy(f->cq);
+ grpc_completion_queue_destroy(f->shutdown_cq);
}
/* Cancel after accept, no payload */
diff --git a/test/core/end2end/tests/cancel_after_client_done.c b/test/core/end2end/tests/cancel_after_client_done.c
index 0e7291116f..7089f3f557 100644
--- a/test/core/end2end/tests/cancel_after_client_done.c
+++ b/test/core/end2end/tests/cancel_after_client_done.c
@@ -75,9 +75,10 @@ static void drain_cq(grpc_completion_queue *cq) {
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), NULL)
+ grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000));
+ GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000),
+ grpc_timeout_seconds_to_deadline(5),
+ NULL)
.type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server);
f->server = NULL;
@@ -96,6 +97,7 @@ static void end_test(grpc_end2end_test_fixture *f) {
grpc_completion_queue_shutdown(f->cq);
drain_cq(f->cq);
grpc_completion_queue_destroy(f->cq);
+ grpc_completion_queue_destroy(f->shutdown_cq);
}
/* Cancel after accept with a writes closed, no payload */
diff --git a/test/core/end2end/tests/cancel_after_invoke.c b/test/core/end2end/tests/cancel_after_invoke.c
index 0ee59806fe..f29012b86d 100644
--- a/test/core/end2end/tests/cancel_after_invoke.c
+++ b/test/core/end2end/tests/cancel_after_invoke.c
@@ -78,9 +78,10 @@ static void drain_cq(grpc_completion_queue *cq) {
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), NULL)
- .type == GRPC_OP_COMPLETE);
+ grpc_event ev = grpc_completion_queue_next(
+ f->cq, grpc_timeout_seconds_to_deadline(5), NULL);
+ GPR_ASSERT(ev.type == GRPC_OP_COMPLETE);
+ GPR_ASSERT(ev.tag == tag(1000));
grpc_server_destroy(f->server);
f->server = NULL;
}
@@ -98,6 +99,7 @@ static void end_test(grpc_end2end_test_fixture *f) {
grpc_completion_queue_shutdown(f->cq);
drain_cq(f->cq);
grpc_completion_queue_destroy(f->cq);
+ grpc_completion_queue_destroy(f->shutdown_cq);
}
/* Cancel after invoke, no payload */
diff --git a/test/core/end2end/tests/cancel_before_invoke.c b/test/core/end2end/tests/cancel_before_invoke.c
index 7d53091a1a..1b1296dc2a 100644
--- a/test/core/end2end/tests/cancel_before_invoke.c
+++ b/test/core/end2end/tests/cancel_before_invoke.c
@@ -74,9 +74,10 @@ static void drain_cq(grpc_completion_queue *cq) {
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), NULL)
+ grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000));
+ GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000),
+ grpc_timeout_seconds_to_deadline(5),
+ NULL)
.type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server);
f->server = NULL;
@@ -95,6 +96,7 @@ static void end_test(grpc_end2end_test_fixture *f) {
grpc_completion_queue_shutdown(f->cq);
drain_cq(f->cq);
grpc_completion_queue_destroy(f->cq);
+ grpc_completion_queue_destroy(f->shutdown_cq);
}
/* Cancel before invoke */
diff --git a/test/core/end2end/tests/cancel_in_a_vacuum.c b/test/core/end2end/tests/cancel_in_a_vacuum.c
index c13fc88c53..4f5e496432 100644
--- a/test/core/end2end/tests/cancel_in_a_vacuum.c
+++ b/test/core/end2end/tests/cancel_in_a_vacuum.c
@@ -75,9 +75,10 @@ static void drain_cq(grpc_completion_queue *cq) {
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), NULL)
+ grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000));
+ GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000),
+ grpc_timeout_seconds_to_deadline(5),
+ NULL)
.type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server);
f->server = NULL;
@@ -96,6 +97,7 @@ static void end_test(grpc_end2end_test_fixture *f) {
grpc_completion_queue_shutdown(f->cq);
drain_cq(f->cq);
grpc_completion_queue_destroy(f->cq);
+ grpc_completion_queue_destroy(f->shutdown_cq);
}
/* Cancel and do nothing */
diff --git a/test/core/end2end/tests/cancel_with_status.c b/test/core/end2end/tests/cancel_with_status.c
index 1e0e33b4e2..180748c2ae 100644
--- a/test/core/end2end/tests/cancel_with_status.c
+++ b/test/core/end2end/tests/cancel_with_status.c
@@ -77,9 +77,10 @@ static void drain_cq(grpc_completion_queue *cq) {
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), NULL)
- .type == GRPC_OP_COMPLETE);
+ grpc_event ev = grpc_completion_queue_next(
+ f->cq, grpc_timeout_seconds_to_deadline(5), NULL);
+ GPR_ASSERT(ev.type == GRPC_OP_COMPLETE);
+ GPR_ASSERT(ev.tag == tag(1000));
grpc_server_destroy(f->server);
f->server = NULL;
}
@@ -97,6 +98,7 @@ static void end_test(grpc_end2end_test_fixture *f) {
grpc_completion_queue_shutdown(f->cq);
drain_cq(f->cq);
grpc_completion_queue_destroy(f->cq);
+ grpc_completion_queue_destroy(f->shutdown_cq);
}
static void simple_request_body(grpc_end2end_test_config config,
diff --git a/test/core/end2end/tests/compressed_payload.c b/test/core/end2end/tests/compressed_payload.c
index c5b750af52..1671ce5564 100644
--- a/test/core/end2end/tests/compressed_payload.c
+++ b/test/core/end2end/tests/compressed_payload.c
@@ -82,9 +82,10 @@ static void drain_cq(grpc_completion_queue *cq) {
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), NULL)
+ grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000));
+ GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000),
+ grpc_timeout_seconds_to_deadline(5),
+ NULL)
.type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server);
f->server = NULL;
@@ -103,6 +104,7 @@ static void end_test(grpc_end2end_test_fixture *f) {
grpc_completion_queue_shutdown(f->cq);
drain_cq(f->cq);
grpc_completion_queue_destroy(f->cq);
+ grpc_completion_queue_destroy(f->shutdown_cq);
}
static void request_for_disabled_algorithm(
diff --git a/test/core/end2end/tests/connectivity.c b/test/core/end2end/tests/connectivity.c
index 979419a100..eb84aaed16 100644
--- a/test/core/end2end/tests/connectivity.c
+++ b/test/core/end2end/tests/connectivity.c
@@ -171,6 +171,9 @@ static void test_connectivity(grpc_end2end_test_config config) {
grpc_channel_destroy(f.client);
grpc_completion_queue_shutdown(f.cq);
grpc_completion_queue_destroy(f.cq);
+
+ /* shutdown_cq is not used in this test */
+ grpc_completion_queue_destroy(f.shutdown_cq);
config.tear_down_data(&f);
cq_verifier_destroy(cqv);
diff --git a/test/core/end2end/tests/default_host.c b/test/core/end2end/tests/default_host.c
index 8dccca20c7..c0ae50ec62 100644
--- a/test/core/end2end/tests/default_host.c
+++ b/test/core/end2end/tests/default_host.c
@@ -76,9 +76,10 @@ static void drain_cq(grpc_completion_queue *cq) {
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), NULL)
+ grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000));
+ GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000),
+ grpc_timeout_seconds_to_deadline(5),
+ NULL)
.type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server);
f->server = NULL;
@@ -97,6 +98,7 @@ static void end_test(grpc_end2end_test_fixture *f) {
grpc_completion_queue_shutdown(f->cq);
drain_cq(f->cq);
grpc_completion_queue_destroy(f->cq);
+ grpc_completion_queue_destroy(f->shutdown_cq);
}
static void simple_request_body(grpc_end2end_test_fixture f) {
diff --git a/test/core/end2end/tests/disappearing_server.c b/test/core/end2end/tests/disappearing_server.c
index e2b888a3bb..22492c0bfc 100644
--- a/test/core/end2end/tests/disappearing_server.c
+++ b/test/core/end2end/tests/disappearing_server.c
@@ -79,6 +79,9 @@ static void end_test(grpc_end2end_test_fixture *f) {
grpc_completion_queue_shutdown(f->cq);
drain_cq(f->cq);
grpc_completion_queue_destroy(f->cq);
+
+ /* Note: shutdown_cq was unused in this test */
+ grpc_completion_queue_destroy(f->shutdown_cq);
}
static void do_request_and_shutdown_server(grpc_end2end_test_config config,
diff --git a/test/core/end2end/tests/empty_batch.c b/test/core/end2end/tests/empty_batch.c
index 37ca81384f..fe57a6e514 100644
--- a/test/core/end2end/tests/empty_batch.c
+++ b/test/core/end2end/tests/empty_batch.c
@@ -76,9 +76,10 @@ static void drain_cq(grpc_completion_queue *cq) {
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), NULL)
+ grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000));
+ GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000),
+ grpc_timeout_seconds_to_deadline(5),
+ NULL)
.type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server);
f->server = NULL;
@@ -97,6 +98,7 @@ static void end_test(grpc_end2end_test_fixture *f) {
grpc_completion_queue_shutdown(f->cq);
drain_cq(f->cq);
grpc_completion_queue_destroy(f->cq);
+ grpc_completion_queue_destroy(f->shutdown_cq);
}
static void empty_batch_body(grpc_end2end_test_config config,
diff --git a/test/core/end2end/tests/filter_call_init_fails.c b/test/core/end2end/tests/filter_call_init_fails.c
index 0c4f0dd42f..8d654d7587 100644
--- a/test/core/end2end/tests/filter_call_init_fails.c
+++ b/test/core/end2end/tests/filter_call_init_fails.c
@@ -84,9 +84,10 @@ static void drain_cq(grpc_completion_queue *cq) {
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), NULL)
+ grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000));
+ GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000),
+ grpc_timeout_seconds_to_deadline(5),
+ NULL)
.type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server);
f->server = NULL;
@@ -105,6 +106,7 @@ static void end_test(grpc_end2end_test_fixture *f) {
grpc_completion_queue_shutdown(f->cq);
drain_cq(f->cq);
grpc_completion_queue_destroy(f->cq);
+ grpc_completion_queue_destroy(f->shutdown_cq);
}
// Simple request via a SERVER_CHANNEL filter that always fails to
diff --git a/test/core/end2end/tests/filter_causes_close.c b/test/core/end2end/tests/filter_causes_close.c
index 9115823a74..decfff3429 100644
--- a/test/core/end2end/tests/filter_causes_close.c
+++ b/test/core/end2end/tests/filter_causes_close.c
@@ -79,9 +79,10 @@ static void drain_cq(grpc_completion_queue *cq) {
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), NULL)
+ grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000));
+ GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000),
+ grpc_timeout_seconds_to_deadline(5),
+ NULL)
.type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server);
f->server = NULL;
@@ -100,6 +101,7 @@ static void end_test(grpc_end2end_test_fixture *f) {
grpc_completion_queue_shutdown(f->cq);
drain_cq(f->cq);
grpc_completion_queue_destroy(f->cq);
+ grpc_completion_queue_destroy(f->shutdown_cq);
}
/* Simple request via a server filter that always closes the stream.*/
diff --git a/test/core/end2end/tests/filter_latency.c b/test/core/end2end/tests/filter_latency.c
index d38ce22e09..e87e7339b8 100644
--- a/test/core/end2end/tests/filter_latency.c
+++ b/test/core/end2end/tests/filter_latency.c
@@ -86,9 +86,10 @@ static void drain_cq(grpc_completion_queue *cq) {
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), NULL)
+ grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000));
+ GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000),
+ grpc_timeout_seconds_to_deadline(5),
+ NULL)
.type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server);
f->server = NULL;
@@ -107,6 +108,7 @@ static void end_test(grpc_end2end_test_fixture *f) {
grpc_completion_queue_shutdown(f->cq);
drain_cq(f->cq);
grpc_completion_queue_destroy(f->cq);
+ grpc_completion_queue_destroy(f->shutdown_cq);
}
// Simple request via a server filter that saves the reported latency value.
diff --git a/test/core/end2end/tests/graceful_server_shutdown.c b/test/core/end2end/tests/graceful_server_shutdown.c
index 182bb20780..efb54a4a1d 100644
--- a/test/core/end2end/tests/graceful_server_shutdown.c
+++ b/test/core/end2end/tests/graceful_server_shutdown.c
@@ -91,6 +91,8 @@ static void end_test(grpc_end2end_test_fixture *f) {
grpc_completion_queue_shutdown(f->cq);
drain_cq(f->cq);
grpc_completion_queue_destroy(f->cq);
+ /* Note: shutdown_cq is not used in this test */
+ grpc_completion_queue_destroy(f->shutdown_cq);
}
static void test_early_server_shutdown_finishes_inflight_calls(
diff --git a/test/core/end2end/tests/high_initial_seqno.c b/test/core/end2end/tests/high_initial_seqno.c
index f534a19c87..ae364fd293 100644
--- a/test/core/end2end/tests/high_initial_seqno.c
+++ b/test/core/end2end/tests/high_initial_seqno.c
@@ -78,9 +78,10 @@ static void drain_cq(grpc_completion_queue *cq) {
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), NULL)
+ grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000));
+ GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000),
+ grpc_timeout_seconds_to_deadline(5),
+ NULL)
.type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server);
f->server = NULL;
@@ -99,6 +100,7 @@ static void end_test(grpc_end2end_test_fixture *f) {
grpc_completion_queue_shutdown(f->cq);
drain_cq(f->cq);
grpc_completion_queue_destroy(f->cq);
+ grpc_completion_queue_destroy(f->shutdown_cq);
}
static void simple_request_body(grpc_end2end_test_config config,
diff --git a/test/core/end2end/tests/hpack_size.c b/test/core/end2end/tests/hpack_size.c
index 17ef204ce9..15f5bb0240 100644
--- a/test/core/end2end/tests/hpack_size.c
+++ b/test/core/end2end/tests/hpack_size.c
@@ -218,9 +218,10 @@ static void drain_cq(grpc_completion_queue *cq) {
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), NULL)
+ grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000));
+ GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000),
+ grpc_timeout_seconds_to_deadline(5),
+ NULL)
.type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server);
f->server = NULL;
@@ -239,6 +240,7 @@ static void end_test(grpc_end2end_test_fixture *f) {
grpc_completion_queue_shutdown(f->cq);
drain_cq(f->cq);
grpc_completion_queue_destroy(f->cq);
+ grpc_completion_queue_destroy(f->shutdown_cq);
}
static void simple_request_body(grpc_end2end_test_config config,
diff --git a/test/core/end2end/tests/idempotent_request.c b/test/core/end2end/tests/idempotent_request.c
index f80654db1a..9c1ec25855 100644
--- a/test/core/end2end/tests/idempotent_request.c
+++ b/test/core/end2end/tests/idempotent_request.c
@@ -76,9 +76,10 @@ static void drain_cq(grpc_completion_queue *cq) {
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), NULL)
+ grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000));
+ GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000),
+ grpc_timeout_seconds_to_deadline(5),
+ NULL)
.type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server);
f->server = NULL;
@@ -97,6 +98,7 @@ static void end_test(grpc_end2end_test_fixture *f) {
grpc_completion_queue_shutdown(f->cq);
drain_cq(f->cq);
grpc_completion_queue_destroy(f->cq);
+ grpc_completion_queue_destroy(f->shutdown_cq);
}
static void simple_request_body(grpc_end2end_test_config config,
diff --git a/test/core/end2end/tests/invoke_large_request.c b/test/core/end2end/tests/invoke_large_request.c
index f4b93d9873..a437fd7fb7 100644
--- a/test/core/end2end/tests/invoke_large_request.c
+++ b/test/core/end2end/tests/invoke_large_request.c
@@ -71,9 +71,10 @@ static void drain_cq(grpc_completion_queue *cq) {
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), NULL)
+ grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000));
+ GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000),
+ grpc_timeout_seconds_to_deadline(5),
+ NULL)
.type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server);
f->server = NULL;
@@ -92,6 +93,7 @@ static void end_test(grpc_end2end_test_fixture *f) {
grpc_completion_queue_shutdown(f->cq);
drain_cq(f->cq);
grpc_completion_queue_destroy(f->cq);
+ grpc_completion_queue_destroy(f->shutdown_cq);
}
static grpc_slice large_slice(void) {
diff --git a/test/core/end2end/tests/keepalive_timeout.c b/test/core/end2end/tests/keepalive_timeout.c
index bf6ca0d9d9..f274cdb26c 100644
--- a/test/core/end2end/tests/keepalive_timeout.c
+++ b/test/core/end2end/tests/keepalive_timeout.c
@@ -78,8 +78,9 @@ static void drain_cq(grpc_completion_queue *cq) {
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_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000));
+ GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000),
five_seconds_from_now(), NULL)
.type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server);
@@ -99,6 +100,7 @@ static void end_test(grpc_end2end_test_fixture *f) {
grpc_completion_queue_shutdown(f->cq);
drain_cq(f->cq);
grpc_completion_queue_destroy(f->cq);
+ grpc_completion_queue_destroy(f->shutdown_cq);
}
/* Client sends a request, server replies with a payload, then waits for the
diff --git a/test/core/end2end/tests/large_metadata.c b/test/core/end2end/tests/large_metadata.c
index a670e411e9..cef03b69df 100644
--- a/test/core/end2end/tests/large_metadata.c
+++ b/test/core/end2end/tests/large_metadata.c
@@ -74,9 +74,10 @@ static void drain_cq(grpc_completion_queue *cq) {
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), NULL)
+ grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000));
+ GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000),
+ grpc_timeout_seconds_to_deadline(5),
+ NULL)
.type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server);
f->server = NULL;
@@ -95,6 +96,7 @@ static void end_test(grpc_end2end_test_fixture *f) {
grpc_completion_queue_shutdown(f->cq);
drain_cq(f->cq);
grpc_completion_queue_destroy(f->cq);
+ grpc_completion_queue_destroy(f->shutdown_cq);
}
// Request with a large amount of metadata.
diff --git a/test/core/end2end/tests/load_reporting_hook.c b/test/core/end2end/tests/load_reporting_hook.c
index ea3dd2368b..72e9db6e21 100644
--- a/test/core/end2end/tests/load_reporting_hook.c
+++ b/test/core/end2end/tests/load_reporting_hook.c
@@ -101,9 +101,10 @@ static void drain_cq(grpc_completion_queue *cq) {
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), NULL)
+ grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000));
+ GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000),
+ grpc_timeout_seconds_to_deadline(5),
+ NULL)
.type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server);
f->server = NULL;
@@ -122,6 +123,7 @@ static void end_test(grpc_end2end_test_fixture *f) {
grpc_completion_queue_shutdown(f->cq);
drain_cq(f->cq);
grpc_completion_queue_destroy(f->cq);
+ grpc_completion_queue_destroy(f->shutdown_cq);
}
static void request_response_with_payload(
diff --git a/test/core/end2end/tests/max_concurrent_streams.c b/test/core/end2end/tests/max_concurrent_streams.c
index 2360138ede..645701613b 100644
--- a/test/core/end2end/tests/max_concurrent_streams.c
+++ b/test/core/end2end/tests/max_concurrent_streams.c
@@ -74,9 +74,10 @@ static void drain_cq(grpc_completion_queue *cq) {
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), NULL)
+ grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000));
+ GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000),
+ grpc_timeout_seconds_to_deadline(5),
+ NULL)
.type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server);
f->server = NULL;
@@ -95,6 +96,7 @@ static void end_test(grpc_end2end_test_fixture *f) {
grpc_completion_queue_shutdown(f->cq);
drain_cq(f->cq);
grpc_completion_queue_destroy(f->cq);
+ grpc_completion_queue_destroy(f->shutdown_cq);
}
static void simple_request_body(grpc_end2end_test_config config,
diff --git a/test/core/end2end/tests/max_connection_age.c b/test/core/end2end/tests/max_connection_age.c
index 04bdb39445..7b41fa597b 100644
--- a/test/core/end2end/tests/max_connection_age.c
+++ b/test/core/end2end/tests/max_connection_age.c
@@ -89,6 +89,7 @@ static void end_test(grpc_end2end_test_fixture *f) {
grpc_completion_queue_shutdown(f->cq);
drain_cq(f->cq);
grpc_completion_queue_destroy(f->cq);
+ grpc_completion_queue_destroy(f->shutdown_cq);
}
static void test_max_age_forcibly_close(grpc_end2end_test_config config) {
diff --git a/test/core/end2end/tests/max_connection_idle.c b/test/core/end2end/tests/max_connection_idle.c
index 98bc08c6d5..ceb02947fe 100644
--- a/test/core/end2end/tests/max_connection_idle.c
+++ b/test/core/end2end/tests/max_connection_idle.c
@@ -242,6 +242,7 @@ static void test_max_connection_idle(grpc_end2end_test_config config) {
grpc_completion_queue_shutdown(f.cq);
drain_cq(f.cq);
grpc_completion_queue_destroy(f.cq);
+ grpc_completion_queue_destroy(f.shutdown_cq);
config.tear_down_data(&f);
cq_verifier_destroy(cqv);
diff --git a/test/core/end2end/tests/max_message_length.c b/test/core/end2end/tests/max_message_length.c
index a8b6f1f79a..224c1cd833 100644
--- a/test/core/end2end/tests/max_message_length.c
+++ b/test/core/end2end/tests/max_message_length.c
@@ -83,9 +83,10 @@ static void drain_cq(grpc_completion_queue *cq) {
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), NULL)
+ grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000));
+ GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000),
+ grpc_timeout_seconds_to_deadline(5),
+ NULL)
.type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server);
f->server = NULL;
@@ -104,6 +105,7 @@ static void end_test(grpc_end2end_test_fixture *f) {
grpc_completion_queue_shutdown(f->cq);
drain_cq(f->cq);
grpc_completion_queue_destroy(f->cq);
+ grpc_completion_queue_destroy(f->shutdown_cq);
}
// Test with request larger than the limit.
diff --git a/test/core/end2end/tests/negative_deadline.c b/test/core/end2end/tests/negative_deadline.c
index e7448bd6bc..52c1a72bbf 100644
--- a/test/core/end2end/tests/negative_deadline.c
+++ b/test/core/end2end/tests/negative_deadline.c
@@ -76,9 +76,10 @@ static void drain_cq(grpc_completion_queue *cq) {
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), NULL)
+ grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000));
+ GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000),
+ grpc_timeout_seconds_to_deadline(5),
+ NULL)
.type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server);
f->server = NULL;
@@ -97,6 +98,7 @@ static void end_test(grpc_end2end_test_fixture *f) {
grpc_completion_queue_shutdown(f->cq);
drain_cq(f->cq);
grpc_completion_queue_destroy(f->cq);
+ grpc_completion_queue_destroy(f->shutdown_cq);
}
static void simple_request_body(grpc_end2end_test_config config,
diff --git a/test/core/end2end/tests/network_status_change.c b/test/core/end2end/tests/network_status_change.c
index 1a5f2b25cc..a810489bf2 100644
--- a/test/core/end2end/tests/network_status_change.c
+++ b/test/core/end2end/tests/network_status_change.c
@@ -77,9 +77,10 @@ static void drain_cq(grpc_completion_queue *cq) {
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), NULL)
+ grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000));
+ GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000),
+ grpc_timeout_seconds_to_deadline(5),
+ NULL)
.type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server);
f->server = NULL;
@@ -98,6 +99,7 @@ static void end_test(grpc_end2end_test_fixture *f) {
grpc_completion_queue_shutdown(f->cq);
drain_cq(f->cq);
grpc_completion_queue_destroy(f->cq);
+ grpc_completion_queue_destroy(f->shutdown_cq);
}
/* Client sends a request with payload, server reads then returns status. */
diff --git a/test/core/end2end/tests/no_logging.c b/test/core/end2end/tests/no_logging.c
index 683d6465db..44e8188059 100644
--- a/test/core/end2end/tests/no_logging.c
+++ b/test/core/end2end/tests/no_logging.c
@@ -104,9 +104,10 @@ static void drain_cq(grpc_completion_queue *cq) {
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), NULL)
+ grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000));
+ GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000),
+ grpc_timeout_seconds_to_deadline(5),
+ NULL)
.type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server);
f->server = NULL;
@@ -125,6 +126,7 @@ static void end_test(grpc_end2end_test_fixture *f) {
grpc_completion_queue_shutdown(f->cq);
drain_cq(f->cq);
grpc_completion_queue_destroy(f->cq);
+ grpc_completion_queue_destroy(f->shutdown_cq);
}
static void simple_request_body(grpc_end2end_test_config config,
diff --git a/test/core/end2end/tests/no_op.c b/test/core/end2end/tests/no_op.c
index 698d8fbc60..0d98fc9c0a 100644
--- a/test/core/end2end/tests/no_op.c
+++ b/test/core/end2end/tests/no_op.c
@@ -74,9 +74,10 @@ static void drain_cq(grpc_completion_queue *cq) {
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), NULL)
+ grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000));
+ GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000),
+ grpc_timeout_seconds_to_deadline(5),
+ NULL)
.type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server);
f->server = NULL;
@@ -95,6 +96,7 @@ static void end_test(grpc_end2end_test_fixture *f) {
grpc_completion_queue_shutdown(f->cq);
drain_cq(f->cq);
grpc_completion_queue_destroy(f->cq);
+ grpc_completion_queue_destroy(f->shutdown_cq);
}
static void test_no_op(grpc_end2end_test_config config) {
diff --git a/test/core/end2end/tests/payload.c b/test/core/end2end/tests/payload.c
index 5751b801b5..df9004fb55 100644
--- a/test/core/end2end/tests/payload.c
+++ b/test/core/end2end/tests/payload.c
@@ -74,9 +74,10 @@ static void drain_cq(grpc_completion_queue *cq) {
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), NULL)
+ grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000));
+ GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000),
+ grpc_timeout_seconds_to_deadline(5),
+ NULL)
.type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server);
f->server = NULL;
@@ -95,6 +96,7 @@ static void end_test(grpc_end2end_test_fixture *f) {
grpc_completion_queue_shutdown(f->cq);
drain_cq(f->cq);
grpc_completion_queue_destroy(f->cq);
+ grpc_completion_queue_destroy(f->shutdown_cq);
}
/* Creates and returns a grpc_slice containing random alphanumeric characters.
diff --git a/test/core/end2end/tests/ping.c b/test/core/end2end/tests/ping.c
index c51c4993e2..027c17ea4c 100644
--- a/test/core/end2end/tests/ping.c
+++ b/test/core/end2end/tests/ping.c
@@ -112,6 +112,9 @@ static void test_ping(grpc_end2end_test_config config,
grpc_channel_destroy(f.client);
grpc_completion_queue_shutdown(f.cq);
grpc_completion_queue_destroy(f.cq);
+
+ /* f.shutdown_cq is not used in this test */
+ grpc_completion_queue_destroy(f.shutdown_cq);
config.tear_down_data(&f);
cq_verifier_destroy(cqv);
diff --git a/test/core/end2end/tests/ping_pong_streaming.c b/test/core/end2end/tests/ping_pong_streaming.c
index cd81ce24fe..fc5a0a5ec3 100644
--- a/test/core/end2end/tests/ping_pong_streaming.c
+++ b/test/core/end2end/tests/ping_pong_streaming.c
@@ -74,9 +74,10 @@ static void drain_cq(grpc_completion_queue *cq) {
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), NULL)
+ grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000));
+ GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000),
+ grpc_timeout_seconds_to_deadline(5),
+ NULL)
.type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server);
f->server = NULL;
@@ -95,6 +96,7 @@ static void end_test(grpc_end2end_test_fixture *f) {
grpc_completion_queue_shutdown(f->cq);
drain_cq(f->cq);
grpc_completion_queue_destroy(f->cq);
+ grpc_completion_queue_destroy(f->shutdown_cq);
}
/* Client pings and server pongs. Repeat messages rounds before finishing. */
diff --git a/test/core/end2end/tests/registered_call.c b/test/core/end2end/tests/registered_call.c
index 242add37cb..258040371f 100644
--- a/test/core/end2end/tests/registered_call.c
+++ b/test/core/end2end/tests/registered_call.c
@@ -76,9 +76,10 @@ static void drain_cq(grpc_completion_queue *cq) {
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), NULL)
+ grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000));
+ GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000),
+ grpc_timeout_seconds_to_deadline(5),
+ NULL)
.type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server);
f->server = NULL;
@@ -97,6 +98,7 @@ static void end_test(grpc_end2end_test_fixture *f) {
grpc_completion_queue_shutdown(f->cq);
drain_cq(f->cq);
grpc_completion_queue_destroy(f->cq);
+ grpc_completion_queue_destroy(f->shutdown_cq);
}
static void simple_request_body(grpc_end2end_test_config config,
diff --git a/test/core/end2end/tests/request_with_flags.c b/test/core/end2end/tests/request_with_flags.c
index 10ecf5b1af..e913fa46c3 100644
--- a/test/core/end2end/tests/request_with_flags.c
+++ b/test/core/end2end/tests/request_with_flags.c
@@ -75,9 +75,10 @@ static void drain_cq(grpc_completion_queue *cq) {
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), NULL)
+ grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000));
+ GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000),
+ grpc_timeout_seconds_to_deadline(5),
+ NULL)
.type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server);
f->server = NULL;
@@ -96,6 +97,7 @@ static void end_test(grpc_end2end_test_fixture *f) {
grpc_completion_queue_shutdown(f->cq);
drain_cq(f->cq);
grpc_completion_queue_destroy(f->cq);
+ grpc_completion_queue_destroy(f->shutdown_cq);
}
static void test_invoke_request_with_flags(
diff --git a/test/core/end2end/tests/request_with_payload.c b/test/core/end2end/tests/request_with_payload.c
index 4eb3399bb9..17c0761090 100644
--- a/test/core/end2end/tests/request_with_payload.c
+++ b/test/core/end2end/tests/request_with_payload.c
@@ -74,9 +74,10 @@ static void drain_cq(grpc_completion_queue *cq) {
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), NULL)
+ grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000));
+ GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000),
+ grpc_timeout_seconds_to_deadline(5),
+ NULL)
.type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server);
f->server = NULL;
@@ -95,6 +96,7 @@ static void end_test(grpc_end2end_test_fixture *f) {
grpc_completion_queue_shutdown(f->cq);
drain_cq(f->cq);
grpc_completion_queue_destroy(f->cq);
+ grpc_completion_queue_destroy(f->shutdown_cq);
}
/* Client sends a request with payload, server reads then returns status. */
diff --git a/test/core/end2end/tests/resource_quota_server.c b/test/core/end2end/tests/resource_quota_server.c
index 4d3ce1c937..29b35d0468 100644
--- a/test/core/end2end/tests/resource_quota_server.c
+++ b/test/core/end2end/tests/resource_quota_server.c
@@ -74,9 +74,10 @@ static void drain_cq(grpc_completion_queue *cq) {
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), NULL)
+ grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000));
+ GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000),
+ grpc_timeout_seconds_to_deadline(5),
+ NULL)
.type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server);
f->server = NULL;
@@ -95,6 +96,7 @@ static void end_test(grpc_end2end_test_fixture *f) {
grpc_completion_queue_shutdown(f->cq);
drain_cq(f->cq);
grpc_completion_queue_destroy(f->cq);
+ grpc_completion_queue_destroy(f->shutdown_cq);
}
/* Creates and returns a grpc_slice containing random alphanumeric characters.
diff --git a/test/core/end2end/tests/server_finishes_request.c b/test/core/end2end/tests/server_finishes_request.c
index 88bc90e778..990f063090 100644
--- a/test/core/end2end/tests/server_finishes_request.c
+++ b/test/core/end2end/tests/server_finishes_request.c
@@ -76,9 +76,10 @@ static void drain_cq(grpc_completion_queue *cq) {
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), NULL)
+ grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000));
+ GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000),
+ grpc_timeout_seconds_to_deadline(5),
+ NULL)
.type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server);
f->server = NULL;
@@ -97,6 +98,7 @@ static void end_test(grpc_end2end_test_fixture *f) {
grpc_completion_queue_shutdown(f->cq);
drain_cq(f->cq);
grpc_completion_queue_destroy(f->cq);
+ grpc_completion_queue_destroy(f->shutdown_cq);
}
static void simple_request_body(grpc_end2end_test_config config,
diff --git a/test/core/end2end/tests/shutdown_finishes_calls.c b/test/core/end2end/tests/shutdown_finishes_calls.c
index 6f9421d19a..2385423538 100644
--- a/test/core/end2end/tests/shutdown_finishes_calls.c
+++ b/test/core/end2end/tests/shutdown_finishes_calls.c
@@ -84,6 +84,8 @@ static void end_test(grpc_end2end_test_fixture *f) {
grpc_completion_queue_shutdown(f->cq);
drain_cq(f->cq);
grpc_completion_queue_destroy(f->cq);
+ /* f->shutdown_cq is not used in this test */
+ grpc_completion_queue_destroy(f->shutdown_cq);
}
static void test_early_server_shutdown_finishes_inflight_calls(
diff --git a/test/core/end2end/tests/shutdown_finishes_tags.c b/test/core/end2end/tests/shutdown_finishes_tags.c
index 51a242337f..008f72e6f4 100644
--- a/test/core/end2end/tests/shutdown_finishes_tags.c
+++ b/test/core/end2end/tests/shutdown_finishes_tags.c
@@ -84,6 +84,8 @@ static void end_test(grpc_end2end_test_fixture *f) {
grpc_completion_queue_shutdown(f->cq);
drain_cq(f->cq);
grpc_completion_queue_destroy(f->cq);
+ /* f->shutdown_cq is not used in this test */
+ grpc_completion_queue_destroy(f->shutdown_cq);
}
static void test_early_server_shutdown_finishes_tags(
diff --git a/test/core/end2end/tests/simple_cacheable_request.c b/test/core/end2end/tests/simple_cacheable_request.c
index 4f1013a030..d0c292c338 100644
--- a/test/core/end2end/tests/simple_cacheable_request.c
+++ b/test/core/end2end/tests/simple_cacheable_request.c
@@ -76,9 +76,10 @@ static void drain_cq(grpc_completion_queue *cq) {
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), NULL)
+ grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000));
+ GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000),
+ grpc_timeout_seconds_to_deadline(5),
+ NULL)
.type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server);
f->server = NULL;
@@ -97,6 +98,7 @@ static void end_test(grpc_end2end_test_fixture *f) {
grpc_completion_queue_shutdown(f->cq);
drain_cq(f->cq);
grpc_completion_queue_destroy(f->cq);
+ grpc_completion_queue_destroy(f->shutdown_cq);
}
/* Request/response with metadata and payload.*/
diff --git a/test/core/end2end/tests/simple_delayed_request.c b/test/core/end2end/tests/simple_delayed_request.c
index 978dff0dc0..c8b88def1f 100644
--- a/test/core/end2end/tests/simple_delayed_request.c
+++ b/test/core/end2end/tests/simple_delayed_request.c
@@ -62,9 +62,10 @@ static void drain_cq(grpc_completion_queue *cq) {
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), NULL)
+ grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000));
+ GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000),
+ grpc_timeout_seconds_to_deadline(5),
+ NULL)
.type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server);
f->server = NULL;
@@ -83,6 +84,7 @@ static void end_test(grpc_end2end_test_fixture *f) {
grpc_completion_queue_shutdown(f->cq);
drain_cq(f->cq);
grpc_completion_queue_destroy(f->cq);
+ grpc_completion_queue_destroy(f->shutdown_cq);
}
static void simple_delayed_request_body(grpc_end2end_test_config config,
diff --git a/test/core/end2end/tests/simple_metadata.c b/test/core/end2end/tests/simple_metadata.c
index 83d1037e4b..367f0b7696 100644
--- a/test/core/end2end/tests/simple_metadata.c
+++ b/test/core/end2end/tests/simple_metadata.c
@@ -74,9 +74,10 @@ static void drain_cq(grpc_completion_queue *cq) {
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), NULL)
+ grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000));
+ GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000),
+ grpc_timeout_seconds_to_deadline(5),
+ NULL)
.type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server);
f->server = NULL;
@@ -95,6 +96,7 @@ static void end_test(grpc_end2end_test_fixture *f) {
grpc_completion_queue_shutdown(f->cq);
drain_cq(f->cq);
grpc_completion_queue_destroy(f->cq);
+ grpc_completion_queue_destroy(f->shutdown_cq);
}
/* Request/response with metadata and payload.*/
diff --git a/test/core/end2end/tests/simple_request.c b/test/core/end2end/tests/simple_request.c
index 31bfef4cc2..0f19fd0b0f 100644
--- a/test/core/end2end/tests/simple_request.c
+++ b/test/core/end2end/tests/simple_request.c
@@ -76,9 +76,10 @@ static void drain_cq(grpc_completion_queue *cq) {
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), NULL)
+ grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000));
+ GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000),
+ grpc_timeout_seconds_to_deadline(5),
+ NULL)
.type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server);
f->server = NULL;
@@ -97,6 +98,7 @@ static void end_test(grpc_end2end_test_fixture *f) {
grpc_completion_queue_shutdown(f->cq);
drain_cq(f->cq);
grpc_completion_queue_destroy(f->cq);
+ grpc_completion_queue_destroy(f->shutdown_cq);
}
static void simple_request_body(grpc_end2end_test_config config,
diff --git a/test/core/end2end/tests/streaming_error_response.c b/test/core/end2end/tests/streaming_error_response.c
index c652d9469d..0617566c35 100644
--- a/test/core/end2end/tests/streaming_error_response.c
+++ b/test/core/end2end/tests/streaming_error_response.c
@@ -79,9 +79,10 @@ static void drain_cq(grpc_completion_queue *cq) {
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), NULL)
+ grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000));
+ GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000),
+ grpc_timeout_seconds_to_deadline(5),
+ NULL)
.type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server);
f->server = NULL;
@@ -100,6 +101,7 @@ static void end_test(grpc_end2end_test_fixture *f) {
grpc_completion_queue_shutdown(f->cq);
drain_cq(f->cq);
grpc_completion_queue_destroy(f->cq);
+ grpc_completion_queue_destroy(f->shutdown_cq);
}
/* Client sends a request with payload, server reads then returns status. */
diff --git a/test/core/end2end/tests/trailing_metadata.c b/test/core/end2end/tests/trailing_metadata.c
index 3cbffdfe75..78046261c3 100644
--- a/test/core/end2end/tests/trailing_metadata.c
+++ b/test/core/end2end/tests/trailing_metadata.c
@@ -74,9 +74,10 @@ static void drain_cq(grpc_completion_queue *cq) {
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), NULL)
+ grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000));
+ GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000),
+ grpc_timeout_seconds_to_deadline(5),
+ NULL)
.type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server);
f->server = NULL;
@@ -95,6 +96,7 @@ static void end_test(grpc_end2end_test_fixture *f) {
grpc_completion_queue_shutdown(f->cq);
drain_cq(f->cq);
grpc_completion_queue_destroy(f->cq);
+ grpc_completion_queue_destroy(f->shutdown_cq);
}
/* Request/response with metadata and payload.*/
diff --git a/test/core/end2end/tests/write_buffering.c b/test/core/end2end/tests/write_buffering.c
index 2d4142b97d..e937912d5f 100644
--- a/test/core/end2end/tests/write_buffering.c
+++ b/test/core/end2end/tests/write_buffering.c
@@ -74,9 +74,10 @@ static void drain_cq(grpc_completion_queue *cq) {
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), NULL)
+ grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000));
+ GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000),
+ grpc_timeout_seconds_to_deadline(5),
+ NULL)
.type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server);
f->server = NULL;
@@ -95,6 +96,7 @@ static void end_test(grpc_end2end_test_fixture *f) {
grpc_completion_queue_shutdown(f->cq);
drain_cq(f->cq);
grpc_completion_queue_destroy(f->cq);
+ grpc_completion_queue_destroy(f->shutdown_cq);
}
/* Client sends a request with payload, server reads then returns status. */
diff --git a/test/core/end2end/tests/write_buffering_at_end.c b/test/core/end2end/tests/write_buffering_at_end.c
index e61343e684..42024cfa9b 100644
--- a/test/core/end2end/tests/write_buffering_at_end.c
+++ b/test/core/end2end/tests/write_buffering_at_end.c
@@ -74,9 +74,10 @@ static void drain_cq(grpc_completion_queue *cq) {
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), NULL)
+ grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000));
+ GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000),
+ grpc_timeout_seconds_to_deadline(5),
+ NULL)
.type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server);
f->server = NULL;
@@ -95,6 +96,7 @@ static void end_test(grpc_end2end_test_fixture *f) {
grpc_completion_queue_shutdown(f->cq);
drain_cq(f->cq);
grpc_completion_queue_destroy(f->cq);
+ grpc_completion_queue_destroy(f->shutdown_cq);
}
/* Client sends a request with payload, server reads then returns status. */
diff --git a/test/core/fling/client.c b/test/core/fling/client.c
index 85bab6d431..ecb73cfbdb 100644
--- a/test/core/fling/client.c
+++ b/test/core/fling/client.c
@@ -208,7 +208,7 @@ int main(int argc, char **argv) {
}
channel = grpc_insecure_channel_create(target, NULL, NULL);
- cq = grpc_completion_queue_create(NULL);
+ cq = grpc_completion_queue_create_for_next(NULL);
the_buffer = grpc_raw_byte_buffer_create(&slice, (size_t)payload_size);
histogram = gpr_histogram_create(0.01, 60e9);
diff --git a/test/core/fling/server.c b/test/core/fling/server.c
index 7ea54b1167..7edff3d132 100644
--- a/test/core/fling/server.c
+++ b/test/core/fling/server.c
@@ -185,6 +185,7 @@ int main(int argc, char **argv) {
call_state *s;
char *addr_buf = NULL;
gpr_cmdline *cl;
+ grpc_completion_queue *shutdown_cq;
int shutdown_started = 0;
int shutdown_finished = 0;
@@ -214,7 +215,7 @@ int main(int argc, char **argv) {
}
gpr_log(GPR_INFO, "creating server on: %s", addr);
- cq = grpc_completion_queue_create(NULL);
+ cq = grpc_completion_queue_create_for_next(NULL);
if (secure) {
grpc_ssl_pem_key_cert_pair pem_key_cert_pair = {test_server1_key,
test_server1_cert};
@@ -242,10 +243,16 @@ int main(int argc, char **argv) {
while (!shutdown_finished) {
if (got_sigint && !shutdown_started) {
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), NULL)
- .type == GRPC_OP_COMPLETE);
+
+ shutdown_cq = grpc_completion_queue_create_for_pluck(NULL);
+ grpc_server_shutdown_and_notify(server, shutdown_cq, tag(1000));
+
+ GPR_ASSERT(
+ grpc_completion_queue_pluck(shutdown_cq, tag(1000),
+ grpc_timeout_seconds_to_deadline(5), NULL)
+ .type == GRPC_OP_COMPLETE);
+ grpc_completion_queue_destroy(shutdown_cq);
+
grpc_completion_queue_shutdown(cq);
shutdown_started = 1;
}
diff --git a/test/core/handshake/client_ssl.c b/test/core/handshake/client_ssl.c
index f291d09493..f7fa919cd4 100644
--- a/test/core/handshake/client_ssl.c
+++ b/test/core/handshake/client_ssl.c
@@ -289,7 +289,8 @@ static bool client_ssl_test(char *server_alpn_preferred) {
// completed and we know that the client's ALPN list satisfied the server.
int retries = 10;
grpc_connectivity_state state = GRPC_CHANNEL_IDLE;
- grpc_completion_queue *cq = grpc_completion_queue_create(NULL);
+ grpc_completion_queue *cq = grpc_completion_queue_create_for_next(NULL);
+
while (state != GRPC_CHANNEL_READY && retries-- > 0) {
grpc_channel_watch_connectivity_state(
channel, state, grpc_timeout_seconds_to_deadline(3), cq, NULL);
diff --git a/test/core/handshake/server_ssl.c b/test/core/handshake/server_ssl.c
index e568a37014..30f6474b3f 100644
--- a/test/core/handshake/server_ssl.c
+++ b/test/core/handshake/server_ssl.c
@@ -104,7 +104,7 @@ static void server_thread(void *arg) {
GPR_ASSERT(grpc_server_add_secure_http2_port(server, addr, ssl_creds));
free(addr);
- grpc_completion_queue *cq = grpc_completion_queue_create(NULL);
+ grpc_completion_queue *cq = grpc_completion_queue_create_for_next(NULL);
grpc_server_register_completion_queue(server, cq, NULL);
grpc_server_start(server);
diff --git a/test/core/memory_usage/client.c b/test/core/memory_usage/client.c
index 51ea51bc12..fcdc161ac9 100644
--- a/test/core/memory_usage/client.c
+++ b/test/core/memory_usage/client.c
@@ -223,7 +223,7 @@ int main(int argc, char **argv) {
calls[k].details = grpc_empty_slice();
}
- cq = grpc_completion_queue_create(NULL);
+ cq = grpc_completion_queue_create_for_next(NULL);
struct grpc_memory_counters client_channel_start =
grpc_memory_counters_snapshot();
diff --git a/test/core/memory_usage/server.c b/test/core/memory_usage/server.c
index ab059c25b8..44c5488014 100644
--- a/test/core/memory_usage/server.c
+++ b/test/core/memory_usage/server.c
@@ -161,6 +161,7 @@ int main(int argc, char **argv) {
grpc_event ev;
char *addr_buf = NULL;
gpr_cmdline *cl;
+ grpc_completion_queue *shutdown_cq;
int shutdown_started = 0;
int shutdown_finished = 0;
@@ -188,7 +189,7 @@ int main(int argc, char **argv) {
}
gpr_log(GPR_INFO, "creating server on: %s", addr);
- cq = grpc_completion_queue_create(NULL);
+ cq = grpc_completion_queue_create_for_next(NULL);
struct grpc_memory_counters before_server_create =
grpc_memory_counters_snapshot();
@@ -230,10 +231,14 @@ int main(int argc, char **argv) {
while (!shutdown_finished) {
if (got_sigint && !shutdown_started) {
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), NULL)
- .type == GRPC_OP_COMPLETE);
+
+ shutdown_cq = grpc_completion_queue_create_for_pluck(NULL);
+ grpc_server_shutdown_and_notify(server, shutdown_cq, tag(1000));
+ GPR_ASSERT(
+ grpc_completion_queue_pluck(shutdown_cq, tag(1000),
+ grpc_timeout_seconds_to_deadline(5), NULL)
+ .type == GRPC_OP_COMPLETE);
+ grpc_completion_queue_destroy(shutdown_cq);
grpc_completion_queue_shutdown(cq);
shutdown_started = 1;
}
diff --git a/test/core/surface/alarm_test.c b/test/core/surface/alarm_test.c
index 4afe357c27..6ea3444fe2 100644
--- a/test/core/surface/alarm_test.c
+++ b/test/core/surface/alarm_test.c
@@ -58,7 +58,7 @@ static void test_alarm(void) {
grpc_completion_queue *cc;
LOG_TEST("test_alarm");
- cc = grpc_completion_queue_create(NULL);
+ cc = grpc_completion_queue_create_for_next(NULL);
{
/* regular expiry */
grpc_event ev;
diff --git a/test/core/surface/completion_queue_test.c b/test/core/surface/completion_queue_test.c
index 07f6a9869b..35bda5b641 100644
--- a/test/core/surface/completion_queue_test.c
+++ b/test/core/surface/completion_queue_test.c
@@ -51,33 +51,88 @@ 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), NULL);
+
+ switch (grpc_get_cq_completion_type(cc)) {
+ case GRPC_CQ_NEXT: {
+ ev = grpc_completion_queue_next(cc, gpr_inf_past(GPR_CLOCK_REALTIME),
+ NULL);
+ break;
+ }
+ case GRPC_CQ_PLUCK: {
+ ev = grpc_completion_queue_pluck(cc, create_test_tag(),
+ gpr_inf_past(GPR_CLOCK_REALTIME), NULL);
+ break;
+ }
+ default: {
+ gpr_log(GPR_ERROR, "Unknown completion type");
+ break;
+ }
+ }
+
GPR_ASSERT(ev.type == GRPC_QUEUE_SHUTDOWN);
grpc_completion_queue_destroy(cc);
}
/* ensure we can create and destroy a completion channel */
static void test_no_op(void) {
+ grpc_cq_completion_type completion_types[] = {GRPC_CQ_NEXT, GRPC_CQ_PLUCK};
+ grpc_cq_polling_type polling_types[] = {
+ GRPC_CQ_DEFAULT_POLLING, GRPC_CQ_NON_LISTENING, GRPC_CQ_NON_POLLING};
+ grpc_completion_queue_attributes attr;
LOG_TEST("test_no_op");
- shutdown_and_destroy(grpc_completion_queue_create(NULL));
+
+ attr.version = 1;
+ for (size_t i = 0; i < GPR_ARRAY_SIZE(completion_types); i++) {
+ for (size_t j = 0; j < GPR_ARRAY_SIZE(polling_types); j++) {
+ attr.cq_completion_type = completion_types[i];
+ attr.cq_polling_type = polling_types[j];
+ shutdown_and_destroy(grpc_completion_queue_create(
+ grpc_completion_queue_factory_lookup(&attr), &attr, NULL));
+ }
+ }
}
static void test_pollset_conversion(void) {
- grpc_completion_queue *cq = grpc_completion_queue_create(NULL);
- GPR_ASSERT(grpc_cq_from_pollset(grpc_cq_pollset(cq)) == cq);
- shutdown_and_destroy(cq);
+ grpc_cq_completion_type completion_types[] = {GRPC_CQ_NEXT, GRPC_CQ_PLUCK};
+ grpc_cq_polling_type polling_types[] = {GRPC_CQ_DEFAULT_POLLING,
+ GRPC_CQ_NON_LISTENING};
+ grpc_completion_queue *cq;
+ grpc_completion_queue_attributes attr;
+
+ LOG_TEST("test_pollset_conversion");
+
+ attr.version = 1;
+ for (size_t i = 0; i < GPR_ARRAY_SIZE(completion_types); i++) {
+ for (size_t j = 0; j < GPR_ARRAY_SIZE(polling_types); j++) {
+ attr.cq_completion_type = completion_types[i];
+ attr.cq_polling_type = polling_types[j];
+ cq = grpc_completion_queue_create(
+ grpc_completion_queue_factory_lookup(&attr), &attr, NULL);
+ GPR_ASSERT(grpc_cq_from_pollset(grpc_cq_pollset(cq)) == cq);
+ shutdown_and_destroy(cq);
+ }
+ }
}
static void test_wait_empty(void) {
+ grpc_cq_polling_type polling_types[] = {
+ GRPC_CQ_DEFAULT_POLLING, GRPC_CQ_NON_LISTENING, GRPC_CQ_NON_POLLING};
grpc_completion_queue *cc;
+ grpc_completion_queue_attributes attr;
grpc_event event;
LOG_TEST("test_wait_empty");
- 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);
+ attr.version = 1;
+ attr.cq_completion_type = GRPC_CQ_NEXT;
+ for (size_t i = 0; i < GPR_ARRAY_SIZE(polling_types); i++) {
+ attr.cq_polling_type = polling_types[i];
+ cc = grpc_completion_queue_create(
+ grpc_completion_queue_factory_lookup(&attr), &attr, NULL);
+ event = grpc_completion_queue_next(cc, gpr_now(GPR_CLOCK_REALTIME), NULL);
+ GPR_ASSERT(event.type == GRPC_QUEUE_TIMEOUT);
+ shutdown_and_destroy(cc);
+ }
}
static void do_nothing_end_completion(grpc_exec_ctx *exec_ctx, void *arg,
@@ -87,50 +142,80 @@ static void test_cq_end_op(void) {
grpc_event ev;
grpc_completion_queue *cc;
grpc_cq_completion completion;
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_cq_polling_type polling_types[] = {
+ GRPC_CQ_DEFAULT_POLLING, GRPC_CQ_NON_LISTENING, GRPC_CQ_NON_POLLING};
+ grpc_completion_queue_attributes attr;
+ grpc_exec_ctx init_exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_exec_ctx exec_ctx;
void *tag = create_test_tag();
LOG_TEST("test_cq_end_op");
- cc = grpc_completion_queue_create(NULL);
-
- grpc_cq_begin_op(cc, tag);
- grpc_cq_end_op(&exec_ctx, cc, tag, GRPC_ERROR_NONE, do_nothing_end_completion,
- NULL, &completion);
-
- 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);
-
- shutdown_and_destroy(cc);
- grpc_exec_ctx_finish(&exec_ctx);
+ attr.version = 1;
+ attr.cq_completion_type = GRPC_CQ_NEXT;
+ for (size_t i = 0; i < GPR_ARRAY_SIZE(polling_types); i++) {
+ exec_ctx = init_exec_ctx; // Reset exec_ctx
+ attr.cq_polling_type = polling_types[i];
+ cc = grpc_completion_queue_create(
+ grpc_completion_queue_factory_lookup(&attr), &attr, NULL);
+
+ grpc_cq_begin_op(cc, tag);
+ grpc_cq_end_op(&exec_ctx, cc, tag, GRPC_ERROR_NONE,
+ do_nothing_end_completion, NULL, &completion);
+
+ 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);
+
+ shutdown_and_destroy(cc);
+ grpc_exec_ctx_finish(&exec_ctx);
+ }
}
static void test_shutdown_then_next_polling(void) {
+ grpc_cq_polling_type polling_types[] = {
+ GRPC_CQ_DEFAULT_POLLING, GRPC_CQ_NON_LISTENING, GRPC_CQ_NON_POLLING};
grpc_completion_queue *cc;
+ grpc_completion_queue_attributes attr;
grpc_event event;
LOG_TEST("test_shutdown_then_next_polling");
- cc = grpc_completion_queue_create(NULL);
- grpc_completion_queue_shutdown(cc);
- 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);
+ attr.version = 1;
+ attr.cq_completion_type = GRPC_CQ_NEXT;
+ for (size_t i = 0; i < GPR_ARRAY_SIZE(polling_types); i++) {
+ attr.cq_polling_type = polling_types[i];
+ cc = grpc_completion_queue_create(
+ grpc_completion_queue_factory_lookup(&attr), &attr, NULL);
+ grpc_completion_queue_shutdown(cc);
+ 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_cq_polling_type polling_types[] = {
+ GRPC_CQ_DEFAULT_POLLING, GRPC_CQ_NON_LISTENING, GRPC_CQ_NON_POLLING};
grpc_completion_queue *cc;
+ grpc_completion_queue_attributes attr;
grpc_event event;
LOG_TEST("test_shutdown_then_next_with_timeout");
- cc = grpc_completion_queue_create(NULL);
- grpc_completion_queue_shutdown(cc);
- 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);
+ attr.version = 1;
+ attr.cq_completion_type = GRPC_CQ_NEXT;
+ for (size_t i = 0; i < GPR_ARRAY_SIZE(polling_types); i++) {
+ attr.cq_polling_type = polling_types[i];
+ cc = grpc_completion_queue_create(
+ grpc_completion_queue_factory_lookup(&attr), &attr, NULL);
+
+ grpc_completion_queue_shutdown(cc);
+ 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);
+ }
}
static void test_pluck(void) {
@@ -138,7 +223,11 @@ static void test_pluck(void) {
grpc_completion_queue *cc;
void *tags[128];
grpc_cq_completion completions[GPR_ARRAY_SIZE(tags)];
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_cq_polling_type polling_types[] = {
+ GRPC_CQ_DEFAULT_POLLING, GRPC_CQ_NON_LISTENING, GRPC_CQ_NON_POLLING};
+ grpc_completion_queue_attributes attr;
+ grpc_exec_ctx init_exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_exec_ctx exec_ctx;
unsigned i, j;
LOG_TEST("test_pluck");
@@ -150,49 +239,71 @@ static void test_pluck(void) {
}
}
- cc = grpc_completion_queue_create(NULL);
+ attr.version = 1;
+ attr.cq_completion_type = GRPC_CQ_PLUCK;
+ for (size_t pidx = 0; pidx < GPR_ARRAY_SIZE(polling_types); pidx++) {
+ exec_ctx = init_exec_ctx; // reset exec_ctx
+ attr.cq_polling_type = polling_types[pidx];
+ cc = grpc_completion_queue_create(
+ grpc_completion_queue_factory_lookup(&attr), &attr, NULL);
+
+ for (i = 0; i < GPR_ARRAY_SIZE(tags); i++) {
+ grpc_cq_begin_op(cc, tags[i]);
+ grpc_cq_end_op(&exec_ctx, cc, tags[i], GRPC_ERROR_NONE,
+ do_nothing_end_completion, NULL, &completions[i]);
+ }
- for (i = 0; i < GPR_ARRAY_SIZE(tags); i++) {
- grpc_cq_begin_op(cc, tags[i]);
- grpc_cq_end_op(&exec_ctx, cc, tags[i], GRPC_ERROR_NONE,
- do_nothing_end_completion, NULL, &completions[i]);
- }
+ for (i = 0; i < GPR_ARRAY_SIZE(tags); i++) {
+ ev = grpc_completion_queue_pluck(cc, tags[i],
+ gpr_inf_past(GPR_CLOCK_REALTIME), NULL);
+ GPR_ASSERT(ev.tag == tags[i]);
+ }
- for (i = 0; i < GPR_ARRAY_SIZE(tags); i++) {
- ev = grpc_completion_queue_pluck(cc, tags[i],
- gpr_inf_past(GPR_CLOCK_REALTIME), NULL);
- GPR_ASSERT(ev.tag == tags[i]);
- }
+ for (i = 0; i < GPR_ARRAY_SIZE(tags); i++) {
+ grpc_cq_begin_op(cc, tags[i]);
+ grpc_cq_end_op(&exec_ctx, cc, tags[i], GRPC_ERROR_NONE,
+ do_nothing_end_completion, NULL, &completions[i]);
+ }
- for (i = 0; i < GPR_ARRAY_SIZE(tags); i++) {
- grpc_cq_begin_op(cc, tags[i]);
- grpc_cq_end_op(&exec_ctx, cc, tags[i], GRPC_ERROR_NONE,
- do_nothing_end_completion, NULL, &completions[i]);
- }
+ 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), NULL);
+ GPR_ASSERT(ev.tag == tags[GPR_ARRAY_SIZE(tags) - i - 1]);
+ }
- 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), NULL);
- GPR_ASSERT(ev.tag == tags[GPR_ARRAY_SIZE(tags) - i - 1]);
+ shutdown_and_destroy(cc);
+ grpc_exec_ctx_finish(&exec_ctx);
}
-
- shutdown_and_destroy(cc);
- grpc_exec_ctx_finish(&exec_ctx);
}
static void test_pluck_after_shutdown(void) {
+ grpc_cq_polling_type polling_types[] = {
+ GRPC_CQ_DEFAULT_POLLING, GRPC_CQ_NON_LISTENING, GRPC_CQ_NON_POLLING};
grpc_event ev;
grpc_completion_queue *cc;
+ grpc_completion_queue_attributes attr;
LOG_TEST("test_pluck_after_shutdown");
- cc = grpc_completion_queue_create(NULL);
- grpc_completion_queue_shutdown(cc);
- ev = grpc_completion_queue_pluck(cc, NULL, gpr_inf_future(GPR_CLOCK_REALTIME),
- NULL);
- GPR_ASSERT(ev.type == GRPC_QUEUE_SHUTDOWN);
- grpc_completion_queue_destroy(cc);
+
+ attr.version = 1;
+ attr.cq_completion_type = GRPC_CQ_PLUCK;
+ for (size_t i = 0; i < GPR_ARRAY_SIZE(polling_types); i++) {
+ attr.cq_polling_type = polling_types[i];
+ cc = grpc_completion_queue_create(
+ grpc_completion_queue_factory_lookup(&attr), &attr, NULL);
+ grpc_completion_queue_shutdown(cc);
+ ev = grpc_completion_queue_pluck(cc, NULL,
+ gpr_inf_future(GPR_CLOCK_REALTIME), NULL);
+ GPR_ASSERT(ev.type == GRPC_QUEUE_SHUTDOWN);
+ grpc_completion_queue_destroy(cc);
+ }
}
+struct thread_state {
+ grpc_completion_queue *cc;
+ void *tag;
+};
+
int main(int argc, char **argv) {
grpc_test_init(argc, argv);
grpc_init();
diff --git a/test/core/surface/completion_queue_threading_test.c b/test/core/surface/completion_queue_threading_test.c
index 2d55ead843..bff69ec74f 100644
--- a/test/core/surface/completion_queue_threading_test.c
+++ b/test/core/surface/completion_queue_threading_test.c
@@ -52,7 +52,24 @@ 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), NULL);
+
+ switch (grpc_get_cq_completion_type(cc)) {
+ case GRPC_CQ_NEXT: {
+ ev = grpc_completion_queue_next(cc, gpr_inf_past(GPR_CLOCK_REALTIME),
+ NULL);
+ break;
+ }
+ case GRPC_CQ_PLUCK: {
+ ev = grpc_completion_queue_pluck(cc, create_test_tag(),
+ gpr_inf_past(GPR_CLOCK_REALTIME), NULL);
+ break;
+ }
+ default: {
+ gpr_log(GPR_ERROR, "Unknown completion type");
+ break;
+ }
+ }
+
GPR_ASSERT(ev.type == GRPC_QUEUE_SHUTDOWN);
grpc_completion_queue_destroy(cc);
}
@@ -84,7 +101,7 @@ static void test_too_many_plucks(void) {
LOG_TEST("test_too_many_plucks");
- cc = grpc_completion_queue_create(NULL);
+ cc = grpc_completion_queue_create_for_pluck(NULL);
gpr_thd_options_set_joinable(&thread_options);
for (i = 0; i < GPR_ARRAY_SIZE(tags); i++) {
@@ -210,7 +227,7 @@ static void test_threading(size_t producers, size_t 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(NULL);
+ grpc_completion_queue *cc = grpc_completion_queue_create_for_next(NULL);
size_t i;
size_t total_consumed = 0;
static int optid = 101;
diff --git a/test/core/surface/concurrent_connectivity_test.c b/test/core/surface/concurrent_connectivity_test.c
index 2f7c3dfb85..d6841ea1f8 100644
--- a/test/core/surface/concurrent_connectivity_test.c
+++ b/test/core/surface/concurrent_connectivity_test.c
@@ -66,7 +66,7 @@ static int detag(void *p) { return (int)(uintptr_t)p; }
void create_loop_destroy(void *addr) {
for (int i = 0; i < NUM_OUTER_LOOPS; ++i) {
- grpc_completion_queue *cq = grpc_completion_queue_create(NULL);
+ grpc_completion_queue *cq = grpc_completion_queue_create_for_next(NULL);
grpc_channel *chan = grpc_insecure_channel_create((char *)addr, NULL, NULL);
for (int j = 0; j < NUM_INNER_LOOPS; ++j) {
@@ -196,7 +196,7 @@ int main(int argc, char **argv) {
gpr_asprintf(&args.addr, "localhost:%d", port);
args.server = grpc_server_create(NULL, NULL);
grpc_server_add_insecure_http2_port(args.server, args.addr);
- args.cq = grpc_completion_queue_create(NULL);
+ args.cq = grpc_completion_queue_create_for_next(NULL);
grpc_server_register_completion_queue(args.server, args.cq, NULL);
grpc_server_start(args.server);
gpr_thd_new(&server, server_thread, &args, &options);
diff --git a/test/core/surface/lame_client_test.c b/test/core/surface/lame_client_test.c
index 9deb50bb04..6c14a5dcdf 100644
--- a/test/core/surface/lame_client_test.c
+++ b/test/core/surface/lame_client_test.c
@@ -108,7 +108,7 @@ int main(int argc, char **argv) {
GPR_ASSERT(GRPC_CHANNEL_SHUTDOWN ==
grpc_channel_check_connectivity_state(chan, 0));
- cq = grpc_completion_queue_create(NULL);
+ cq = grpc_completion_queue_create_for_next(NULL);
grpc_slice host = grpc_slice_from_static_string("anywhere");
call = grpc_channel_create_call(chan, NULL, GRPC_PROPAGATE_DEFAULTS, cq,
diff --git a/test/core/surface/sequential_connectivity_test.c b/test/core/surface/sequential_connectivity_test.c
index 5f66f90037..fbecdd7e38 100644
--- a/test/core/surface/sequential_connectivity_test.c
+++ b/test/core/surface/sequential_connectivity_test.c
@@ -76,7 +76,8 @@ static void run_test(const test_fixture *fixture) {
grpc_server *server = grpc_server_create(NULL, NULL);
fixture->add_server_port(server, addr);
- grpc_completion_queue *server_cq = grpc_completion_queue_create(NULL);
+ grpc_completion_queue *server_cq =
+ grpc_completion_queue_create_for_next(NULL);
grpc_server_register_completion_queue(server, server_cq, NULL);
grpc_server_start(server);
@@ -86,7 +87,7 @@ static void run_test(const test_fixture *fixture) {
gpr_thd_options_set_joinable(&thdopt);
gpr_thd_new(&server_thread, server_thread_func, &sta, &thdopt);
- grpc_completion_queue *cq = grpc_completion_queue_create(NULL);
+ grpc_completion_queue *cq = grpc_completion_queue_create_for_next(NULL);
grpc_channel *channels[NUM_CONNECTIONS];
for (size_t i = 0; i < NUM_CONNECTIONS; i++) {
channels[i] = fixture->create_channel(addr);
diff --git a/test/core/surface/server_chttp2_test.c b/test/core/surface/server_chttp2_test.c
index 8d40c64654..06293e5102 100644
--- a/test/core/surface/server_chttp2_test.c
+++ b/test/core/surface/server_chttp2_test.c
@@ -60,7 +60,7 @@ void test_add_same_port_twice() {
int port = grpc_pick_unused_port_or_die();
char *addr = NULL;
- grpc_completion_queue *cq = grpc_completion_queue_create(NULL);
+ grpc_completion_queue *cq = grpc_completion_queue_create_for_pluck(NULL);
grpc_server *server = grpc_server_create(&args, NULL);
grpc_server_credentials *fake_creds =
grpc_fake_transport_security_server_credentials_create();
diff --git a/test/core/surface/server_test.c b/test/core/surface/server_test.c
index 3fd1c2c266..81a39de216 100644
--- a/test/core/surface/server_test.c
+++ b/test/core/surface/server_test.c
@@ -70,7 +70,7 @@ void test_register_method_fail(void) {
}
void test_request_call_on_no_server_cq(void) {
- grpc_completion_queue *cc = grpc_completion_queue_create(NULL);
+ grpc_completion_queue *cc = grpc_completion_queue_create_for_next(NULL);
grpc_server *server = grpc_server_create(NULL, NULL);
GPR_ASSERT(GRPC_CALL_ERROR_NOT_SERVER_COMPLETION_QUEUE ==
grpc_server_request_call(server, NULL, NULL, NULL, cc, cc, NULL));
@@ -91,7 +91,7 @@ void test_bind_server_twice(void) {
char *addr;
grpc_server *server1 = grpc_server_create(&args, NULL);
grpc_server *server2 = grpc_server_create(&args, NULL);
- grpc_completion_queue *cq = grpc_completion_queue_create(NULL);
+ grpc_completion_queue *cq = grpc_completion_queue_create_for_next(NULL);
int port = grpc_pick_unused_port_or_die();
gpr_asprintf(&addr, "[::]:%d", port);
grpc_server_register_completion_queue(server1, cq, NULL);
@@ -128,7 +128,7 @@ void test_bind_server_to_addr(const char *host, bool secure) {
} else {
GPR_ASSERT(grpc_server_add_insecure_http2_port(server, addr));
}
- grpc_completion_queue *cq = grpc_completion_queue_create(NULL);
+ grpc_completion_queue *cq = grpc_completion_queue_create_for_next(NULL);
grpc_server_register_completion_queue(server, cq, NULL);
grpc_server_start(server);
grpc_server_shutdown_and_notify(server, cq, NULL);
diff --git a/test/cpp/grpclb/grpclb_test.cc b/test/cpp/grpclb/grpclb_test.cc
index eb3e5b644d..a80431f46a 100644
--- a/test/cpp/grpclb/grpclb_test.cc
+++ b/test/cpp/grpclb/grpclb_test.cc
@@ -593,7 +593,7 @@ static void setup_client(const server_fixture *lb_server,
grpc_channel_args_copy_and_add(NULL, &expected_target_arg, 1);
gpr_free(expected_target_names);
- cf->cq = grpc_completion_queue_create(NULL);
+ cf->cq = grpc_completion_queue_create_for_next(NULL);
cf->server_uri = lb_uri;
grpc_channel_credentials *fake_creds =
grpc_fake_transport_security_credentials_create();
@@ -616,7 +616,7 @@ static void teardown_client(client_fixture *cf) {
static void setup_server(const char *host, server_fixture *sf) {
int assigned_port;
- sf->cq = grpc_completion_queue_create(NULL);
+ sf->cq = grpc_completion_queue_create_for_next(NULL);
const char *colon_idx = strchr(host, ':');
if (colon_idx) {
const char *port_str = colon_idx + 1;
@@ -643,10 +643,15 @@ static void teardown_server(server_fixture *sf) {
if (!sf->server) return;
gpr_log(GPR_INFO, "Server[%s] shutting down", sf->servers_hostport);
- grpc_server_shutdown_and_notify(sf->server, sf->cq, tag(1000));
- GPR_ASSERT(grpc_completion_queue_pluck(
- sf->cq, tag(1000), grpc_timeout_seconds_to_deadline(5), NULL)
+
+ grpc_completion_queue *shutdown_cq =
+ grpc_completion_queue_create_for_pluck(NULL);
+ grpc_server_shutdown_and_notify(sf->server, shutdown_cq, tag(1000));
+ GPR_ASSERT(grpc_completion_queue_pluck(shutdown_cq, tag(1000),
+ grpc_timeout_seconds_to_deadline(5),
+ NULL)
.type == GRPC_OP_COMPLETE);
+ grpc_completion_queue_destroy(shutdown_cq);
grpc_server_destroy(sf->server);
gpr_thd_join(sf->tid);
diff --git a/test/cpp/microbenchmarks/bm_call_create.cc b/test/cpp/microbenchmarks/bm_call_create.cc
index 0acfb9402f..8373eead61 100644
--- a/test/cpp/microbenchmarks/bm_call_create.cc
+++ b/test/cpp/microbenchmarks/bm_call_create.cc
@@ -119,7 +119,7 @@ template <class Fixture>
static void BM_CallCreateDestroy(benchmark::State &state) {
TrackCounters track_counters;
Fixture fixture;
- grpc_completion_queue *cq = grpc_completion_queue_create(NULL);
+ grpc_completion_queue *cq = grpc_completion_queue_create_for_next(NULL);
gpr_timespec deadline = gpr_inf_future(GPR_CLOCK_MONOTONIC);
void *method_hdl =
grpc_channel_register_call(fixture.channel(), "/foo/bar", NULL, NULL);
@@ -576,7 +576,7 @@ class IsolatedCallFixture : public TrackCounters {
GRPC_CLIENT_CHANNEL);
grpc_exec_ctx_finish(&exec_ctx);
}
- cq_ = grpc_completion_queue_create(NULL);
+ cq_ = grpc_completion_queue_create_for_next(NULL);
}
void Finish(benchmark::State &state) {
diff --git a/test/cpp/microbenchmarks/bm_cq.cc b/test/cpp/microbenchmarks/bm_cq.cc
index 38ac9d2705..8b26bf977c 100644
--- a/test/cpp/microbenchmarks/bm_cq.cc
+++ b/test/cpp/microbenchmarks/bm_cq.cc
@@ -62,7 +62,8 @@ BENCHMARK(BM_CreateDestroyCpp);
static void BM_CreateDestroyCpp2(benchmark::State& state) {
TrackCounters track_counters;
while (state.KeepRunning()) {
- grpc_completion_queue* core_cq = grpc_completion_queue_create(NULL);
+ grpc_completion_queue* core_cq =
+ grpc_completion_queue_create_for_next(NULL);
CompletionQueue cq(core_cq);
}
track_counters.Finish(state);
@@ -72,7 +73,9 @@ BENCHMARK(BM_CreateDestroyCpp2);
static void BM_CreateDestroyCore(benchmark::State& state) {
TrackCounters track_counters;
while (state.KeepRunning()) {
- grpc_completion_queue_destroy(grpc_completion_queue_create(NULL));
+ // TODO: sreek Templatize this benchmark and pass completion type and
+ // polling type as parameters
+ grpc_completion_queue_destroy(grpc_completion_queue_create_for_next(NULL));
}
track_counters.Finish(state);
}
@@ -108,7 +111,8 @@ BENCHMARK(BM_Pass1Cpp);
static void BM_Pass1Core(benchmark::State& state) {
TrackCounters track_counters;
- grpc_completion_queue* cq = grpc_completion_queue_create(NULL);
+ // TODO: sreek Templatize this benchmark and pass polling_type as a param
+ grpc_completion_queue* cq = grpc_completion_queue_create_for_next(NULL);
gpr_timespec deadline = gpr_inf_future(GPR_CLOCK_MONOTONIC);
while (state.KeepRunning()) {
grpc_cq_completion completion;
@@ -126,7 +130,8 @@ BENCHMARK(BM_Pass1Core);
static void BM_Pluck1Core(benchmark::State& state) {
TrackCounters track_counters;
- grpc_completion_queue* cq = grpc_completion_queue_create(NULL);
+ // TODO: sreek Templatize this benchmark and pass polling_type as a param
+ grpc_completion_queue* cq = grpc_completion_queue_create_for_pluck(NULL);
gpr_timespec deadline = gpr_inf_future(GPR_CLOCK_MONOTONIC);
while (state.KeepRunning()) {
grpc_cq_completion completion;
@@ -144,7 +149,8 @@ BENCHMARK(BM_Pluck1Core);
static void BM_EmptyCore(benchmark::State& state) {
TrackCounters track_counters;
- grpc_completion_queue* cq = grpc_completion_queue_create(NULL);
+ // TODO: sreek Templatize this benchmark and pass polling_type as a param
+ grpc_completion_queue* cq = grpc_completion_queue_create_for_next(NULL);
gpr_timespec deadline = gpr_inf_past(GPR_CLOCK_MONOTONIC);
while (state.KeepRunning()) {
grpc_completion_queue_next(cq, deadline, NULL);
diff --git a/test/cpp/microbenchmarks/bm_cq_multiple_threads.cc b/test/cpp/microbenchmarks/bm_cq_multiple_threads.cc
index 8627463204..9d7f65d292 100644
--- a/test/cpp/microbenchmarks/bm_cq_multiple_threads.cc
+++ b/test/cpp/microbenchmarks/bm_cq_multiple_threads.cc
@@ -108,7 +108,7 @@ static void setup() {
init_engine_vtable();
grpc_set_event_engine_test_only(&g_vtable);
- g_cq = grpc_completion_queue_create(NULL);
+ g_cq = grpc_completion_queue_create_for_next(NULL);
}
static void teardown() {