diff options
113 files changed, 1210 insertions, 555 deletions
diff --git a/src/core/channel/client_channel.c b/src/core/channel/client_channel.c index 0193928a50..b59b62a6aa 100644 --- a/src/core/channel/client_channel.c +++ b/src/core/channel/client_channel.c @@ -692,16 +692,9 @@ static void destroy_channel_elem(grpc_exec_ctx *exec_ctx, } const grpc_channel_filter grpc_client_channel_filter = { - cc_start_transport_stream_op, - cc_start_transport_op, - sizeof(call_data), - init_call_elem, - destroy_call_elem, - sizeof(channel_data), - init_channel_elem, - destroy_channel_elem, - cc_get_peer, - "client-channel", + cc_start_transport_stream_op, cc_start_transport_op, sizeof(call_data), + init_call_elem, destroy_call_elem, sizeof(channel_data), init_channel_elem, + destroy_channel_elem, cc_get_peer, "client-channel", }; void grpc_client_channel_set_resolver(grpc_exec_ctx *exec_ctx, diff --git a/src/core/channel/compress_filter.c b/src/core/channel/compress_filter.c index 2aa826fcd8..182fbf18bf 100644 --- a/src/core/channel/compress_filter.c +++ b/src/core/channel/compress_filter.c @@ -387,13 +387,6 @@ static void destroy_channel_elem(grpc_exec_ctx *exec_ctx, } const grpc_channel_filter grpc_compress_filter = { - compress_start_transport_stream_op, - grpc_channel_next_op, - sizeof(call_data), - init_call_elem, - destroy_call_elem, - sizeof(channel_data), - init_channel_elem, - destroy_channel_elem, - grpc_call_next_get_peer, - "compress"}; + compress_start_transport_stream_op, grpc_channel_next_op, sizeof(call_data), + init_call_elem, destroy_call_elem, sizeof(channel_data), init_channel_elem, + destroy_channel_elem, grpc_call_next_get_peer, "compress"}; diff --git a/src/core/channel/connected_channel.c b/src/core/channel/connected_channel.c index ea701bc284..f9fc280259 100644 --- a/src/core/channel/connected_channel.c +++ b/src/core/channel/connected_channel.c @@ -130,16 +130,9 @@ static char *con_get_peer(grpc_exec_ctx *exec_ctx, grpc_call_element *elem) { } const grpc_channel_filter grpc_connected_channel_filter = { - con_start_transport_stream_op, - con_start_transport_op, - sizeof(call_data), - init_call_elem, - destroy_call_elem, - sizeof(channel_data), - init_channel_elem, - destroy_channel_elem, - con_get_peer, - "connected", + con_start_transport_stream_op, con_start_transport_op, sizeof(call_data), + init_call_elem, destroy_call_elem, sizeof(channel_data), init_channel_elem, + destroy_channel_elem, con_get_peer, "connected", }; void grpc_connected_channel_bind_transport(grpc_channel_stack *channel_stack, diff --git a/src/core/channel/noop_filter.c b/src/core/channel/noop_filter.c index 91b30d61ca..48f6b1c650 100644 --- a/src/core/channel/noop_filter.c +++ b/src/core/channel/noop_filter.c @@ -116,13 +116,7 @@ static void destroy_channel_elem(grpc_exec_ctx *exec_ctx, ignore_unused(channeld); } -const grpc_channel_filter grpc_no_op_filter = {noop_start_transport_stream_op, - grpc_channel_next_op, - sizeof(call_data), - init_call_elem, - destroy_call_elem, - sizeof(channel_data), - init_channel_elem, - destroy_channel_elem, - grpc_call_next_get_peer, - "no-op"}; +const grpc_channel_filter grpc_no_op_filter = { + noop_start_transport_stream_op, grpc_channel_next_op, sizeof(call_data), + init_call_elem, destroy_call_elem, sizeof(channel_data), init_channel_elem, + destroy_channel_elem, grpc_call_next_get_peer, "no-op"}; diff --git a/src/core/client_config/lb_policies/pick_first.c b/src/core/client_config/lb_policies/pick_first.c index 5fa1ee4418..28155d0fbc 100644 --- a/src/core/client_config/lb_policies/pick_first.c +++ b/src/core/client_config/lb_policies/pick_first.c @@ -317,13 +317,8 @@ void pf_notify_on_state_change(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol, } static const grpc_lb_policy_vtable pick_first_lb_policy_vtable = { - pf_destroy, - pf_shutdown, - pf_pick, - pf_exit_idle, - pf_broadcast, - pf_check_connectivity, - pf_notify_on_state_change}; + pf_destroy, pf_shutdown, pf_pick, pf_exit_idle, pf_broadcast, + pf_check_connectivity, pf_notify_on_state_change}; static void pick_first_factory_ref(grpc_lb_policy_factory *factory) {} diff --git a/src/core/client_config/lb_policies/round_robin.c b/src/core/client_config/lb_policies/round_robin.c index 479c376724..d0b60a0df2 100644 --- a/src/core/client_config/lb_policies/round_robin.c +++ b/src/core/client_config/lb_policies/round_robin.c @@ -487,13 +487,8 @@ static void rr_notify_on_state_change(grpc_exec_ctx *exec_ctx, } static const grpc_lb_policy_vtable round_robin_lb_policy_vtable = { - rr_destroy, - rr_shutdown, - rr_pick, - rr_exit_idle, - rr_broadcast, - rr_check_connectivity, - rr_notify_on_state_change}; + rr_destroy, rr_shutdown, rr_pick, rr_exit_idle, rr_broadcast, + rr_check_connectivity, rr_notify_on_state_change}; static void round_robin_factory_ref(grpc_lb_policy_factory *factory) {} diff --git a/src/core/client_config/subchannel.c b/src/core/client_config/subchannel.c index 740389003a..a94c69123e 100644 --- a/src/core/client_config/subchannel.c +++ b/src/core/client_config/subchannel.c @@ -153,8 +153,8 @@ static gpr_timespec compute_connect_deadline(grpc_subchannel *c); static void subchannel_connected(grpc_exec_ctx *exec_ctx, void *subchannel, int iomgr_success); -static void subchannel_ref_locked( - grpc_subchannel *c GRPC_SUBCHANNEL_REF_EXTRA_ARGS); +static void subchannel_ref_locked(grpc_subchannel *c + GRPC_SUBCHANNEL_REF_EXTRA_ARGS); static int subchannel_unref_locked( grpc_subchannel *c GRPC_SUBCHANNEL_REF_EXTRA_ARGS) GRPC_MUST_USE_RESULT; static void connection_ref_locked(connection *c GRPC_SUBCHANNEL_REF_EXTRA_ARGS); @@ -203,8 +203,8 @@ static void connection_destroy(grpc_exec_ctx *exec_ctx, connection *c) { gpr_free(c); } -static void connection_ref_locked( - connection *c GRPC_SUBCHANNEL_REF_EXTRA_ARGS) { +static void connection_ref_locked(connection *c + GRPC_SUBCHANNEL_REF_EXTRA_ARGS) { REF_LOG("CONNECTION", c); subchannel_ref_locked(c->subchannel REF_PASS_ARGS); ++c->refs; @@ -227,14 +227,14 @@ static grpc_subchannel *connection_unref_locked( * grpc_subchannel implementation */ -static void subchannel_ref_locked( - grpc_subchannel *c GRPC_SUBCHANNEL_REF_EXTRA_ARGS) { +static void subchannel_ref_locked(grpc_subchannel *c + GRPC_SUBCHANNEL_REF_EXTRA_ARGS) { REF_LOG("SUBCHANNEL", c); ++c->refs; } -static int subchannel_unref_locked( - grpc_subchannel *c GRPC_SUBCHANNEL_REF_EXTRA_ARGS) { +static int subchannel_unref_locked(grpc_subchannel *c + GRPC_SUBCHANNEL_REF_EXTRA_ARGS) { UNREF_LOG("SUBCHANNEL", c); return --c->refs == 0; } @@ -709,8 +709,8 @@ static void connectivity_state_changed_locked(grpc_exec_ctx *exec_ctx, * grpc_subchannel_call implementation */ -void grpc_subchannel_call_ref( - grpc_subchannel_call *c GRPC_SUBCHANNEL_REF_EXTRA_ARGS) { +void grpc_subchannel_call_ref(grpc_subchannel_call *c + GRPC_SUBCHANNEL_REF_EXTRA_ARGS) { gpr_ref(&c->refs); } diff --git a/src/core/iomgr/exec_ctx.h b/src/core/iomgr/exec_ctx.h index aa0610cbea..43df488094 100644 --- a/src/core/iomgr/exec_ctx.h +++ b/src/core/iomgr/exec_ctx.h @@ -61,7 +61,7 @@ struct grpc_exec_ctx { { GRPC_CLOSURE_LIST_INIT } /** Flush any work that has been enqueued onto this grpc_exec_ctx. - * Caller must guarantee that no interfering locks are held. + * Caller must guarantee that no interfering locks are held. * Returns 1 if work was performed, 0 otherwise. */ int grpc_exec_ctx_flush(grpc_exec_ctx *exec_ctx); /** Finish any pending work for a grpc_exec_ctx. Must be called before diff --git a/src/core/iomgr/iocp_windows.c b/src/core/iomgr/iocp_windows.c index cf33d74366..cebd863924 100644 --- a/src/core/iomgr/iocp_windows.c +++ b/src/core/iomgr/iocp_windows.c @@ -62,13 +62,13 @@ static DWORD deadline_to_millis_timeout(gpr_timespec deadline, return INFINITE; } if (gpr_time_cmp(deadline, gpr_time_add(now, gpr_time_from_micros( - max_spin_polling_us, - GPR_TIMESPAN))) <= 0) { + max_spin_polling_us, + GPR_TIMESPAN))) <= 0) { return 0; } timeout = gpr_time_sub(deadline, now); return gpr_time_to_millis(gpr_time_add( - timeout, gpr_time_from_nanos(GPR_NS_PER_MS - 1, GPR_TIMESPAN))); + timeout, gpr_time_from_nanos(GPR_NS_PER_MS - 1, GPR_TIMESPAN))); } void grpc_iocp_work(grpc_exec_ctx *exec_ctx, gpr_timespec deadline) { @@ -80,8 +80,9 @@ void grpc_iocp_work(grpc_exec_ctx *exec_ctx, gpr_timespec deadline) { grpc_winsocket *socket; grpc_winsocket_callback_info *info; grpc_closure *closure = NULL; - success = GetQueuedCompletionStatus(g_iocp, &bytes, &completion_key, - &overlapped, deadline_to_millis_timeout(deadline, gpr_now(deadline.clock_type))); + success = GetQueuedCompletionStatus( + g_iocp, &bytes, &completion_key, &overlapped, + deadline_to_millis_timeout(deadline, gpr_now(deadline.clock_type))); if (success == 0 && overlapped == NULL) { return; } @@ -139,7 +140,7 @@ void grpc_iocp_kick(void) { void grpc_iocp_flush(void) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - + do { grpc_iocp_work(&exec_ctx, gpr_inf_past(GPR_CLOCK_MONOTONIC)); } while (grpc_exec_ctx_flush(&exec_ctx)); diff --git a/src/core/iomgr/iomgr_posix.c b/src/core/iomgr/iomgr_posix.c index f6474b7e6d..fecb7b9760 100644 --- a/src/core/iomgr/iomgr_posix.c +++ b/src/core/iomgr/iomgr_posix.c @@ -45,11 +45,8 @@ void grpc_iomgr_platform_init(void) { grpc_register_tracer("tcp", &grpc_tcp_trace); } -void grpc_iomgr_platform_flush(void) { -} +void grpc_iomgr_platform_flush(void) {} -void grpc_iomgr_platform_shutdown(void) { - grpc_fd_global_shutdown(); -} +void grpc_iomgr_platform_shutdown(void) { grpc_fd_global_shutdown(); } #endif /* GRPC_POSIX_SOCKET */ diff --git a/src/core/iomgr/iomgr_windows.c b/src/core/iomgr/iomgr_windows.c index 93bdc5ec16..14775516bb 100644 --- a/src/core/iomgr/iomgr_windows.c +++ b/src/core/iomgr/iomgr_windows.c @@ -63,9 +63,7 @@ void grpc_iomgr_platform_init(void) { grpc_iocp_init(); } -void grpc_iomgr_platform_flush(void) { - grpc_iocp_flush(); -} +void grpc_iomgr_platform_flush(void) { grpc_iocp_flush(); } void grpc_iomgr_platform_shutdown(void) { grpc_iocp_shutdown(); diff --git a/src/core/iomgr/pollset_multipoller_with_epoll.c b/src/core/iomgr/pollset_multipoller_with_epoll.c index d26e60f665..faf0a6362b 100644 --- a/src/core/iomgr/pollset_multipoller_with_epoll.c +++ b/src/core/iomgr/pollset_multipoller_with_epoll.c @@ -198,7 +198,7 @@ static void multipoll_with_epoll_pollset_maybe_work_and_unlock( } if (pfds[1].revents) { do { - /* The following epoll_wait never blocks; it has a timeout of 0 */ + /* The following epoll_wait never blocks; it has a timeout of 0 */ ep_rv = epoll_wait(h->epoll_fd, ep_ev, GRPC_EPOLL_MAX_EVENTS, 0); if (ep_rv < 0) { if (errno != EINTR) { @@ -264,9 +264,11 @@ static void epoll_become_multipoller(grpc_exec_ctx *exec_ctx, ev.events = (uint32_t)(EPOLLIN | EPOLLET); ev.data.ptr = NULL; - err = epoll_ctl(h->epoll_fd, EPOLL_CTL_ADD, GRPC_WAKEUP_FD_GET_READ_FD(&grpc_global_wakeup_fd), &ev); + err = epoll_ctl(h->epoll_fd, EPOLL_CTL_ADD, + GRPC_WAKEUP_FD_GET_READ_FD(&grpc_global_wakeup_fd), &ev); if (err < 0) { - gpr_log(GPR_ERROR, "epoll_ctl add for %d failed: %s", GRPC_WAKEUP_FD_GET_READ_FD(&grpc_global_wakeup_fd), + gpr_log(GPR_ERROR, "epoll_ctl add for %d failed: %s", + GRPC_WAKEUP_FD_GET_READ_FD(&grpc_global_wakeup_fd), strerror(errno)); } diff --git a/src/core/iomgr/pollset_posix.c b/src/core/iomgr/pollset_posix.c index 82a82cc064..464c1f6ae3 100644 --- a/src/core/iomgr/pollset_posix.c +++ b/src/core/iomgr/pollset_posix.c @@ -139,9 +139,7 @@ void grpc_pollset_global_shutdown(void) { gpr_tls_destroy(&g_current_thread_worker); } -void grpc_kick_poller(void) { - grpc_wakeup_fd_wakeup(&grpc_global_wakeup_fd); -} +void grpc_kick_poller(void) { grpc_wakeup_fd_wakeup(&grpc_global_wakeup_fd); } /* main interface */ diff --git a/src/core/iomgr/pollset_windows.c b/src/core/iomgr/pollset_windows.c index 1b4935a841..96abaea0b3 100644 --- a/src/core/iomgr/pollset_windows.c +++ b/src/core/iomgr/pollset_windows.c @@ -51,22 +51,21 @@ void grpc_pollset_global_init() { gpr_mu_init(&grpc_polling_mu); g_active_poller = NULL; g_global_root_worker.links[GRPC_POLLSET_WORKER_LINK_GLOBAL].next = - g_global_root_worker.links[GRPC_POLLSET_WORKER_LINK_GLOBAL].prev = - &g_global_root_worker; + g_global_root_worker.links[GRPC_POLLSET_WORKER_LINK_GLOBAL].prev = + &g_global_root_worker; } -void grpc_pollset_global_shutdown() { - gpr_mu_destroy(&grpc_polling_mu); -} +void grpc_pollset_global_shutdown() { gpr_mu_destroy(&grpc_polling_mu); } -static void remove_worker(grpc_pollset_worker *worker, +static void remove_worker(grpc_pollset_worker *worker, grpc_pollset_worker_link_type type) { worker->links[type].prev->links[type].next = worker->links[type].next; worker->links[type].next->links[type].prev = worker->links[type].prev; worker->links[type].next = worker->links[type].prev = worker; } -static int has_workers(grpc_pollset_worker *root, grpc_pollset_worker_link_type type) { +static int has_workers(grpc_pollset_worker *root, + grpc_pollset_worker_link_type type) { return root->links[type].next != root; } @@ -81,24 +80,22 @@ static grpc_pollset_worker *pop_front_worker( } } -static void push_back_worker(grpc_pollset_worker *root, - grpc_pollset_worker_link_type type, +static void push_back_worker(grpc_pollset_worker *root, + grpc_pollset_worker_link_type type, grpc_pollset_worker *worker) { worker->links[type].next = root; worker->links[type].prev = worker->links[type].next->links[type].prev; - worker->links[type].prev->links[type].next = - worker->links[type].next->links[type].prev = - worker; + worker->links[type].prev->links[type].next = + worker->links[type].next->links[type].prev = worker; } -static void push_front_worker(grpc_pollset_worker *root, - grpc_pollset_worker_link_type type, +static void push_front_worker(grpc_pollset_worker *root, + grpc_pollset_worker_link_type type, grpc_pollset_worker *worker) { worker->links[type].prev = root; worker->links[type].next = worker->links[type].prev->links[type].next; - worker->links[type].prev->links[type].next = - worker->links[type].next->links[type].prev = - worker; + worker->links[type].prev->links[type].next = + worker->links[type].next->links[type].prev = worker; } /* There isn't really any such thing as a pollset under Windows, due to the @@ -108,9 +105,9 @@ static void push_front_worker(grpc_pollset_worker *root, void grpc_pollset_init(grpc_pollset *pollset) { memset(pollset, 0, sizeof(*pollset)); - pollset->root_worker.links[GRPC_POLLSET_WORKER_LINK_POLLSET].next = - pollset->root_worker.links[GRPC_POLLSET_WORKER_LINK_POLLSET].prev = - &pollset->root_worker; + pollset->root_worker.links[GRPC_POLLSET_WORKER_LINK_POLLSET].next = + pollset->root_worker.links[GRPC_POLLSET_WORKER_LINK_POLLSET].prev = + &pollset->root_worker; } void grpc_pollset_shutdown(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset, @@ -126,18 +123,16 @@ void grpc_pollset_shutdown(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset, gpr_mu_unlock(&grpc_polling_mu); } -void grpc_pollset_destroy(grpc_pollset *pollset) { -} +void grpc_pollset_destroy(grpc_pollset *pollset) {} void grpc_pollset_work(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset, grpc_pollset_worker *worker, gpr_timespec now, gpr_timespec deadline) { int added_worker = 0; - worker->links[GRPC_POLLSET_WORKER_LINK_POLLSET].next = - worker->links[GRPC_POLLSET_WORKER_LINK_POLLSET].prev = - worker->links[GRPC_POLLSET_WORKER_LINK_GLOBAL].next = - worker->links[GRPC_POLLSET_WORKER_LINK_GLOBAL].prev = - NULL; + worker->links[GRPC_POLLSET_WORKER_LINK_POLLSET].next = + worker->links[GRPC_POLLSET_WORKER_LINK_POLLSET].prev = + worker->links[GRPC_POLLSET_WORKER_LINK_GLOBAL].next = + worker->links[GRPC_POLLSET_WORKER_LINK_GLOBAL].prev = NULL; worker->kicked = 0; worker->pollset = pollset; gpr_cv_init(&worker->cv); @@ -157,9 +152,13 @@ void grpc_pollset_work(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset, pollset->is_iocp_worker = 0; g_active_poller = NULL; /* try to get a worker from this pollsets worker list */ - next_worker = pop_front_worker(&pollset->root_worker, GRPC_POLLSET_WORKER_LINK_POLLSET); - /* try to get a worker from the global list */ - next_worker = pop_front_worker(&g_global_root_worker, GRPC_POLLSET_WORKER_LINK_GLOBAL); + next_worker = pop_front_worker(&pollset->root_worker, + GRPC_POLLSET_WORKER_LINK_POLLSET); + if (next_worker == NULL) { + /* try to get a worker from the global list */ + next_worker = pop_front_worker(&g_global_root_worker, + GRPC_POLLSET_WORKER_LINK_GLOBAL); + } if (next_worker != NULL) { next_worker->kicked = 1; gpr_cv_signal(&next_worker->cv); @@ -171,8 +170,10 @@ void grpc_pollset_work(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset, } goto done; } - push_front_worker(&g_global_root_worker, GRPC_POLLSET_WORKER_LINK_GLOBAL, worker); - push_front_worker(&pollset->root_worker, GRPC_POLLSET_WORKER_LINK_POLLSET, worker); + push_front_worker(&g_global_root_worker, GRPC_POLLSET_WORKER_LINK_GLOBAL, + worker); + push_front_worker(&pollset->root_worker, GRPC_POLLSET_WORKER_LINK_POLLSET, + worker); added_worker = 1; while (!worker->kicked) { if (gpr_cv_wait(&worker->cv, &grpc_polling_mu, deadline)) { @@ -198,9 +199,11 @@ done: void grpc_pollset_kick(grpc_pollset *p, grpc_pollset_worker *specific_worker) { if (specific_worker != NULL) { if (specific_worker == GRPC_POLLSET_KICK_BROADCAST) { - for (specific_worker = p->root_worker.links[GRPC_POLLSET_WORKER_LINK_POLLSET].next; + for (specific_worker = + p->root_worker.links[GRPC_POLLSET_WORKER_LINK_POLLSET].next; specific_worker != &p->root_worker; - specific_worker = specific_worker->links[GRPC_POLLSET_WORKER_LINK_POLLSET].next) { + specific_worker = + specific_worker->links[GRPC_POLLSET_WORKER_LINK_POLLSET].next) { specific_worker->kicked = 1; gpr_cv_signal(&specific_worker->cv); } @@ -219,7 +222,8 @@ void grpc_pollset_kick(grpc_pollset *p, grpc_pollset_worker *specific_worker) { } } } else { - specific_worker = pop_front_worker(&p->root_worker, GRPC_POLLSET_WORKER_LINK_POLLSET); + specific_worker = + pop_front_worker(&p->root_worker, GRPC_POLLSET_WORKER_LINK_POLLSET); if (specific_worker != NULL) { grpc_pollset_kick(p, specific_worker); } else if (p->is_iocp_worker) { @@ -230,8 +234,6 @@ void grpc_pollset_kick(grpc_pollset *p, grpc_pollset_worker *specific_worker) { } } -void grpc_kick_poller(void) { - grpc_iocp_kick(); -} +void grpc_kick_poller(void) { grpc_iocp_kick(); } #endif /* GPR_WINSOCK_SOCKET */ diff --git a/src/core/iomgr/tcp_posix.c b/src/core/iomgr/tcp_posix.c index 54ebad7dbc..4a57037a72 100644 --- a/src/core/iomgr/tcp_posix.c +++ b/src/core/iomgr/tcp_posix.c @@ -292,7 +292,7 @@ static flush_result tcp_flush(grpc_tcp *tcp) { unwind_slice_idx = tcp->outgoing_slice_idx; unwind_byte_idx = tcp->outgoing_byte_idx; for (iov_size = 0; tcp->outgoing_slice_idx != tcp->outgoing_buffer->count && - iov_size != MAX_WRITE_IOVEC; + iov_size != MAX_WRITE_IOVEC; iov_size++) { iov[iov_size].iov_base = GPR_SLICE_START_PTR( @@ -441,7 +441,7 @@ static char *tcp_get_peer(grpc_endpoint *ep) { } static const grpc_endpoint_vtable vtable = { - tcp_read, tcp_write, tcp_add_to_pollset, tcp_add_to_pollset_set, + tcp_read, tcp_write, tcp_add_to_pollset, tcp_add_to_pollset_set, tcp_shutdown, tcp_destroy, tcp_get_peer}; grpc_endpoint *grpc_tcp_create(grpc_fd *em_fd, size_t slice_size, diff --git a/src/core/iomgr/tcp_server_windows.c b/src/core/iomgr/tcp_server_windows.c index 4b11ab0f06..db3319b3c6 100644 --- a/src/core/iomgr/tcp_server_windows.c +++ b/src/core/iomgr/tcp_server_windows.c @@ -382,7 +382,7 @@ static int add_socket_to_server(grpc_tcp_server *s, SOCKET sock, if (s->nports == s->port_capacity) { /* too many ports, and we need to store their address in a closure */ /* TODO(ctiller): make server_port a linked list */ - abort(); + abort(); } sp = &s->ports[s->nports++]; sp->server = s; diff --git a/src/core/iomgr/tcp_windows.c b/src/core/iomgr/tcp_windows.c index b67683dbfd..9ceffca065 100644 --- a/src/core/iomgr/tcp_windows.c +++ b/src/core/iomgr/tcp_windows.c @@ -382,9 +382,9 @@ static char *win_get_peer(grpc_endpoint *ep) { return gpr_strdup(tcp->peer_string); } -static grpc_endpoint_vtable vtable = { - win_read, win_write, win_add_to_pollset, win_add_to_pollset_set, - win_shutdown, win_destroy, win_get_peer}; +static grpc_endpoint_vtable vtable = {win_read, win_write, win_add_to_pollset, + win_add_to_pollset_set, win_shutdown, + win_destroy, win_get_peer}; grpc_endpoint *grpc_tcp_create(grpc_winsocket *socket, char *peer_string) { grpc_tcp *tcp = (grpc_tcp *)gpr_malloc(sizeof(grpc_tcp)); diff --git a/src/core/iomgr/udp_server.c b/src/core/iomgr/udp_server.c index a8d611c3f2..59df47fcb3 100644 --- a/src/core/iomgr/udp_server.c +++ b/src/core/iomgr/udp_server.c @@ -118,7 +118,7 @@ struct grpc_udp_server { /* number of pollsets in the pollsets array */ size_t pollset_count; /* The parent grpc server */ - grpc_server* grpc_server; + grpc_server *grpc_server; }; grpc_udp_server *grpc_udp_server_create(void) { diff --git a/src/core/security/client_auth_filter.c b/src/core/security/client_auth_filter.c index 3f4c084ffc..635982b252 100644 --- a/src/core/security/client_auth_filter.c +++ b/src/core/security/client_auth_filter.c @@ -355,8 +355,7 @@ static void destroy_channel_elem(grpc_exec_ctx *exec_ctx, } const grpc_channel_filter grpc_client_auth_filter = { - auth_start_transport_op, grpc_channel_next_op, - sizeof(call_data), init_call_elem, - destroy_call_elem, sizeof(channel_data), - init_channel_elem, destroy_channel_elem, - grpc_call_next_get_peer, "client-auth"}; + auth_start_transport_op, grpc_channel_next_op, sizeof(call_data), + init_call_elem, destroy_call_elem, sizeof(channel_data), + init_channel_elem, destroy_channel_elem, grpc_call_next_get_peer, + "client-auth"}; diff --git a/src/core/security/secure_endpoint.c b/src/core/security/secure_endpoint.c index 0288f7128a..fd50abb773 100644 --- a/src/core/security/secure_endpoint.c +++ b/src/core/security/secure_endpoint.c @@ -354,9 +354,8 @@ static char *endpoint_get_peer(grpc_endpoint *secure_ep) { } static const grpc_endpoint_vtable vtable = { - endpoint_read, endpoint_write, - endpoint_add_to_pollset, endpoint_add_to_pollset_set, - endpoint_shutdown, endpoint_destroy, + endpoint_read, endpoint_write, endpoint_add_to_pollset, + endpoint_add_to_pollset_set, endpoint_shutdown, endpoint_destroy, endpoint_get_peer}; grpc_endpoint *grpc_secure_endpoint_create( diff --git a/src/core/security/server_auth_filter.c b/src/core/security/server_auth_filter.c index 9638b18e88..30ca9f57a2 100644 --- a/src/core/security/server_auth_filter.c +++ b/src/core/security/server_auth_filter.c @@ -273,8 +273,7 @@ static void destroy_channel_elem(grpc_exec_ctx *exec_ctx, } const grpc_channel_filter grpc_server_auth_filter = { - auth_start_transport_op, grpc_channel_next_op, - sizeof(call_data), init_call_elem, - destroy_call_elem, sizeof(channel_data), - init_channel_elem, destroy_channel_elem, - grpc_call_next_get_peer, "server-auth"}; + auth_start_transport_op, grpc_channel_next_op, sizeof(call_data), + init_call_elem, destroy_call_elem, sizeof(channel_data), + init_channel_elem, destroy_channel_elem, grpc_call_next_get_peer, + "server-auth"}; diff --git a/src/core/statistics/census_rpc_stats.c b/src/core/statistics/census_rpc_stats.c index ba2c81d6a3..d6638ed641 100644 --- a/src/core/statistics/census_rpc_stats.c +++ b/src/core/statistics/census_rpc_stats.c @@ -85,8 +85,8 @@ static void delete_key(void *key) { gpr_free(key); } static const census_ht_option ht_opt = { CENSUS_HT_POINTER /* key type */, 1999 /* n_of_buckets */, - simple_hash /* hash function */, cmp_str_keys /* key comparator */, - delete_stats /* data deleter */, delete_key /* key deleter */ + simple_hash /* hash function */, cmp_str_keys /* key comparator */, + delete_stats /* data deleter */, delete_key /* key deleter */ }; static void init_rpc_stats(void *stats) { diff --git a/src/core/statistics/census_tracing.c b/src/core/statistics/census_tracing.c index 0eeecfe6c8..ecbe27e536 100644 --- a/src/core/statistics/census_tracing.c +++ b/src/core/statistics/census_tracing.c @@ -60,11 +60,8 @@ static void delete_trace_obj(void *obj) { } static const census_ht_option ht_opt = { - CENSUS_HT_UINT64 /* key type */, - 571 /* n_of_buckets */, - NULL /* hash */, - NULL /* compare_keys */, - delete_trace_obj /* delete data */, + CENSUS_HT_UINT64 /* key type */, 571 /* n_of_buckets */, NULL /* hash */, + NULL /* compare_keys */, delete_trace_obj /* delete data */, NULL /* delete key */ }; diff --git a/src/core/support/slice_buffer.c b/src/core/support/slice_buffer.c index a1aa56fd72..310fbe1350 100644 --- a/src/core/support/slice_buffer.c +++ b/src/core/support/slice_buffer.c @@ -208,7 +208,8 @@ void gpr_slice_buffer_move_into(gpr_slice_buffer *src, gpr_slice_buffer *dst) { src->length = 0; } -void gpr_slice_buffer_trim_end(gpr_slice_buffer *sb, size_t n, gpr_slice_buffer *garbage) { +void gpr_slice_buffer_trim_end(gpr_slice_buffer *sb, size_t n, + gpr_slice_buffer *garbage) { GPR_ASSERT(n <= sb->length); sb->length -= n; for (;;) { diff --git a/src/core/surface/lame_client.c b/src/core/surface/lame_client.c index 0b22d225d0..9e14ce2191 100644 --- a/src/core/surface/lame_client.c +++ b/src/core/surface/lame_client.c @@ -133,16 +133,9 @@ static void destroy_channel_elem(grpc_exec_ctx *exec_ctx, grpc_channel_element *elem) {} static const grpc_channel_filter lame_filter = { - lame_start_transport_stream_op, - lame_start_transport_op, - sizeof(call_data), - init_call_elem, - destroy_call_elem, - sizeof(channel_data), - init_channel_elem, - destroy_channel_elem, - lame_get_peer, - "lame-client", + lame_start_transport_stream_op, lame_start_transport_op, sizeof(call_data), + init_call_elem, destroy_call_elem, sizeof(channel_data), init_channel_elem, + destroy_channel_elem, lame_get_peer, "lame-client", }; #define CHANNEL_STACK_FROM_CHANNEL(c) ((grpc_channel_stack *)((c) + 1)) diff --git a/src/core/surface/server.c b/src/core/surface/server.c index 41191ebf26..e3ce88b3e6 100644 --- a/src/core/surface/server.c +++ b/src/core/surface/server.c @@ -767,16 +767,9 @@ static void destroy_channel_elem(grpc_exec_ctx *exec_ctx, } static const grpc_channel_filter server_surface_filter = { - server_start_transport_stream_op, - grpc_channel_next_op, - sizeof(call_data), - init_call_elem, - destroy_call_elem, - sizeof(channel_data), - init_channel_elem, - destroy_channel_elem, - grpc_call_next_get_peer, - "server", + server_start_transport_stream_op, grpc_channel_next_op, sizeof(call_data), + init_call_elem, destroy_call_elem, sizeof(channel_data), init_channel_elem, + destroy_channel_elem, grpc_call_next_get_peer, "server", }; void grpc_server_register_completion_queue(grpc_server *server, @@ -940,8 +933,7 @@ void grpc_server_setup_transport(grpc_exec_ctx *exec_ctx, grpc_server *s, channel = grpc_channel_create_from_filters(exec_ctx, NULL, filters, num_filters, args, mdctx, 0); chand = (channel_data *)grpc_channel_stack_element( - grpc_channel_get_channel_stack(channel), 0) - ->channel_data; + grpc_channel_get_channel_stack(channel), 0)->channel_data; chand->server = s; server_ref(s); chand->channel = channel; @@ -962,7 +954,7 @@ void grpc_server_setup_transport(grpc_exec_ctx *exec_ctx, grpc_server *s, method = grpc_mdstr_from_string(mdctx, rm->method); hash = GRPC_MDSTR_KV_HASH(host ? host->hash : 0, method->hash); for (probes = 0; chand->registered_methods[(hash + probes) % slots] - .server_registered_method != NULL; + .server_registered_method != NULL; probes++) ; if (probes > max_probes) max_probes = probes; diff --git a/src/core/surface/version.c b/src/core/surface/version.c index 4b90e06a04..e559d51448 100644 --- a/src/core/surface/version.c +++ b/src/core/surface/version.c @@ -36,6 +36,4 @@ #include <grpc/grpc.h> -const char *grpc_version_string(void) { - return "0.11.0.0"; -} +const char *grpc_version_string(void) { return "0.11.0.0"; } diff --git a/src/core/transport/chttp2/bin_encoder.c b/src/core/transport/chttp2/bin_encoder.c index e21d800083..f1bbf9aa91 100644 --- a/src/core/transport/chttp2/bin_encoder.c +++ b/src/core/transport/chttp2/bin_encoder.c @@ -46,18 +46,70 @@ typedef struct { gpr_uint8 length; } b64_huff_sym; -static const b64_huff_sym huff_alphabet[64] = { - {0x21, 6}, {0x5d, 7}, {0x5e, 7}, {0x5f, 7}, {0x60, 7}, {0x61, 7}, - {0x62, 7}, {0x63, 7}, {0x64, 7}, {0x65, 7}, {0x66, 7}, {0x67, 7}, - {0x68, 7}, {0x69, 7}, {0x6a, 7}, {0x6b, 7}, {0x6c, 7}, {0x6d, 7}, - {0x6e, 7}, {0x6f, 7}, {0x70, 7}, {0x71, 7}, {0x72, 7}, {0xfc, 8}, - {0x73, 7}, {0xfd, 8}, {0x3, 5}, {0x23, 6}, {0x4, 5}, {0x24, 6}, - {0x5, 5}, {0x25, 6}, {0x26, 6}, {0x27, 6}, {0x6, 5}, {0x74, 7}, - {0x75, 7}, {0x28, 6}, {0x29, 6}, {0x2a, 6}, {0x7, 5}, {0x2b, 6}, - {0x76, 7}, {0x2c, 6}, {0x8, 5}, {0x9, 5}, {0x2d, 6}, {0x77, 7}, - {0x78, 7}, {0x79, 7}, {0x7a, 7}, {0x7b, 7}, {0x0, 5}, {0x1, 5}, - {0x2, 5}, {0x19, 6}, {0x1a, 6}, {0x1b, 6}, {0x1c, 6}, {0x1d, 6}, - {0x1e, 6}, {0x1f, 6}, {0x7fb, 11}, {0x18, 6}}; +static const b64_huff_sym huff_alphabet[64] = {{0x21, 6}, + {0x5d, 7}, + {0x5e, 7}, + {0x5f, 7}, + {0x60, 7}, + {0x61, 7}, + {0x62, 7}, + {0x63, 7}, + {0x64, 7}, + {0x65, 7}, + {0x66, 7}, + {0x67, 7}, + {0x68, 7}, + {0x69, 7}, + {0x6a, 7}, + {0x6b, 7}, + {0x6c, 7}, + {0x6d, 7}, + {0x6e, 7}, + {0x6f, 7}, + {0x70, 7}, + {0x71, 7}, + {0x72, 7}, + {0xfc, 8}, + {0x73, 7}, + {0xfd, 8}, + {0x3, 5}, + {0x23, 6}, + {0x4, 5}, + {0x24, 6}, + {0x5, 5}, + {0x25, 6}, + {0x26, 6}, + {0x27, 6}, + {0x6, 5}, + {0x74, 7}, + {0x75, 7}, + {0x28, 6}, + {0x29, 6}, + {0x2a, 6}, + {0x7, 5}, + {0x2b, 6}, + {0x76, 7}, + {0x2c, 6}, + {0x8, 5}, + {0x9, 5}, + {0x2d, 6}, + {0x77, 7}, + {0x78, 7}, + {0x79, 7}, + {0x7a, 7}, + {0x7b, 7}, + {0x0, 5}, + {0x1, 5}, + {0x2, 5}, + {0x19, 6}, + {0x1a, 6}, + {0x1b, 6}, + {0x1c, 6}, + {0x1d, 6}, + {0x1e, 6}, + {0x1f, 6}, + {0x7fb, 11}, + {0x18, 6}}; static const gpr_uint8 tail_xtra[3] = {0, 2, 3}; diff --git a/src/core/transport/chttp2/hpack_parser.c b/src/core/transport/chttp2/hpack_parser.c index 3b0a5e7207..20ea513375 100644 --- a/src/core/transport/chttp2/hpack_parser.c +++ b/src/core/transport/chttp2/hpack_parser.c @@ -150,12 +150,10 @@ typedef enum { /* jump table of parse state functions -- order must match first_byte_type above */ static const grpc_chttp2_hpack_parser_state first_byte_action[] = { - parse_indexed_field, parse_indexed_field_x, - parse_lithdr_incidx, parse_lithdr_incidx_x, - parse_lithdr_incidx_v, parse_lithdr_notidx, - parse_lithdr_notidx_x, parse_lithdr_notidx_v, - parse_lithdr_nvridx, parse_lithdr_nvridx_x, - parse_lithdr_nvridx_v, parse_max_tbl_size, + parse_indexed_field, parse_indexed_field_x, parse_lithdr_incidx, + parse_lithdr_incidx_x, parse_lithdr_incidx_v, parse_lithdr_notidx, + parse_lithdr_notidx_x, parse_lithdr_notidx_v, parse_lithdr_nvridx, + parse_lithdr_nvridx_x, parse_lithdr_nvridx_v, parse_max_tbl_size, parse_max_tbl_size_x, parse_error}; /* indexes the first byte to a parse state function - generated by diff --git a/src/core/transport/chttp2/huffsyms.c b/src/core/transport/chttp2/huffsyms.c index 6f5cf6a2a9..7b138e9b5d 100644 --- a/src/core/transport/chttp2/huffsyms.c +++ b/src/core/transport/chttp2/huffsyms.c @@ -37,69 +37,261 @@ command: :%s/.* \([0-9a-f]\+\) \[ *\([0-9]\+\)\]/{0x\1, \2},/g */ const grpc_chttp2_huffsym grpc_chttp2_huffsyms[GRPC_CHTTP2_NUM_HUFFSYMS] = { - {0x1ff8, 13}, {0x7fffd8, 23}, {0xfffffe2, 28}, {0xfffffe3, 28}, - {0xfffffe4, 28}, {0xfffffe5, 28}, {0xfffffe6, 28}, {0xfffffe7, 28}, - {0xfffffe8, 28}, {0xffffea, 24}, {0x3ffffffc, 30}, {0xfffffe9, 28}, - {0xfffffea, 28}, {0x3ffffffd, 30}, {0xfffffeb, 28}, {0xfffffec, 28}, - {0xfffffed, 28}, {0xfffffee, 28}, {0xfffffef, 28}, {0xffffff0, 28}, - {0xffffff1, 28}, {0xffffff2, 28}, {0x3ffffffe, 30}, {0xffffff3, 28}, - {0xffffff4, 28}, {0xffffff5, 28}, {0xffffff6, 28}, {0xffffff7, 28}, - {0xffffff8, 28}, {0xffffff9, 28}, {0xffffffa, 28}, {0xffffffb, 28}, - {0x14, 6}, {0x3f8, 10}, {0x3f9, 10}, {0xffa, 12}, - {0x1ff9, 13}, {0x15, 6}, {0xf8, 8}, {0x7fa, 11}, - {0x3fa, 10}, {0x3fb, 10}, {0xf9, 8}, {0x7fb, 11}, - {0xfa, 8}, {0x16, 6}, {0x17, 6}, {0x18, 6}, - {0x0, 5}, {0x1, 5}, {0x2, 5}, {0x19, 6}, - {0x1a, 6}, {0x1b, 6}, {0x1c, 6}, {0x1d, 6}, - {0x1e, 6}, {0x1f, 6}, {0x5c, 7}, {0xfb, 8}, - {0x7ffc, 15}, {0x20, 6}, {0xffb, 12}, {0x3fc, 10}, - {0x1ffa, 13}, {0x21, 6}, {0x5d, 7}, {0x5e, 7}, - {0x5f, 7}, {0x60, 7}, {0x61, 7}, {0x62, 7}, - {0x63, 7}, {0x64, 7}, {0x65, 7}, {0x66, 7}, - {0x67, 7}, {0x68, 7}, {0x69, 7}, {0x6a, 7}, - {0x6b, 7}, {0x6c, 7}, {0x6d, 7}, {0x6e, 7}, - {0x6f, 7}, {0x70, 7}, {0x71, 7}, {0x72, 7}, - {0xfc, 8}, {0x73, 7}, {0xfd, 8}, {0x1ffb, 13}, - {0x7fff0, 19}, {0x1ffc, 13}, {0x3ffc, 14}, {0x22, 6}, - {0x7ffd, 15}, {0x3, 5}, {0x23, 6}, {0x4, 5}, - {0x24, 6}, {0x5, 5}, {0x25, 6}, {0x26, 6}, - {0x27, 6}, {0x6, 5}, {0x74, 7}, {0x75, 7}, - {0x28, 6}, {0x29, 6}, {0x2a, 6}, {0x7, 5}, - {0x2b, 6}, {0x76, 7}, {0x2c, 6}, {0x8, 5}, - {0x9, 5}, {0x2d, 6}, {0x77, 7}, {0x78, 7}, - {0x79, 7}, {0x7a, 7}, {0x7b, 7}, {0x7ffe, 15}, - {0x7fc, 11}, {0x3ffd, 14}, {0x1ffd, 13}, {0xffffffc, 28}, - {0xfffe6, 20}, {0x3fffd2, 22}, {0xfffe7, 20}, {0xfffe8, 20}, - {0x3fffd3, 22}, {0x3fffd4, 22}, {0x3fffd5, 22}, {0x7fffd9, 23}, - {0x3fffd6, 22}, {0x7fffda, 23}, {0x7fffdb, 23}, {0x7fffdc, 23}, - {0x7fffdd, 23}, {0x7fffde, 23}, {0xffffeb, 24}, {0x7fffdf, 23}, - {0xffffec, 24}, {0xffffed, 24}, {0x3fffd7, 22}, {0x7fffe0, 23}, - {0xffffee, 24}, {0x7fffe1, 23}, {0x7fffe2, 23}, {0x7fffe3, 23}, - {0x7fffe4, 23}, {0x1fffdc, 21}, {0x3fffd8, 22}, {0x7fffe5, 23}, - {0x3fffd9, 22}, {0x7fffe6, 23}, {0x7fffe7, 23}, {0xffffef, 24}, - {0x3fffda, 22}, {0x1fffdd, 21}, {0xfffe9, 20}, {0x3fffdb, 22}, - {0x3fffdc, 22}, {0x7fffe8, 23}, {0x7fffe9, 23}, {0x1fffde, 21}, - {0x7fffea, 23}, {0x3fffdd, 22}, {0x3fffde, 22}, {0xfffff0, 24}, - {0x1fffdf, 21}, {0x3fffdf, 22}, {0x7fffeb, 23}, {0x7fffec, 23}, - {0x1fffe0, 21}, {0x1fffe1, 21}, {0x3fffe0, 22}, {0x1fffe2, 21}, - {0x7fffed, 23}, {0x3fffe1, 22}, {0x7fffee, 23}, {0x7fffef, 23}, - {0xfffea, 20}, {0x3fffe2, 22}, {0x3fffe3, 22}, {0x3fffe4, 22}, - {0x7ffff0, 23}, {0x3fffe5, 22}, {0x3fffe6, 22}, {0x7ffff1, 23}, - {0x3ffffe0, 26}, {0x3ffffe1, 26}, {0xfffeb, 20}, {0x7fff1, 19}, - {0x3fffe7, 22}, {0x7ffff2, 23}, {0x3fffe8, 22}, {0x1ffffec, 25}, - {0x3ffffe2, 26}, {0x3ffffe3, 26}, {0x3ffffe4, 26}, {0x7ffffde, 27}, - {0x7ffffdf, 27}, {0x3ffffe5, 26}, {0xfffff1, 24}, {0x1ffffed, 25}, - {0x7fff2, 19}, {0x1fffe3, 21}, {0x3ffffe6, 26}, {0x7ffffe0, 27}, - {0x7ffffe1, 27}, {0x3ffffe7, 26}, {0x7ffffe2, 27}, {0xfffff2, 24}, - {0x1fffe4, 21}, {0x1fffe5, 21}, {0x3ffffe8, 26}, {0x3ffffe9, 26}, - {0xffffffd, 28}, {0x7ffffe3, 27}, {0x7ffffe4, 27}, {0x7ffffe5, 27}, - {0xfffec, 20}, {0xfffff3, 24}, {0xfffed, 20}, {0x1fffe6, 21}, - {0x3fffe9, 22}, {0x1fffe7, 21}, {0x1fffe8, 21}, {0x7ffff3, 23}, - {0x3fffea, 22}, {0x3fffeb, 22}, {0x1ffffee, 25}, {0x1ffffef, 25}, - {0xfffff4, 24}, {0xfffff5, 24}, {0x3ffffea, 26}, {0x7ffff4, 23}, - {0x3ffffeb, 26}, {0x7ffffe6, 27}, {0x3ffffec, 26}, {0x3ffffed, 26}, - {0x7ffffe7, 27}, {0x7ffffe8, 27}, {0x7ffffe9, 27}, {0x7ffffea, 27}, - {0x7ffffeb, 27}, {0xffffffe, 28}, {0x7ffffec, 27}, {0x7ffffed, 27}, - {0x7ffffee, 27}, {0x7ffffef, 27}, {0x7fffff0, 27}, {0x3ffffee, 26}, + {0x1ff8, 13}, + {0x7fffd8, 23}, + {0xfffffe2, 28}, + {0xfffffe3, 28}, + {0xfffffe4, 28}, + {0xfffffe5, 28}, + {0xfffffe6, 28}, + {0xfffffe7, 28}, + {0xfffffe8, 28}, + {0xffffea, 24}, + {0x3ffffffc, 30}, + {0xfffffe9, 28}, + {0xfffffea, 28}, + {0x3ffffffd, 30}, + {0xfffffeb, 28}, + {0xfffffec, 28}, + {0xfffffed, 28}, + {0xfffffee, 28}, + {0xfffffef, 28}, + {0xffffff0, 28}, + {0xffffff1, 28}, + {0xffffff2, 28}, + {0x3ffffffe, 30}, + {0xffffff3, 28}, + {0xffffff4, 28}, + {0xffffff5, 28}, + {0xffffff6, 28}, + {0xffffff7, 28}, + {0xffffff8, 28}, + {0xffffff9, 28}, + {0xffffffa, 28}, + {0xffffffb, 28}, + {0x14, 6}, + {0x3f8, 10}, + {0x3f9, 10}, + {0xffa, 12}, + {0x1ff9, 13}, + {0x15, 6}, + {0xf8, 8}, + {0x7fa, 11}, + {0x3fa, 10}, + {0x3fb, 10}, + {0xf9, 8}, + {0x7fb, 11}, + {0xfa, 8}, + {0x16, 6}, + {0x17, 6}, + {0x18, 6}, + {0x0, 5}, + {0x1, 5}, + {0x2, 5}, + {0x19, 6}, + {0x1a, 6}, + {0x1b, 6}, + {0x1c, 6}, + {0x1d, 6}, + {0x1e, 6}, + {0x1f, 6}, + {0x5c, 7}, + {0xfb, 8}, + {0x7ffc, 15}, + {0x20, 6}, + {0xffb, 12}, + {0x3fc, 10}, + {0x1ffa, 13}, + {0x21, 6}, + {0x5d, 7}, + {0x5e, 7}, + {0x5f, 7}, + {0x60, 7}, + {0x61, 7}, + {0x62, 7}, + {0x63, 7}, + {0x64, 7}, + {0x65, 7}, + {0x66, 7}, + {0x67, 7}, + {0x68, 7}, + {0x69, 7}, + {0x6a, 7}, + {0x6b, 7}, + {0x6c, 7}, + {0x6d, 7}, + {0x6e, 7}, + {0x6f, 7}, + {0x70, 7}, + {0x71, 7}, + {0x72, 7}, + {0xfc, 8}, + {0x73, 7}, + {0xfd, 8}, + {0x1ffb, 13}, + {0x7fff0, 19}, + {0x1ffc, 13}, + {0x3ffc, 14}, + {0x22, 6}, + {0x7ffd, 15}, + {0x3, 5}, + {0x23, 6}, + {0x4, 5}, + {0x24, 6}, + {0x5, 5}, + {0x25, 6}, + {0x26, 6}, + {0x27, 6}, + {0x6, 5}, + {0x74, 7}, + {0x75, 7}, + {0x28, 6}, + {0x29, 6}, + {0x2a, 6}, + {0x7, 5}, + {0x2b, 6}, + {0x76, 7}, + {0x2c, 6}, + {0x8, 5}, + {0x9, 5}, + {0x2d, 6}, + {0x77, 7}, + {0x78, 7}, + {0x79, 7}, + {0x7a, 7}, + {0x7b, 7}, + {0x7ffe, 15}, + {0x7fc, 11}, + {0x3ffd, 14}, + {0x1ffd, 13}, + {0xffffffc, 28}, + {0xfffe6, 20}, + {0x3fffd2, 22}, + {0xfffe7, 20}, + {0xfffe8, 20}, + {0x3fffd3, 22}, + {0x3fffd4, 22}, + {0x3fffd5, 22}, + {0x7fffd9, 23}, + {0x3fffd6, 22}, + {0x7fffda, 23}, + {0x7fffdb, 23}, + {0x7fffdc, 23}, + {0x7fffdd, 23}, + {0x7fffde, 23}, + {0xffffeb, 24}, + {0x7fffdf, 23}, + {0xffffec, 24}, + {0xffffed, 24}, + {0x3fffd7, 22}, + {0x7fffe0, 23}, + {0xffffee, 24}, + {0x7fffe1, 23}, + {0x7fffe2, 23}, + {0x7fffe3, 23}, + {0x7fffe4, 23}, + {0x1fffdc, 21}, + {0x3fffd8, 22}, + {0x7fffe5, 23}, + {0x3fffd9, 22}, + {0x7fffe6, 23}, + {0x7fffe7, 23}, + {0xffffef, 24}, + {0x3fffda, 22}, + {0x1fffdd, 21}, + {0xfffe9, 20}, + {0x3fffdb, 22}, + {0x3fffdc, 22}, + {0x7fffe8, 23}, + {0x7fffe9, 23}, + {0x1fffde, 21}, + {0x7fffea, 23}, + {0x3fffdd, 22}, + {0x3fffde, 22}, + {0xfffff0, 24}, + {0x1fffdf, 21}, + {0x3fffdf, 22}, + {0x7fffeb, 23}, + {0x7fffec, 23}, + {0x1fffe0, 21}, + {0x1fffe1, 21}, + {0x3fffe0, 22}, + {0x1fffe2, 21}, + {0x7fffed, 23}, + {0x3fffe1, 22}, + {0x7fffee, 23}, + {0x7fffef, 23}, + {0xfffea, 20}, + {0x3fffe2, 22}, + {0x3fffe3, 22}, + {0x3fffe4, 22}, + {0x7ffff0, 23}, + {0x3fffe5, 22}, + {0x3fffe6, 22}, + {0x7ffff1, 23}, + {0x3ffffe0, 26}, + {0x3ffffe1, 26}, + {0xfffeb, 20}, + {0x7fff1, 19}, + {0x3fffe7, 22}, + {0x7ffff2, 23}, + {0x3fffe8, 22}, + {0x1ffffec, 25}, + {0x3ffffe2, 26}, + {0x3ffffe3, 26}, + {0x3ffffe4, 26}, + {0x7ffffde, 27}, + {0x7ffffdf, 27}, + {0x3ffffe5, 26}, + {0xfffff1, 24}, + {0x1ffffed, 25}, + {0x7fff2, 19}, + {0x1fffe3, 21}, + {0x3ffffe6, 26}, + {0x7ffffe0, 27}, + {0x7ffffe1, 27}, + {0x3ffffe7, 26}, + {0x7ffffe2, 27}, + {0xfffff2, 24}, + {0x1fffe4, 21}, + {0x1fffe5, 21}, + {0x3ffffe8, 26}, + {0x3ffffe9, 26}, + {0xffffffd, 28}, + {0x7ffffe3, 27}, + {0x7ffffe4, 27}, + {0x7ffffe5, 27}, + {0xfffec, 20}, + {0xfffff3, 24}, + {0xfffed, 20}, + {0x1fffe6, 21}, + {0x3fffe9, 22}, + {0x1fffe7, 21}, + {0x1fffe8, 21}, + {0x7ffff3, 23}, + {0x3fffea, 22}, + {0x3fffeb, 22}, + {0x1ffffee, 25}, + {0x1ffffef, 25}, + {0xfffff4, 24}, + {0xfffff5, 24}, + {0x3ffffea, 26}, + {0x7ffff4, 23}, + {0x3ffffeb, 26}, + {0x7ffffe6, 27}, + {0x3ffffec, 26}, + {0x3ffffed, 26}, + {0x7ffffe7, 27}, + {0x7ffffe8, 27}, + {0x7ffffe9, 27}, + {0x7ffffea, 27}, + {0x7ffffeb, 27}, + {0xffffffe, 28}, + {0x7ffffec, 27}, + {0x7ffffed, 27}, + {0x7ffffee, 27}, + {0x7ffffef, 27}, + {0x7fffff0, 27}, + {0x3ffffee, 26}, {0x3fffffff, 30}, }; diff --git a/src/core/transport/chttp2/stream_encoder.c b/src/core/transport/chttp2/stream_encoder.c index ec97af3d5d..83227e677d 100644 --- a/src/core/transport/chttp2/stream_encoder.c +++ b/src/core/transport/chttp2/stream_encoder.c @@ -278,7 +278,7 @@ static void emit_indexed(grpc_chttp2_hpack_compressor *c, gpr_uint32 elem_index, framer_state *st) { gpr_uint32 len = GRPC_CHTTP2_VARINT_LENGTH(elem_index, 1); GRPC_CHTTP2_WRITE_VARINT(elem_index, 1, 0x80, add_tiny_header_data(st, len), - len); + len); } static gpr_slice get_wire_value(grpc_mdelem *elem, gpr_uint8 *huffman_prefix) { @@ -365,7 +365,7 @@ static void emit_lithdr_noidx_v(grpc_chttp2_hpack_compressor *c, } static gpr_uint32 dynidx(grpc_chttp2_hpack_compressor *c, - gpr_uint32 elem_index) { + gpr_uint32 elem_index) { return 1 + GRPC_CHTTP2_LAST_STATIC_ENTRY + c->tail_remote_index + c->table_elems - elem_index; } diff --git a/src/core/transport/chttp2_transport.c b/src/core/transport/chttp2_transport.c index 0202d53abd..0437dbfadf 100644 --- a/src/core/transport/chttp2_transport.c +++ b/src/core/transport/chttp2_transport.c @@ -1114,8 +1114,8 @@ static void recv_data(grpc_exec_ctx *exec_ctx, void *tp, int success) { grpc_chttp2_prepare_to_read(&t->global, &t->parsing); gpr_mu_unlock(&t->mu); for (; i < t->read_buffer.count && - grpc_chttp2_perform_read(exec_ctx, &t->parsing, - t->read_buffer.slices[i]); + grpc_chttp2_perform_read(exec_ctx, &t->parsing, + t->read_buffer.slices[i]); i++) ; gpr_mu_lock(&t->mu); @@ -1229,13 +1229,9 @@ static char *chttp2_get_peer(grpc_exec_ctx *exec_ctx, grpc_transport *t) { return gpr_strdup(((grpc_chttp2_transport *)t)->peer_string); } -static const grpc_transport_vtable vtable = {sizeof(grpc_chttp2_stream), - init_stream, - perform_stream_op, - perform_transport_op, - destroy_stream, - destroy_transport, - chttp2_get_peer}; +static const grpc_transport_vtable vtable = { + sizeof(grpc_chttp2_stream), init_stream, perform_stream_op, + perform_transport_op, destroy_stream, destroy_transport, chttp2_get_peer}; grpc_transport *grpc_create_chttp2_transport( grpc_exec_ctx *exec_ctx, const grpc_channel_args *channel_args, diff --git a/src/core/tsi/fake_transport_security.c b/src/core/tsi/fake_transport_security.c index 9ef4b163be..cbb6f17ae1 100644 --- a/src/core/tsi/fake_transport_security.c +++ b/src/core/tsi/fake_transport_security.c @@ -493,10 +493,8 @@ static void fake_handshaker_destroy(tsi_handshaker *self) { static const tsi_handshaker_vtable handshaker_vtable = { fake_handshaker_get_bytes_to_send_to_peer, - fake_handshaker_process_bytes_from_peer, - fake_handshaker_get_result, - fake_handshaker_extract_peer, - fake_handshaker_create_frame_protector, + fake_handshaker_process_bytes_from_peer, fake_handshaker_get_result, + fake_handshaker_extract_peer, fake_handshaker_create_frame_protector, fake_handshaker_destroy, }; diff --git a/src/core/tsi/ssl_transport_security.c b/src/core/tsi/ssl_transport_security.c index ad6b2d7684..05789f07d4 100644 --- a/src/core/tsi/ssl_transport_security.c +++ b/src/core/tsi/ssl_transport_security.c @@ -976,10 +976,8 @@ static void ssl_handshaker_destroy(tsi_handshaker *self) { static const tsi_handshaker_vtable handshaker_vtable = { ssl_handshaker_get_bytes_to_send_to_peer, - ssl_handshaker_process_bytes_from_peer, - ssl_handshaker_get_result, - ssl_handshaker_extract_peer, - ssl_handshaker_create_frame_protector, + ssl_handshaker_process_bytes_from_peer, ssl_handshaker_get_result, + ssl_handshaker_extract_peer, ssl_handshaker_create_frame_protector, ssl_handshaker_destroy, }; diff --git a/src/cpp/proto/proto_utils.cc b/src/cpp/proto/proto_utils.cc index 3c0be58919..4131fbe5e5 100644 --- a/src/cpp/proto/proto_utils.cc +++ b/src/cpp/proto/proto_utils.cc @@ -161,7 +161,8 @@ Status SerializeProto(const grpc::protobuf::Message& msg, int byte_size = msg.ByteSize(); if (byte_size <= kMaxBufferLength) { gpr_slice slice = gpr_slice_malloc(byte_size); - GPR_ASSERT(GPR_SLICE_END_PTR(slice) == msg.SerializeWithCachedSizesToArray(GPR_SLICE_START_PTR(slice))); + GPR_ASSERT(GPR_SLICE_END_PTR(slice) == + msg.SerializeWithCachedSizesToArray(GPR_SLICE_START_PTR(slice))); *bp = grpc_raw_byte_buffer_create(&slice, 1); gpr_slice_unref(slice); return Status::OK; diff --git a/src/cpp/server/secure_server_credentials.cc b/src/cpp/server/secure_server_credentials.cc index 7c828cb125..d472667a7e 100644 --- a/src/cpp/server/secure_server_credentials.cc +++ b/src/cpp/server/secure_server_credentials.cc @@ -35,7 +35,6 @@ #include <map> #include <memory> - #include "src/cpp/common/secure_auth_context.h" #include "src/cpp/server/secure_server_credentials.h" @@ -43,7 +42,7 @@ namespace grpc { -void AuthMetadataProcessorAyncWrapper::Destroy(void *wrapper) { +void AuthMetadataProcessorAyncWrapper::Destroy(void* wrapper) { auto* w = reinterpret_cast<AuthMetadataProcessorAyncWrapper*>(wrapper); delete w; } @@ -68,8 +67,7 @@ void AuthMetadataProcessorAyncWrapper::Process( } void AuthMetadataProcessorAyncWrapper::InvokeProcessor( - grpc_auth_context* ctx, - const grpc_metadata* md, size_t num_md, + grpc_auth_context* ctx, const grpc_metadata* md, size_t num_md, grpc_process_auth_metadata_done_cb cb, void* user_data) { AuthMetadataProcessor::InputMetadata metadata; for (size_t i = 0; i < num_md; i++) { @@ -117,7 +115,7 @@ int SecureServerCredentials::AddPortToServer(const grpc::string& addr, void SecureServerCredentials::SetAuthMetadataProcessor( const std::shared_ptr<AuthMetadataProcessor>& processor) { - auto *wrapper = new AuthMetadataProcessorAyncWrapper(processor); + auto* wrapper = new AuthMetadataProcessorAyncWrapper(processor); grpc_server_credentials_set_auth_metadata_processor( creds_, {AuthMetadataProcessorAyncWrapper::Process, AuthMetadataProcessorAyncWrapper::Destroy, wrapper}); diff --git a/src/cpp/server/server.cc b/src/cpp/server/server.cc index a3020c342b..a44e1d2025 100644 --- a/src/cpp/server/server.cc +++ b/src/cpp/server/server.cc @@ -325,7 +325,7 @@ bool Server::RegisterAsyncService(const grpc::string* host, GPR_ASSERT(service->server_ == nullptr && "Can only register an asynchronous service against one server."); service->server_ = this; - service->request_args_ = new void*[service->method_count_]; + service->request_args_ = new void* [service->method_count_]; for (size_t i = 0; i < service->method_count_; ++i) { void* tag = grpc_server_register_method(server_, service->method_names_[i], host ? host->c_str() : nullptr); diff --git a/src/cpp/server/server_builder.cc b/src/cpp/server/server_builder.cc index 1c7e4e4eb6..b8094aa8f6 100644 --- a/src/cpp/server/server_builder.cc +++ b/src/cpp/server/server_builder.cc @@ -44,7 +44,7 @@ namespace grpc { ServerBuilder::ServerBuilder() : max_message_size_(-1), generic_service_(nullptr), thread_pool_(nullptr) { - grpc_compression_options_init(&compression_options_); + grpc_compression_options_init(&compression_options_); } std::unique_ptr<ServerCompletionQueue> ServerBuilder::AddCompletionQueue() { diff --git a/src/cpp/util/string_ref.cc b/src/cpp/util/string_ref.cc index c42033f61f..604134fa9d 100644 --- a/src/cpp/util/string_ref.cc +++ b/src/cpp/util/string_ref.cc @@ -85,29 +85,17 @@ size_t string_ref::find(char c) const { return it == cend() ? npos : std::distance(cbegin(), it); } -bool operator==(string_ref x, string_ref y) { - return x.compare(y) == 0; -} +bool operator==(string_ref x, string_ref y) { return x.compare(y) == 0; } -bool operator!=(string_ref x, string_ref y) { - return x.compare(y) != 0; -} +bool operator!=(string_ref x, string_ref y) { return x.compare(y) != 0; } -bool operator<(string_ref x, string_ref y) { - return x.compare(y) < 0; -} +bool operator<(string_ref x, string_ref y) { return x.compare(y) < 0; } -bool operator<=(string_ref x, string_ref y) { - return x.compare(y) <= 0; -} +bool operator<=(string_ref x, string_ref y) { return x.compare(y) <= 0; } -bool operator>(string_ref x, string_ref y) { - return x.compare(y) > 0; -} +bool operator>(string_ref x, string_ref y) { return x.compare(y) > 0; } -bool operator>=(string_ref x, string_ref y) { - return x.compare(y) >= 0; -} +bool operator>=(string_ref x, string_ref y) { return x.compare(y) >= 0; } std::ostream& operator<<(std::ostream& out, const string_ref& string) { return out << grpc::string(string.begin(), string.end()); diff --git a/src/node/.istanbul.yml b/src/node/.istanbul.yml new file mode 100644 index 0000000000..9ff1379f51 --- /dev/null +++ b/src/node/.istanbul.yml @@ -0,0 +1,6 @@ +reporting: + watermarks: + statements: [80, 95] + lines: [80, 95] + functions: [80, 95] + branches: [80, 95] diff --git a/src/node/binding.gyp b/src/node/binding.gyp index a644030932..247719e981 100644 --- a/src/node/binding.gyp +++ b/src/node/binding.gyp @@ -1,4 +1,7 @@ { + "variables" : { + 'config': '<!(echo $CONFIG)' + }, "targets" : [ { 'include_dirs': [ @@ -22,6 +25,18 @@ 'pkg_config_grpc': '<!(pkg-config --exists grpc >/dev/null 2>&1 && echo true || echo false)' }, 'conditions': [ + ['config=="gcov"', { + 'cflags': [ + '-ftest-coverage', + '-fprofile-arcs', + '-O0' + ], + 'ldflags': [ + '-ftest-coverage', + '-fprofile-arcs' + ] + } + ], ['pkg_config_grpc == "true"', { 'link_settings': { 'libraries': [ diff --git a/src/node/package.json b/src/node/package.json index 22f94757ce..0a5528781d 100644 --- a/src/node/package.json +++ b/src/node/package.json @@ -21,8 +21,9 @@ }, "scripts": { "lint": "node ./node_modules/jshint/bin/jshint src test examples interop index.js", - "test": "node ./node_modules/mocha/bin/mocha && npm run-script lint", - "gen_docs": "./node_modules/.bin/jsdoc -c jsdoc_conf.json" + "test": "./node_modules/.bin/mocha && npm run-script lint", + "gen_docs": "./node_modules/.bin/jsdoc -c jsdoc_conf.json", + "coverage": "./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha" }, "dependencies": { "bindings": "^1.2.0", @@ -33,6 +34,7 @@ "devDependencies": { "async": "^0.9.0", "google-auth-library": "^0.9.2", + "istanbul": "^0.3.21", "jsdoc": "^3.3.2", "jshint": "^2.5.0", "minimist": "^1.1.0", diff --git a/src/objective-c/tests/run_tests.sh b/src/objective-c/tests/run_tests.sh index 7b133c1782..598f4e7fa1 100755 --- a/src/objective-c/tests/run_tests.sh +++ b/src/objective-c/tests/run_tests.sh @@ -37,7 +37,7 @@ cd $(dirname $0) # Run the tests server. ../../../bins/$CONFIG/interop_server --port=5050 & -../../../bins/$CONFIG/interop_server --port=5051 --enable_ssl & +../../../bins/$CONFIG/interop_server --port=5051 --use_tls & # Kill them when this script exits. trap 'kill -9 `jobs -p`' EXIT diff --git a/src/python/grpcio_test/grpc_test/conftest.py b/src/python/grpcio_test/grpc_test/conftest.py new file mode 100644 index 0000000000..357320ec64 --- /dev/null +++ b/src/python/grpcio_test/grpc_test/conftest.py @@ -0,0 +1,60 @@ +import types +import unittest + +import pytest + + +class LoadTestsSuiteCollector(pytest.Collector): + + def __init__(self, name, parent, suite): + super(LoadTestsSuiteCollector, self).__init__(name, parent=parent) + self.suite = suite + self.obj = suite + + def collect(self): + collected = [] + for case in self.suite: + if isinstance(case, unittest.TestCase): + collected.append(LoadTestsCase(case.id(), self, case)) + elif isinstance(case, unittest.TestSuite): + collected.append( + LoadTestsSuiteCollector('suite_child_of_mine', self, case)) + return collected + + def reportinfo(self): + return str(self.suite) + + +class LoadTestsCase(pytest.Function): + + def __init__(self, name, parent, item): + super(LoadTestsCase, self).__init__(name, parent, callobj=self._item_run) + self.item = item + + def _item_run(self): + result = unittest.TestResult() + self.item(result) + if result.failures: + test_method, trace = result.failures[0] + pytest.fail(trace, False) + elif result.errors: + test_method, trace = result.errors[0] + pytest.fail(trace, False) + elif result.skipped: + test_method, reason = result.skipped[0] + pytest.skip(reason) + + +def pytest_pycollect_makeitem(collector, name, obj): + if name == 'load_tests' and isinstance(obj, types.FunctionType): + suite = unittest.TestSuite() + loader = unittest.TestLoader() + pattern = '*' + try: + # Check that the 'load_tests' object is actually a callable that actually + # accepts the arguments expected for the load_tests protocol. + suite = obj(loader, suite, pattern) + except Exception as e: + return None + else: + return LoadTestsSuiteCollector(name, collector, suite) 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/README b/test/core/end2end/README index 59daec45d0..a18172a7a1 100644 --- a/test/core/end2end/README +++ b/test/core/end2end/README @@ -3,5 +3,5 @@ forms a complete end-to-end test. To add a new test or fixture: - add the code to the relevant directory -- update gen_build_json.py to reflect the change +- update gen_build_yaml.py to reflect the change - regenerate projects 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/core/util/test_config.c b/test/core/util/test_config.c index 30caf4b1ef..84b376ad3e 100644 --- a/test/core/util/test_config.c +++ b/test/core/util/test_config.c @@ -35,6 +35,7 @@ #include <grpc/support/port_platform.h> #include <grpc/support/log.h> +#include "src/core/support/string.h" #include <stdlib.h> #include <signal.h> @@ -88,25 +89,43 @@ static void install_crash_handler() { #include <stdio.h> #include <string.h> #include <grpc/support/useful.h> +#include <errno.h> static char g_alt_stack[MINSIGSTKSZ]; #define MAX_FRAMES 32 +/* signal safe output */ +static void output_string(const char *string) { + size_t len = strlen(string); + ssize_t r; + + do { + r = write(STDERR_FILENO, string, len); + } while (r == -1 && errno == EINTR); +} + +static void output_num(long num) { + char buf[GPR_LTOA_MIN_BUFSIZE]; + gpr_ltoa(num, buf); + output_string(buf); +} + static void crash_handler(int signum, siginfo_t *info, void *data) { void *addrlist[MAX_FRAMES + 1]; int addrlen; - int i; - char **symlist; - fprintf(stderr, "Caught signal %d\n", signum); + output_string("\n\n\n*******************************\nCaught signal "); + output_num(signum); + output_string("\n"); + addrlen = backtrace(addrlist, GPR_ARRAY_SIZE(addrlist)); - symlist = backtrace_symbols(addrlist, addrlen); - for (i = 0; i < addrlen; i++) { - fprintf(stderr, " %s\n", symlist[i]); + if (addrlen == 0) { + output_string(" no backtrace\n"); + } else { + backtrace_symbols_fd(addrlist, addrlen, STDERR_FILENO); } - free(symlist); raise(signum); } @@ -114,6 +133,7 @@ static void crash_handler(int signum, siginfo_t *info, void *data) { static void install_crash_handler() { stack_t ss; struct sigaction sa; + memset(&ss, 0, sizeof(ss)); memset(&sa, 0, sizeof(sa)); ss.ss_size = sizeof(g_alt_stack); 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(); } - diff --git a/tools/dockerfile/grpc_clang_format/clang_format_all_the_things.sh b/tools/dockerfile/grpc_clang_format/clang_format_all_the_things.sh index 5aa265800d..5da9dfabba 100755 --- a/tools/dockerfile/grpc_clang_format/clang_format_all_the_things.sh +++ b/tools/dockerfile/grpc_clang_format/clang_format_all_the_things.sh @@ -4,7 +4,7 @@ DIRS="src/core src/cpp test/core test/cpp include" # file matching patterns to check -GLOB="*.h *.cpp" +GLOB="*.h *.c *.cc" # clang format command CLANG_FORMAT=clang-format-3.6 diff --git a/tools/dockerfile/grpc_cxx/Dockerfile b/tools/dockerfile/grpc_cxx/Dockerfile index ac09e25e40..82887df95c 100644 --- a/tools/dockerfile/grpc_cxx/Dockerfile +++ b/tools/dockerfile/grpc_cxx/Dockerfile @@ -54,4 +54,4 @@ ADD service_account service_account ADD cacerts cacerts ENV GRPC_DEFAULT_SSL_ROOTS_FILE_PATH /cacerts/roots.pem -CMD ["/var/local/git/grpc/bins/opt/interop_server", "--enable_ssl", "--port=8010"] +CMD ["/var/local/git/grpc/bins/opt/interop_server", "--use_tls", "--port=8010"] diff --git a/tools/gce_setup/grpc_docker.sh b/tools/gce_setup/grpc_docker.sh index 84263ad6b9..fdb7736327 100755 --- a/tools/gce_setup/grpc_docker.sh +++ b/tools/gce_setup/grpc_docker.sh @@ -1477,7 +1477,7 @@ grpc_cloud_prod_auth_compute_engine_creds_gen_node_cmd() { # cmd=$($grpc_gen_test_cmd $flags) grpc_interop_gen_cxx_cmd() { local cmd_prefix="sudo docker run grpc/cxx"; - local test_script="/var/local/git/grpc/bins/opt/interop_client --enable_ssl"; + local test_script="/var/local/git/grpc/bins/opt/interop_client --use_tls"; local the_cmd="$cmd_prefix $test_script $@"; echo $the_cmd } @@ -1489,7 +1489,7 @@ grpc_interop_gen_cxx_cmd() { # cmd=$($grpc_gen_test_cmd $flags) grpc_cloud_prod_gen_cxx_cmd() { local cmd_prefix="sudo docker run grpc/cxx"; - local test_script="/var/local/git/grpc/bins/opt/interop_client --enable_ssl --use_prod_roots"; + local test_script="/var/local/git/grpc/bins/opt/interop_client --use_tls --use_prod_roots"; local gfe_flags=$(_grpc_prod_gfe_flags) local the_cmd="$cmd_prefix $test_script $gfe_flags $@"; echo $the_cmd @@ -1502,7 +1502,7 @@ grpc_cloud_prod_gen_cxx_cmd() { # cmd=$($grpc_gen_test_cmd $flags) grpc_cloud_prod_auth_service_account_creds_gen_cxx_cmd() { local cmd_prefix="sudo docker run grpc/cxx"; - local test_script="/var/local/git/grpc/bins/opt/interop_client --enable_ssl --use_prod_roots"; + local test_script="/var/local/git/grpc/bins/opt/interop_client --use_tls --use_prod_roots"; local gfe_flags=$(_grpc_prod_gfe_flags) local added_gfe_flags=$(_grpc_svc_acc_test_flags) local the_cmd="$cmd_prefix $test_script $gfe_flags $added_gfe_flags $@"; @@ -1516,7 +1516,7 @@ grpc_cloud_prod_auth_service_account_creds_gen_cxx_cmd() { # cmd=$($grpc_gen_test_cmd $flags) grpc_cloud_prod_auth_compute_engine_creds_gen_cxx_cmd() { local cmd_prefix="sudo docker run grpc/cxx"; - local test_script="/var/local/git/grpc/bins/opt/interop_client --enable_ssl --use_prod_roots"; + local test_script="/var/local/git/grpc/bins/opt/interop_client --use_tls --use_prod_roots"; local gfe_flags=$(_grpc_prod_gfe_flags) local added_gfe_flags=$(_grpc_gce_test_flags) local the_cmd="$cmd_prefix $test_script $gfe_flags $added_gfe_flags $@"; @@ -1530,7 +1530,7 @@ grpc_cloud_prod_auth_compute_engine_creds_gen_cxx_cmd() { # cmd=$($grpc_gen_test_cmd $flags) grpc_cloud_prod_auth_jwt_token_creds_gen_cxx_cmd() { local cmd_prefix="sudo docker run grpc/cxx"; - local test_script="/var/local/git/grpc/bins/opt/interop_client --enable_ssl --use_prod_roots"; + local test_script="/var/local/git/grpc/bins/opt/interop_client --use_tls --use_prod_roots"; local gfe_flags=$(_grpc_prod_gfe_flags) local added_gfe_flags=$(_grpc_jwt_token_test_flags) local the_cmd="$cmd_prefix $test_script $gfe_flags $added_gfe_flags $@"; diff --git a/tools/jenkins/grpc_jenkins_slave/Dockerfile b/tools/jenkins/grpc_jenkins_slave/Dockerfile index 7248f97409..4f5387eeb5 100644 --- a/tools/jenkins/grpc_jenkins_slave/Dockerfile +++ b/tools/jenkins/grpc_jenkins_slave/Dockerfile @@ -32,7 +32,7 @@ FROM debian:jessie -# Install Git. +# Install Git and basic packages. RUN apt-get update && apt-get install -y \ autoconf \ autotools-dev \ @@ -44,6 +44,7 @@ RUN apt-get update && apt-get install -y \ gcc-multilib \ git \ gyp \ + lcov \ libc6 \ libc6-dbg \ libc6-dev \ diff --git a/tools/jenkins/grpc_jenkins_slave_32bits/Dockerfile b/tools/jenkins/grpc_jenkins_slave_32bits/Dockerfile index c1ff85c3ca..81a0399091 100644 --- a/tools/jenkins/grpc_jenkins_slave_32bits/Dockerfile +++ b/tools/jenkins/grpc_jenkins_slave_32bits/Dockerfile @@ -32,7 +32,7 @@ FROM 32bit/debian:jessie -# Install Git. +# Install Git and basic packages. RUN apt-get update && apt-get install -y \ autoconf \ autotools-dev \ @@ -44,6 +44,7 @@ RUN apt-get update && apt-get install -y \ gcc-multilib \ git \ gyp \ + lcov \ libc6 \ libc6-dbg \ libc6-dev \ diff --git a/tools/run_tests/run_interop_tests.py b/tools/run_tests/run_interop_tests.py index b5c1043e72..274eaa3336 100755 --- a/tools/run_tests/run_interop_tests.py +++ b/tools/run_tests/run_interop_tests.py @@ -60,7 +60,8 @@ _CLOUD_TO_CLOUD_BASE_ARGS = [ # supported by C core SslCredentials instead. _SSL_CERT_ENV = { 'SSL_CERT_FILE':'/usr/local/share/grpc/roots.pem' } -# TODO(jtatttermusch) unify usage of --enable_ssl, --use_tls and --use_tls=true +# TODO(jtatttermusch) unify usage of --use_tls and --use_tls=true +# TODO(jtatttermusch) unify usage of --use_prod_roots and --use_test_ca class CXXLanguage: @@ -72,17 +73,17 @@ class CXXLanguage: def cloud_to_prod_args(self): return (self.client_cmdline_base + _CLOUD_TO_PROD_BASE_ARGS + - ['--enable_ssl','--use_prod_roots']) + ['--use_tls=true','--use_prod_roots']) def cloud_to_cloud_args(self): return (self.client_cmdline_base + _CLOUD_TO_CLOUD_BASE_ARGS + - ['--enable_ssl']) + ['--use_tls=true']) def cloud_to_prod_env(self): return None def server_args(self): - return ['bins/opt/interop_server', '--enable_ssl'] + return ['bins/opt/interop_server', '--use_tls=true'] def __str__(self): return 'c++' @@ -223,11 +224,10 @@ _LANGUAGES = { # TODO(jtattermusch): enable other languages as servers as well _SERVERS = ['c++', 'node', 'csharp', 'java'] -# TODO(jtattermusch): add empty_stream once C++ starts supporting it. # TODO(jtattermusch): add timeout_on_sleeping_server once java starts supporting it. # TODO(jtattermusch): add support for auth tests. _TEST_CASES = ['large_unary', 'empty_unary', 'ping_pong', - 'client_streaming', 'server_streaming', + 'empty_stream', 'client_streaming', 'server_streaming', 'cancel_after_begin', 'cancel_after_first_response'] diff --git a/tools/run_tests/run_node.sh b/tools/run_tests/run_node.sh index bcd93ed226..1043b447db 100755 --- a/tools/run_tests/run_node.sh +++ b/tools/run_tests/run_node.sh @@ -37,6 +37,19 @@ cd $(dirname $0)/../.. root=`pwd` +cd $root/src/node + export LD_LIBRARY_PATH=$root/libs/$CONFIG -$root/src/node/node_modules/mocha/bin/mocha --timeout 8000 $root/src/node/test +if [ "$CONFIG" = "gcov" ] +then + ./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha -- \ + --timeout 8000 + cd build + gcov Release/obj.target/grpc/ext/*.o + lcov --base-directory . --directory . -c -o coverage.info + genhtml -o ../ext_coverage --num-spaces 2 -t 'Node gRPC test coverage' \ + coverage.info +else + ./node_modules/mocha/bin/mocha --timeout 8000 +fi diff --git a/tools/run_tests/run_python.sh b/tools/run_tests/run_python.sh index 977b02fd94..e2135be04c 100755 --- a/tools/run_tests/run_python.sh +++ b/tools/run_tests/run_python.sh @@ -40,14 +40,4 @@ export DYLD_LIBRARY_PATH=$ROOT/libs/$CONFIG export PATH=$ROOT/bins/$CONFIG:$ROOT/bins/$CONFIG/protobuf:$PATH source "python"$PYVER"_virtual_environment"/bin/activate -# TODO(atash): These tests don't currently run under py.test and thus don't -# appear under the coverage report. Find a way to get these tests to work with -# py.test (or find another tool or *something*) that's acceptable to the rest of -# the team... -"python"$PYVER -m grpc_test._core_over_links_base_interface_test -"python"$PYVER -m grpc_test._crust_over_core_over_links_face_interface_test -"python"$PYVER -m grpc_test.beta._face_interface_test -"python"$PYVER -m grpc_test.framework._crust_over_core_face_interface_test -"python"$PYVER -m grpc_test.framework.core._base_interface_test - "python"$PYVER $GRPCIO_TEST/setup.py test -a "-n8 --cov=grpc --junitxml=./report.xml --timeout=300" diff --git a/vsprojects/coapp/zlib/README.md b/vsprojects/coapp/zlib/README.md new file mode 100644 index 0000000000..c81a57a48b --- /dev/null +++ b/vsprojects/coapp/zlib/README.md @@ -0,0 +1,35 @@ +Zlib Native Nuget package +------------------------- + +Uses [CoApp](http://coapp.org/) project to build the zlib package. + +Prerequisites +------------- +Multiple versions of VS installed to be able to build all the targets: +* Visual Studio 2013 +* Visual Studio 2010 (you might need SP1 to prevent LNK1123 error) + +CoApp toolkit: http://downloads.coapp.org/files/CoApp.Tools.Powershell.msi + +More details on installation: http://coapp.org/tutorials/installation.html + +Building +-------- + +Build all flavors of zlib library using the provided batch file. +``` +buildall.bat +``` + +Then, create NuGet package using powershell (you'll need the CoApp toolkit installed): +``` +[THIS_DIRECTORY]> Write-NuGetPackage grpc.dependencies.zlib.autopkg +``` + +This will create three NuGet packages: +* the main dev package +* the redistributable package that contains just the binaries and no headers +* the symbols package (debug symbols) + +Later, you can push the package to NuGet.org repo. +Attention: before pusing the resulting nuget package to public nuget repo, you have to be 100% sure it works correctly - there’s no way how to delete or update an already existing package.
\ No newline at end of file diff --git a/vsprojects/coapp/zlib/buildall.bat b/vsprojects/coapp/zlib/buildall.bat new file mode 100644 index 0000000000..a71e56f4ae --- /dev/null +++ b/vsprojects/coapp/zlib/buildall.bat @@ -0,0 +1,51 @@ +@echo off +setlocal + +setlocal +call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" amd64 +call :build x64 Release v120 || goto :eof +call :build x64 Debug v120 || goto :eof +endlocal + +setlocal +call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" x86 +call :build Win32 Release v120 || goto :eof +call :build Win32 Debug v120 || goto :eof +endlocal + +REM setlocal +REM call "C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.bat" amd64 +REM call :build x64 Release v110 || goto :eof +REM call :build x64 Debug v110 || goto :eof +REM endlocal + +REM setlocal +REM call "C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.bat" x86 +REM call :build Win32 Release v110 || goto :eof +REM call :build Win32 Debug v110 || goto :eof +REM endlocal + +REM setlocal +REM call "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" amd64 +REM call :build x64 Release v100 || goto :eof +REM call :build x64 Debug v100 || goto :eof +REM endlocal + +setlocal +call "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" x86 +call :build Win32 Release v100 || goto :eof +call :build Win32 Debug v100 || goto :eof +endlocal + +goto :eof + +:build +msbuild /P:Platform=%1 /P:Configuration=%2 /P:PlatformToolset=%3 /P:UsesConfigurationType=Dynamic /P:CallingConvention=cdecl .\zlib.sln || goto :eof +msbuild /P:Platform=%1 /P:Configuration=%2 /P:PlatformToolset=%3 /P:UsesConfigurationType=Dynamic /P:CallingConvention=stdcall .\zlib.sln || goto :eof +msbuild /P:Platform=%1 /P:Configuration=%2 /P:PlatformToolset=%3 /P:UsesConfigurationType=Static /P:CallingConvention=cdecl .\zlib.sln || goto :eof +msbuild /P:Platform=%1 /P:Configuration=%2 /P:PlatformToolset=%3 /P:UsesConfigurationType=Static /P:CallingConvention=stdcall .\zlib.sln || goto :eof +msbuild /P:Platform=%1 /P:Configuration=%2 /P:PlatformToolset=%3 /P:UsesConfigurationType=ltcg /P:CallingConvention=cdecl .\zlib.sln || goto :eof +msbuild /P:Platform=%1 /P:Configuration=%2 /P:PlatformToolset=%3 /P:UsesConfigurationType=ltcg /P:CallingConvention=stdcall .\zlib.sln || goto :eof +goto :eof + + diff --git a/vsprojects/coapp/zlib/grpc.dependencies.zlib.autopkg b/vsprojects/coapp/zlib/grpc.dependencies.zlib.autopkg new file mode 100644 index 0000000000..01390b9434 --- /dev/null +++ b/vsprojects/coapp/zlib/grpc.dependencies.zlib.autopkg @@ -0,0 +1,102 @@ +@import @"version.inc"; + +configurations { +}; + +#define { + package-id = "grpc.dependencies.zlib"; +} + +nuget { + // the nuspec file metadata. Gets created/updated on build + nuspec { + id = ${package-id}; + version : ${package-version}; + title: gRPC Native Dependency: ZLib compression library; + authors: {Jean-loup Gailly, Mark Adler, Garrett Serack, Tim Rogers}; + owners: {Jan Tattermusch}; + licenseUrl: "http://zlib.net/zlib-license.html"; + projectUrl: "http://github.com/jtattermusch/zlib"; + iconUrl: "http://zlib.net/images/zlib3d-b1.png"; + requireLicenseAcceptance:false; + summary:A zlib library; + description: @"A native zlib library. + zlib homepage: http://zlib.net"; + releaseNotes: "Release of zlib 1.2.8 libraries."; + copyright: Copyright 2013; + tags: { zlib, native, CoApp }; + + }; + + // the files that go into the content folders + // (inserted into the nuspec file) + files { + // .targets file that are applied when redist package is installed from a managed project. + managed_build: { + #output { + package = redist; + }; + #destination = "\build\portable-net45"; + "managed_targets\${package-id}.redist.props"; + "managed_targets\${package-id}.redist.targets"; + }; + + include: { ..\..\..\third_party\zlib\zlib.h, ..\..\..\third_party\zlib\zconf.h }; + + docs: { ..\..\..\third_party\zlib\doc\**\* }; + + source += { + "..\..\..\third_party\zlib\adler32.c", + "..\..\..\third_party\zlib\compress.c", + "..\..\..\third_party\zlib\crc32.c", + "..\..\..\third_party\zlib\deflate.c", + "..\..\..\third_party\zlib\gzclose.c", + "..\..\..\third_party\zlib\gzlib.c", + "..\..\..\third_party\zlib\gzread.c", + "..\..\..\third_party\zlib\gzwrite.c", + "..\..\..\third_party\zlib\infback.c", + "..\..\..\third_party\zlib\inffast.c", + "..\..\..\third_party\zlib\inflate.c", + "..\..\..\third_party\zlib\inftrees.c", + "..\..\..\third_party\zlib\trees.c", + "..\..\..\third_party\zlib\uncompr.c", + "..\..\..\third_party\zlib\zutil.c", + "..\..\..\third_party\zlib\crc32.h", + "..\..\..\third_party\zlib\deflate.h", + "..\..\..\third_party\zlib\gzguts.h", + "..\..\..\third_party\zlib\inffast.h", + "..\..\..\third_party\zlib\inffixed.h", + "..\..\..\third_party\zlib\inflate.h", + "..\..\..\third_party\zlib\inftrees.h", + "..\..\..\third_party\zlib\trees.h", + "..\..\..\third_party\zlib\zconf.h", + "..\..\..\third_party\zlib\zlib.h", + "..\..\..\third_party\zlib\zutil.h", + "..\..\..\third_party\zlib\contrib\masmx64\inffas8664.c", + }; + ("v100,v120", "Win32,x64", "Release,Debug", "Dynamic", "cdecl,stdcall", "MultiByte") => { + [${0},${1},${2},${3},${4}] { + lib: { .\output\${0}\${1}\${2}\${3}\${4}\${5}\*.lib }; + bin: { .\output\${0}\${1}\${2}\${3}\${4}\${5}\*.dll }; + symbols: { .\output\${0}\${1}\${2}\${3}\${4}\${5}\*.pdb }; + }; + }; + ("v100,v120", "Win32,x64", "Release,Debug", "Static,ltcg", "cdecl,stdcall", "MultiByte") => { + [${0},${1},${2},${3},${4}] { + lib: { .\output\${0}\${1}\${2}\${3}\${4}\${5}\*.lib }; + }; + }; + + }; + + // the VC++ .targets file that gets generated and inserted into the ${d_content} folder + targets { + Defines += HAS_ZLIB; + [dynamic] + Defines += ZLIB_DLL; + [stdcall] + Defines += ZLIB_WINAPI; + + }; +} + diff --git a/vsprojects/coapp/zlib/managed_targets/grpc.dependencies.zlib.redist.props b/vsprojects/coapp/zlib/managed_targets/grpc.dependencies.zlib.redist.props new file mode 100644 index 0000000000..bcb37de0f7 --- /dev/null +++ b/vsprojects/coapp/zlib/managed_targets/grpc.dependencies.zlib.redist.props @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <!-- Whether or not copy native dependencies to output directory after building --> + <CopyNativeDependencies Condition=" '$(CopyNativeDependencies)' == '' ">true</CopyNativeDependencies> + + <!-- Set defaults for native dependencies if not already set. Properties can be overriden in the project files. --> + <NativeDependenciesToolset Condition=" '$(NativeDependenciesToolset)' == '' ">v120</NativeDependenciesToolset> + <NativeDependenciesPlatform Condition=" '$(NativeDependenciesPlatform)' == '' ">Win32</NativeDependenciesPlatform> + <NativeDependenciesConfiguration Condition=" '$(NativeDependenciesConfiguration)' == '' ">Debug</NativeDependenciesConfiguration> + <ZlibCallingConvention Condition=" '$(ZlibCallingConvention)' == '' ">cdecl</ZlibCallingConvention> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/vsprojects/coapp/zlib/managed_targets/grpc.dependencies.zlib.redist.targets b/vsprojects/coapp/zlib/managed_targets/grpc.dependencies.zlib.redist.targets new file mode 100644 index 0000000000..f00d97dc36 --- /dev/null +++ b/vsprojects/coapp/zlib/managed_targets/grpc.dependencies.zlib.redist.targets @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Choose> + <!-- Under older versions of Monodevelop, Choose is not supported and is just ignored, which gives us the desired effect. --> + <When Condition=" '$(OS)' != 'Unix' "> + <ItemGroup Condition=" '$(CopyNativeDependencies)' == 'true' "> + <Content Include="$(MSBuildThisFileDirectory)..\..\build\native\bin\$(NativeDependenciesToolset)\$(NativeDependenciesPlatform)\$(NativeDependenciesConfiguration)\dynamic\$(ZlibCallingConvention)\zlib.dll"> + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> + </Content> + </ItemGroup> + </When> + <Otherwise /> + </Choose> +</Project>
\ No newline at end of file diff --git a/vsprojects/coapp/zlib/version.inc b/vsprojects/coapp/zlib/version.inc new file mode 100644 index 0000000000..1f893a4951 --- /dev/null +++ b/vsprojects/coapp/zlib/version.inc @@ -0,0 +1 @@ +#define { package-version : 1.2.8.9; } diff --git a/vsprojects/coapp/zlib/zlib.sln b/vsprojects/coapp/zlib/zlib.sln new file mode 100644 index 0000000000..7c38e6e121 --- /dev/null +++ b/vsprojects/coapp/zlib/zlib.sln @@ -0,0 +1,26 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zlib", "zlib.vcxproj", "{63BED288-E8C3-4345-B84D-2E64598DCF3A}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + Debug|x64 = Debug|x64 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {63BED288-E8C3-4345-B84D-2E64598DCF3A}.Debug|Win32.ActiveCfg = Debug|Win32 + {63BED288-E8C3-4345-B84D-2E64598DCF3A}.Debug|Win32.Build.0 = Debug|Win32 + {63BED288-E8C3-4345-B84D-2E64598DCF3A}.Release|Win32.ActiveCfg = Release|Win32 + {63BED288-E8C3-4345-B84D-2E64598DCF3A}.Release|Win32.Build.0 = Release|Win32 + {63BED288-E8C3-4345-B84D-2E64598DCF3A}.Debug|x64.ActiveCfg = Debug|x64 + {63BED288-E8C3-4345-B84D-2E64598DCF3A}.Debug|x64.Build.0 = Debug|x64 + {63BED288-E8C3-4345-B84D-2E64598DCF3A}.Release|x64.ActiveCfg = Release|x64 + {63BED288-E8C3-4345-B84D-2E64598DCF3A}.Release|x64.Build.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/vsprojects/coapp/zlib/zlib.vcxproj b/vsprojects/coapp/zlib/zlib.vcxproj new file mode 100644 index 0000000000..56df39a248 --- /dev/null +++ b/vsprojects/coapp/zlib/zlib.vcxproj @@ -0,0 +1,147 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="PreBuildCmds;PreBuildTargets;Build;PostBuildCmds;PostBuildTargets" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup Label="CoApp" > + <CoAppEtcDirectory>$(registry:HKEY_LOCAL_MACHINE\Software\Outercurve\CoApp.Powershell\etc)</CoAppEtcDirectory> + + <!-- Set to true to make visual studio use PTK when building.--> + <UsePTKFromVisualStudio>false</UsePTKFromVisualStudio> + </PropertyGroup> + + <PropertyGroup Label="Configuration" > + <!-- This lets Visual Studio see this as a VC12 project by default --> + <PlatformToolset Condition="'$(PlatformToolset)' == ''">v120</PlatformToolset> + </PropertyGroup> + + <Import Condition="Exists('$(CoAppEtcDirectory)\common-variables.vcxproj')" Project="$(CoAppEtcDirectory)\common-variables.vcxproj" /> + + <PropertyGroup Label="CustomSettings" /> + + <PropertyGroup Label="Globals"> + <ProjectGuid>{63BED288-E8C3-4345-B84D-2E64598DCF3A}</ProjectGuid> + <RootNamespace>$(MSBuildProjectName)</RootNamespace> + + <OutNameSuffix Condition="$(IS_CDECL) AND $(IS_DYNAMIC)">1</OutNameSuffix> + + <!-- set to Application or DynamicLibrary (DynamicLibrary can get altered to StaticLibrary by PTK --> + <ConfigurationType>DynamicLibrary</ConfigurationType> + + <!-- Common Compiler Defines (semicolon delimited) --> + <Defines>_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;</Defines> + <Defines Condition="$(IS_STDCALL)">$(Defines);ZLIB_WINAPI;</Defines> + <Defines Condition="$(IS_DYNAMIC)">$(Defines);ZLIB_DLL;</Defines> + <Defines Condition="'$(AppContainer)' == 'App'">$(Defines);IOWIN32_USING_WINRT_API=1;</Defines> + <Defines Condition="'$(AppContainer)' != 'App'">$(Defines);IOWIN32_USING_WINRT_API=0;</Defines> + <Defines Condition="'$(UseASM)' == 'ASM'">$(Defines);ASMV;ASMINF;</Defines> + <Defines Condition="$(IS_X64)">$(Defines);WIN64;</Defines> + + <!-- Additional Include folders (semicolon delimited) --> + <IncludeDirectories>..\..\..\third_party\zlib;</IncludeDirectories> + + <!-- Additional Library folders (semicolon delimited) --> + <LibraryDirectories></LibraryDirectories> + + <!-- Libraries to Link with --> + <Libraries></Libraries> + + <!-- Batch script to run before Build--> + <PreBuild></PreBuild> + + <!-- Batch script to run after Build--> + <PostBuild></PostBuild> + + <!-- Batch script to run before Link step--> + <PreLink></PreLink> + + <!-- Batch script to run after Link--> + <PostLink></PostLink> + + <!-- Batch script to run before Lib step--> + <PreLib></PreLib> + + <!-- Batch script to run after Lib--> + <PostLib></PostLib> + + <!-- Targets to run before Build (semcolon delimited)--> + <PreBuildTargets></PreBuildTargets> + + <!-- Targets to run before Build (semcolon delimited)--> + <PostBuildTargets></PostBuildTargets> + + <!-- for Dynamic libs, you can specify the Module .DEF file path --> + <ModuleDefinitionFile></ModuleDefinitionFile> + </PropertyGroup> + + <Import Condition="Exists('$(CoAppEtcDirectory)\common-header.vcxproj')" Project="$(CoAppEtcDirectory)\common-header.vcxproj" /> + <Import Condition="'$(UseASM)' == 'ASM'" Project="$(VCTargetsPath)\BuildCustomizations\masm.props" /> + + <PropertyGroup> + <OutDir>$(ProjectRootDir)Output/$(PlatformToolset)/$(Platform)/$(Configuration)/$(UsesConfigurationType)/$(CallingConvention)/$(CharacterSet)/$(AppContainer)/$(UseASM)/</OutDir> + <IntDir>$(ProjectRootDir)Intermediate/$(TargetName)/$(PlatformToolset)/$(Platform)/$(Configuration)/$(UsesConfigurationType)/$(CallingConvention)/$(CharacterSet)/$(AppContainer)/$(UseASM)/</IntDir> + </PropertyGroup> + + <ItemDefinitionGroup> + <ClCompile> + <SDLCheck>true</SDLCheck> + </ClCompile> + <Link> + <BaseAddress>0x5A4C0000</BaseAddress> + </Link> + </ItemDefinitionGroup> + + <ItemGroup Condition="'$(UseASM)' == 'ASM'"> + <MASM Include="..\..\..\third_party\zlib\contrib\masmx64\gvmat64.asm" Condition="$(IS_X64)"> + <AssembledCodeListingFile>$(IntDir)gvmat64.lst</AssembledCodeListingFile> + <MASMBeforeTargets>Build</MASMBeforeTargets> + <ObjectFileName>$(IntDir)gvmat64.obj</ObjectFileName> + </MASM> + <MASM Include="..\..\..\third_party\zlib\contrib\masmx64\inffasx64.asm" Condition="$(IS_X64)"> + <AssembledCodeListingFile>$(IntDir)inffasx64.lst</AssembledCodeListingFile> + <MASMBeforeTargets>Build</MASMBeforeTargets> + <ObjectFileName>$(IntDir)inffasx64.obj</ObjectFileName> + </MASM> + <MASM Include="..\..\..\third_party\zlib\contrib\masmx86\inffas32.asm" Condition="$(IS_X86) AND $(IS_STDCALL)"> + <AssembledCodeListingFile>$(IntDir)inffas32.lst</AssembledCodeListingFile> + <MASMBeforeTargets>Build</MASMBeforeTargets> + <UseSafeExceptionHandlers>true</UseSafeExceptionHandlers> + <AdditionalOptions>/coff %(AdditionalOptions)</AdditionalOptions> + <ObjectFileName>$(IntDir)inffas32.obj</ObjectFileName> + </MASM> + <MASM Include="..\..\..\third_party\zlib\contrib\masmx86\match686.asm" Condition="$(IS_X86) AND $(IS_STDCALL)"> + <AssembledCodeListingFile>$(IntDir)match686.lst</AssembledCodeListingFile> + <MASMBeforeTargets>Build</MASMBeforeTargets> + <UseSafeExceptionHandlers>true</UseSafeExceptionHandlers> + <AdditionalOptions>/coff %(AdditionalOptions)</AdditionalOptions> + <ObjectFileName>$(IntDir)match686.obj</ObjectFileName> + </MASM> + </ItemGroup> + + <ItemGroup Label="C Source Files"> + <!-- Include the source files to compile here --> + <!-- <ClCompile Include="..\src\foo.c" /> --> + <ClCompile Include="..\..\..\third_party\zlib\adler32.c" /> + <ClCompile Include="..\..\..\third_party\zlib\compress.c" /> + <ClCompile Include="..\..\..\third_party\zlib\crc32.c" /> + <ClCompile Include="..\..\..\third_party\zlib\deflate.c" /> + <ClCompile Include="..\..\..\third_party\zlib\gzclose.c" /> + <ClCompile Include="..\..\..\third_party\zlib\gzlib.c" /> + <ClCompile Include="..\..\..\third_party\zlib\gzread.c" /> + <ClCompile Include="..\..\..\third_party\zlib\gzwrite.c" /> + <ClCompile Include="..\..\..\third_party\zlib\infback.c" /> + <ClCompile Include="..\..\..\third_party\zlib\contrib\masmx64\inffas8664.c" Condition="$(IS_X64)" /> + <ClCompile Include="..\..\..\third_party\zlib\inffast.c" /> + <ClCompile Include="..\..\..\third_party\zlib\inflate.c" /> + <ClCompile Include="..\..\..\third_party\zlib\inftrees.c" /> + <ClCompile Include="..\..\..\third_party\zlib\trees.c" /> + <ClCompile Include="..\..\..\third_party\zlib\uncompr.c" /> + <ClCompile Include="..\..\..\third_party\zlib\zutil.c" /> + </ItemGroup> + + <ItemGroup Label="Resource Files"> + <!-- Include the source files to compile here --> + <!-- <ResourceCompile Include="..\src\foo.rc" /> --> + <ResourceCompile Include="..\..\..\third_party\zlib\win32\zlib1.rc" /> + </ItemGroup> + + <Import Condition="'$(UseASM)' == 'ASM'" Project="$(VCTargetsPath)\BuildCustomizations\masm.targets" /> + <Import Condition="Exists('$(CoAppEtcDirectory)\common-footer.vcxproj')" Project="$(CoAppEtcDirectory)\common-footer.vcxproj" /> +</Project> |