diff options
author | Muxi Yan <mxyan@google.com> | 2017-12-06 18:52:18 -0800 |
---|---|---|
committer | Muxi Yan <mxyan@google.com> | 2017-12-06 18:55:05 -0800 |
commit | 38fcd0c6c3e70e516d1e4dcbfd9cdfe9654f4b0f (patch) | |
tree | 531100570cfbe084b31e65facc1c49dae5434f52 /test/core/surface | |
parent | f5eb1cf9f0e832a2a6d301cc7adeec22e79ef903 (diff) |
clang-format
Diffstat (limited to 'test/core/surface')
-rw-r--r-- | test/core/surface/alarm_test.c | 24 | ||||
-rw-r--r-- | test/core/surface/byte_buffer_reader_test.c | 26 | ||||
-rw-r--r-- | test/core/surface/channel_create_test.c | 6 | ||||
-rw-r--r-- | test/core/surface/completion_queue_test.c | 44 | ||||
-rw-r--r-- | test/core/surface/completion_queue_threading_test.c | 66 | ||||
-rw-r--r-- | test/core/surface/concurrent_connectivity_test.c | 62 | ||||
-rw-r--r-- | test/core/surface/init_test.c | 2 | ||||
-rw-r--r-- | test/core/surface/invalid_channel_args_test.c | 26 | ||||
-rw-r--r-- | test/core/surface/lame_client_test.c | 30 | ||||
-rw-r--r-- | test/core/surface/num_external_connectivity_watchers_test.c | 50 | ||||
-rw-r--r-- | test/core/surface/secure_channel_create_test.c | 16 | ||||
-rw-r--r-- | test/core/surface/sequential_connectivity_test.c | 52 | ||||
-rw-r--r-- | test/core/surface/server_chttp2_test.c | 12 | ||||
-rw-r--r-- | test/core/surface/server_test.c | 47 |
14 files changed, 235 insertions, 228 deletions
diff --git a/test/core/surface/alarm_test.c b/test/core/surface/alarm_test.c index 4fd7cb93c6..88b0b31478 100644 --- a/test/core/surface/alarm_test.c +++ b/test/core/surface/alarm_test.c @@ -25,13 +25,13 @@ #define LOG_TEST(x) gpr_log(GPR_INFO, "%s", x) -static void *create_test_tag(void) { +static void* create_test_tag(void) { static intptr_t i = 0; - return (void *)(++i); + return (void*)(++i); } /* helper for tests to shutdown correctly and tersely */ -static void shutdown_and_destroy(grpc_completion_queue *cc) { +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); @@ -40,15 +40,15 @@ static void shutdown_and_destroy(grpc_completion_queue *cc) { } static void test_alarm(void) { - grpc_completion_queue *cc; + grpc_completion_queue* cc; LOG_TEST("test_alarm"); cc = grpc_completion_queue_create_for_next(NULL); { /* regular expiry */ grpc_event ev; - void *tag = create_test_tag(); - grpc_alarm *alarm = grpc_alarm_create(NULL); + void* tag = create_test_tag(); + grpc_alarm* alarm = grpc_alarm_create(NULL); grpc_alarm_set(alarm, cc, grpc_timeout_seconds_to_deadline(1), tag, NULL); ev = grpc_completion_queue_next(cc, grpc_timeout_seconds_to_deadline(2), @@ -61,8 +61,8 @@ static void test_alarm(void) { { /* cancellation */ grpc_event ev; - void *tag = create_test_tag(); - grpc_alarm *alarm = grpc_alarm_create(NULL); + void* tag = create_test_tag(); + grpc_alarm* alarm = grpc_alarm_create(NULL); grpc_alarm_set(alarm, cc, grpc_timeout_seconds_to_deadline(2), tag, NULL); grpc_alarm_cancel(alarm, NULL); @@ -76,8 +76,8 @@ static void test_alarm(void) { { /* alarm_destroy before cq_next */ grpc_event ev; - void *tag = create_test_tag(); - grpc_alarm *alarm = grpc_alarm_create(NULL); + void* tag = create_test_tag(); + grpc_alarm* alarm = grpc_alarm_create(NULL); grpc_alarm_set(alarm, cc, grpc_timeout_seconds_to_deadline(2), tag, NULL); grpc_alarm_destroy(alarm, NULL); @@ -89,14 +89,14 @@ static void test_alarm(void) { } { /* alarm_destroy before set */ - grpc_alarm *alarm = grpc_alarm_create(NULL); + grpc_alarm* alarm = grpc_alarm_create(NULL); grpc_alarm_destroy(alarm, NULL); } shutdown_and_destroy(cc); } -int main(int argc, char **argv) { +int main(int argc, char** argv) { grpc_test_init(argc, argv); grpc_init(); test_alarm(); diff --git a/test/core/surface/byte_buffer_reader_test.c b/test/core/surface/byte_buffer_reader_test.c index 40bb4a2913..7450a93090 100644 --- a/test/core/surface/byte_buffer_reader_test.c +++ b/test/core/surface/byte_buffer_reader_test.c @@ -36,7 +36,7 @@ static void test_read_one_slice(void) { grpc_slice slice; - grpc_byte_buffer *buffer; + grpc_byte_buffer* buffer; grpc_byte_buffer_reader reader; grpc_slice first_slice, second_slice; int first_code, second_code; @@ -58,7 +58,7 @@ static void test_read_one_slice(void) { static void test_read_one_slice_malloc(void) { grpc_slice slice; - grpc_byte_buffer *buffer; + grpc_byte_buffer* buffer; grpc_byte_buffer_reader reader; grpc_slice first_slice, second_slice; int first_code, second_code; @@ -81,7 +81,7 @@ static void test_read_one_slice_malloc(void) { static void test_read_none_compressed_slice(void) { grpc_slice slice; - grpc_byte_buffer *buffer; + grpc_byte_buffer* buffer; grpc_byte_buffer_reader reader; grpc_slice first_slice, second_slice; int first_code, second_code; @@ -103,7 +103,7 @@ static void test_read_none_compressed_slice(void) { static void test_read_corrupted_slice(void) { grpc_slice slice; - grpc_byte_buffer *buffer; + grpc_byte_buffer* buffer; grpc_byte_buffer_reader reader; LOG_TEST("test_read_corrupted_slice"); @@ -120,7 +120,7 @@ static void read_compressed_slice(grpc_compression_algorithm algorithm, grpc_slice input_slice; grpc_slice_buffer sliceb_in; grpc_slice_buffer sliceb_out; - grpc_byte_buffer *buffer; + grpc_byte_buffer* buffer; grpc_byte_buffer_reader reader; grpc_slice read_slice; size_t read_count = 0; @@ -197,10 +197,10 @@ static void test_byte_buffer_from_reader(void) { } static void test_readall(void) { - char *lotsa_as[512]; - char *lotsa_bs[1024]; + char* lotsa_as[512]; + char* lotsa_bs[1024]; grpc_slice slices[2]; - grpc_byte_buffer *buffer; + grpc_byte_buffer* buffer; grpc_byte_buffer_reader reader; grpc_slice slice_out; @@ -231,11 +231,11 @@ static void test_readall(void) { } static void test_byte_buffer_copy(void) { - char *lotsa_as[512]; - char *lotsa_bs[1024]; + char* lotsa_as[512]; + char* lotsa_bs[1024]; grpc_slice slices[2]; - grpc_byte_buffer *buffer; - grpc_byte_buffer *copied_buffer; + grpc_byte_buffer* buffer; + grpc_byte_buffer* copied_buffer; grpc_byte_buffer_reader reader; grpc_slice slice_out; @@ -267,7 +267,7 @@ static void test_byte_buffer_copy(void) { grpc_byte_buffer_destroy(copied_buffer); } -int main(int argc, char **argv) { +int main(int argc, char** argv) { grpc_test_init(argc, argv); test_read_one_slice(); test_read_one_slice_malloc(); diff --git a/test/core/surface/channel_create_test.c b/test/core/surface/channel_create_test.c index a6884750e7..4627c57438 100644 --- a/test/core/surface/channel_create_test.c +++ b/test/core/surface/channel_create_test.c @@ -27,7 +27,7 @@ #include "test/core/util/test_config.h" void test_unknown_scheme_target(void) { - grpc_channel *chan; + grpc_channel* chan; /* avoid default prefix */ grpc_resolver_registry_shutdown(); grpc_resolver_registry_init(); @@ -36,7 +36,7 @@ void test_unknown_scheme_target(void) { GPR_ASSERT(chan != NULL); grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_channel_element *elem = + grpc_channel_element* elem = grpc_channel_stack_element(grpc_channel_get_channel_stack(chan), 0); GPR_ASSERT(0 == strcmp(elem->filter->name, "lame-client")); grpc_exec_ctx_finish(&exec_ctx); @@ -44,7 +44,7 @@ void test_unknown_scheme_target(void) { grpc_channel_destroy(chan); } -int main(int argc, char **argv) { +int main(int argc, char** argv) { grpc_test_init(argc, argv); grpc_init(); test_unknown_scheme_target(); diff --git a/test/core/surface/completion_queue_test.c b/test/core/surface/completion_queue_test.c index e4e4c9f1b2..277ffde553 100644 --- a/test/core/surface/completion_queue_test.c +++ b/test/core/surface/completion_queue_test.c @@ -27,13 +27,13 @@ #define LOG_TEST(x) gpr_log(GPR_INFO, "%s", x) -static void *create_test_tag(void) { +static void* create_test_tag(void) { static intptr_t i = 0; - return (void *)(++i); + return (void*)(++i); } /* helper for tests to shutdown correctly and tersely */ -static void shutdown_and_destroy(grpc_completion_queue *cc) { +static void shutdown_and_destroy(grpc_completion_queue* cc) { grpc_event ev; grpc_completion_queue_shutdown(cc); @@ -81,7 +81,7 @@ static void test_pollset_conversion(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_completion_queue *cq; + grpc_completion_queue* cq; grpc_completion_queue_attributes attr; LOG_TEST("test_pollset_conversion"); @@ -102,7 +102,7 @@ static void test_pollset_conversion(void) { 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* cc; grpc_completion_queue_attributes attr; grpc_event event; @@ -120,19 +120,19 @@ static void test_wait_empty(void) { } } -static void do_nothing_end_completion(grpc_exec_ctx *exec_ctx, void *arg, - grpc_cq_completion *c) {} +static void do_nothing_end_completion(grpc_exec_ctx* exec_ctx, void* arg, + grpc_cq_completion* c) {} static void test_cq_end_op(void) { grpc_event ev; - grpc_completion_queue *cc; + grpc_completion_queue* cc; 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(); + void* tag = create_test_tag(); LOG_TEST("test_cq_end_op"); @@ -160,15 +160,15 @@ static void test_cq_end_op(void) { static void test_cq_tls_cache_full(void) { grpc_event ev; - grpc_completion_queue *cc; + grpc_completion_queue* cc; 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(); - void *res_tag; + void* tag = create_test_tag(); + void* res_tag; int ok; LOG_TEST("test_cq_tls_cache_full"); @@ -203,13 +203,13 @@ static void test_cq_tls_cache_full(void) { } static void test_cq_tls_cache_empty(void) { - grpc_completion_queue *cc; + grpc_completion_queue* cc; 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 *res_tag; + void* res_tag; int ok; LOG_TEST("test_cq_tls_cache_empty"); @@ -235,7 +235,7 @@ static void test_cq_tls_cache_empty(void) { 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* cc; grpc_completion_queue_attributes attr; grpc_event event; LOG_TEST("test_shutdown_then_next_polling"); @@ -257,7 +257,7 @@ static void test_shutdown_then_next_polling(void) { 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* cc; grpc_completion_queue_attributes attr; grpc_event event; LOG_TEST("test_shutdown_then_next_with_timeout"); @@ -279,8 +279,8 @@ static void test_shutdown_then_next_with_timeout(void) { static void test_pluck(void) { grpc_event ev; - grpc_completion_queue *cc; - void *tags[128]; + grpc_completion_queue* cc; + void* tags[128]; 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}; @@ -339,7 +339,7 @@ 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* cc; grpc_completion_queue_attributes attr; LOG_TEST("test_pluck_after_shutdown"); @@ -359,11 +359,11 @@ static void test_pluck_after_shutdown(void) { } struct thread_state { - grpc_completion_queue *cc; - void *tag; + grpc_completion_queue* cc; + void* tag; }; -int main(int argc, char **argv) { +int main(int argc, char** argv) { grpc_test_init(argc, argv); grpc_init(); test_no_op(); diff --git a/test/core/surface/completion_queue_threading_test.c b/test/core/surface/completion_queue_threading_test.c index 9996b6b840..d98289f80e 100644 --- a/test/core/surface/completion_queue_threading_test.c +++ b/test/core/surface/completion_queue_threading_test.c @@ -28,13 +28,13 @@ #define LOG_TEST(x) gpr_log(GPR_INFO, "%s", x) -static void *create_test_tag(void) { +static void* create_test_tag(void) { static intptr_t i = 0; - return (void *)(++i); + return (void*)(++i); } /* helper for tests to shutdown correctly and tersely */ -static void shutdown_and_destroy(grpc_completion_queue *cc) { +static void shutdown_and_destroy(grpc_completion_queue* cc) { grpc_event ev; grpc_completion_queue_shutdown(cc); @@ -59,24 +59,24 @@ static void shutdown_and_destroy(grpc_completion_queue *cc) { grpc_completion_queue_destroy(cc); } -static void do_nothing_end_completion(grpc_exec_ctx *exec_ctx, void *arg, - grpc_cq_completion *c) {} +static void do_nothing_end_completion(grpc_exec_ctx* exec_ctx, void* arg, + grpc_cq_completion* c) {} struct thread_state { - grpc_completion_queue *cc; - void *tag; + grpc_completion_queue* cc; + void* tag; }; -static void pluck_one(void *arg) { - struct thread_state *state = arg; +static void pluck_one(void* arg) { + struct thread_state* state = arg; grpc_completion_queue_pluck(state->cc, state->tag, gpr_inf_future(GPR_CLOCK_REALTIME), NULL); } static void test_too_many_plucks(void) { grpc_event ev; - grpc_completion_queue *cc; - void *tags[GRPC_MAX_COMPLETION_QUEUE_PLUCKERS]; + grpc_completion_queue* cc; + void* tags[GRPC_MAX_COMPLETION_QUEUE_PLUCKERS]; grpc_cq_completion completions[GPR_ARRAY_SIZE(tags)]; gpr_thd_id thread_ids[GPR_ARRAY_SIZE(tags)]; struct thread_state thread_states[GPR_ARRAY_SIZE(tags)]; @@ -124,45 +124,45 @@ static void test_too_many_plucks(void) { typedef struct test_thread_options { gpr_event on_started; - gpr_event *phase1; + gpr_event* phase1; gpr_event on_phase1_done; - gpr_event *phase2; + gpr_event* phase2; gpr_event on_finished; size_t events_triggered; int id; - grpc_completion_queue *cc; + grpc_completion_queue* cc; } test_thread_options; gpr_timespec ten_seconds_time(void) { return grpc_timeout_seconds_to_deadline(10); } -static void free_completion(grpc_exec_ctx *exec_ctx, void *arg, - grpc_cq_completion *completion) { +static void free_completion(grpc_exec_ctx* exec_ctx, void* arg, + grpc_cq_completion* completion) { gpr_free(completion); } -static void producer_thread(void *arg) { - test_thread_options *opt = arg; +static void producer_thread(void* arg) { + test_thread_options* opt = arg; int i; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; gpr_log(GPR_INFO, "producer %d started", opt->id); - gpr_event_set(&opt->on_started, (void *)(intptr_t)1); + gpr_event_set(&opt->on_started, (void*)(intptr_t)1); GPR_ASSERT(gpr_event_wait(opt->phase1, ten_seconds_time())); gpr_log(GPR_INFO, "producer %d phase 1", opt->id); for (i = 0; i < TEST_THREAD_EVENTS; i++) { - GPR_ASSERT(grpc_cq_begin_op(opt->cc, (void *)(intptr_t)1)); + GPR_ASSERT(grpc_cq_begin_op(opt->cc, (void*)(intptr_t)1)); } gpr_log(GPR_INFO, "producer %d phase 1 done", opt->id); - gpr_event_set(&opt->on_phase1_done, (void *)(intptr_t)1); + gpr_event_set(&opt->on_phase1_done, (void*)(intptr_t)1); GPR_ASSERT(gpr_event_wait(opt->phase2, ten_seconds_time())); gpr_log(GPR_INFO, "producer %d phase 2", opt->id); for (i = 0; i < TEST_THREAD_EVENTS; i++) { - grpc_cq_end_op(&exec_ctx, opt->cc, (void *)(intptr_t)1, GRPC_ERROR_NONE, + grpc_cq_end_op(&exec_ctx, opt->cc, (void*)(intptr_t)1, GRPC_ERROR_NONE, free_completion, NULL, gpr_malloc(sizeof(grpc_cq_completion))); opt->events_triggered++; @@ -170,22 +170,22 @@ static void producer_thread(void *arg) { } gpr_log(GPR_INFO, "producer %d phase 2 done", opt->id); - gpr_event_set(&opt->on_finished, (void *)(intptr_t)1); + gpr_event_set(&opt->on_finished, (void*)(intptr_t)1); grpc_exec_ctx_finish(&exec_ctx); } -static void consumer_thread(void *arg) { - test_thread_options *opt = arg; +static void consumer_thread(void* arg) { + test_thread_options* opt = arg; grpc_event ev; gpr_log(GPR_INFO, "consumer %d started", opt->id); - gpr_event_set(&opt->on_started, (void *)(intptr_t)1); + gpr_event_set(&opt->on_started, (void*)(intptr_t)1); GPR_ASSERT(gpr_event_wait(opt->phase1, ten_seconds_time())); gpr_log(GPR_INFO, "consumer %d phase 1", opt->id); gpr_log(GPR_INFO, "consumer %d phase 1 done", opt->id); - gpr_event_set(&opt->on_phase1_done, (void *)(intptr_t)1); + gpr_event_set(&opt->on_phase1_done, (void*)(intptr_t)1); GPR_ASSERT(gpr_event_wait(opt->phase2, ten_seconds_time())); gpr_log(GPR_INFO, "consumer %d phase 2", opt->id); @@ -199,7 +199,7 @@ static void consumer_thread(void *arg) { break; case GRPC_QUEUE_SHUTDOWN: gpr_log(GPR_INFO, "consumer %d phase 2 done", opt->id); - gpr_event_set(&opt->on_finished, (void *)(intptr_t)1); + gpr_event_set(&opt->on_finished, (void*)(intptr_t)1); return; case GRPC_QUEUE_TIMEOUT: gpr_log(GPR_ERROR, "Invalid timeout received"); @@ -209,11 +209,11 @@ static void consumer_thread(void *arg) { } static void test_threading(size_t producers, size_t consumers) { - test_thread_options *options = + test_thread_options* options = 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_for_next(NULL); + grpc_completion_queue* cc = grpc_completion_queue_create_for_next(NULL); size_t i; size_t total_consumed = 0; static int optid = 101; @@ -241,7 +241,7 @@ static void test_threading(size_t producers, size_t consumers) { /* start phase1: producers will pre-declare all operations they will complete */ gpr_log(GPR_INFO, "start phase 1"); - gpr_event_set(&phase1, (void *)(intptr_t)1); + gpr_event_set(&phase1, (void*)(intptr_t)1); gpr_log(GPR_INFO, "wait phase 1"); for (i = 0; i < producers + consumers; i++) { @@ -251,7 +251,7 @@ static void test_threading(size_t producers, size_t consumers) { /* start phase2: operations will complete, and consumers will consume them */ gpr_log(GPR_INFO, "start phase 2"); - gpr_event_set(&phase2, (void *)(intptr_t)1); + gpr_event_set(&phase2, (void*)(intptr_t)1); /* in parallel, we shutdown the completion channel - all events should still be consumed */ @@ -280,7 +280,7 @@ static void test_threading(size_t producers, size_t consumers) { gpr_free(options); } -int main(int argc, char **argv) { +int main(int argc, char** argv) { grpc_test_init(argc, argv); grpc_init(); test_too_many_plucks(); diff --git a/test/core/surface/concurrent_connectivity_test.c b/test/core/surface/concurrent_connectivity_test.c index 3595885ff6..105905f212 100644 --- a/test/core/surface/concurrent_connectivity_test.c +++ b/test/core/surface/concurrent_connectivity_test.c @@ -54,13 +54,13 @@ // end after the shorter delay_millis #define POLL_MILLIS_SHORT_TIMEOUTS 30000 -static void *tag(int n) { return (void *)(uintptr_t)n; } -static int detag(void *p) { return (int)(uintptr_t)p; } +static void* tag(int n) { return (void*)(uintptr_t)n; } +static int detag(void* p) { return (int)(uintptr_t)p; } -void create_loop_destroy(void *addr) { +void create_loop_destroy(void* addr) { for (int i = 0; i < NUM_OUTER_LOOPS; ++i) { - grpc_completion_queue *cq = grpc_completion_queue_create_for_next(NULL); - grpc_channel *chan = grpc_insecure_channel_create((char *)addr, NULL, 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) { gpr_timespec later_time = @@ -81,17 +81,17 @@ void create_loop_destroy(void *addr) { } struct server_thread_args { - char *addr; - grpc_server *server; - grpc_completion_queue *cq; - grpc_pollset *pollset; - gpr_mu *mu; + char* addr; + grpc_server* server; + grpc_completion_queue* cq; + grpc_pollset* pollset; + gpr_mu* mu; gpr_event ready; gpr_atm stop; }; -void server_thread(void *vargs) { - struct server_thread_args *args = (struct server_thread_args *)vargs; +void server_thread(void* vargs) { + struct server_thread_args* args = (struct server_thread_args*)vargs; grpc_event ev; gpr_timespec deadline = gpr_inf_future(GPR_CLOCK_MONOTONIC); ev = grpc_completion_queue_next(args->cq, deadline, NULL); @@ -99,11 +99,11 @@ void server_thread(void *vargs) { GPR_ASSERT(detag(ev.tag) == 0xd1e); } -static void on_connect(grpc_exec_ctx *exec_ctx, void *vargs, grpc_endpoint *tcp, - grpc_pollset *accepting_pollset, - grpc_tcp_server_acceptor *acceptor) { +static void on_connect(grpc_exec_ctx* exec_ctx, void* vargs, grpc_endpoint* tcp, + grpc_pollset* accepting_pollset, + grpc_tcp_server_acceptor* acceptor) { gpr_free(acceptor); - struct server_thread_args *args = (struct server_thread_args *)vargs; + struct server_thread_args* args = (struct server_thread_args*)vargs; grpc_endpoint_shutdown(exec_ctx, tcp, GRPC_ERROR_CREATE_FROM_STATIC_STRING("Connected")); grpc_endpoint_destroy(exec_ctx, tcp); @@ -113,15 +113,15 @@ static void on_connect(grpc_exec_ctx *exec_ctx, void *vargs, grpc_endpoint *tcp, gpr_mu_unlock(args->mu); } -void bad_server_thread(void *vargs) { - struct server_thread_args *args = (struct server_thread_args *)vargs; +void bad_server_thread(void* vargs) { + struct server_thread_args* args = (struct server_thread_args*)vargs; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_resolved_address resolved_addr; - struct sockaddr_storage *addr = (struct sockaddr_storage *)resolved_addr.addr; + struct sockaddr_storage* addr = (struct sockaddr_storage*)resolved_addr.addr; int port; - grpc_tcp_server *s; - grpc_error *error = grpc_tcp_server_create(&exec_ctx, NULL, NULL, &s); + grpc_tcp_server* s; + grpc_error* error = grpc_tcp_server_create(&exec_ctx, NULL, NULL, &s); GPR_ASSERT(error == GRPC_ERROR_NONE); memset(&resolved_addr, 0, sizeof(resolved_addr)); addr->ss_family = AF_INET; @@ -131,13 +131,13 @@ void bad_server_thread(void *vargs) { gpr_asprintf(&args->addr, "localhost:%d", port); grpc_tcp_server_start(&exec_ctx, s, &args->pollset, 1, on_connect, args); - gpr_event_set(&args->ready, (void *)1); + gpr_event_set(&args->ready, (void*)1); gpr_mu_lock(args->mu); while (gpr_atm_acq_load(&args->stop) == 0) { grpc_millis deadline = grpc_exec_ctx_now(&exec_ctx) + 100; - grpc_pollset_worker *worker = NULL; + grpc_pollset_worker* worker = NULL; if (!GRPC_LOG_IF_ERROR( "pollset_work", grpc_pollset_work(&exec_ctx, args->pollset, &worker, deadline))) { @@ -156,8 +156,8 @@ void bad_server_thread(void *vargs) { gpr_free(args->addr); } -static void done_pollset_shutdown(grpc_exec_ctx *exec_ctx, void *pollset, - grpc_error *error) { +static void done_pollset_shutdown(grpc_exec_ctx* exec_ctx, void* pollset, + grpc_error* error) { grpc_pollset_destroy(exec_ctx, pollset); gpr_free(pollset); } @@ -171,7 +171,7 @@ int run_concurrent_connectivity_test() { gpr_thd_id threads[NUM_THREADS]; gpr_thd_id server; - char *localhost = gpr_strdup("localhost:54321"); + char* localhost = gpr_strdup("localhost:54321"); gpr_thd_options options = gpr_thd_options_default(); gpr_thd_options_set_joinable(&options); @@ -236,10 +236,10 @@ int run_concurrent_connectivity_test() { return 0; } -void watches_with_short_timeouts(void *addr) { +void watches_with_short_timeouts(void* addr) { for (int i = 0; i < NUM_OUTER_LOOPS_SHORT_TIMEOUTS; ++i) { - grpc_completion_queue *cq = grpc_completion_queue_create_for_next(NULL); - grpc_channel *chan = grpc_insecure_channel_create((char *)addr, NULL, 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_SHORT_TIMEOUTS; ++j) { gpr_timespec later_time = @@ -269,7 +269,7 @@ int run_concurrent_watches_with_short_timeouts_test() { gpr_thd_id threads[NUM_THREADS]; - char *localhost = gpr_strdup("localhost:54321"); + char* localhost = gpr_strdup("localhost:54321"); gpr_thd_options options = gpr_thd_options_default(); gpr_thd_options_set_joinable(&options); @@ -285,7 +285,7 @@ int run_concurrent_watches_with_short_timeouts_test() { return 0; } -int main(int argc, char **argv) { +int main(int argc, char** argv) { grpc_test_init(argc, argv); run_concurrent_connectivity_test(); diff --git a/test/core/surface/init_test.c b/test/core/surface/init_test.c index b835a2a884..5749bc8b36 100644 --- a/test/core/surface/init_test.c +++ b/test/core/surface/init_test.c @@ -59,7 +59,7 @@ static void test_repeatedly() { } } -int main(int argc, char **argv) { +int main(int argc, char** argv) { grpc_test_init(argc, argv); test(1); test(2); diff --git a/test/core/surface/invalid_channel_args_test.c b/test/core/surface/invalid_channel_args_test.c index 9c84c30f03..1f81b3c8f5 100644 --- a/test/core/surface/invalid_channel_args_test.c +++ b/test/core/surface/invalid_channel_args_test.c @@ -24,10 +24,10 @@ #include <grpc/support/string_util.h> #include "test/core/util/test_config.h" -static char *g_last_log_error_message = NULL; -static const char *g_file_name = "channel.cc"; +static char* g_last_log_error_message = NULL; +static const char* g_file_name = "channel.cc"; -static int ends_with(const char *src, const char *suffix) { +static int ends_with(const char* src, const char* suffix) { size_t src_len = strlen(src); size_t suffix_len = strlen(suffix); if (src_len < suffix_len) { @@ -36,14 +36,14 @@ static int ends_with(const char *src, const char *suffix) { return strcmp(src + src_len - suffix_len, suffix) == 0; } -static void log_error_sink(gpr_log_func_args *args) { +static void log_error_sink(gpr_log_func_args* args) { if (args->severity == GPR_LOG_SEVERITY_ERROR && ends_with(args->file, g_file_name)) { g_last_log_error_message = gpr_strdup(args->message); } } -static void verify_last_error(const char *message) { +static void verify_last_error(const char* message) { if (message == NULL) { GPR_ASSERT(g_last_log_error_message == NULL); return; @@ -53,14 +53,14 @@ static void verify_last_error(const char *message) { g_last_log_error_message = NULL; } -static char *compose_error_string(const char *key, const char *message) { - char *ret; +static char* compose_error_string(const char* key, const char* message) { + char* ret; gpr_asprintf(&ret, "%s%s", key, message); return ret; } -static void one_test(grpc_channel_args *args, char *expected_error_message) { - grpc_channel *chan = +static void one_test(grpc_channel_args* args, char* expected_error_message) { + grpc_channel* chan = grpc_insecure_channel_create("nonexistant:54321", args, NULL); verify_last_error(expected_error_message); gpr_free(expected_error_message); @@ -72,7 +72,7 @@ static void test_no_error_message(void) { one_test(NULL, NULL); } static void test_default_authority_type(void) { grpc_arg client_arg; grpc_channel_args client_args; - char *expected_error_message; + char* expected_error_message; client_arg.type = GRPC_ARG_INTEGER; client_arg.key = GRPC_ARG_DEFAULT_AUTHORITY; @@ -88,7 +88,7 @@ static void test_default_authority_type(void) { static void test_ssl_name_override_type(void) { grpc_arg client_arg; grpc_channel_args client_args; - char *expected_error_message; + char* expected_error_message; client_arg.type = GRPC_ARG_INTEGER; client_arg.key = GRPC_SSL_TARGET_NAME_OVERRIDE_ARG; @@ -104,7 +104,7 @@ static void test_ssl_name_override_type(void) { static void test_ssl_name_override_failed(void) { grpc_arg client_arg[2]; grpc_channel_args client_args; - char *expected_error_message; + char* expected_error_message; client_arg[0].type = GRPC_ARG_STRING; client_arg[0].key = GRPC_ARG_DEFAULT_AUTHORITY; @@ -121,7 +121,7 @@ static void test_ssl_name_override_failed(void) { one_test(&client_args, expected_error_message); } -int main(int argc, char **argv) { +int main(int argc, char** argv) { grpc_test_init(argc, argv); grpc_init(); gpr_set_log_function(log_error_sink); diff --git a/test/core/surface/lame_client_test.c b/test/core/surface/lame_client_test.c index f623e1a743..274efa634a 100644 --- a/test/core/surface/lame_client_test.c +++ b/test/core/surface/lame_client_test.c @@ -30,20 +30,20 @@ grpc_closure transport_op_cb; -static void *tag(intptr_t x) { return (void *)x; } +static void* tag(intptr_t x) { return (void*)x; } -void verify_connectivity(grpc_exec_ctx *exec_ctx, void *arg, - grpc_error *error) { - grpc_connectivity_state *state = arg; +void verify_connectivity(grpc_exec_ctx* exec_ctx, void* arg, + grpc_error* error) { + grpc_connectivity_state* state = arg; GPR_ASSERT(GRPC_CHANNEL_SHUTDOWN == *state); GPR_ASSERT(error == GRPC_ERROR_NONE); } -void do_nothing(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) {} +void do_nothing(grpc_exec_ctx* exec_ctx, void* arg, grpc_error* error) {} -void test_transport_op(grpc_channel *channel) { - grpc_transport_op *op; - grpc_channel_element *elem; +void test_transport_op(grpc_channel* channel) { + grpc_transport_op* op; + grpc_channel_element* elem; grpc_connectivity_state state = GRPC_CHANNEL_IDLE; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; @@ -64,19 +64,19 @@ void test_transport_op(grpc_channel *channel) { grpc_exec_ctx_finish(&exec_ctx); } -int main(int argc, char **argv) { - grpc_channel *chan; - grpc_call *call; - grpc_completion_queue *cq; - cq_verifier *cqv; +int main(int argc, char** argv) { + grpc_channel* chan; + grpc_call* call; + grpc_completion_queue* cq; + cq_verifier* cqv; grpc_op ops[6]; - grpc_op *op; + grpc_op* op; grpc_metadata_array initial_metadata_recv; grpc_metadata_array trailing_metadata_recv; grpc_status_code status; grpc_call_error error; grpc_slice details; - char *peer; + char* peer; grpc_test_init(argc, argv); grpc_init(); diff --git a/test/core/surface/num_external_connectivity_watchers_test.c b/test/core/surface/num_external_connectivity_watchers_test.c index 16401bb7ac..faf3945d6f 100644 --- a/test/core/surface/num_external_connectivity_watchers_test.c +++ b/test/core/surface/num_external_connectivity_watchers_test.c @@ -30,26 +30,26 @@ #include "test/core/util/test_config.h" typedef struct test_fixture { - const char *name; - grpc_channel *(*create_channel)(const char *addr); + const char* name; + grpc_channel* (*create_channel)(const char* addr); } test_fixture; static size_t next_tag = 1; -static void channel_idle_start_watch(grpc_channel *channel, - grpc_completion_queue *cq) { +static void channel_idle_start_watch(grpc_channel* channel, + grpc_completion_queue* cq) { gpr_timespec connect_deadline = grpc_timeout_milliseconds_to_deadline(1); GPR_ASSERT(grpc_channel_check_connectivity_state(channel, 0) == GRPC_CHANNEL_IDLE); grpc_channel_watch_connectivity_state( - channel, GRPC_CHANNEL_IDLE, connect_deadline, cq, (void *)(next_tag++)); + channel, GRPC_CHANNEL_IDLE, connect_deadline, cq, (void*)(next_tag++)); gpr_log(GPR_DEBUG, "number of active connect watchers: %d", grpc_channel_num_external_connectivity_watchers(channel)); } -static void channel_idle_poll_for_timeout(grpc_channel *channel, - grpc_completion_queue *cq) { +static void channel_idle_poll_for_timeout(grpc_channel* channel, + grpc_completion_queue* cq) { grpc_event ev = grpc_completion_queue_next(cq, gpr_inf_future(GPR_CLOCK_REALTIME), NULL); @@ -63,17 +63,17 @@ static void channel_idle_poll_for_timeout(grpc_channel *channel, /* Test and use the "num_external_watchers" call to make sure * that "connectivity watcher" structs are free'd just after, if * their corresponding timeouts occur. */ -static void run_timeouts_test(const test_fixture *fixture) { +static void run_timeouts_test(const test_fixture* fixture) { gpr_log(GPR_INFO, "TEST: %s", fixture->name); - char *addr; + char* addr; grpc_init(); gpr_join_host_port(&addr, "localhost", grpc_pick_unused_port_or_die()); - grpc_channel *channel = fixture->create_channel(addr); - grpc_completion_queue *cq = grpc_completion_queue_create_for_next(NULL); + grpc_channel* channel = fixture->create_channel(addr); + grpc_completion_queue* cq = grpc_completion_queue_create_for_next(NULL); /* start 1 watcher and then let it time out */ channel_idle_start_watch(channel, cq); @@ -117,17 +117,17 @@ static void run_timeouts_test(const test_fixture *fixture) { /* An edge scenario; sets channel state to explicitly, and outside * of a polling call. */ static void run_channel_shutdown_before_timeout_test( - const test_fixture *fixture) { + const test_fixture* fixture) { gpr_log(GPR_INFO, "TEST: %s", fixture->name); - char *addr; + char* addr; grpc_init(); gpr_join_host_port(&addr, "localhost", grpc_pick_unused_port_or_die()); - grpc_channel *channel = fixture->create_channel(addr); - grpc_completion_queue *cq = grpc_completion_queue_create_for_next(NULL); + grpc_channel* channel = fixture->create_channel(addr); + grpc_completion_queue* cq = grpc_completion_queue_create_for_next(NULL); /* start 1 watcher and then shut down the channel before the timer goes off */ GPR_ASSERT(grpc_channel_num_external_connectivity_watchers(channel) == 0); @@ -138,7 +138,7 @@ static void run_channel_shutdown_before_timeout_test( GRPC_CHANNEL_IDLE); grpc_channel_watch_connectivity_state(channel, GRPC_CHANNEL_IDLE, - connect_deadline, cq, (void *)1); + connect_deadline, cq, (void*)1); grpc_channel_destroy(channel); grpc_event ev = @@ -157,23 +157,24 @@ static void run_channel_shutdown_before_timeout_test( gpr_free(addr); } -static grpc_channel *insecure_test_create_channel(const char *addr) { +static grpc_channel* insecure_test_create_channel(const char* addr) { return grpc_insecure_channel_create(addr, NULL, NULL); } static const test_fixture insecure_test = { - "insecure", insecure_test_create_channel, + "insecure", + insecure_test_create_channel, }; -static grpc_channel *secure_test_create_channel(const char *addr) { - grpc_channel_credentials *ssl_creds = +static grpc_channel* secure_test_create_channel(const char* addr) { + grpc_channel_credentials* ssl_creds = grpc_ssl_credentials_create(test_root_cert, NULL, NULL); grpc_arg ssl_name_override = {GRPC_ARG_STRING, GRPC_SSL_TARGET_NAME_OVERRIDE_ARG, {"foo.test.google.fr"}}; - grpc_channel_args *new_client_args = + grpc_channel_args* new_client_args = grpc_channel_args_copy_and_add(NULL, &ssl_name_override, 1); - grpc_channel *channel = + grpc_channel* channel = grpc_secure_channel_create(ssl_creds, addr, new_client_args, NULL); { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; @@ -185,10 +186,11 @@ static grpc_channel *secure_test_create_channel(const char *addr) { } static const test_fixture secure_test = { - "secure", secure_test_create_channel, + "secure", + secure_test_create_channel, }; -int main(int argc, char **argv) { +int main(int argc, char** argv) { grpc_test_init(argc, argv); run_timeouts_test(&insecure_test); diff --git a/test/core/surface/secure_channel_create_test.c b/test/core/surface/secure_channel_create_test.c index 0c45135501..a052e107f7 100644 --- a/test/core/surface/secure_channel_create_test.c +++ b/test/core/surface/secure_channel_create_test.c @@ -30,11 +30,11 @@ void test_unknown_scheme_target(void) { grpc_resolver_registry_shutdown(); grpc_resolver_registry_init(); - grpc_channel_credentials *creds = + grpc_channel_credentials* creds = grpc_fake_transport_security_credentials_create(); - grpc_channel *chan = + grpc_channel* chan = grpc_secure_channel_create(creds, "blah://blah", NULL, NULL); - grpc_channel_element *elem = + grpc_channel_element* elem = grpc_channel_stack_element(grpc_channel_get_channel_stack(chan), 0); GPR_ASSERT(0 == strcmp(elem->filter->name, "lame-client")); grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; @@ -51,8 +51,8 @@ void test_security_connector_already_in_arg(void) { grpc_channel_args args; args.num_args = 1; args.args = &arg; - grpc_channel *chan = grpc_secure_channel_create(NULL, NULL, &args, NULL); - grpc_channel_element *elem = + grpc_channel* chan = grpc_secure_channel_create(NULL, NULL, &args, NULL); + grpc_channel_element* elem = grpc_channel_stack_element(grpc_channel_get_channel_stack(chan), 0); GPR_ASSERT(0 == strcmp(elem->filter->name, "lame-client")); grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; @@ -61,8 +61,8 @@ void test_security_connector_already_in_arg(void) { } void test_null_creds(void) { - grpc_channel *chan = grpc_secure_channel_create(NULL, NULL, NULL, NULL); - grpc_channel_element *elem = + grpc_channel* chan = grpc_secure_channel_create(NULL, NULL, NULL, NULL); + grpc_channel_element* elem = grpc_channel_stack_element(grpc_channel_get_channel_stack(chan), 0); GPR_ASSERT(0 == strcmp(elem->filter->name, "lame-client")); grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; @@ -70,7 +70,7 @@ void test_null_creds(void) { grpc_exec_ctx_finish(&exec_ctx); } -int main(int argc, char **argv) { +int main(int argc, char** argv) { grpc_test_init(argc, argv); grpc_init(); test_security_connector_already_in_arg(); diff --git a/test/core/surface/sequential_connectivity_test.c b/test/core/surface/sequential_connectivity_test.c index d5fd2db81b..712bfb9f68 100644 --- a/test/core/surface/sequential_connectivity_test.c +++ b/test/core/surface/sequential_connectivity_test.c @@ -30,20 +30,20 @@ #include "test/core/util/test_config.h" typedef struct test_fixture { - const char *name; - void (*add_server_port)(grpc_server *server, const char *addr); - grpc_channel *(*create_channel)(const char *addr); + const char* name; + void (*add_server_port)(grpc_server* server, const char* addr); + grpc_channel* (*create_channel)(const char* addr); } test_fixture; #define NUM_CONNECTIONS 1000 typedef struct { - grpc_server *server; - grpc_completion_queue *cq; + grpc_server* server; + grpc_completion_queue* cq; } server_thread_args; -static void server_thread_func(void *args) { - server_thread_args *a = args; +static void server_thread_func(void* args) { + server_thread_args* a = args; grpc_event ev = grpc_completion_queue_next( a->cq, gpr_inf_future(GPR_CLOCK_REALTIME), NULL); GPR_ASSERT(ev.type == GRPC_OP_COMPLETE); @@ -51,17 +51,17 @@ static void server_thread_func(void *args) { GPR_ASSERT(ev.success == true); } -static void run_test(const test_fixture *fixture) { +static void run_test(const test_fixture* fixture) { gpr_log(GPR_INFO, "TEST: %s", fixture->name); grpc_init(); - char *addr; + char* addr; gpr_join_host_port(&addr, "localhost", grpc_pick_unused_port_or_die()); - grpc_server *server = grpc_server_create(NULL, NULL); + grpc_server* server = grpc_server_create(NULL, NULL); fixture->add_server_port(server, addr); - grpc_completion_queue *server_cq = + 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); @@ -72,8 +72,8 @@ 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_for_next(NULL); - grpc_channel *channels[NUM_CONNECTIONS]; + 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); @@ -121,36 +121,38 @@ static void run_test(const test_fixture *fixture) { gpr_free(addr); } -static void insecure_test_add_port(grpc_server *server, const char *addr) { +static void insecure_test_add_port(grpc_server* server, const char* addr) { grpc_server_add_insecure_http2_port(server, addr); } -static grpc_channel *insecure_test_create_channel(const char *addr) { +static grpc_channel* insecure_test_create_channel(const char* addr) { return grpc_insecure_channel_create(addr, NULL, NULL); } static const test_fixture insecure_test = { - "insecure", insecure_test_add_port, insecure_test_create_channel, + "insecure", + insecure_test_add_port, + insecure_test_create_channel, }; -static void secure_test_add_port(grpc_server *server, const char *addr) { +static void secure_test_add_port(grpc_server* server, const char* addr) { grpc_ssl_pem_key_cert_pair pem_cert_key_pair = {test_server1_key, test_server1_cert}; - grpc_server_credentials *ssl_creds = + grpc_server_credentials* ssl_creds = grpc_ssl_server_credentials_create(NULL, &pem_cert_key_pair, 1, 0, NULL); grpc_server_add_secure_http2_port(server, addr, ssl_creds); grpc_server_credentials_release(ssl_creds); } -static grpc_channel *secure_test_create_channel(const char *addr) { - grpc_channel_credentials *ssl_creds = +static grpc_channel* secure_test_create_channel(const char* addr) { + grpc_channel_credentials* ssl_creds = grpc_ssl_credentials_create(test_root_cert, NULL, NULL); grpc_arg ssl_name_override = {GRPC_ARG_STRING, GRPC_SSL_TARGET_NAME_OVERRIDE_ARG, {"foo.test.google.fr"}}; - grpc_channel_args *new_client_args = + grpc_channel_args* new_client_args = grpc_channel_args_copy_and_add(NULL, &ssl_name_override, 1); - grpc_channel *channel = + grpc_channel* channel = grpc_secure_channel_create(ssl_creds, addr, new_client_args, NULL); { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; @@ -162,10 +164,12 @@ static grpc_channel *secure_test_create_channel(const char *addr) { } static const test_fixture secure_test = { - "secure", secure_test_add_port, secure_test_create_channel, + "secure", + secure_test_add_port, + secure_test_create_channel, }; -int main(int argc, char **argv) { +int main(int argc, char** argv) { grpc_test_init(argc, argv); run_test(&insecure_test); diff --git a/test/core/surface/server_chttp2_test.c b/test/core/surface/server_chttp2_test.c index cd8931e0d7..f90dcccc30 100644 --- a/test/core/surface/server_chttp2_test.c +++ b/test/core/surface/server_chttp2_test.c @@ -30,7 +30,7 @@ void test_unparsable_target(void) { grpc_channel_args args = {0, NULL}; - grpc_server *server = grpc_server_create(&args, NULL); + grpc_server* server = grpc_server_create(&args, NULL); int port = grpc_server_add_insecure_http2_port(server, "["); GPR_ASSERT(port == 0); grpc_server_destroy(server); @@ -44,10 +44,10 @@ void test_add_same_port_twice() { grpc_channel_args args = {1, &a}; int port = grpc_pick_unused_port_or_die(); - char *addr = 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 = + char* addr = 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(); gpr_join_host_port(&addr, "localhost", port); GPR_ASSERT(grpc_server_add_secure_http2_port(server, addr, fake_creds)); @@ -62,7 +62,7 @@ void test_add_same_port_twice() { grpc_completion_queue_destroy(cq); } -int main(int argc, char **argv) { +int main(int argc, char** argv) { grpc_test_init(argc, argv); grpc_init(); test_unparsable_target(); diff --git a/test/core/surface/server_test.c b/test/core/surface/server_test.c index 4c185cd8ea..6e1e1b6c57 100644 --- a/test/core/surface/server_test.c +++ b/test/core/surface/server_test.c @@ -28,9 +28,9 @@ #include "test/core/util/test_config.h" void test_register_method_fail(void) { - grpc_server *server = grpc_server_create(NULL, NULL); - void *method; - void *method_old; + grpc_server* server = grpc_server_create(NULL, NULL); + void* method; + void* method_old; method = grpc_server_register_method(server, NULL, NULL, GRPC_SRM_PAYLOAD_NONE, 0); GPR_ASSERT(method == NULL); @@ -55,8 +55,8 @@ void test_register_method_fail(void) { } void test_request_call_on_no_server_cq(void) { - grpc_completion_queue *cc = grpc_completion_queue_create_for_next(NULL); - grpc_server *server = grpc_server_create(NULL, 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)); GPR_ASSERT(GRPC_CALL_ERROR_NOT_SERVER_COMPLETION_QUEUE == @@ -73,10 +73,10 @@ void test_bind_server_twice(void) { a.value.integer = 0; grpc_channel_args args = {1, &a}; - 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_for_next(NULL); + 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_for_next(NULL); int port = grpc_pick_unused_port_or_die(); gpr_asprintf(&addr, "[::]:%d", port); grpc_server_register_completion_queue(server1, cq, NULL); @@ -84,7 +84,7 @@ void test_bind_server_twice(void) { GPR_ASSERT(0 == grpc_server_add_secure_http2_port(server2, addr, NULL)); GPR_ASSERT(port == grpc_server_add_insecure_http2_port(server1, addr)); GPR_ASSERT(0 == grpc_server_add_insecure_http2_port(server2, addr)); - grpc_server_credentials *fake_creds = + grpc_server_credentials* fake_creds = grpc_fake_transport_security_server_credentials_create(); GPR_ASSERT(0 == grpc_server_add_secure_http2_port(server2, addr, fake_creds)); grpc_server_credentials_release(fake_creds); @@ -98,22 +98,22 @@ void test_bind_server_twice(void) { gpr_free(addr); } -void test_bind_server_to_addr(const char *host, bool secure) { +void test_bind_server_to_addr(const char* host, bool secure) { int port = grpc_pick_unused_port_or_die(); - char *addr; + char* addr; gpr_join_host_port(&addr, host, port); gpr_log(GPR_INFO, "Test bind to %s", addr); - grpc_server *server = grpc_server_create(NULL, NULL); + grpc_server* server = grpc_server_create(NULL, NULL); if (secure) { - grpc_server_credentials *fake_creds = + grpc_server_credentials* fake_creds = grpc_fake_transport_security_server_credentials_create(); GPR_ASSERT(grpc_server_add_secure_http2_port(server, addr, fake_creds)); grpc_server_credentials_release(fake_creds); } else { GPR_ASSERT(grpc_server_add_insecure_http2_port(server, addr)); } - grpc_completion_queue *cq = grpc_completion_queue_create_for_next(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); @@ -123,9 +123,9 @@ void test_bind_server_to_addr(const char *host, bool secure) { gpr_free(addr); } -static int external_dns_works(const char *host) { - grpc_resolved_addresses *res = NULL; - grpc_error *error = grpc_blocking_resolve_address(host, "80", &res); +static int external_dns_works(const char* host) { + grpc_resolved_addresses* res = NULL; + grpc_error* error = grpc_blocking_resolve_address(host, "80", &res); GRPC_ERROR_UNREF(error); if (res != NULL) { grpc_resolved_addresses_destroy(res); @@ -134,28 +134,29 @@ static int external_dns_works(const char *host) { return 0; } -static void test_bind_server_to_addrs(const char **addrs, size_t n) { +static void test_bind_server_to_addrs(const char** addrs, size_t n) { for (size_t i = 0; i < n; i++) { test_bind_server_to_addr(addrs[i], false); test_bind_server_to_addr(addrs[i], true); } } -int main(int argc, char **argv) { +int main(int argc, char** argv) { grpc_test_init(argc, argv); grpc_init(); test_register_method_fail(); test_request_call_on_no_server_cq(); test_bind_server_twice(); - static const char *addrs[] = { + static const char* addrs[] = { "::1", "127.0.0.1", "::ffff:127.0.0.1", "localhost", "0.0.0.0", "::", }; test_bind_server_to_addrs(addrs, GPR_ARRAY_SIZE(addrs)); if (external_dns_works("loopback46.unittest.grpc.io")) { - static const char *dns_addrs[] = { - "loopback46.unittest.grpc.io", "loopback4.unittest.grpc.io", + static const char* dns_addrs[] = { + "loopback46.unittest.grpc.io", + "loopback4.unittest.grpc.io", }; test_bind_server_to_addrs(dns_addrs, GPR_ARRAY_SIZE(dns_addrs)); } |