aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/core/surface
diff options
context:
space:
mode:
authorGravatar Sree Kuchibhotla <sreek@google.com>2017-03-22 02:32:01 -0700
committerGravatar Sree Kuchibhotla <sreek@google.com>2017-03-22 02:32:01 -0700
commitb5b6bfd89b642c6a3de305b985d736fd2bd93bab (patch)
tree31d26e3526a125758841877f0241d041b0305314 /test/core/surface
parent20159e1d51b29eda4a1e148295a6dc4cadf81799 (diff)
Updates C Core
Diffstat (limited to 'test/core/surface')
-rw-r--r--test/core/surface/alarm_test.c3
-rw-r--r--test/core/surface/completion_queue_test.c55
-rw-r--r--test/core/surface/completion_queue_threading_test.c6
-rw-r--r--test/core/surface/concurrent_connectivity_test.c6
-rw-r--r--test/core/surface/lame_client_test.c3
-rw-r--r--test/core/surface/sequential_connectivity_test.c5
-rw-r--r--test/core/surface/server_chttp2_test.c3
-rw-r--r--test/core/surface/server_test.c9
8 files changed, 57 insertions, 33 deletions
diff --git a/test/core/surface/alarm_test.c b/test/core/surface/alarm_test.c
index 2c555db5dd..6ea3444fe2 100644
--- a/test/core/surface/alarm_test.c
+++ b/test/core/surface/alarm_test.c
@@ -58,8 +58,7 @@ static void test_alarm(void) {
grpc_completion_queue *cc;
LOG_TEST("test_alarm");
- cc =
- grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, 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 c90e72cde6..4489057b2f 100644
--- a/test/core/surface/completion_queue_test.c
+++ b/test/core/surface/completion_queue_test.c
@@ -78,12 +78,15 @@ 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");
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(
- completion_types[i], polling_types[j], NULL));
+ grpc_completion_queue_factory_lookup(&attr), &attr, NULL));
}
}
}
@@ -93,13 +96,16 @@ static void test_pollset_conversion(void) {
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");
for (size_t i = 0; i < GPR_ARRAY_SIZE(completion_types); i++) {
for (size_t j = 0; j < GPR_ARRAY_SIZE(polling_types); j++) {
- cq = grpc_completion_queue_create(completion_types[i], polling_types[j],
- NULL);
+ 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);
}
@@ -110,12 +116,17 @@ 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");
+ attr.cq_completion_type = GRPC_CQ_NEXT;
+
for (size_t i = 0; i < GPR_ARRAY_SIZE(polling_types); i++) {
- cc = grpc_completion_queue_create(GRPC_CQ_NEXT, polling_types[i], NULL);
+ 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);
@@ -131,16 +142,20 @@ static void test_cq_end_op(void) {
grpc_cq_completion completion;
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");
+ 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
- cc = grpc_completion_queue_create(GRPC_CQ_NEXT, polling_types[i], NULL);
+ 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,
@@ -160,11 +175,16 @@ 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");
+ attr.cq_completion_type = GRPC_CQ_NEXT;
+
for (size_t i = 0; i < GPR_ARRAY_SIZE(polling_types); i++) {
- cc = grpc_completion_queue_create(GRPC_CQ_NEXT, polling_types[i], NULL);
+ 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);
@@ -177,11 +197,16 @@ 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");
+ attr.cq_completion_type = GRPC_CQ_NEXT;
+
for (size_t i = 0; i < GPR_ARRAY_SIZE(polling_types); i++) {
- cc = grpc_completion_queue_create(GRPC_CQ_NEXT, polling_types[i], NULL);
+ 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),
@@ -198,6 +223,7 @@ static void test_pluck(void) {
grpc_cq_completion completions[GPR_ARRAY_SIZE(tags)];
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;
@@ -211,9 +237,13 @@ static void test_pluck(void) {
}
}
+ 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
- cc = grpc_completion_queue_create(GRPC_CQ_PLUCK, polling_types[pidx], NULL);
+ 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]);
@@ -249,11 +279,16 @@ static void test_pluck_after_shutdown(void) {
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");
+ attr.cq_completion_type = GRPC_CQ_PLUCK;
+
for (size_t i = 0; i < GPR_ARRAY_SIZE(polling_types); i++) {
- cc = grpc_completion_queue_create(GRPC_CQ_PLUCK, polling_types[i], NULL);
+ 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);
diff --git a/test/core/surface/completion_queue_threading_test.c b/test/core/surface/completion_queue_threading_test.c
index 6a23aee537..bff69ec74f 100644
--- a/test/core/surface/completion_queue_threading_test.c
+++ b/test/core/surface/completion_queue_threading_test.c
@@ -101,8 +101,7 @@ static void test_too_many_plucks(void) {
LOG_TEST("test_too_many_plucks");
- cc = grpc_completion_queue_create(GRPC_CQ_PLUCK, GRPC_CQ_DEFAULT_POLLING,
- 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++) {
@@ -228,8 +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(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, 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 69f00f4d48..f9197fb8fc 100644
--- a/test/core/surface/concurrent_connectivity_test.c
+++ b/test/core/surface/concurrent_connectivity_test.c
@@ -66,8 +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(
- GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, 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,8 +195,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(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, 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 6531e5eb18..6c14a5dcdf 100644
--- a/test/core/surface/lame_client_test.c
+++ b/test/core/surface/lame_client_test.c
@@ -108,8 +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(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, 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 1880c0b859..fbecdd7e38 100644
--- a/test/core/surface/sequential_connectivity_test.c
+++ b/test/core/surface/sequential_connectivity_test.c
@@ -77,7 +77,7 @@ 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(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL);
+ grpc_completion_queue_create_for_next(NULL);
grpc_server_register_completion_queue(server, server_cq, NULL);
grpc_server_start(server);
@@ -87,8 +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(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, 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 47e8eeab1e..0d4de0e28b 100644
--- a/test/core/surface/server_chttp2_test.c
+++ b/test/core/surface/server_chttp2_test.c
@@ -60,8 +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(GRPC_CQ_PLUCK, GRPC_CQ_NON_POLLING, 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 e488966b93..81a39de216 100644
--- a/test/core/surface/server_test.c
+++ b/test/core/surface/server_test.c
@@ -70,8 +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(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, 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));
@@ -92,8 +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(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, 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);
@@ -130,8 +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(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, 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);