aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/core
diff options
context:
space:
mode:
Diffstat (limited to 'test/core')
-rw-r--r--test/core/bad_client/bad_client.c4
-rw-r--r--test/core/channel/channel_stack_test.c6
-rw-r--r--test/core/client_config/set_initial_connect_string_test.c2
-rw-r--r--test/core/end2end/fixtures/h2_uchannel.c6
-rw-r--r--test/core/httpcli/httpcli_test.c4
-rw-r--r--test/core/httpcli/httpscli_test.c4
-rw-r--r--test/core/iomgr/endpoint_pair_test.c4
-rw-r--r--test/core/iomgr/endpoint_tests.c6
-rw-r--r--test/core/iomgr/fd_posix_test.c18
-rw-r--r--test/core/iomgr/tcp_client_posix_test.c8
-rw-r--r--test/core/iomgr/tcp_posix_test.c8
-rw-r--r--test/core/iomgr/tcp_server_posix_test.c4
-rw-r--r--test/core/iomgr/timer_list_test.c4
-rw-r--r--test/core/iomgr/workqueue_test.c8
-rw-r--r--test/core/security/create_jwt.c4
-rw-r--r--test/core/security/credentials_test.c8
-rw-r--r--test/core/security/json_token_test.c8
-rw-r--r--test/core/security/oauth2_utils.c4
-rw-r--r--test/core/security/secure_endpoint_test.c6
-rw-r--r--test/core/security/security_connector_test.c68
-rw-r--r--test/core/surface/lame_client_test.c6
-rw-r--r--test/core/surface/public_headers_must_be_c89.c15
-rw-r--r--test/core/transport/connectivity_state_test.c6
-rw-r--r--test/core/util/port_posix.c6
-rw-r--r--test/core/util/port_windows.c4
-rw-r--r--test/core/util/test_tcp_server.c4
26 files changed, 152 insertions, 73 deletions
diff --git a/test/core/bad_client/bad_client.c b/test/core/bad_client/bad_client.c
index 832570a81d..1a2ca6f0c0 100644
--- a/test/core/bad_client/bad_client.c
+++ b/test/core/bad_client/bad_client.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -60,7 +60,7 @@ static void thd_func(void *arg) {
gpr_event_set(&a->done_thd, (void *)1);
}
-static void done_write(grpc_exec_ctx *exec_ctx, void *arg, int success) {
+static void done_write(grpc_exec_ctx *exec_ctx, void *arg, bool success) {
thd_args *a = arg;
gpr_event_set(&a->done_write, (void *)1);
}
diff --git a/test/core/channel/channel_stack_test.c b/test/core/channel/channel_stack_test.c
index f1bb37c0bf..e19e9a57ae 100644
--- a/test/core/channel/channel_stack_test.c
+++ b/test/core/channel/channel_stack_test.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -81,12 +81,12 @@ static char *get_peer(grpc_exec_ctx *exec_ctx, grpc_call_element *elem) {
return gpr_strdup("peer");
}
-static void free_channel(grpc_exec_ctx *exec_ctx, void *arg, int success) {
+static void free_channel(grpc_exec_ctx *exec_ctx, void *arg, bool success) {
grpc_channel_stack_destroy(exec_ctx, arg);
gpr_free(arg);
}
-static void free_call(grpc_exec_ctx *exec_ctx, void *arg, int success) {
+static void free_call(grpc_exec_ctx *exec_ctx, void *arg, bool success) {
grpc_call_stack_destroy(exec_ctx, arg);
gpr_free(arg);
}
diff --git a/test/core/client_config/set_initial_connect_string_test.c b/test/core/client_config/set_initial_connect_string_test.c
index 33cab715b2..bcd1f26123 100644
--- a/test/core/client_config/set_initial_connect_string_test.c
+++ b/test/core/client_config/set_initial_connect_string_test.c
@@ -64,7 +64,7 @@ static int server_port;
static struct rpc_state state;
static grpc_closure on_read;
-static void handle_read(grpc_exec_ctx *exec_ctx, void *arg, int success) {
+static void handle_read(grpc_exec_ctx *exec_ctx, void *arg, bool success) {
GPR_ASSERT(success);
gpr_slice_buffer_move_into(&state.temp_incoming_buffer,
&state.incoming_buffer);
diff --git a/test/core/end2end/fixtures/h2_uchannel.c b/test/core/end2end/fixtures/h2_uchannel.c
index 24079c0b4b..dbdd3524ed 100644
--- a/test/core/end2end/fixtures/h2_uchannel.c
+++ b/test/core/end2end/fixtures/h2_uchannel.c
@@ -81,7 +81,7 @@ static void connector_unref(grpc_exec_ctx *exec_ctx, grpc_connector *con) {
}
}
-static void connected(grpc_exec_ctx *exec_ctx, void *arg, int success) {
+static void connected(grpc_exec_ctx *exec_ctx, void *arg, bool success) {
connector *c = arg;
grpc_closure *notify;
grpc_endpoint *tcp = c->tcp;
@@ -240,7 +240,7 @@ static grpc_end2end_test_fixture chttp2_create_fixture_micro_fullstack(
grpc_connectivity_state g_state = GRPC_CHANNEL_IDLE;
grpc_pollset_set g_interested_parties;
-static void state_changed(grpc_exec_ctx *exec_ctx, void *arg, int success) {
+static void state_changed(grpc_exec_ctx *exec_ctx, void *arg, bool success) {
if (g_state != GRPC_CHANNEL_READY) {
grpc_subchannel_notify_on_state_change(
exec_ctx, arg, &g_interested_parties, &g_state,
@@ -248,7 +248,7 @@ static void state_changed(grpc_exec_ctx *exec_ctx, void *arg, int success) {
}
}
-static void destroy_pollset(grpc_exec_ctx *exec_ctx, void *arg, int success) {
+static void destroy_pollset(grpc_exec_ctx *exec_ctx, void *arg, bool success) {
grpc_pollset_destroy(arg);
}
diff --git a/test/core/httpcli/httpcli_test.c b/test/core/httpcli/httpcli_test.c
index 612388c61d..651ef1fa3b 100644
--- a/test/core/httpcli/httpcli_test.c
+++ b/test/core/httpcli/httpcli_test.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -131,7 +131,7 @@ static void test_post(int port) {
gpr_free(host);
}
-static void destroy_pollset(grpc_exec_ctx *exec_ctx, void *p, int success) {
+static void destroy_pollset(grpc_exec_ctx *exec_ctx, void *p, bool success) {
grpc_pollset_destroy(p);
}
diff --git a/test/core/httpcli/httpscli_test.c b/test/core/httpcli/httpscli_test.c
index ba5660bd18..db41be17e7 100644
--- a/test/core/httpcli/httpscli_test.c
+++ b/test/core/httpcli/httpscli_test.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -133,7 +133,7 @@ static void test_post(int port) {
gpr_free(host);
}
-static void destroy_pollset(grpc_exec_ctx *exec_ctx, void *p, int success) {
+static void destroy_pollset(grpc_exec_ctx *exec_ctx, void *p, bool success) {
grpc_pollset_destroy(p);
}
diff --git a/test/core/iomgr/endpoint_pair_test.c b/test/core/iomgr/endpoint_pair_test.c
index ff590cf2d5..7e266ebfb9 100644
--- a/test/core/iomgr/endpoint_pair_test.c
+++ b/test/core/iomgr/endpoint_pair_test.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -65,7 +65,7 @@ static grpc_endpoint_test_config configs[] = {
{"tcp/tcp_socketpair", create_fixture_endpoint_pair, clean_up},
};
-static void destroy_pollset(grpc_exec_ctx *exec_ctx, void *p, int success) {
+static void destroy_pollset(grpc_exec_ctx *exec_ctx, void *p, bool success) {
grpc_pollset_destroy(p);
}
diff --git a/test/core/iomgr/endpoint_tests.c b/test/core/iomgr/endpoint_tests.c
index a66fe32fde..1b6a78da9a 100644
--- a/test/core/iomgr/endpoint_tests.c
+++ b/test/core/iomgr/endpoint_tests.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -127,7 +127,7 @@ struct read_and_write_test_state {
};
static void read_and_write_test_read_handler(grpc_exec_ctx *exec_ctx,
- void *data, int success) {
+ void *data, bool success) {
struct read_and_write_test_state *state = data;
state->bytes_read += count_slices(
@@ -145,7 +145,7 @@ static void read_and_write_test_read_handler(grpc_exec_ctx *exec_ctx,
}
static void read_and_write_test_write_handler(grpc_exec_ctx *exec_ctx,
- void *data, int success) {
+ void *data, bool success) {
struct read_and_write_test_state *state = data;
gpr_slice *slices = NULL;
size_t nslices;
diff --git a/test/core/iomgr/fd_posix_test.c b/test/core/iomgr/fd_posix_test.c
index b186520729..347a86af10 100644
--- a/test/core/iomgr/fd_posix_test.c
+++ b/test/core/iomgr/fd_posix_test.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -118,7 +118,7 @@ typedef struct {
/* Called when an upload session can be safely shutdown.
Close session FD and start to shutdown listen FD. */
static void session_shutdown_cb(grpc_exec_ctx *exec_ctx, void *arg, /*session */
- int success) {
+ bool success) {
session *se = arg;
server *sv = se->sv;
grpc_fd_orphan(exec_ctx, se->em_fd, NULL, NULL, "a");
@@ -129,7 +129,7 @@ static void session_shutdown_cb(grpc_exec_ctx *exec_ctx, void *arg, /*session */
/* Called when data become readable in a session. */
static void session_read_cb(grpc_exec_ctx *exec_ctx, void *arg, /*session */
- int success) {
+ bool success) {
session *se = arg;
int fd = se->em_fd->fd;
@@ -187,7 +187,7 @@ static void listen_shutdown_cb(grpc_exec_ctx *exec_ctx, void *arg /*server */,
/* Called when a new TCP connection request arrives in the listening port. */
static void listen_cb(grpc_exec_ctx *exec_ctx, void *arg, /*=sv_arg*/
- int success) {
+ bool success) {
server *sv = arg;
int fd;
int flags;
@@ -301,7 +301,7 @@ static void client_session_shutdown_cb(grpc_exec_ctx *exec_ctx,
/* Write as much as possible, then register notify_on_write. */
static void client_session_write(grpc_exec_ctx *exec_ctx, void *arg, /*client */
- int success) {
+ bool success) {
client *cl = arg;
int fd = cl->em_fd->fd;
ssize_t write_once = 0;
@@ -399,7 +399,7 @@ static void test_grpc_fd(void) {
}
typedef struct fd_change_data {
- void (*cb_that_ran)(grpc_exec_ctx *exec_ctx, void *, int success);
+ grpc_iomgr_cb_func cb_that_ran;
} fd_change_data;
void init_change_data(fd_change_data *fdc) { fdc->cb_that_ran = NULL; }
@@ -407,7 +407,7 @@ void init_change_data(fd_change_data *fdc) { fdc->cb_that_ran = NULL; }
void destroy_change_data(fd_change_data *fdc) {}
static void first_read_callback(grpc_exec_ctx *exec_ctx,
- void *arg /* fd_change_data */, int success) {
+ void *arg /* fd_change_data */, bool success) {
fd_change_data *fdc = arg;
gpr_mu_lock(GRPC_POLLSET_MU(&g_pollset));
@@ -417,7 +417,7 @@ static void first_read_callback(grpc_exec_ctx *exec_ctx,
}
static void second_read_callback(grpc_exec_ctx *exec_ctx,
- void *arg /* fd_change_data */, int success) {
+ void *arg /* fd_change_data */, bool success) {
fd_change_data *fdc = arg;
gpr_mu_lock(GRPC_POLLSET_MU(&g_pollset));
@@ -510,7 +510,7 @@ static void test_grpc_fd_change(void) {
close(sv[1]);
}
-static void destroy_pollset(grpc_exec_ctx *exec_ctx, void *p, int success) {
+static void destroy_pollset(grpc_exec_ctx *exec_ctx, void *p, bool success) {
grpc_pollset_destroy(p);
}
diff --git a/test/core/iomgr/tcp_client_posix_test.c b/test/core/iomgr/tcp_client_posix_test.c
index 833ceace54..9725d8a3b6 100644
--- a/test/core/iomgr/tcp_client_posix_test.c
+++ b/test/core/iomgr/tcp_client_posix_test.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -63,7 +63,7 @@ static void finish_connection() {
gpr_mu_unlock(GRPC_POLLSET_MU(&g_pollset));
}
-static void must_succeed(grpc_exec_ctx *exec_ctx, void *arg, int success) {
+static void must_succeed(grpc_exec_ctx *exec_ctx, void *arg, bool success) {
GPR_ASSERT(g_connecting != NULL);
GPR_ASSERT(success);
grpc_endpoint_shutdown(exec_ctx, g_connecting);
@@ -72,7 +72,7 @@ static void must_succeed(grpc_exec_ctx *exec_ctx, void *arg, int success) {
finish_connection();
}
-static void must_fail(grpc_exec_ctx *exec_ctx, void *arg, int success) {
+static void must_fail(grpc_exec_ctx *exec_ctx, void *arg, bool success) {
GPR_ASSERT(g_connecting == NULL);
GPR_ASSERT(!success);
finish_connection();
@@ -258,7 +258,7 @@ void test_times_out(void) {
}
}
-static void destroy_pollset(grpc_exec_ctx *exec_ctx, void *p, int success) {
+static void destroy_pollset(grpc_exec_ctx *exec_ctx, void *p, bool success) {
grpc_pollset_destroy(p);
}
diff --git a/test/core/iomgr/tcp_posix_test.c b/test/core/iomgr/tcp_posix_test.c
index e0136b3cd7..d290c6bc3a 100644
--- a/test/core/iomgr/tcp_posix_test.c
+++ b/test/core/iomgr/tcp_posix_test.c
@@ -138,7 +138,7 @@ static size_t count_slices(gpr_slice *slices, size_t nslices,
return num_bytes;
}
-static void read_cb(grpc_exec_ctx *exec_ctx, void *user_data, int success) {
+static void read_cb(grpc_exec_ctx *exec_ctx, void *user_data, bool success) {
struct read_socket_state *state = (struct read_socket_state *)user_data;
size_t read_bytes;
int current_data;
@@ -280,7 +280,7 @@ static gpr_slice *allocate_blocks(size_t num_bytes, size_t slice_size,
}
static void write_done(grpc_exec_ctx *exec_ctx,
- void *user_data /* write_socket_state */, int success) {
+ void *user_data /* write_socket_state */, bool success) {
struct write_socket_state *state = (struct write_socket_state *)user_data;
gpr_log(GPR_INFO, "Write done callback called");
gpr_mu_lock(GRPC_POLLSET_MU(&g_pollset));
@@ -383,7 +383,7 @@ static void write_test(size_t num_bytes, size_t slice_size) {
grpc_exec_ctx_finish(&exec_ctx);
}
-void on_fd_released(grpc_exec_ctx *exec_ctx, void *arg, int success) {
+void on_fd_released(grpc_exec_ctx *exec_ctx, void *arg, bool success) {
int *done = arg;
*done = 1;
grpc_pollset_kick(&g_pollset, NULL);
@@ -503,7 +503,7 @@ static grpc_endpoint_test_config configs[] = {
{"tcp/tcp_socketpair", create_fixture_tcp_socketpair, clean_up},
};
-static void destroy_pollset(grpc_exec_ctx *exec_ctx, void *p, int success) {
+static void destroy_pollset(grpc_exec_ctx *exec_ctx, void *p, bool success) {
grpc_pollset_destroy(p);
}
diff --git a/test/core/iomgr/tcp_server_posix_test.c b/test/core/iomgr/tcp_server_posix_test.c
index f7097ac904..272d97bfcb 100644
--- a/test/core/iomgr/tcp_server_posix_test.c
+++ b/test/core/iomgr/tcp_server_posix_test.c
@@ -86,7 +86,7 @@ static void on_connect_result_set(on_connect_result *result,
}
static void server_weak_ref_shutdown(grpc_exec_ctx *exec_ctx, void *arg,
- int success) {
+ bool success) {
server_weak_ref *weak_ref = arg;
weak_ref->server = NULL;
}
@@ -303,7 +303,7 @@ static void test_connect(unsigned n) {
grpc_exec_ctx_finish(&exec_ctx);
}
-static void destroy_pollset(grpc_exec_ctx *exec_ctx, void *p, int success) {
+static void destroy_pollset(grpc_exec_ctx *exec_ctx, void *p, bool success) {
grpc_pollset_destroy(p);
}
diff --git a/test/core/iomgr/timer_list_test.c b/test/core/iomgr/timer_list_test.c
index 63014c3939..15de87c5a1 100644
--- a/test/core/iomgr/timer_list_test.c
+++ b/test/core/iomgr/timer_list_test.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -43,7 +43,7 @@
static int cb_called[MAX_CB][2];
-static void cb(grpc_exec_ctx *exec_ctx, void *arg, int success) {
+static void cb(grpc_exec_ctx *exec_ctx, void *arg, bool success) {
cb_called[(intptr_t)arg][success]++;
}
diff --git a/test/core/iomgr/workqueue_test.c b/test/core/iomgr/workqueue_test.c
index d1f9dabc57..500170b542 100644
--- a/test/core/iomgr/workqueue_test.c
+++ b/test/core/iomgr/workqueue_test.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -40,7 +40,7 @@
static grpc_pollset g_pollset;
-static void must_succeed(grpc_exec_ctx *exec_ctx, void *p, int success) {
+static void must_succeed(grpc_exec_ctx *exec_ctx, void *p, bool success) {
GPR_ASSERT(success == 1);
gpr_mu_lock(GRPC_POLLSET_MU(&g_pollset));
*(int *)p = 1;
@@ -90,7 +90,7 @@ static void test_flush(void) {
grpc_pollset_worker worker;
grpc_closure_init(&c, must_succeed, &done);
- grpc_exec_ctx_enqueue(&exec_ctx, &c, 1);
+ grpc_exec_ctx_enqueue(&exec_ctx, &c, true, NULL);
grpc_workqueue_flush(&exec_ctx, wq);
grpc_workqueue_add_to_pollset(&exec_ctx, wq, &g_pollset);
@@ -106,7 +106,7 @@ static void test_flush(void) {
grpc_exec_ctx_finish(&exec_ctx);
}
-static void destroy_pollset(grpc_exec_ctx *exec_ctx, void *p, int success) {
+static void destroy_pollset(grpc_exec_ctx *exec_ctx, void *p, bool success) {
grpc_pollset_destroy(p);
}
diff --git a/test/core/security/create_jwt.c b/test/core/security/create_jwt.c
index b02469fb35..237dc9aa3e 100644
--- a/test/core/security/create_jwt.c
+++ b/test/core/security/create_jwt.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -62,7 +62,7 @@ void create_jwt(const char *json_key_file_path, const char *service_url,
}
jwt = grpc_jwt_encode_and_sign(
&key, service_url == NULL ? GRPC_JWT_OAUTH2_AUDIENCE : service_url,
- grpc_max_auth_token_lifetime, scope);
+ grpc_max_auth_token_lifetime(), scope);
grpc_auth_json_key_destruct(&key);
if (jwt == NULL) {
fprintf(stderr, "Could not create JWT.\n");
diff --git a/test/core/security/credentials_test.c b/test/core/security/credentials_test.c
index a32ddd2ec7..8a210bb3c3 100644
--- a/test/core/security/credentials_test.c
+++ b/test/core/security/credentials_test.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -734,7 +734,7 @@ static void validate_jwt_encode_and_sign_params(
"777-abaslkan11hlb6nmim3bpspl31ud@developer."
"gserviceaccount.com") == 0);
if (scope != NULL) GPR_ASSERT(strcmp(scope, test_scope) == 0);
- GPR_ASSERT(!gpr_time_cmp(token_lifetime, grpc_max_auth_token_lifetime));
+ GPR_ASSERT(!gpr_time_cmp(token_lifetime, grpc_max_auth_token_lifetime()));
}
static char *encode_and_sign_jwt_success(const grpc_auth_json_key *json_key,
@@ -794,7 +794,7 @@ static void test_jwt_creds_success(void) {
NULL};
grpc_call_credentials *jwt_creds =
grpc_service_account_jwt_access_credentials_create(
- json_key_string, grpc_max_auth_token_lifetime, NULL);
+ json_key_string, grpc_max_auth_token_lifetime(), NULL);
/* First request: jwt_encode_and_sign should be called. */
grpc_jwt_encode_and_sign_set_override(encode_and_sign_jwt_success);
@@ -832,7 +832,7 @@ static void test_jwt_creds_signing_failure(void) {
NULL};
grpc_call_credentials *jwt_creds =
grpc_service_account_jwt_access_credentials_create(
- json_key_string, grpc_max_auth_token_lifetime, NULL);
+ json_key_string, grpc_max_auth_token_lifetime(), NULL);
grpc_jwt_encode_and_sign_set_override(encode_and_sign_jwt_failure);
grpc_call_credentials_get_request_metadata(
diff --git a/test/core/security/json_token_test.c b/test/core/security/json_token_test.c
index 740fd018b6..7c01a9ce5c 100644
--- a/test/core/security/json_token_test.c
+++ b/test/core/security/json_token_test.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -330,7 +330,7 @@ static void check_jwt_claim(grpc_json *claim, const char *expected_audience,
issue_time.tv_sec = strtol(iat->value, NULL, 10);
parsed_lifetime = gpr_time_sub(expiration, issue_time);
- GPR_ASSERT(parsed_lifetime.tv_sec == grpc_max_auth_token_lifetime.tv_sec);
+ GPR_ASSERT(parsed_lifetime.tv_sec == grpc_max_auth_token_lifetime().tv_sec);
}
static void check_jwt_signature(const char *b64_signature, RSA *rsa_key,
@@ -361,12 +361,12 @@ static void check_jwt_signature(const char *b64_signature, RSA *rsa_key,
static char *service_account_creds_jwt_encode_and_sign(
const grpc_auth_json_key *key) {
return grpc_jwt_encode_and_sign(key, GRPC_JWT_OAUTH2_AUDIENCE,
- grpc_max_auth_token_lifetime, test_scope);
+ grpc_max_auth_token_lifetime(), test_scope);
}
static char *jwt_creds_jwt_encode_and_sign(const grpc_auth_json_key *key) {
return grpc_jwt_encode_and_sign(key, test_service_url,
- grpc_max_auth_token_lifetime, NULL);
+ grpc_max_auth_token_lifetime(), NULL);
}
static void service_account_creds_check_jwt_claim(grpc_json *claim) {
diff --git a/test/core/security/oauth2_utils.c b/test/core/security/oauth2_utils.c
index fb62bf4134..55ac31e62c 100644
--- a/test/core/security/oauth2_utils.c
+++ b/test/core/security/oauth2_utils.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -73,7 +73,7 @@ static void on_oauth2_response(grpc_exec_ctx *exec_ctx, void *user_data,
gpr_mu_unlock(GRPC_POLLSET_MU(&request->pollset));
}
-static void do_nothing(grpc_exec_ctx *exec_ctx, void *unused, int success) {}
+static void do_nothing(grpc_exec_ctx *exec_ctx, void *unused, bool success) {}
char *grpc_test_fetch_oauth2_token_with_credentials(
grpc_call_credentials *creds) {
diff --git a/test/core/security/secure_endpoint_test.c b/test/core/security/secure_endpoint_test.c
index 240c4596b4..fb4bd30e2d 100644
--- a/test/core/security/secure_endpoint_test.c
+++ b/test/core/security/secure_endpoint_test.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -138,7 +138,7 @@ static grpc_endpoint_test_config configs[] = {
secure_endpoint_create_fixture_tcp_socketpair_leftover, clean_up},
};
-static void inc_call_ctr(grpc_exec_ctx *exec_ctx, void *arg, int success) {
+static void inc_call_ctr(grpc_exec_ctx *exec_ctx, void *arg, bool success) {
++*(int *)arg;
}
@@ -171,7 +171,7 @@ static void test_leftover(grpc_endpoint_test_config config, size_t slice_size) {
clean_up();
}
-static void destroy_pollset(grpc_exec_ctx *exec_ctx, void *p, int success) {
+static void destroy_pollset(grpc_exec_ctx *exec_ctx, void *p, bool success) {
grpc_pollset_destroy(p);
}
diff --git a/test/core/security/security_connector_test.c b/test/core/security/security_connector_test.c
index 0dcffa40ce..ee5435f01d 100644
--- a/test/core/security/security_connector_test.c
+++ b/test/core/security/security_connector_test.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -36,6 +36,9 @@
#include "src/core/security/security_connector.h"
#include "src/core/security/security_context.h"
+#include "src/core/support/env.h"
+#include "src/core/support/file.h"
+#include "src/core/support/string.h"
#include "src/core/tsi/ssl_transport_security.h"
#include "src/core/tsi/transport_security.h"
#include "test/core/util/test_config.h"
@@ -44,6 +47,7 @@
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
+#include <grpc/support/string_util.h>
#include <grpc/support/useful.h>
static int check_transport_security_type(const grpc_auth_context *ctx) {
@@ -297,7 +301,66 @@ static void test_cn_and_multiple_sans_and_others_ssl_peer_to_auth_context(
GRPC_AUTH_CONTEXT_UNREF(ctx, "test");
}
-/* TODO(jboeuf): Unit-test tsi_shallow_peer_from_auth_context. */
+static const char *roots_for_override_api = "roots for override api";
+
+static grpc_ssl_roots_override_result override_roots_success(
+ char **pem_root_certs) {
+ *pem_root_certs = gpr_strdup(roots_for_override_api);
+ return GRPC_SSL_ROOTS_OVERRIDE_OK;
+}
+
+static grpc_ssl_roots_override_result override_roots_permanent_failure(
+ char **pem_root_certs) {
+ return GRPC_SSL_ROOTS_OVERRIDE_FAIL_PERMANENTLY;
+}
+
+static void test_default_ssl_roots(void) {
+ const char *roots_for_env_var = "roots for env var";
+
+ char *roots_env_var_file_path;
+ FILE *roots_env_var_file =
+ gpr_tmpfile("test_roots_for_env_var", &roots_env_var_file_path);
+ fwrite(roots_for_env_var, 1, strlen(roots_for_env_var), roots_env_var_file);
+ fclose(roots_env_var_file);
+
+ /* First let's get the root through the override: set the env to an invalid
+ value. */
+ gpr_setenv(GRPC_DEFAULT_SSL_ROOTS_FILE_PATH_ENV_VAR, "");
+ grpc_set_ssl_roots_override_callback(override_roots_success);
+ gpr_slice roots = grpc_get_default_ssl_roots_for_testing();
+ char *roots_contents = gpr_dump_slice(roots, GPR_DUMP_ASCII);
+ gpr_slice_unref(roots);
+ GPR_ASSERT(strcmp(roots_contents, roots_for_override_api) == 0);
+ gpr_free(roots_contents);
+
+ /* Now let's set the env var: We should get the contents pointed value
+ instead. */
+ gpr_setenv(GRPC_DEFAULT_SSL_ROOTS_FILE_PATH_ENV_VAR, roots_env_var_file_path);
+ roots = grpc_get_default_ssl_roots_for_testing();
+ roots_contents = gpr_dump_slice(roots, GPR_DUMP_ASCII);
+ gpr_slice_unref(roots);
+ GPR_ASSERT(strcmp(roots_contents, roots_for_env_var) == 0);
+ gpr_free(roots_contents);
+
+ /* Now reset the env var. We should fall back to the value overridden using
+ the api. */
+ gpr_setenv(GRPC_DEFAULT_SSL_ROOTS_FILE_PATH_ENV_VAR, "");
+ roots = grpc_get_default_ssl_roots_for_testing();
+ roots_contents = gpr_dump_slice(roots, GPR_DUMP_ASCII);
+ gpr_slice_unref(roots);
+ GPR_ASSERT(strcmp(roots_contents, roots_for_override_api) == 0);
+ gpr_free(roots_contents);
+
+ /* Now setup a permanent failure for the overridden roots and we should get
+ an empty slice. */
+ grpc_set_ssl_roots_override_callback(override_roots_permanent_failure);
+ roots = grpc_get_default_ssl_roots_for_testing();
+ GPR_ASSERT(GPR_SLICE_IS_EMPTY(roots));
+
+ /* Cleanup. */
+ remove(roots_env_var_file_path);
+ gpr_free(roots_env_var_file_path);
+}
int main(int argc, char **argv) {
grpc_test_init(argc, argv);
@@ -308,6 +371,7 @@ int main(int argc, char **argv) {
test_cn_and_one_san_ssl_peer_to_auth_context();
test_cn_and_multiple_sans_ssl_peer_to_auth_context();
test_cn_and_multiple_sans_and_others_ssl_peer_to_auth_context();
+ test_default_ssl_roots();
grpc_shutdown();
return 0;
diff --git a/test/core/surface/lame_client_test.c b/test/core/surface/lame_client_test.c
index e03cce1322..79e53cb422 100644
--- a/test/core/surface/lame_client_test.c
+++ b/test/core/surface/lame_client_test.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -47,13 +47,13 @@ grpc_closure transport_op_cb;
static void *tag(intptr_t x) { return (void *)x; }
-void verify_connectivity(grpc_exec_ctx *exec_ctx, void *arg, int success) {
+void verify_connectivity(grpc_exec_ctx *exec_ctx, void *arg, bool success) {
grpc_transport_op *op = arg;
GPR_ASSERT(GRPC_CHANNEL_FATAL_FAILURE == *op->connectivity_state);
GPR_ASSERT(success);
}
-void do_nothing(grpc_exec_ctx *exec_ctx, void *arg, int success) {}
+void do_nothing(grpc_exec_ctx *exec_ctx, void *arg, bool success) {}
void test_transport_op(grpc_channel *channel) {
grpc_transport_op op;
diff --git a/test/core/surface/public_headers_must_be_c89.c b/test/core/surface/public_headers_must_be_c89.c
index 1e1524d098..579faa4441 100644
--- a/test/core/surface/public_headers_must_be_c89.c
+++ b/test/core/surface/public_headers_must_be_c89.c
@@ -37,6 +37,21 @@
#include <grpc/compression.h>
#include <grpc/grpc.h>
#include <grpc/grpc_security.h>
+#include <grpc/impl/codegen/alloc.h>
+#include <grpc/impl/codegen/atm.h>
+#include <grpc/impl/codegen/byte_buffer.h>
+#include <grpc/impl/codegen/compression_types.h>
+#include <grpc/impl/codegen/connectivity_state.h>
+#include <grpc/impl/codegen/grpc_types.h>
+#include <grpc/impl/codegen/log.h>
+#include <grpc/impl/codegen/port_platform.h>
+#include <grpc/impl/codegen/propagation_bits.h>
+#include <grpc/impl/codegen/slice.h>
+#include <grpc/impl/codegen/slice_buffer.h>
+#include <grpc/impl/codegen/status.h>
+#include <grpc/impl/codegen/sync.h>
+#include <grpc/impl/codegen/sync_generic.h>
+#include <grpc/impl/codegen/time.h>
#include <grpc/status.h>
#include <grpc/support/alloc.h>
#include <grpc/support/atm.h>
diff --git a/test/core/transport/connectivity_state_test.c b/test/core/transport/connectivity_state_test.c
index 34ab45d260..4b2d0aa44a 100644
--- a/test/core/transport/connectivity_state_test.c
+++ b/test/core/transport/connectivity_state_test.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -43,13 +43,13 @@
int g_counter;
-static void must_succeed(grpc_exec_ctx *exec_ctx, void *arg, int success) {
+static void must_succeed(grpc_exec_ctx *exec_ctx, void *arg, bool success) {
GPR_ASSERT(success);
GPR_ASSERT(arg == THE_ARG);
g_counter++;
}
-static void must_fail(grpc_exec_ctx *exec_ctx, void *arg, int success) {
+static void must_fail(grpc_exec_ctx *exec_ctx, void *arg, bool success) {
GPR_ASSERT(!success);
GPR_ASSERT(arg == THE_ARG);
g_counter++;
diff --git a/test/core/util/port_posix.c b/test/core/util/port_posix.c
index 11cefbf01c..4b31f810e5 100644
--- a/test/core/util/port_posix.c
+++ b/test/core/util/port_posix.c
@@ -37,12 +37,12 @@
#include "test/core/util/port.h"
+#include <errno.h>
#include <math.h>
#include <netinet/in.h>
-#include <sys/socket.h>
#include <stdio.h>
-#include <errno.h>
#include <string.h>
+#include <sys/socket.h>
#include <unistd.h>
#include <grpc/grpc.h>
@@ -74,7 +74,7 @@ typedef struct freereq {
} freereq;
static void destroy_pollset_and_shutdown(grpc_exec_ctx *exec_ctx, void *p,
- int success) {
+ bool success) {
grpc_pollset_destroy(p);
grpc_shutdown();
}
diff --git a/test/core/util/port_windows.c b/test/core/util/port_windows.c
index 60ad9b4f2a..85d7c0ce07 100644
--- a/test/core/util/port_windows.c
+++ b/test/core/util/port_windows.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -152,7 +152,7 @@ static void got_port_from_server(grpc_exec_ctx *exec_ctx, void *arg,
}
static void destroy_pollset_and_shutdown(grpc_exec_ctx *exec_ctx, void *p,
- int success) {
+ bool success) {
grpc_pollset_destroy(p);
grpc_shutdown();
}
diff --git a/test/core/util/test_tcp_server.c b/test/core/util/test_tcp_server.c
index aaba7be356..66470c0288 100644
--- a/test/core/util/test_tcp_server.c
+++ b/test/core/util/test_tcp_server.c
@@ -46,7 +46,7 @@
#include "test/core/util/port.h"
static void on_server_destroyed(grpc_exec_ctx *exec_ctx, void *data,
- int success) {
+ bool success) {
test_tcp_server *server = data;
server->shutdown = 1;
}
@@ -97,7 +97,7 @@ void test_tcp_server_poll(test_tcp_server *server, int seconds) {
grpc_exec_ctx_finish(&exec_ctx);
}
-static void do_nothing(grpc_exec_ctx *exec_ctx, void *arg, int success) {}
+static void do_nothing(grpc_exec_ctx *exec_ctx, void *arg, bool success) {}
void test_tcp_server_destroy(test_tcp_server *server) {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;