diff options
author | Craig Tiller <ctiller@google.com> | 2015-06-19 17:46:20 -0700 |
---|---|---|
committer | Craig Tiller <ctiller@google.com> | 2015-06-19 17:46:20 -0700 |
commit | 7552f0f95863705e498d71e3227bb890cbb4ef05 (patch) | |
tree | a53f467f9bc31f13f532cff7c158f33e853bb6fb /test/core/security | |
parent | c7299987a0c7621d5d6bef7438e9baf04fc70de2 (diff) |
Ensure tests are built during run_tests runs
The issue remains that we don't test our tools, but at least we test
that they compile.
Diffstat (limited to 'test/core/security')
-rw-r--r-- | test/core/security/fetch_oauth2.c | 23 | ||||
-rw-r--r-- | test/core/security/print_google_default_creds_token.c | 23 |
2 files changed, 20 insertions, 26 deletions
diff --git a/test/core/security/fetch_oauth2.c b/test/core/security/fetch_oauth2.c index 3202df3328..767f724b62 100644 --- a/test/core/security/fetch_oauth2.c +++ b/test/core/security/fetch_oauth2.c @@ -46,8 +46,7 @@ #include "src/core/support/file.h" typedef struct { - gpr_cv cv; - gpr_mu mu; + grpc_pollset pollset; int is_done; } synchronizer; @@ -69,10 +68,10 @@ static void on_oauth2_response(void *user_data, printf("Got token: %s.\n", token); gpr_free(token); } - gpr_mu_lock(&sync->mu); + gpr_mu_lock(GRPC_POLLSET_MU(&sync->pollset)); sync->is_done = 1; - gpr_mu_unlock(&sync->mu); - gpr_cv_signal(&sync->cv); + grpc_pollset_kick(&sync->pollset); + gpr_mu_unlock(GRPC_POLLSET_MU(&sync->pollset)); } static grpc_credentials *create_service_account_creds( @@ -176,18 +175,16 @@ int main(int argc, char **argv) { } GPR_ASSERT(creds != NULL); - gpr_mu_init(&sync.mu); - gpr_cv_init(&sync.cv); + grpc_pollset_init(&sync.pollset); sync.is_done = 0; - grpc_credentials_get_request_metadata(creds, "", on_oauth2_response, &sync); + grpc_credentials_get_request_metadata(creds, &sync.pollset, "", on_oauth2_response, &sync); - gpr_mu_lock(&sync.mu); - while (!sync.is_done) gpr_cv_wait(&sync.cv, &sync.mu, gpr_inf_future); - gpr_mu_unlock(&sync.mu); + gpr_mu_lock(GRPC_POLLSET_MU(&sync.pollset)); + while (!sync.is_done) grpc_pollset_work(&sync.pollset, gpr_inf_future); + gpr_mu_unlock(GRPC_POLLSET_MU(&sync.pollset)); - gpr_mu_destroy(&sync.mu); - gpr_cv_destroy(&sync.cv); + grpc_pollset_destroy(&sync.pollset); grpc_credentials_release(creds); gpr_cmdline_destroy(cl); grpc_shutdown(); diff --git a/test/core/security/print_google_default_creds_token.c b/test/core/security/print_google_default_creds_token.c index 051e8607c4..a0da5b2d93 100644 --- a/test/core/security/print_google_default_creds_token.c +++ b/test/core/security/print_google_default_creds_token.c @@ -44,8 +44,7 @@ #include <grpc/support/sync.h> typedef struct { - gpr_cv cv; - gpr_mu mu; + grpc_pollset pollset; int is_done; } synchronizer; @@ -61,10 +60,10 @@ static void on_metadata_response(void *user_data, printf("\nGot token: %s\n\n", (const char *)GPR_SLICE_START_PTR(md_elems[0].value)); } - gpr_mu_lock(&sync->mu); + gpr_mu_lock(GRPC_POLLSET_MU(&sync->pollset)); sync->is_done = 1; - gpr_mu_unlock(&sync->mu); - gpr_cv_signal(&sync->cv); + grpc_pollset_kick(&sync->pollset); + gpr_mu_unlock(GRPC_POLLSET_MU(&sync->pollset)); } int main(int argc, char **argv) { @@ -86,18 +85,16 @@ int main(int argc, char **argv) { goto end; } - gpr_mu_init(&sync.mu); - gpr_cv_init(&sync.cv); + grpc_pollset_init(&sync.pollset); sync.is_done = 0; - grpc_credentials_get_request_metadata(creds, "", on_metadata_response, &sync); + grpc_credentials_get_request_metadata(creds, &sync.pollset, "", on_metadata_response, &sync); - gpr_mu_lock(&sync.mu); - while (!sync.is_done) gpr_cv_wait(&sync.cv, &sync.mu, gpr_inf_future); - gpr_mu_unlock(&sync.mu); + gpr_mu_lock(GRPC_POLLSET_MU(&sync.pollset)); + while (!sync.is_done) grpc_pollset_work(&sync.pollset, gpr_inf_future); + gpr_mu_unlock(GRPC_POLLSET_MU(&sync.pollset)); - gpr_mu_destroy(&sync.mu); - gpr_cv_destroy(&sync.cv); + grpc_pollset_destroy(&sync.pollset); grpc_credentials_release(creds); end: |