diff options
author | David Garcia Quintas <dgq@google.com> | 2016-06-07 21:21:27 -0700 |
---|---|---|
committer | David Garcia Quintas <dgq@google.com> | 2016-06-07 21:21:27 -0700 |
commit | 533add5a8733a15f36bc03546dcab4312fd4365a (patch) | |
tree | 0b112923b795436944e01920829da106ceb953a1 /test/core | |
parent | 8ba42bec907e3e9cebd2621127caac22aed30a0d (diff) | |
parent | d30d4e279c4a63effaa6e912fc00bd4ad96054c7 (diff) |
Merge branch 'master' of github.com:grpc/grpc into compression_md_level_bis
Diffstat (limited to 'test/core')
-rw-r--r-- | test/core/channel/channel_stack_test.c | 23 | ||||
-rw-r--r-- | test/core/end2end/tests/filter_causes_close.c | 2 | ||||
-rw-r--r-- | test/core/http/httpcli_test.c | 28 | ||||
-rw-r--r-- | test/core/http/httpscli_test.c | 28 | ||||
-rw-r--r-- | test/core/security/oauth2_utils.c | 24 | ||||
-rw-r--r-- | test/core/security/print_google_default_creds_token.c | 17 | ||||
-rw-r--r-- | test/core/surface/public_headers_must_be_c89.c | 1 | ||||
-rw-r--r-- | test/core/util/port_server_client.c | 49 |
8 files changed, 90 insertions, 82 deletions
diff --git a/test/core/channel/channel_stack_test.c b/test/core/channel/channel_stack_test.c index b1ce9d32dd..b5476c8f6a 100644 --- a/test/core/channel/channel_stack_test.c +++ b/test/core/channel/channel_stack_test.c @@ -92,17 +92,18 @@ static void free_call(grpc_exec_ctx *exec_ctx, void *arg, bool success) { } static void test_create_channel_stack(void) { - const grpc_channel_filter filter = {call_func, - channel_func, - sizeof(int), - call_init_func, - grpc_call_stack_ignore_set_pollset, - call_destroy_func, - sizeof(int), - channel_init_func, - channel_destroy_func, - get_peer, - "some_test_filter"}; + const grpc_channel_filter filter = { + call_func, + channel_func, + sizeof(int), + call_init_func, + grpc_call_stack_ignore_set_pollset_or_pollset_set, + call_destroy_func, + sizeof(int), + channel_init_func, + channel_destroy_func, + get_peer, + "some_test_filter"}; const grpc_channel_filter *filters = &filter; grpc_channel_stack *channel_stack; grpc_call_stack *call_stack; diff --git a/test/core/end2end/tests/filter_causes_close.c b/test/core/end2end/tests/filter_causes_close.c index 6e0fadbb15..e6edb213cc 100644 --- a/test/core/end2end/tests/filter_causes_close.c +++ b/test/core/end2end/tests/filter_causes_close.c @@ -249,7 +249,7 @@ static const grpc_channel_filter test_filter = { grpc_channel_next_op, sizeof(call_data), init_call_elem, - grpc_call_stack_ignore_set_pollset, + grpc_call_stack_ignore_set_pollset_or_pollset_set, destroy_call_elem, sizeof(channel_data), init_channel_elem, diff --git a/test/core/http/httpcli_test.c b/test/core/http/httpcli_test.c index d3a68d0eb8..6c27ea2651 100644 --- a/test/core/http/httpcli_test.c +++ b/test/core/http/httpcli_test.c @@ -48,7 +48,7 @@ static int g_done = 0; static grpc_httpcli_context g_context; static gpr_mu *g_mu; -static grpc_pollset *g_pollset; +static grpc_polling_entity g_pops; static gpr_timespec n_seconds_time(int seconds) { return GRPC_TIMEOUT_SECONDS_TO_DEADLINE(seconds); @@ -66,7 +66,7 @@ static void on_finish(grpc_exec_ctx *exec_ctx, void *arg, GPR_ASSERT(0 == memcmp(expect, response->body, response->body_length)); gpr_mu_lock(g_mu); g_done = 1; - grpc_pollset_kick(g_pollset, NULL); + grpc_pollset_kick(grpc_polling_entity_pollset(&g_pops), NULL); gpr_mu_unlock(g_mu); } @@ -86,12 +86,12 @@ static void test_get(int port) { req.http.path = "/get"; req.handshaker = &grpc_httpcli_plaintext; - grpc_httpcli_get(&exec_ctx, &g_context, g_pollset, &req, n_seconds_time(15), + grpc_httpcli_get(&exec_ctx, &g_context, &g_pops, &req, n_seconds_time(15), on_finish, (void *)42); gpr_mu_lock(g_mu); while (!g_done) { grpc_pollset_worker *worker = NULL; - grpc_pollset_work(&exec_ctx, g_pollset, &worker, + grpc_pollset_work(&exec_ctx, grpc_polling_entity_pollset(&g_pops), &worker, gpr_now(GPR_CLOCK_MONOTONIC), n_seconds_time(20)); gpr_mu_unlock(g_mu); grpc_exec_ctx_finish(&exec_ctx); @@ -117,12 +117,12 @@ static void test_post(int port) { req.http.path = "/post"; req.handshaker = &grpc_httpcli_plaintext; - grpc_httpcli_post(&exec_ctx, &g_context, g_pollset, &req, "hello", 5, + grpc_httpcli_post(&exec_ctx, &g_context, &g_pops, &req, "hello", 5, n_seconds_time(15), on_finish, (void *)42); gpr_mu_lock(g_mu); while (!g_done) { grpc_pollset_worker *worker = NULL; - grpc_pollset_work(&exec_ctx, g_pollset, &worker, + grpc_pollset_work(&exec_ctx, grpc_polling_entity_pollset(&g_pops), &worker, gpr_now(GPR_CLOCK_MONOTONIC), n_seconds_time(20)); gpr_mu_unlock(g_mu); grpc_exec_ctx_finish(&exec_ctx); @@ -132,8 +132,8 @@ static void test_post(int port) { gpr_free(host); } -static void destroy_pollset(grpc_exec_ctx *exec_ctx, void *p, bool success) { - grpc_pollset_destroy(p); +static void destroy_pops(grpc_exec_ctx *exec_ctx, void *p, bool success) { + grpc_pollset_destroy(grpc_polling_entity_pollset(p)); } int main(int argc, char **argv) { @@ -180,19 +180,21 @@ int main(int argc, char **argv) { grpc_test_init(argc, argv); grpc_init(); grpc_httpcli_context_init(&g_context); - g_pollset = gpr_malloc(grpc_pollset_size()); - grpc_pollset_init(g_pollset, &g_mu); + grpc_pollset *pollset = gpr_malloc(grpc_pollset_size()); + grpc_pollset_init(pollset, &g_mu); + g_pops = grpc_polling_entity_create_from_pollset(pollset); test_get(port); test_post(port); grpc_httpcli_context_destroy(&g_context); - grpc_closure_init(&destroyed, destroy_pollset, g_pollset); - grpc_pollset_shutdown(&exec_ctx, g_pollset, &destroyed); + grpc_closure_init(&destroyed, destroy_pops, &g_pops); + grpc_pollset_shutdown(&exec_ctx, grpc_polling_entity_pollset(&g_pops), + &destroyed); grpc_exec_ctx_finish(&exec_ctx); grpc_shutdown(); - gpr_free(g_pollset); + gpr_free(grpc_polling_entity_pollset(&g_pops)); gpr_subprocess_destroy(server); diff --git a/test/core/http/httpscli_test.c b/test/core/http/httpscli_test.c index d807336904..1b0bc60048 100644 --- a/test/core/http/httpscli_test.c +++ b/test/core/http/httpscli_test.c @@ -48,7 +48,7 @@ static int g_done = 0; static grpc_httpcli_context g_context; static gpr_mu *g_mu; -static grpc_pollset *g_pollset; +static grpc_polling_entity g_pops; static gpr_timespec n_seconds_time(int seconds) { return GRPC_TIMEOUT_SECONDS_TO_DEADLINE(seconds); @@ -66,7 +66,7 @@ static void on_finish(grpc_exec_ctx *exec_ctx, void *arg, GPR_ASSERT(0 == memcmp(expect, response->body, response->body_length)); gpr_mu_lock(g_mu); g_done = 1; - grpc_pollset_kick(g_pollset, NULL); + grpc_pollset_kick(grpc_polling_entity_pollset(&g_pops), NULL); gpr_mu_unlock(g_mu); } @@ -87,12 +87,12 @@ static void test_get(int port) { req.http.path = "/get"; req.handshaker = &grpc_httpcli_ssl; - grpc_httpcli_get(&exec_ctx, &g_context, g_pollset, &req, n_seconds_time(15), + grpc_httpcli_get(&exec_ctx, &g_context, &g_pops, &req, n_seconds_time(15), on_finish, (void *)42); gpr_mu_lock(g_mu); while (!g_done) { grpc_pollset_worker *worker = NULL; - grpc_pollset_work(&exec_ctx, g_pollset, &worker, + grpc_pollset_work(&exec_ctx, grpc_polling_entity_pollset(&g_pops), &worker, gpr_now(GPR_CLOCK_MONOTONIC), n_seconds_time(20)); gpr_mu_unlock(g_mu); grpc_exec_ctx_finish(&exec_ctx); @@ -119,12 +119,12 @@ static void test_post(int port) { req.http.path = "/post"; req.handshaker = &grpc_httpcli_ssl; - grpc_httpcli_post(&exec_ctx, &g_context, g_pollset, &req, "hello", 5, + grpc_httpcli_post(&exec_ctx, &g_context, &g_pops, &req, "hello", 5, n_seconds_time(15), on_finish, (void *)42); gpr_mu_lock(g_mu); while (!g_done) { grpc_pollset_worker *worker = NULL; - grpc_pollset_work(&exec_ctx, g_pollset, &worker, + grpc_pollset_work(&exec_ctx, grpc_polling_entity_pollset(&g_pops), &worker, gpr_now(GPR_CLOCK_MONOTONIC), n_seconds_time(20)); gpr_mu_unlock(g_mu); grpc_exec_ctx_finish(&exec_ctx); @@ -134,8 +134,8 @@ static void test_post(int port) { gpr_free(host); } -static void destroy_pollset(grpc_exec_ctx *exec_ctx, void *p, bool success) { - grpc_pollset_destroy(p); +static void destroy_pops(grpc_exec_ctx *exec_ctx, void *p, bool success) { + grpc_pollset_destroy(grpc_polling_entity_pollset(p)); } int main(int argc, char **argv) { @@ -183,19 +183,21 @@ int main(int argc, char **argv) { grpc_test_init(argc, argv); grpc_init(); grpc_httpcli_context_init(&g_context); - g_pollset = gpr_malloc(grpc_pollset_size()); - grpc_pollset_init(g_pollset, &g_mu); + grpc_pollset *pollset = gpr_malloc(grpc_pollset_size()); + grpc_pollset_init(pollset, &g_mu); + g_pops = grpc_polling_entity_create_from_pollset(pollset); test_get(port); test_post(port); grpc_httpcli_context_destroy(&g_context); - grpc_closure_init(&destroyed, destroy_pollset, g_pollset); - grpc_pollset_shutdown(&exec_ctx, g_pollset, &destroyed); + grpc_closure_init(&destroyed, destroy_pops, &g_pops); + grpc_pollset_shutdown(&exec_ctx, grpc_polling_entity_pollset(&g_pops), + &destroyed); grpc_exec_ctx_finish(&exec_ctx); grpc_shutdown(); - gpr_free(g_pollset); + gpr_free(grpc_polling_entity_pollset(&g_pops)); gpr_subprocess_destroy(server); diff --git a/test/core/security/oauth2_utils.c b/test/core/security/oauth2_utils.c index 80d21cc602..cb27a1a564 100644 --- a/test/core/security/oauth2_utils.c +++ b/test/core/security/oauth2_utils.c @@ -46,7 +46,7 @@ typedef struct { gpr_mu *mu; - grpc_pollset *pollset; + grpc_polling_entity pops; int is_done; char *token; } oauth2_request; @@ -70,7 +70,7 @@ static void on_oauth2_response(grpc_exec_ctx *exec_ctx, void *user_data, gpr_mu_lock(request->mu); request->is_done = 1; request->token = token; - grpc_pollset_kick(request->pollset, NULL); + grpc_pollset_kick(grpc_polling_entity_pollset(&request->pops), NULL); gpr_mu_unlock(request->mu); } @@ -83,30 +83,30 @@ char *grpc_test_fetch_oauth2_token_with_credentials( grpc_closure do_nothing_closure; grpc_auth_metadata_context null_ctx = {"", "", NULL, NULL}; - request.pollset = gpr_malloc(grpc_pollset_size()); - grpc_pollset_init(request.pollset, &request.mu); + grpc_pollset *pollset = gpr_malloc(grpc_pollset_size()); + grpc_pollset_init(pollset, &request.mu); + request.pops = grpc_polling_entity_create_from_pollset(pollset); request.is_done = 0; grpc_closure_init(&do_nothing_closure, do_nothing, NULL); - grpc_call_credentials_get_request_metadata(&exec_ctx, creds, request.pollset, - null_ctx, on_oauth2_response, - &request); + grpc_call_credentials_get_request_metadata( + &exec_ctx, creds, &request.pops, null_ctx, on_oauth2_response, &request); grpc_exec_ctx_finish(&exec_ctx); gpr_mu_lock(request.mu); while (!request.is_done) { grpc_pollset_worker *worker = NULL; - grpc_pollset_work(&exec_ctx, request.pollset, &worker, - gpr_now(GPR_CLOCK_MONOTONIC), + grpc_pollset_work(&exec_ctx, grpc_polling_entity_pollset(&request.pops), + &worker, gpr_now(GPR_CLOCK_MONOTONIC), gpr_inf_future(GPR_CLOCK_MONOTONIC)); } gpr_mu_unlock(request.mu); - grpc_pollset_shutdown(&exec_ctx, request.pollset, &do_nothing_closure); + grpc_pollset_shutdown(&exec_ctx, grpc_polling_entity_pollset(&request.pops), + &do_nothing_closure); grpc_exec_ctx_finish(&exec_ctx); - grpc_pollset_destroy(request.pollset); - gpr_free(request.pollset); + gpr_free(grpc_polling_entity_pollset(&request.pops)); return request.token; } diff --git a/test/core/security/print_google_default_creds_token.c b/test/core/security/print_google_default_creds_token.c index 1b7036cf9e..07c8c58d41 100644 --- a/test/core/security/print_google_default_creds_token.c +++ b/test/core/security/print_google_default_creds_token.c @@ -48,7 +48,7 @@ typedef struct { gpr_mu *mu; - grpc_pollset *pollset; + grpc_polling_entity pops; int is_done; } synchronizer; @@ -67,7 +67,7 @@ static void on_metadata_response(grpc_exec_ctx *exec_ctx, void *user_data, } gpr_mu_lock(sync->mu); sync->is_done = 1; - grpc_pollset_kick(sync->pollset, NULL); + grpc_pollset_kick(grpc_polling_entity_pollset(&sync->pops), NULL); gpr_mu_unlock(sync->mu); } @@ -94,19 +94,20 @@ int main(int argc, char **argv) { goto end; } - sync.pollset = gpr_malloc(grpc_pollset_size()); - grpc_pollset_init(sync.pollset, &sync.mu); + grpc_pollset *pollset = gpr_malloc(grpc_pollset_size()); + grpc_pollset_init(pollset, &sync.mu); + sync.pops = grpc_polling_entity_create_from_pollset(pollset); sync.is_done = 0; grpc_call_credentials_get_request_metadata( &exec_ctx, ((grpc_composite_channel_credentials *)creds)->call_creds, - sync.pollset, context, on_metadata_response, &sync); + &sync.pops, context, on_metadata_response, &sync); gpr_mu_lock(sync.mu); while (!sync.is_done) { grpc_pollset_worker *worker = NULL; - grpc_pollset_work(&exec_ctx, sync.pollset, &worker, - gpr_now(GPR_CLOCK_MONOTONIC), + grpc_pollset_work(&exec_ctx, grpc_polling_entity_pollset(&sync.pops), + &worker, gpr_now(GPR_CLOCK_MONOTONIC), gpr_inf_future(GPR_CLOCK_MONOTONIC)); gpr_mu_unlock(sync.mu); grpc_exec_ctx_flush(&exec_ctx); @@ -117,7 +118,7 @@ int main(int argc, char **argv) { grpc_exec_ctx_finish(&exec_ctx); grpc_channel_credentials_release(creds); - gpr_free(sync.pollset); + gpr_free(grpc_polling_entity_pollset(&sync.pops)); end: gpr_cmdline_destroy(cl); diff --git a/test/core/surface/public_headers_must_be_c89.c b/test/core/surface/public_headers_must_be_c89.c index fd6ff2c26f..3eeb55d033 100644 --- a/test/core/surface/public_headers_must_be_c89.c +++ b/test/core/surface/public_headers_must_be_c89.c @@ -36,7 +36,6 @@ #include <grpc/census.h> #include <grpc/compression.h> #include <grpc/grpc.h> -#include <grpc/grpc_cronet.h> #include <grpc/grpc_security.h> #include <grpc/grpc_security_constants.h> #include <grpc/impl/codegen/alloc.h> diff --git a/test/core/util/port_server_client.c b/test/core/util/port_server_client.c index 84e90547aa..f924d553d5 100644 --- a/test/core/util/port_server_client.c +++ b/test/core/util/port_server_client.c @@ -51,14 +51,15 @@ typedef struct freereq { gpr_mu *mu; - grpc_pollset *pollset; + grpc_polling_entity pops; int done; } freereq; -static void destroy_pollset_and_shutdown(grpc_exec_ctx *exec_ctx, void *p, - bool success) { - grpc_pollset_destroy(p); - gpr_free(p); +static void destroy_pops_and_shutdown(grpc_exec_ctx *exec_ctx, void *p, + bool success) { + grpc_pollset *pollset = grpc_polling_entity_pollset(p); + grpc_pollset_destroy(pollset); + gpr_free(pollset); grpc_shutdown(); } @@ -67,7 +68,7 @@ static void freed_port_from_server(grpc_exec_ctx *exec_ctx, void *arg, freereq *pr = arg; gpr_mu_lock(pr->mu); pr->done = 1; - grpc_pollset_kick(pr->pollset, NULL); + grpc_pollset_kick(grpc_polling_entity_pollset(&pr->pops), NULL); gpr_mu_unlock(pr->mu); } @@ -84,23 +85,23 @@ void grpc_free_port_using_server(char *server, int port) { memset(&pr, 0, sizeof(pr)); memset(&req, 0, sizeof(req)); - pr.pollset = gpr_malloc(grpc_pollset_size()); - grpc_pollset_init(pr.pollset, &pr.mu); - shutdown_closure = - grpc_closure_create(destroy_pollset_and_shutdown, pr.pollset); + grpc_pollset *pollset = gpr_malloc(grpc_pollset_size()); + grpc_pollset_init(pollset, &pr.mu); + pr.pops = grpc_polling_entity_create_from_pollset(pollset); + shutdown_closure = grpc_closure_create(destroy_pops_and_shutdown, &pr.pops); req.host = server; gpr_asprintf(&path, "/drop/%d", port); req.http.path = path; grpc_httpcli_context_init(&context); - grpc_httpcli_get(&exec_ctx, &context, pr.pollset, &req, + grpc_httpcli_get(&exec_ctx, &context, &pr.pops, &req, GRPC_TIMEOUT_SECONDS_TO_DEADLINE(10), freed_port_from_server, &pr); gpr_mu_lock(pr.mu); while (!pr.done) { grpc_pollset_worker *worker = NULL; - grpc_pollset_work(&exec_ctx, pr.pollset, &worker, + grpc_pollset_work(&exec_ctx, grpc_polling_entity_pollset(&pr.pops), &worker, gpr_now(GPR_CLOCK_MONOTONIC), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(1)); } @@ -108,14 +109,15 @@ void grpc_free_port_using_server(char *server, int port) { grpc_httpcli_context_destroy(&context); grpc_exec_ctx_finish(&exec_ctx); - grpc_pollset_shutdown(&exec_ctx, pr.pollset, shutdown_closure); + grpc_pollset_shutdown(&exec_ctx, grpc_polling_entity_pollset(&pr.pops), + shutdown_closure); grpc_exec_ctx_finish(&exec_ctx); gpr_free(path); } typedef struct portreq { gpr_mu *mu; - grpc_pollset *pollset; + grpc_polling_entity pops; int port; int retries; char *server; @@ -151,7 +153,7 @@ static void got_port_from_server(grpc_exec_ctx *exec_ctx, void *arg, pr->retries++; req.host = pr->server; req.http.path = "/get"; - grpc_httpcli_get(exec_ctx, pr->ctx, pr->pollset, &req, + grpc_httpcli_get(exec_ctx, pr->ctx, &pr->pops, &req, GRPC_TIMEOUT_SECONDS_TO_DEADLINE(10), got_port_from_server, pr); return; @@ -165,7 +167,7 @@ static void got_port_from_server(grpc_exec_ctx *exec_ctx, void *arg, GPR_ASSERT(port > 1024); gpr_mu_lock(pr->mu); pr->port = port; - grpc_pollset_kick(pr->pollset, NULL); + grpc_pollset_kick(grpc_polling_entity_pollset(&pr->pops), NULL); gpr_mu_unlock(pr->mu); } @@ -180,10 +182,10 @@ int grpc_pick_port_using_server(char *server) { memset(&pr, 0, sizeof(pr)); memset(&req, 0, sizeof(req)); - pr.pollset = gpr_malloc(grpc_pollset_size()); - grpc_pollset_init(pr.pollset, &pr.mu); - shutdown_closure = - grpc_closure_create(destroy_pollset_and_shutdown, pr.pollset); + grpc_pollset *pollset = gpr_malloc(grpc_pollset_size()); + grpc_pollset_init(pollset, &pr.mu); + pr.pops = grpc_polling_entity_create_from_pollset(pollset); + shutdown_closure = grpc_closure_create(destroy_pops_and_shutdown, &pr.pops); pr.port = -1; pr.server = server; pr.ctx = &context; @@ -192,21 +194,22 @@ int grpc_pick_port_using_server(char *server) { req.http.path = "/get"; grpc_httpcli_context_init(&context); - grpc_httpcli_get(&exec_ctx, &context, pr.pollset, &req, + grpc_httpcli_get(&exec_ctx, &context, &pr.pops, &req, GRPC_TIMEOUT_SECONDS_TO_DEADLINE(10), got_port_from_server, &pr); grpc_exec_ctx_finish(&exec_ctx); gpr_mu_lock(pr.mu); while (pr.port == -1) { grpc_pollset_worker *worker = NULL; - grpc_pollset_work(&exec_ctx, pr.pollset, &worker, + grpc_pollset_work(&exec_ctx, grpc_polling_entity_pollset(&pr.pops), &worker, gpr_now(GPR_CLOCK_MONOTONIC), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(1)); } gpr_mu_unlock(pr.mu); grpc_httpcli_context_destroy(&context); - grpc_pollset_shutdown(&exec_ctx, pr.pollset, shutdown_closure); + grpc_pollset_shutdown(&exec_ctx, grpc_polling_entity_pollset(&pr.pops), + shutdown_closure); grpc_exec_ctx_finish(&exec_ctx); return pr.port; |