diff options
Diffstat (limited to 'test')
51 files changed, 212 insertions, 214 deletions
diff --git a/test/core/bad_client/bad_client.c b/test/core/bad_client/bad_client.c index 9c09f00e56..ed46e7b009 100644 --- a/test/core/bad_client/bad_client.c +++ b/test/core/bad_client/bad_client.c @@ -157,9 +157,9 @@ void grpc_run_bad_client_test(grpc_bad_client_server_side_validator validator, grpc_exec_ctx_finish(&exec_ctx); } grpc_server_shutdown_and_notify(a.server, a.cq, NULL); - GPR_ASSERT(grpc_completion_queue_pluck( - a.cq, NULL, GRPC_TIMEOUT_SECONDS_TO_DEADLINE(1), NULL) - .type == GRPC_OP_COMPLETE); + GPR_ASSERT(grpc_completion_queue_pluck(a.cq, NULL, + GRPC_TIMEOUT_SECONDS_TO_DEADLINE(1), + NULL).type == GRPC_OP_COMPLETE); grpc_server_destroy(a.server); grpc_completion_queue_destroy(a.cq); gpr_slice_buffer_destroy(&outgoing); diff --git a/test/core/bad_client/tests/connection_prefix.c b/test/core/bad_client/tests/connection_prefix.c index ec85211605..90d37a3735 100644 --- a/test/core/bad_client/tests/connection_prefix.c +++ b/test/core/bad_client/tests/connection_prefix.c @@ -36,9 +36,9 @@ static void verifier(grpc_server *server, grpc_completion_queue *cq) { while (grpc_server_has_open_connections(server)) { - GPR_ASSERT(grpc_completion_queue_next( - cq, GRPC_TIMEOUT_MILLIS_TO_DEADLINE(20), NULL) - .type == GRPC_QUEUE_TIMEOUT); + GPR_ASSERT(grpc_completion_queue_next(cq, + GRPC_TIMEOUT_MILLIS_TO_DEADLINE(20), + NULL).type == GRPC_QUEUE_TIMEOUT); } } diff --git a/test/core/bad_client/tests/initial_settings_frame.c b/test/core/bad_client/tests/initial_settings_frame.c index 261fecdaf2..827e93b67c 100644 --- a/test/core/bad_client/tests/initial_settings_frame.c +++ b/test/core/bad_client/tests/initial_settings_frame.c @@ -38,9 +38,9 @@ static void verifier(grpc_server *server, grpc_completion_queue *cq) { while (grpc_server_has_open_connections(server)) { - GPR_ASSERT(grpc_completion_queue_next( - cq, GRPC_TIMEOUT_MILLIS_TO_DEADLINE(20), NULL) - .type == GRPC_QUEUE_TIMEOUT); + GPR_ASSERT(grpc_completion_queue_next(cq, + GRPC_TIMEOUT_MILLIS_TO_DEADLINE(20), + NULL).type == GRPC_QUEUE_TIMEOUT); } } diff --git a/test/core/channel/channel_stack_test.c b/test/core/channel/channel_stack_test.c index 2939027891..076a122e20 100644 --- a/test/core/channel/channel_stack_test.c +++ b/test/core/channel/channel_stack_test.c @@ -85,11 +85,10 @@ static char *get_peer(grpc_exec_ctx *exec_ctx, grpc_call_element *elem) { } static void test_create_channel_stack(void) { - const grpc_channel_filter filter = {call_func, channel_func, - sizeof(int), call_init_func, - 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, 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/client_config/lb_policies_test.c b/test/core/client_config/lb_policies_test.c index b5f75dc3e8..a9edf38157 100644 --- a/test/core/client_config/lb_policies_test.c +++ b/test/core/client_config/lb_policies_test.c @@ -134,9 +134,9 @@ static void kill_server(const servers_fixture *f, size_t i) { gpr_log(GPR_INFO, "KILLING SERVER %d", i); GPR_ASSERT(f->servers[i] != NULL); grpc_server_shutdown_and_notify(f->servers[i], f->cq, tag(10000)); - GPR_ASSERT(grpc_completion_queue_pluck( - f->cq, tag(10000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL) - .type == GRPC_OP_COMPLETE); + GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(10000), + GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), + NULL).type == GRPC_OP_COMPLETE); grpc_server_destroy(f->servers[i]); f->servers[i] = NULL; } @@ -190,9 +190,9 @@ static void teardown_servers(servers_fixture *f) { for (i = 0; i < f->num_servers; i++) { if (f->servers[i] == NULL) continue; grpc_server_shutdown_and_notify(f->servers[i], f->cq, tag(10000)); - GPR_ASSERT(grpc_completion_queue_pluck( - f->cq, tag(10000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL) - .type == GRPC_OP_COMPLETE); + GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(10000), + GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), + NULL).type == GRPC_OP_COMPLETE); grpc_server_destroy(f->servers[i]); } grpc_completion_queue_shutdown(f->cq); @@ -307,8 +307,8 @@ int *perform_request(servers_fixture *f, grpc_channel *client, s_idx = -1; while ((ev = grpc_completion_queue_next( - f->cq, GRPC_TIMEOUT_SECONDS_TO_DEADLINE(1), NULL)) - .type != GRPC_QUEUE_TIMEOUT) { + f->cq, GRPC_TIMEOUT_SECONDS_TO_DEADLINE(1), NULL)).type != + GRPC_QUEUE_TIMEOUT) { read_tag = ((int)(gpr_intptr)ev.tag); gpr_log(GPR_DEBUG, "EVENT: success:%d, type:%d, tag:%d iter:%d", ev.success, ev.type, read_tag, iter_num); diff --git a/test/core/end2end/dualstack_socket_test.c b/test/core/end2end/dualstack_socket_test.c index ca72d71dc1..e5ee7c4375 100644 --- a/test/core/end2end/dualstack_socket_test.c +++ b/test/core/end2end/dualstack_socket_test.c @@ -249,9 +249,9 @@ void test_connect(const char *server_host, const char *client_host, int port, /* Destroy server. */ grpc_server_shutdown_and_notify(server, cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck( - cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL) - .type == GRPC_OP_COMPLETE); + GPR_ASSERT(grpc_completion_queue_pluck(cq, tag(1000), + GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), + NULL).type == GRPC_OP_COMPLETE); grpc_server_destroy(server); grpc_completion_queue_shutdown(cq); drain_cq(cq); diff --git a/test/core/end2end/no_server_test.c b/test/core/end2end/no_server_test.c index c391003141..775fb221d0 100644 --- a/test/core/end2end/no_server_test.c +++ b/test/core/end2end/no_server_test.c @@ -88,9 +88,8 @@ int main(int argc, char **argv) { GPR_ASSERT(status == GRPC_STATUS_DEADLINE_EXCEEDED); grpc_completion_queue_shutdown(cq); - while ( - grpc_completion_queue_next(cq, gpr_inf_future(GPR_CLOCK_REALTIME), NULL) - .type != GRPC_QUEUE_SHUTDOWN) + while (grpc_completion_queue_next(cq, gpr_inf_future(GPR_CLOCK_REALTIME), + NULL).type != GRPC_QUEUE_SHUTDOWN) ; grpc_completion_queue_destroy(cq); grpc_call_destroy(call); diff --git a/test/core/end2end/tests/bad_hostname.c b/test/core/end2end/tests/bad_hostname.c index 93e2df1e43..ca4c1a9805 100644 --- a/test/core/end2end/tests/bad_hostname.c +++ b/test/core/end2end/tests/bad_hostname.c @@ -77,9 +77,9 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck( - f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL) - .type == GRPC_OP_COMPLETE); + GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000), + GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), + NULL).type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; } diff --git a/test/core/end2end/tests/binary_metadata.c b/test/core/end2end/tests/binary_metadata.c index 21e0bbcc49..58636ac2a2 100644 --- a/test/core/end2end/tests/binary_metadata.c +++ b/test/core/end2end/tests/binary_metadata.c @@ -75,9 +75,9 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck( - f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL) - .type == GRPC_OP_COMPLETE); + GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000), + GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), + NULL).type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; } diff --git a/test/core/end2end/tests/call_creds.c b/test/core/end2end/tests/call_creds.c index 4e905aafc7..4aeade1336 100644 --- a/test/core/end2end/tests/call_creds.c +++ b/test/core/end2end/tests/call_creds.c @@ -93,9 +93,9 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck( - f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL) - .type == GRPC_OP_COMPLETE); + GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000), + GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), + NULL).type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; } diff --git a/test/core/end2end/tests/cancel_after_accept.c b/test/core/end2end/tests/cancel_after_accept.c index 10e62275ab..d384cd1150 100644 --- a/test/core/end2end/tests/cancel_after_accept.c +++ b/test/core/end2end/tests/cancel_after_accept.c @@ -76,9 +76,9 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck( - f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL) - .type == GRPC_OP_COMPLETE); + GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000), + GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), + NULL).type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; } diff --git a/test/core/end2end/tests/cancel_after_client_done.c b/test/core/end2end/tests/cancel_after_client_done.c index 4fed5be5f7..e267d80493 100644 --- a/test/core/end2end/tests/cancel_after_client_done.c +++ b/test/core/end2end/tests/cancel_after_client_done.c @@ -76,9 +76,9 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck( - f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL) - .type == GRPC_OP_COMPLETE); + GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000), + GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), + NULL).type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; } diff --git a/test/core/end2end/tests/cancel_after_invoke.c b/test/core/end2end/tests/cancel_after_invoke.c index 40595e4c7b..ef9165ee25 100644 --- a/test/core/end2end/tests/cancel_after_invoke.c +++ b/test/core/end2end/tests/cancel_after_invoke.c @@ -77,9 +77,9 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck( - f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL) - .type == GRPC_OP_COMPLETE); + GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000), + GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), + NULL).type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; } diff --git a/test/core/end2end/tests/cancel_before_invoke.c b/test/core/end2end/tests/cancel_before_invoke.c index c049e0c2d6..ce2b402f1b 100644 --- a/test/core/end2end/tests/cancel_before_invoke.c +++ b/test/core/end2end/tests/cancel_before_invoke.c @@ -75,9 +75,9 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck( - f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL) - .type == GRPC_OP_COMPLETE); + GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000), + GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), + NULL).type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; } diff --git a/test/core/end2end/tests/cancel_in_a_vacuum.c b/test/core/end2end/tests/cancel_in_a_vacuum.c index 6c63d7c0ad..6c57299e1a 100644 --- a/test/core/end2end/tests/cancel_in_a_vacuum.c +++ b/test/core/end2end/tests/cancel_in_a_vacuum.c @@ -76,9 +76,9 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck( - f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL) - .type == GRPC_OP_COMPLETE); + GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000), + GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), + NULL).type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; } diff --git a/test/core/end2end/tests/census_simple_request.c b/test/core/end2end/tests/census_simple_request.c index adf855ca60..29f52ed35a 100644 --- a/test/core/end2end/tests/census_simple_request.c +++ b/test/core/end2end/tests/census_simple_request.c @@ -66,9 +66,9 @@ static void *tag(gpr_intptr t) { return (void *)t; } static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck( - f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL) - .type == GRPC_OP_COMPLETE); + GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000), + GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), + NULL).type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; } diff --git a/test/core/end2end/tests/channel_connectivity.c b/test/core/end2end/tests/channel_connectivity.c index be9b7fde1d..46085bbdaf 100644 --- a/test/core/end2end/tests/channel_connectivity.c +++ b/test/core/end2end/tests/channel_connectivity.c @@ -51,9 +51,10 @@ typedef struct { static void child_thread(void *arg) { child_events *ce = arg; grpc_event ev; - gpr_event_set(&ce->started, (void*)1); + gpr_event_set(&ce->started, (void *)1); gpr_log(GPR_DEBUG, "verifying"); - ev = grpc_completion_queue_next(ce->cq, gpr_inf_future(GPR_CLOCK_MONOTONIC), NULL); + ev = grpc_completion_queue_next(ce->cq, gpr_inf_future(GPR_CLOCK_MONOTONIC), + NULL); GPR_ASSERT(ev.type == GRPC_OP_COMPLETE); GPR_ASSERT(ev.tag == tag(1)); GPR_ASSERT(ev.success == 0); @@ -86,9 +87,8 @@ static void test_connectivity(grpc_end2end_test_config config) { /* start watching for a change */ gpr_log(GPR_DEBUG, "watching"); - grpc_channel_watch_connectivity_state(f.client, GRPC_CHANNEL_IDLE, - gpr_now(GPR_CLOCK_MONOTONIC), - f.cq, tag(1)); + grpc_channel_watch_connectivity_state( + f.client, GRPC_CHANNEL_IDLE, gpr_now(GPR_CLOCK_MONOTONIC), f.cq, tag(1)); /* eventually the child thread completion should trigger */ gpr_thd_join(thdid); diff --git a/test/core/end2end/tests/compressed_payload.c b/test/core/end2end/tests/compressed_payload.c index c50eaba8b2..a4614a2aba 100644 --- a/test/core/end2end/tests/compressed_payload.c +++ b/test/core/end2end/tests/compressed_payload.c @@ -80,9 +80,9 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck( - f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL) - .type == GRPC_OP_COMPLETE); + GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000), + GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), + NULL).type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; } diff --git a/test/core/end2end/tests/default_host.c b/test/core/end2end/tests/default_host.c index 294dfba53a..fc06b8950d 100644 --- a/test/core/end2end/tests/default_host.c +++ b/test/core/end2end/tests/default_host.c @@ -77,9 +77,9 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck( - f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL) - .type == GRPC_OP_COMPLETE); + GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000), + GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), + NULL).type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; } diff --git a/test/core/end2end/tests/empty_batch.c b/test/core/end2end/tests/empty_batch.c index c93d236a6a..59eb8f18f9 100644 --- a/test/core/end2end/tests/empty_batch.c +++ b/test/core/end2end/tests/empty_batch.c @@ -77,9 +77,9 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck( - f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL) - .type == GRPC_OP_COMPLETE); + GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000), + GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), + NULL).type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; } diff --git a/test/core/end2end/tests/high_initial_seqno.c b/test/core/end2end/tests/high_initial_seqno.c index 44d6a60c10..75bb133439 100644 --- a/test/core/end2end/tests/high_initial_seqno.c +++ b/test/core/end2end/tests/high_initial_seqno.c @@ -77,9 +77,9 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck( - f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL) - .type == GRPC_OP_COMPLETE); + GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000), + GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), + NULL).type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; } diff --git a/test/core/end2end/tests/invoke_large_request.c b/test/core/end2end/tests/invoke_large_request.c index f79d146da1..67cd303fa6 100644 --- a/test/core/end2end/tests/invoke_large_request.c +++ b/test/core/end2end/tests/invoke_large_request.c @@ -73,9 +73,9 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck( - f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL) - .type == GRPC_OP_COMPLETE); + GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000), + GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), + NULL).type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; } diff --git a/test/core/end2end/tests/large_metadata.c b/test/core/end2end/tests/large_metadata.c index 87529639a7..75d3f71cae 100644 --- a/test/core/end2end/tests/large_metadata.c +++ b/test/core/end2end/tests/large_metadata.c @@ -75,9 +75,9 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck( - f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL) - .type == GRPC_OP_COMPLETE); + GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000), + GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), + NULL).type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; } diff --git a/test/core/end2end/tests/max_concurrent_streams.c b/test/core/end2end/tests/max_concurrent_streams.c index 87eb4dd451..bb64200d9e 100644 --- a/test/core/end2end/tests/max_concurrent_streams.c +++ b/test/core/end2end/tests/max_concurrent_streams.c @@ -75,9 +75,9 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck( - f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL) - .type == GRPC_OP_COMPLETE); + GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000), + GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), + NULL).type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; } diff --git a/test/core/end2end/tests/max_message_length.c b/test/core/end2end/tests/max_message_length.c index 782b9d0f26..3dad47f37b 100644 --- a/test/core/end2end/tests/max_message_length.c +++ b/test/core/end2end/tests/max_message_length.c @@ -75,9 +75,9 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck( - f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL) - .type == GRPC_OP_COMPLETE); + GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000), + GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), + NULL).type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; } diff --git a/test/core/end2end/tests/metadata.c b/test/core/end2end/tests/metadata.c index be7a4f12c2..c325d5a37c 100644 --- a/test/core/end2end/tests/metadata.c +++ b/test/core/end2end/tests/metadata.c @@ -75,9 +75,9 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck( - f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL) - .type == GRPC_OP_COMPLETE); + GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000), + GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), + NULL).type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; } diff --git a/test/core/end2end/tests/no_op.c b/test/core/end2end/tests/no_op.c index 157d0d5349..ec33af78ef 100644 --- a/test/core/end2end/tests/no_op.c +++ b/test/core/end2end/tests/no_op.c @@ -75,9 +75,9 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck( - f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL) - .type == GRPC_OP_COMPLETE); + GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000), + GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), + NULL).type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; } diff --git a/test/core/end2end/tests/payload.c b/test/core/end2end/tests/payload.c index 0b303268fc..b440fbab21 100644 --- a/test/core/end2end/tests/payload.c +++ b/test/core/end2end/tests/payload.c @@ -75,9 +75,9 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck( - f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL) - .type == GRPC_OP_COMPLETE); + GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000), + GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), + NULL).type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; } diff --git a/test/core/end2end/tests/ping_pong_streaming.c b/test/core/end2end/tests/ping_pong_streaming.c index 39682d8bc5..804862ff58 100644 --- a/test/core/end2end/tests/ping_pong_streaming.c +++ b/test/core/end2end/tests/ping_pong_streaming.c @@ -75,9 +75,9 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck( - f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL) - .type == GRPC_OP_COMPLETE); + GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000), + GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), + NULL).type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; } diff --git a/test/core/end2end/tests/registered_call.c b/test/core/end2end/tests/registered_call.c index b3156e0248..eea91e6c3b 100644 --- a/test/core/end2end/tests/registered_call.c +++ b/test/core/end2end/tests/registered_call.c @@ -77,9 +77,9 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck( - f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL) - .type == GRPC_OP_COMPLETE); + GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000), + GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), + NULL).type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; } diff --git a/test/core/end2end/tests/request_with_flags.c b/test/core/end2end/tests/request_with_flags.c index b9cdf5168c..d7c4cff608 100644 --- a/test/core/end2end/tests/request_with_flags.c +++ b/test/core/end2end/tests/request_with_flags.c @@ -76,9 +76,9 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck( - f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL) - .type == GRPC_OP_COMPLETE); + GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000), + GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), + NULL).type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; } diff --git a/test/core/end2end/tests/request_with_payload.c b/test/core/end2end/tests/request_with_payload.c index a323b43ab0..56c199baf3 100644 --- a/test/core/end2end/tests/request_with_payload.c +++ b/test/core/end2end/tests/request_with_payload.c @@ -75,9 +75,9 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck( - f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL) - .type == GRPC_OP_COMPLETE); + GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000), + GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), + NULL).type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; } diff --git a/test/core/end2end/tests/server_finishes_request.c b/test/core/end2end/tests/server_finishes_request.c index bdc18a5e38..c77e31bca3 100644 --- a/test/core/end2end/tests/server_finishes_request.c +++ b/test/core/end2end/tests/server_finishes_request.c @@ -77,9 +77,9 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck( - f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL) - .type == GRPC_OP_COMPLETE); + GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000), + GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), + NULL).type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; } diff --git a/test/core/end2end/tests/simple_delayed_request.c b/test/core/end2end/tests/simple_delayed_request.c index 14e0ac8f66..04447f9df4 100644 --- a/test/core/end2end/tests/simple_delayed_request.c +++ b/test/core/end2end/tests/simple_delayed_request.c @@ -63,9 +63,9 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck( - f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL) - .type == GRPC_OP_COMPLETE); + GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000), + GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), + NULL).type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; } diff --git a/test/core/end2end/tests/simple_request.c b/test/core/end2end/tests/simple_request.c index a874640837..e9965a91ba 100644 --- a/test/core/end2end/tests/simple_request.c +++ b/test/core/end2end/tests/simple_request.c @@ -77,9 +77,9 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck( - f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL) - .type == GRPC_OP_COMPLETE); + GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000), + GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), + NULL).type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; } diff --git a/test/core/end2end/tests/trailing_metadata.c b/test/core/end2end/tests/trailing_metadata.c index c040b9fac1..306ef7e3aa 100644 --- a/test/core/end2end/tests/trailing_metadata.c +++ b/test/core/end2end/tests/trailing_metadata.c @@ -75,9 +75,9 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck( - f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL) - .type == GRPC_OP_COMPLETE); + GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000), + GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), + NULL).type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; } diff --git a/test/core/httpcli/format_request_test.c b/test/core/httpcli/format_request_test.c index 82b2ccb122..da850049e2 100644 --- a/test/core/httpcli/format_request_test.c +++ b/test/core/httpcli/format_request_test.c @@ -142,7 +142,8 @@ static void test_format_post_request_content_type_override(void) { "POST /index.html HTTP/1.0\r\n" "Host: example.com\r\n" "Connection: close\r\n" - "User-Agent: " GRPC_HTTPCLI_USER_AGENT "\r\n" + "User-Agent: " GRPC_HTTPCLI_USER_AGENT + "\r\n" "x-yz: abc\r\n" "Content-Type: application/x-www-form-urlencoded\r\n" "Content-Length: 11\r\n" diff --git a/test/core/json/json_test.c b/test/core/json/json_test.c index 8575331cab..15019913da 100644 --- a/test/core/json/json_test.c +++ b/test/core/json/json_test.c @@ -66,7 +66,7 @@ static testing_pair testing_pairs[] = { {"\"\\ud834\\udd1e\"", "\"\\ud834\\udd1e\""}, /* Testing nested empty containers. */ { - " [ [ ] , { } , [ ] ] ", "[[],{},[]]", + " [ [ ] , { } , [ ] ] ", "[[],{},[]]", }, /* Testing escapes and control chars in key strings. */ {" { \"\x7f\\n\\\\a , b\": 1, \"\": 0 } ", diff --git a/test/core/statistics/hash_table_test.c b/test/core/statistics/hash_table_test.c index 453755f40a..efebd790f2 100644 --- a/test/core/statistics/hash_table_test.c +++ b/test/core/statistics/hash_table_test.c @@ -65,8 +65,8 @@ static void free_data(void *data) { gpr_free(data); } static void test_create_table(void) { /* Create table with uint64 key type */ census_ht *ht = NULL; - census_ht_option ht_options = { - CENSUS_HT_UINT64, 1999, NULL, NULL, NULL, NULL}; + census_ht_option ht_options = {CENSUS_HT_UINT64, 1999, NULL, NULL, NULL, + NULL}; ht = census_ht_create(&ht_options); GPR_ASSERT(ht != NULL); GPR_ASSERT(census_ht_get_size(ht) == 0); @@ -120,8 +120,8 @@ static void test_table_with_int_key(void) { /* Test that there is no memory leak when keys and values are owned by table. */ static void test_value_and_key_deleter(void) { - census_ht_option opt = {CENSUS_HT_POINTER, 7, &hash64, - &cmp_str_keys, &free_data, &free_data}; + census_ht_option opt = {CENSUS_HT_POINTER, 7, &hash64, &cmp_str_keys, + &free_data, &free_data}; census_ht *ht = census_ht_create(&opt); census_ht_key key; char *val = NULL; @@ -185,8 +185,8 @@ static void test_simple_add_and_erase(void) { } static void test_insertion_and_deletion_with_high_collision_rate(void) { - census_ht_option opt = {CENSUS_HT_POINTER, 13, &force_collision, - &cmp_str_keys, NULL, NULL}; + census_ht_option opt = {CENSUS_HT_POINTER, 13, &force_collision, + &cmp_str_keys, NULL, NULL}; census_ht *ht = census_ht_create(&opt); char key_str[1000][GPR_LTOA_MIN_BUFSIZE]; gpr_uint64 val = 0; @@ -209,12 +209,12 @@ static void test_insertion_and_deletion_with_high_collision_rate(void) { } static void test_table_with_string_key(void) { - census_ht_option opt = {CENSUS_HT_POINTER, 7, &hash64, - &cmp_str_keys, NULL, NULL}; + census_ht_option opt = {CENSUS_HT_POINTER, 7, &hash64, &cmp_str_keys, NULL, + NULL}; census_ht *ht = census_ht_create(&opt); - const char *keys[] = { - "k1", "a", "000", "apple", "banana_a_long_long_long_banana", - "%$", "111", "foo", "b"}; + const char *keys[] = {"k1", "a", "000", "apple", + "banana_a_long_long_long_banana", "%$", "111", "foo", + "b"}; const int vals[] = {0, 1, 2, 3, 4, 5, 6, 7, 8}; int i = 0; GPR_ASSERT(ht != NULL); diff --git a/test/cpp/end2end/end2end_test.cc b/test/cpp/end2end/end2end_test.cc index 49a38ce544..02d1f7ac4f 100644 --- a/test/cpp/end2end/end2end_test.cc +++ b/test/cpp/end2end/end2end_test.cc @@ -193,7 +193,6 @@ class TestAuthMetadataProcessor : public AuthMetadataProcessor { const char TestAuthMetadataProcessor::kGoodGuy[] = "Dr Jekyll"; const char TestAuthMetadataProcessor::kIdentityPropName[] = "novel identity"; - class Proxy : public ::grpc::cpp::test::util::TestService::Service { public: Proxy(std::shared_ptr<Channel> channel) @@ -259,7 +258,8 @@ class TestServiceImpl : public ::grpc::cpp::test::util::TestService::Service { if (request->has_param() && (request->param().expected_client_identity().length() > 0 || request->param().check_auth_context())) { - CheckServerAuthContext(context, request->param().expected_client_identity()); + CheckServerAuthContext(context, + request->param().expected_client_identity()); } if (request->has_param() && request->param().response_message_length() > 0) { @@ -734,7 +734,8 @@ TEST_P(End2endTest, ChannelState) { EXPECT_EQ(GRPC_CHANNEL_IDLE, channel_->GetState(true)); EXPECT_TRUE(channel_->WaitForStateChange(GRPC_CHANNEL_IDLE, gpr_inf_future(GPR_CLOCK_REALTIME))); - EXPECT_EQ(GRPC_CHANNEL_CONNECTING, channel_->GetState(false)); + auto state = channel_->GetState(false); + EXPECT_TRUE(state == GRPC_CHANNEL_CONNECTING || state == GRPC_CHANNEL_READY); } // Takes 10s. diff --git a/test/cpp/end2end/streaming_throughput_test.cc b/test/cpp/end2end/streaming_throughput_test.cc index 344bf507ce..d4ab1486cc 100644 --- a/test/cpp/end2end/streaming_throughput_test.cc +++ b/test/cpp/end2end/streaming_throughput_test.cc @@ -58,57 +58,60 @@ using grpc::cpp::test::util::EchoRequest; using grpc::cpp::test::util::EchoResponse; using std::chrono::system_clock; -const char* kLargeString = "(" - "To be, or not to be- that is the question:" - "Whether 'tis nobler in the mind to suffer" - "The slings and arrows of outrageous fortune" - "Or to take arms against a sea of troubles," - "And by opposing end them. To die- to sleep-" - "No more; and by a sleep to say we end" - "The heartache, and the thousand natural shock" - "That flesh is heir to. 'Tis a consummation" - "Devoutly to be wish'd. To die- to sleep." - "To sleep- perchance to dream: ay, there's the rub!" - "For in that sleep of death what dreams may come" - "When we have shuffled off this mortal coil," - "Must give us pause. There's the respect" - "That makes calamity of so long life." - "For who would bear the whips and scorns of time," - "Th' oppressor's wrong, the proud man's contumely," - "The pangs of despis'd love, the law's delay," - "The insolence of office, and the spurns" - "That patient merit of th' unworthy takes," - "When he himself might his quietus make" - "With a bare bodkin? Who would these fardels bear," - "To grunt and sweat under a weary life," - "But that the dread of something after death-" - "The undiscover'd country, from whose bourn" - "No traveller returns- puzzles the will," - "And makes us rather bear those ills we have" - "Than fly to others that we know not of?" - "Thus conscience does make cowards of us all," - "And thus the native hue of resolution" - "Is sicklied o'er with the pale cast of thought," - "And enterprises of great pith and moment" - "With this regard their currents turn awry" - "And lose the name of action.- Soft you now!" - "The fair Ophelia!- Nymph, in thy orisons" - "Be all my sins rememb'red."; +const char* kLargeString = + "(" + "To be, or not to be- that is the question:" + "Whether 'tis nobler in the mind to suffer" + "The slings and arrows of outrageous fortune" + "Or to take arms against a sea of troubles," + "And by opposing end them. To die- to sleep-" + "No more; and by a sleep to say we end" + "The heartache, and the thousand natural shock" + "That flesh is heir to. 'Tis a consummation" + "Devoutly to be wish'd. To die- to sleep." + "To sleep- perchance to dream: ay, there's the rub!" + "For in that sleep of death what dreams may come" + "When we have shuffled off this mortal coil," + "Must give us pause. There's the respect" + "That makes calamity of so long life." + "For who would bear the whips and scorns of time," + "Th' oppressor's wrong, the proud man's contumely," + "The pangs of despis'd love, the law's delay," + "The insolence of office, and the spurns" + "That patient merit of th' unworthy takes," + "When he himself might his quietus make" + "With a bare bodkin? Who would these fardels bear," + "To grunt and sweat under a weary life," + "But that the dread of something after death-" + "The undiscover'd country, from whose bourn" + "No traveller returns- puzzles the will," + "And makes us rather bear those ills we have" + "Than fly to others that we know not of?" + "Thus conscience does make cowards of us all," + "And thus the native hue of resolution" + "Is sicklied o'er with the pale cast of thought," + "And enterprises of great pith and moment" + "With this regard their currents turn awry" + "And lose the name of action.- Soft you now!" + "The fair Ophelia!- Nymph, in thy orisons" + "Be all my sins rememb'red."; namespace grpc { namespace testing { class TestServiceImpl : public ::grpc::cpp::test::util::TestService::Service { public: - static void BidiStream_Sender(ServerReaderWriter<EchoResponse, EchoRequest>* stream, gpr_atm* should_exit) { + static void BidiStream_Sender( + ServerReaderWriter<EchoResponse, EchoRequest>* stream, + gpr_atm* should_exit) { EchoResponse response; response.set_message(kLargeString); while (gpr_atm_acq_load(should_exit) == static_cast<gpr_atm>(0)) { - struct timespec tv = {0, 1000000}; // 1 ms + struct timespec tv = {0, 1000000}; // 1 ms struct timespec rem; // TODO (vpai): Mark this blocking while (nanosleep(&tv, &rem) != 0) { - tv = rem; + tv = rem; }; stream->Write(response); @@ -123,14 +126,15 @@ class TestServiceImpl : public ::grpc::cpp::test::util::TestService::Service { gpr_atm should_exit; gpr_atm_rel_store(&should_exit, static_cast<gpr_atm>(0)); - std::thread sender(std::bind(&TestServiceImpl::BidiStream_Sender, stream, &should_exit)); + std::thread sender( + std::bind(&TestServiceImpl::BidiStream_Sender, stream, &should_exit)); while (stream->Read(&request)) { - struct timespec tv = {0, 3000000}; // 3 ms + struct timespec tv = {0, 3000000}; // 3 ms struct timespec rem; // TODO (vpai): Mark this blocking while (nanosleep(&tv, &rem) != 0) { - tv = rem; + tv = rem; }; } gpr_atm_rel_store(&should_exit, static_cast<gpr_atm>(1)); @@ -155,8 +159,8 @@ class End2endTest : public ::testing::Test { void TearDown() GRPC_OVERRIDE { server_->Shutdown(); } void ResetStub() { - std::shared_ptr<Channel> channel = CreateChannel( - server_address_.str(), InsecureCredentials()); + std::shared_ptr<Channel> channel = + CreateChannel(server_address_.str(), InsecureCredentials()); stub_ = grpc::cpp::test::util::TestService::NewStub(channel); } @@ -169,7 +173,7 @@ class End2endTest : public ::testing::Test { static void Drainer(ClientReaderWriter<EchoRequest, EchoResponse>* reader) { EchoResponse response; while (reader->Read(&response)) { - // Just drain out the responses as fast as possible. + // Just drain out the responses as fast as possible. } } diff --git a/test/cpp/interop/client.cc b/test/cpp/interop/client.cc index 58c71cca35..dbe29395b4 100644 --- a/test/cpp/interop/client.cc +++ b/test/cpp/interop/client.cc @@ -45,7 +45,7 @@ #include "test/cpp/interop/interop_client.h" #include "test/cpp/util/test_config.h" -DEFINE_bool(enable_ssl, false, "Whether to use ssl/tls."); +DEFINE_bool(use_tls, false, "Whether to use tls."); DEFINE_bool(use_prod_roots, false, "True to use SSL roots for google"); DEFINE_int32(server_port, 0, "Server port."); DEFINE_string(server_host, "127.0.0.1", "Server host to connect to"); @@ -143,11 +143,11 @@ int main(int argc, char** argv) { client.DoEmptyStream(); client.DoStatusWithMessage(); // service_account_creds and jwt_token_creds can only run with ssl. - if (FLAGS_enable_ssl) { + if (FLAGS_use_tls) { grpc::string json_key = GetServiceAccountJsonKey(); client.DoJwtTokenCreds(json_key); - client.DoOauth2AuthToken( - FLAGS_default_service_account, FLAGS_oauth_scope); + client.DoOauth2AuthToken(FLAGS_default_service_account, + FLAGS_oauth_scope); client.DoPerRpcCreds(json_key); } // compute_engine_creds only runs in GCE. diff --git a/test/cpp/interop/client_helper.cc b/test/cpp/interop/client_helper.cc index f85aa6ad8e..cbad21e318 100644 --- a/test/cpp/interop/client_helper.cc +++ b/test/cpp/interop/client_helper.cc @@ -51,7 +51,7 @@ #include "test/core/security/oauth2_utils.h" #include "test/cpp/util/create_test_channel.h" -DECLARE_bool(enable_ssl); +DECLARE_bool(use_tls); DECLARE_bool(use_prod_roots); DECLARE_int32(server_port); DECLARE_string(server_host); @@ -99,27 +99,27 @@ std::shared_ptr<Channel> CreateChannelForTestCase( if (test_case == "compute_engine_creds") { std::shared_ptr<Credentials> creds; - GPR_ASSERT(FLAGS_enable_ssl); + GPR_ASSERT(FLAGS_use_tls); creds = GoogleComputeEngineCredentials(); return CreateTestChannel(host_port, FLAGS_server_host_override, - FLAGS_enable_ssl, FLAGS_use_prod_roots, creds); + FLAGS_use_tls, FLAGS_use_prod_roots, creds); } else if (test_case == "jwt_token_creds") { std::shared_ptr<Credentials> creds; - GPR_ASSERT(FLAGS_enable_ssl); + GPR_ASSERT(FLAGS_use_tls); grpc::string json_key = GetServiceAccountJsonKey(); std::chrono::seconds token_lifetime = std::chrono::hours(1); creds = ServiceAccountJWTAccessCredentials(json_key, token_lifetime.count()); return CreateTestChannel(host_port, FLAGS_server_host_override, - FLAGS_enable_ssl, FLAGS_use_prod_roots, creds); + FLAGS_use_tls, FLAGS_use_prod_roots, creds); } else if (test_case == "oauth2_auth_token") { grpc::string raw_token = GetOauth2AccessToken(); std::shared_ptr<Credentials> creds = AccessTokenCredentials(raw_token); return CreateTestChannel(host_port, FLAGS_server_host_override, - FLAGS_enable_ssl, FLAGS_use_prod_roots, creds); + FLAGS_use_tls, FLAGS_use_prod_roots, creds); } else { return CreateTestChannel(host_port, FLAGS_server_host_override, - FLAGS_enable_ssl, FLAGS_use_prod_roots); + FLAGS_use_tls, FLAGS_use_prod_roots); } } diff --git a/test/cpp/interop/interop_client.cc b/test/cpp/interop/interop_client.cc index 02e10a50aa..5169945762 100644 --- a/test/cpp/interop/interop_client.cc +++ b/test/cpp/interop/interop_client.cc @@ -203,8 +203,7 @@ void InteropClient::DoOauth2AuthToken(const grpc::string& username, } void InteropClient::DoPerRpcCreds(const grpc::string& json_key) { - gpr_log(GPR_INFO, - "Sending a unary rpc with per-rpc JWT access token ..."); + gpr_log(GPR_INFO, "Sending a unary rpc with per-rpc JWT access token ..."); SimpleRequest request; SimpleResponse response; request.set_fill_username(true); diff --git a/test/cpp/interop/interop_test.cc b/test/cpp/interop/interop_test.cc index f01b032e95..faf6698903 100644 --- a/test/cpp/interop/interop_test.cc +++ b/test/cpp/interop/interop_test.cc @@ -55,7 +55,6 @@ extern "C" { #include "src/core/support/string.h" } - int test_client(const char* root, const char* host, int port) { int status; pid_t cli; diff --git a/test/cpp/interop/server.cc b/test/cpp/interop/server.cc index 03b6532447..c0e1ec943d 100644 --- a/test/cpp/interop/server.cc +++ b/test/cpp/interop/server.cc @@ -54,7 +54,7 @@ #include "test/proto/empty.grpc.pb.h" #include "test/proto/messages.grpc.pb.h" -DEFINE_bool(enable_ssl, false, "Whether to use ssl/tls."); +DEFINE_bool(use_tls, false, "Whether to use tls."); DEFINE_int32(port, 0, "Server port."); using grpc::Server; diff --git a/test/cpp/interop/server_helper.cc b/test/cpp/interop/server_helper.cc index 015198354e..4570750846 100644 --- a/test/cpp/interop/server_helper.cc +++ b/test/cpp/interop/server_helper.cc @@ -41,13 +41,13 @@ #include "src/core/surface/call.h" #include "test/core/end2end/data/ssl_test_data.h" -DECLARE_bool(enable_ssl); +DECLARE_bool(use_tls); namespace grpc { namespace testing { std::shared_ptr<ServerCredentials> CreateInteropServerCredentials() { - if (FLAGS_enable_ssl) { + if (FLAGS_use_tls) { SslServerCredentialsOptions::PemKeyCertPair pkcp = {test_server1_key, test_server1_cert}; SslServerCredentialsOptions ssl_opts; diff --git a/test/cpp/qps/driver.cc b/test/cpp/qps/driver.cc index 6e71c45935..ac763e4b3c 100644 --- a/test/cpp/qps/driver.cc +++ b/test/cpp/qps/driver.cc @@ -153,8 +153,8 @@ std::unique_ptr<ScenarioResult> RunScenario( // where class contained in std::vector must have a copy constructor auto* servers = new ServerData[num_servers]; for (size_t i = 0; i < num_servers; i++) { - servers[i].stub = Worker::NewStub(CreateChannel(workers[i], - InsecureCredentials())); + servers[i].stub = + Worker::NewStub(CreateChannel(workers[i], InsecureCredentials())); ServerArgs args; result_server_config = server_config; result_server_config.set_host(workers[i]); @@ -181,8 +181,8 @@ std::unique_ptr<ScenarioResult> RunScenario( // where class contained in std::vector must have a copy constructor auto* clients = new ClientData[num_clients]; for (size_t i = 0; i < num_clients; i++) { - clients[i].stub = Worker::NewStub(CreateChannel(workers[i + num_servers], - InsecureCredentials())); + clients[i].stub = Worker::NewStub( + CreateChannel(workers[i + num_servers], InsecureCredentials())); ClientArgs args; result_client_config = client_config; result_client_config.set_host(workers[i + num_servers]); diff --git a/test/cpp/qps/server_async.cc b/test/cpp/qps/server_async.cc index 516598a0e2..76575e42da 100644 --- a/test/cpp/qps/server_async.cc +++ b/test/cpp/qps/server_async.cc @@ -52,7 +52,6 @@ #include "test/cpp/qps/qpstest.grpc.pb.h" #include "test/cpp/qps/server.h" - namespace grpc { namespace testing { @@ -98,8 +97,7 @@ class AsyncQpsServerTest : public Server { } } ~AsyncQpsServerTest() { - auto deadline = std::chrono::system_clock::now() + - std::chrono::seconds(10); + auto deadline = std::chrono::system_clock::now() + std::chrono::seconds(10); server_->Shutdown(deadline); for (auto ss = shutdown_state_.begin(); ss != shutdown_state_.end(); ++ss) { (*ss)->set_shutdown(); diff --git a/test/cpp/qps/server_sync.cc b/test/cpp/qps/server_sync.cc index d930ba2464..dfaa760617 100644 --- a/test/cpp/qps/server_sync.cc +++ b/test/cpp/qps/server_sync.cc @@ -47,7 +47,6 @@ #include "test/cpp/qps/server.h" #include "test/cpp/qps/timer.h" - namespace grpc { namespace testing { @@ -86,8 +85,7 @@ class TestServiceImpl GRPC_FINAL : public TestService::Service { class SynchronousServer GRPC_FINAL : public grpc::testing::Server { public: SynchronousServer(const ServerConfig& config, int port) - : impl_(MakeImpl(port)) { - } + : impl_(MakeImpl(port)) {} private: std::unique_ptr<grpc::Server> MakeImpl(int port) { diff --git a/test/cpp/util/string_ref_test.cc b/test/cpp/util/string_ref_test.cc index 465072d43e..44a298d892 100644 --- a/test/cpp/util/string_ref_test.cc +++ b/test/cpp/util/string_ref_test.cc @@ -45,8 +45,7 @@ const char kTestStringWithEmbeddedNull[] = "blah\0foo"; const size_t kTestStringWithEmbeddedNullLength = 8; const char kTestUnrelatedString[] = "foo"; -class StringRefTest : public ::testing::Test { -}; +class StringRefTest : public ::testing::Test {}; TEST_F(StringRefTest, Empty) { string_ref s; @@ -74,7 +73,8 @@ TEST_F(StringRefTest, FromString) { } TEST_F(StringRefTest, CopyConstructor) { - string_ref s1(kTestString);; + string_ref s1(kTestString); + ; string_ref s2(s1); EXPECT_EQ(s1.length(), s2.length()); EXPECT_EQ(s1.data(), s2.data()); @@ -89,7 +89,8 @@ TEST_F(StringRefTest, FromStringWithEmbeddedNull) { } TEST_F(StringRefTest, Assignment) { - string_ref s1(kTestString);; + string_ref s1(kTestString); + ; string_ref s2; EXPECT_EQ(nullptr, s2.data()); s2 = s1; @@ -109,7 +110,7 @@ TEST_F(StringRefTest, Iterator) { TEST_F(StringRefTest, ReverseIterator) { string_ref s(kTestString); size_t i = strlen(kTestString); - for (auto rit = s.crbegin(); rit != s.crend(); ++rit) { + for (auto rit = s.crbegin(); rit != s.crend(); ++rit) { EXPECT_EQ(kTestString[--i], *rit); } EXPECT_EQ(0U, i); @@ -168,9 +169,9 @@ TEST_F(StringRefTest, Find) { EXPECT_EQ(0U, s1.find(s1)); EXPECT_EQ(0U, s2.find(s2)); EXPECT_EQ(0U, s3.find(s3)); - EXPECT_EQ(string_ref::npos,s1.find(s2) ); - EXPECT_EQ(string_ref::npos,s2.find(s1)); - EXPECT_EQ(string_ref::npos,s1.find(s3)); + EXPECT_EQ(string_ref::npos, s1.find(s2)); + EXPECT_EQ(string_ref::npos, s2.find(s1)); + EXPECT_EQ(string_ref::npos, s1.find(s3)); EXPECT_EQ(0U, s3.find(s1)); EXPECT_EQ(5U, s3.find(s2)); EXPECT_EQ(string_ref::npos, s1.find('z')); @@ -212,4 +213,3 @@ int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } - |