aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/core
diff options
context:
space:
mode:
authorGravatar Vijay Pai <vpai@google.com>2018-02-19 22:45:47 -0800
committerGravatar Vijay Pai <vpai@google.com>2018-02-19 22:45:47 -0800
commit87e2e6a58aac78279578ee26c1625eb3eb016cce (patch)
tree0a4a9aa91dfec4e019fa787df8b45c763ab26741 /test/core
parent4258f11d88a4da003377354c40a81e5f786e25c8 (diff)
clang-fmt
Diffstat (limited to 'test/core')
-rw-r--r--test/core/end2end/bad_server_response_test.cc11
-rw-r--r--test/core/end2end/fixtures/http_proxy_fixture.cc2
-rw-r--r--test/core/end2end/fixtures/proxy.cc4
-rw-r--r--test/core/gpr/arena_test.cc8
-rw-r--r--test/core/gpr/cpu_test.cc4
-rw-r--r--test/core/gpr/mpscq_test.cc10
-rw-r--r--test/core/gpr/spinlock_test.cc2
-rw-r--r--test/core/gpr/sync_test.cc6
-rw-r--r--test/core/gpr/tls_test.cc2
-rw-r--r--test/core/gprpp/thd_test.cc14
-rw-r--r--test/core/iomgr/combiner_test.cc6
-rw-r--r--test/core/iomgr/ev_epollsig_linux_test.cc2
-rw-r--r--test/core/iomgr/resolve_address_posix_test.cc4
-rw-r--r--test/core/iomgr/wakeup_fd_cv_test.cc142
-rw-r--r--test/core/network_benchmarks/low_level_ping_pong.cc2
-rw-r--r--test/core/surface/completion_queue_threading_test.cc14
-rw-r--r--test/core/surface/concurrent_connectivity_test.cc129
17 files changed, 181 insertions, 181 deletions
diff --git a/test/core/end2end/bad_server_response_test.cc b/test/core/end2end/bad_server_response_test.cc
index 0dbde3d788..3d133cfc18 100644
--- a/test/core/end2end/bad_server_response_test.cc
+++ b/test/core/end2end/bad_server_response_test.cc
@@ -254,16 +254,15 @@ static void actually_poll_server(void* arg) {
gpr_free(pa);
}
-static grpc_core::Thread*
- poll_server_until_read_done(test_tcp_server* server,
- gpr_event* signal_when_done) {
+static grpc_core::Thread* poll_server_until_read_done(
+ test_tcp_server* server, gpr_event* signal_when_done) {
gpr_atm_rel_store(&state.done_atm, 0);
state.write_done = 0;
poll_args* pa = static_cast<poll_args*>(gpr_malloc(sizeof(*pa)));
pa->server = server;
pa->signal_when_done = signal_when_done;
auto* th = grpc_core::New<grpc_core::Thread>("grpc_poll_server",
- actually_poll_server, pa);
+ actually_poll_server, pa);
th->Start();
return th;
}
@@ -285,8 +284,8 @@ static void run_test(const char* response_payload,
state.response_payload_length = response_payload_length;
/* poll server until sending out the response */
- grpc_core::UniquePtr<grpc_core::Thread>
- thdptr(poll_server_until_read_done(&test_server, &ev));
+ grpc_core::UniquePtr<grpc_core::Thread> thdptr(
+ poll_server_until_read_done(&test_server, &ev));
start_rpc(server_port, expected_status, expected_detail);
gpr_event_wait(&ev, gpr_inf_future(GPR_CLOCK_REALTIME));
thdptr->Join();
diff --git a/test/core/end2end/fixtures/http_proxy_fixture.cc b/test/core/end2end/fixtures/http_proxy_fixture.cc
index d95ce66423..d074fdaa52 100644
--- a/test/core/end2end/fixtures/http_proxy_fixture.cc
+++ b/test/core/end2end/fixtures/http_proxy_fixture.cc
@@ -20,8 +20,8 @@
#include "src/core/lib/iomgr/sockaddr.h"
-#include <new>
#include <string.h>
+#include <new>
#include <grpc/grpc.h>
#include <grpc/slice_buffer.h>
diff --git a/test/core/end2end/fixtures/proxy.cc b/test/core/end2end/fixtures/proxy.cc
index fe54261b5e..5b4f3b9236 100644
--- a/test/core/end2end/fixtures/proxy.cc
+++ b/test/core/end2end/fixtures/proxy.cc
@@ -18,16 +18,16 @@
#include "test/core/end2end/fixtures/proxy.h"
-#include <new>
#include <string.h>
+#include <new>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/sync.h>
#include "src/core/lib/gpr/host_port.h"
-#include "src/core/lib/gprpp/thd.h"
#include "src/core/lib/gpr/useful.h"
+#include "src/core/lib/gprpp/thd.h"
#include "test/core/util/port.h"
struct grpc_end2end_proxy {
diff --git a/test/core/gpr/arena_test.cc b/test/core/gpr/arena_test.cc
index 717052eacd..b00c014cea 100644
--- a/test/core/gpr/arena_test.cc
+++ b/test/core/gpr/arena_test.cc
@@ -18,9 +18,9 @@
#include "src/core/lib/gpr/arena.h"
-#include <new>
#include <inttypes.h>
#include <string.h>
+#include <new>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
@@ -28,8 +28,8 @@
#include <grpc/support/sync.h>
#include "src/core/lib/gpr/string.h"
-#include "src/core/lib/gprpp/thd.h"
#include "src/core/lib/gpr/useful.h"
+#include "src/core/lib/gprpp/thd.h"
#include "test/core/util/test_config.h"
static void test_noop(void) { gpr_arena_destroy(gpr_arena_create(1)); }
@@ -102,8 +102,8 @@ static void concurrent_test(void) {
grpc_core::Thread thds[CONCURRENT_TEST_THREADS];
for (int i = 0; i < CONCURRENT_TEST_THREADS; i++) {
- new (&thds[i]) grpc_core::Thread("grpc_concurrent_test",
- concurrent_test_body, &args);
+ new (&thds[i])
+ grpc_core::Thread("grpc_concurrent_test", concurrent_test_body, &args);
thds[i].Start();
}
diff --git a/test/core/gpr/cpu_test.cc b/test/core/gpr/cpu_test.cc
index 4575fb643a..279e6e6f5a 100644
--- a/test/core/gpr/cpu_test.cc
+++ b/test/core/gpr/cpu_test.cc
@@ -23,9 +23,9 @@
#include <grpc/support/cpu.h>
-#include <new>
#include <stdio.h>
#include <string.h>
+#include <new>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
@@ -115,7 +115,7 @@ static void cpu_test(void) {
uint32_t nthreads = ct.ncores * 3;
grpc_core::Thread* thd =
- static_cast<grpc_core::Thread*>(gpr_malloc(sizeof(*thd)*nthreads));
+ static_cast<grpc_core::Thread*>(gpr_malloc(sizeof(*thd) * nthreads));
for (i = 0; i < nthreads; i++) {
new (&thd[i]) grpc_core::Thread("grpc_cpu_test", &worker_thread, &ct);
diff --git a/test/core/gpr/mpscq_test.cc b/test/core/gpr/mpscq_test.cc
index bf65b2d0b9..33f93878e0 100644
--- a/test/core/gpr/mpscq_test.cc
+++ b/test/core/gpr/mpscq_test.cc
@@ -18,15 +18,15 @@
#include "src/core/lib/gpr/mpscq.h"
-#include <new>
#include <stdlib.h>
+#include <new>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/sync.h>
-#include "src/core/lib/gprpp/thd.h"
#include "src/core/lib/gpr/useful.h"
+#include "src/core/lib/gprpp/thd.h"
#include "test/core/util/test_config.h"
typedef struct test_node {
@@ -167,12 +167,12 @@ static void test_mt_multipop(void) {
pa.start = &start;
gpr_mu_init(&pa.mu);
for (size_t i = 0; i < GPR_ARRAY_SIZE(pull_thds); i++) {
- new (&pull_thds[i]) grpc_core::Thread("grpc_multipop_pull",
- pull_thread, &pa);
+ new (&pull_thds[i])
+ grpc_core::Thread("grpc_multipop_pull", pull_thread, &pa);
pull_thds[i].Start();
}
gpr_event_set(&start, (void*)1);
- for (auto& pth: pull_thds) {
+ for (auto& pth : pull_thds) {
pth.Join();
}
gpr_log(GPR_DEBUG, "spins: %" PRIdPTR, pa.spins);
diff --git a/test/core/gpr/spinlock_test.cc b/test/core/gpr/spinlock_test.cc
index 1a3475b8f2..ac9f70f301 100644
--- a/test/core/gpr/spinlock_test.cc
+++ b/test/core/gpr/spinlock_test.cc
@@ -20,9 +20,9 @@
#include "src/core/lib/gpr/spinlock.h"
-#include <new>
#include <stdio.h>
#include <stdlib.h>
+#include <new>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
diff --git a/test/core/gpr/sync_test.cc b/test/core/gpr/sync_test.cc
index 2cdf061c71..487f394b14 100644
--- a/test/core/gpr/sync_test.cc
+++ b/test/core/gpr/sync_test.cc
@@ -20,9 +20,9 @@
#include <grpc/support/sync.h>
-#include <new>
#include <stdio.h>
#include <stdlib.h>
+#include <new>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
@@ -164,8 +164,8 @@ struct test {
static struct test* test_new(int nthreads, int64_t iterations, int incr_step) {
struct test* m = static_cast<struct test*>(gpr_malloc(sizeof(*m)));
m->nthreads = nthreads;
- m->threads =
- static_cast<grpc_core::Thread*>(gpr_malloc(sizeof(*m->threads) * nthreads));
+ m->threads = static_cast<grpc_core::Thread*>(
+ gpr_malloc(sizeof(*m->threads) * nthreads));
m->iterations = iterations;
m->counter = 0;
m->thread_count = 0;
diff --git a/test/core/gpr/tls_test.cc b/test/core/gpr/tls_test.cc
index 15f329f21a..a060cd47f1 100644
--- a/test/core/gpr/tls_test.cc
+++ b/test/core/gpr/tls_test.cc
@@ -20,9 +20,9 @@
#include "src/core/lib/gpr/tls.h"
-#include <new>
#include <stdio.h>
#include <stdlib.h>
+#include <new>
#include <grpc/support/log.h>
#include <grpc/support/sync.h>
diff --git a/test/core/gprpp/thd_test.cc b/test/core/gprpp/thd_test.cc
index d98f617288..1aa8632757 100644
--- a/test/core/gprpp/thd_test.cc
+++ b/test/core/gprpp/thd_test.cc
@@ -20,9 +20,9 @@
#include "src/core/lib/gprpp/thd.h"
-#include <new>
#include <stdio.h>
#include <stdlib.h>
+#include <new>
#include <grpc/support/log.h>
#include <grpc/support/sync.h>
@@ -59,7 +59,7 @@ static void test1(void) {
gpr_cv_init(&t.done_cv);
t.n = NUM_THREADS;
t.is_done = 0;
- for (auto& th: thds) {
+ for (auto& th : thds) {
new (&th) grpc_core::Thread("grpc_thread_body1_test", &thd_body1, &t);
th.Start();
}
@@ -68,7 +68,7 @@ static void test1(void) {
gpr_cv_wait(&t.done_cv, &t.mu, gpr_inf_future(GPR_CLOCK_REALTIME));
}
gpr_mu_unlock(&t.mu);
- for (auto& th: thds) {
+ for (auto& th : thds) {
th.Join();
}
GPR_ASSERT(t.n == 0);
@@ -79,14 +79,14 @@ static void thd_body2(void* v) {}
/* Test that we can create a number of threads and join them. */
static void test2(void) {
grpc_core::Thread thds[NUM_THREADS];
- for (auto& th: thds) {
+ for (auto& th : thds) {
bool ok;
- new (&th) grpc_core::Thread("grpc_thread_body2_test", &thd_body2,
- nullptr, &ok);
+ new (&th)
+ grpc_core::Thread("grpc_thread_body2_test", &thd_body2, nullptr, &ok);
GPR_ASSERT(ok);
th.Start();
}
- for (auto& th: thds) {
+ for (auto& th : thds) {
th.Join();
}
}
diff --git a/test/core/iomgr/combiner_test.cc b/test/core/iomgr/combiner_test.cc
index 45afe53564..e4f4783e58 100644
--- a/test/core/iomgr/combiner_test.cc
+++ b/test/core/iomgr/combiner_test.cc
@@ -24,8 +24,8 @@
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
-#include "src/core/lib/gprpp/thd.h"
#include "src/core/lib/gpr/useful.h"
+#include "src/core/lib/gprpp/thd.h"
#include "test/core/util/test_config.h"
static void test_no_op(void) {
@@ -105,8 +105,8 @@ static void test_execute_many(void) {
ta[i].ctr = 0;
ta[i].lock = lock;
gpr_event_init(&ta[i].done);
- new (&thds[i]) grpc_core::Thread("grpc_execute_many",
- execute_many_loop, &ta[i]);
+ new (&thds[i])
+ grpc_core::Thread("grpc_execute_many", execute_many_loop, &ta[i]);
thds[i].Start();
}
for (size_t i = 0; i < GPR_ARRAY_SIZE(thds); i++) {
diff --git a/test/core/iomgr/ev_epollsig_linux_test.cc b/test/core/iomgr/ev_epollsig_linux_test.cc
index 751b80fa89..b5f1d4ef68 100644
--- a/test/core/iomgr/ev_epollsig_linux_test.cc
+++ b/test/core/iomgr/ev_epollsig_linux_test.cc
@@ -30,8 +30,8 @@
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
-#include "src/core/lib/gprpp/thd.h"
#include "src/core/lib/gpr/useful.h"
+#include "src/core/lib/gprpp/thd.h"
#include "src/core/lib/iomgr/iomgr.h"
#include "test/core/util/test_config.h"
diff --git a/test/core/iomgr/resolve_address_posix_test.cc b/test/core/iomgr/resolve_address_posix_test.cc
index 9d61c9818b..895ede24c7 100644
--- a/test/core/iomgr/resolve_address_posix_test.cc
+++ b/test/core/iomgr/resolve_address_posix_test.cc
@@ -18,9 +18,9 @@
#include "src/core/lib/iomgr/resolve_address.h"
-#include <new>
#include <string.h>
#include <sys/un.h>
+#include <new>
#include <grpc/grpc.h>
#include <grpc/support/alloc.h>
@@ -28,8 +28,8 @@
#include <grpc/support/sync.h>
#include <grpc/support/time.h>
-#include "src/core/lib/gprpp/thd.h"
#include "src/core/lib/gpr/useful.h"
+#include "src/core/lib/gprpp/thd.h"
#include "src/core/lib/iomgr/executor.h"
#include "src/core/lib/iomgr/iomgr.h"
#include "test/core/util/test_config.h"
diff --git a/test/core/iomgr/wakeup_fd_cv_test.cc b/test/core/iomgr/wakeup_fd_cv_test.cc
index 1b1c9ef811..9bd7c6e47e 100644
--- a/test/core/iomgr/wakeup_fd_cv_test.cc
+++ b/test/core/iomgr/wakeup_fd_cv_test.cc
@@ -134,89 +134,89 @@ void test_poll_cv_trigger(void) {
pargs.result = -2;
{
- grpc_core::Thread thd("grpc_background_poll", &background_poll, &pargs);
- thd.Start();
- // Wakeup wakeup_fd not listening for events
- GPR_ASSERT(grpc_wakeup_fd_wakeup(&cvfd1) == GRPC_ERROR_NONE);
- thd.Join();
- GPR_ASSERT(pargs.result == 0);
- GPR_ASSERT(pfds[0].revents == 0);
- GPR_ASSERT(pfds[1].revents == 0);
- GPR_ASSERT(pfds[2].revents == 0);
- GPR_ASSERT(pfds[3].revents == 0);
- GPR_ASSERT(pfds[4].revents == 0);
- GPR_ASSERT(pfds[5].revents == 0);
+ grpc_core::Thread thd("grpc_background_poll", &background_poll, &pargs);
+ thd.Start();
+ // Wakeup wakeup_fd not listening for events
+ GPR_ASSERT(grpc_wakeup_fd_wakeup(&cvfd1) == GRPC_ERROR_NONE);
+ thd.Join();
+ GPR_ASSERT(pargs.result == 0);
+ GPR_ASSERT(pfds[0].revents == 0);
+ GPR_ASSERT(pfds[1].revents == 0);
+ GPR_ASSERT(pfds[2].revents == 0);
+ GPR_ASSERT(pfds[3].revents == 0);
+ GPR_ASSERT(pfds[4].revents == 0);
+ GPR_ASSERT(pfds[5].revents == 0);
}
{
- // Pollin on socket fd
- pargs.timeout = -1;
- pargs.result = -2;
- grpc_core::Thread thd("grpc_background_poll", &background_poll, &pargs);
- thd.Start();
- trigger_socket_event();
- thd.Join();
- GPR_ASSERT(pargs.result == 1);
- GPR_ASSERT(pfds[0].revents == 0);
- GPR_ASSERT(pfds[1].revents == 0);
- GPR_ASSERT(pfds[2].revents == POLLIN);
- GPR_ASSERT(pfds[3].revents == 0);
- GPR_ASSERT(pfds[4].revents == 0);
- GPR_ASSERT(pfds[5].revents == 0);
+ // Pollin on socket fd
+ pargs.timeout = -1;
+ pargs.result = -2;
+ grpc_core::Thread thd("grpc_background_poll", &background_poll, &pargs);
+ thd.Start();
+ trigger_socket_event();
+ thd.Join();
+ GPR_ASSERT(pargs.result == 1);
+ GPR_ASSERT(pfds[0].revents == 0);
+ GPR_ASSERT(pfds[1].revents == 0);
+ GPR_ASSERT(pfds[2].revents == POLLIN);
+ GPR_ASSERT(pfds[3].revents == 0);
+ GPR_ASSERT(pfds[4].revents == 0);
+ GPR_ASSERT(pfds[5].revents == 0);
}
{
- // Pollin on wakeup fd
- reset_socket_event();
- pargs.result = -2;
- grpc_core::Thread thd("grpc_background_poll", &background_poll, &pargs);
- thd.Start();
- GPR_ASSERT(grpc_wakeup_fd_wakeup(&cvfd2) == GRPC_ERROR_NONE);
- thd.Join();
-
- GPR_ASSERT(pargs.result == 1);
- GPR_ASSERT(pfds[0].revents == 0);
- GPR_ASSERT(pfds[1].revents == POLLIN);
- GPR_ASSERT(pfds[2].revents == 0);
- GPR_ASSERT(pfds[3].revents == 0);
- GPR_ASSERT(pfds[4].revents == 0);
- GPR_ASSERT(pfds[5].revents == 0);
+ // Pollin on wakeup fd
+ reset_socket_event();
+ pargs.result = -2;
+ grpc_core::Thread thd("grpc_background_poll", &background_poll, &pargs);
+ thd.Start();
+ GPR_ASSERT(grpc_wakeup_fd_wakeup(&cvfd2) == GRPC_ERROR_NONE);
+ thd.Join();
+
+ GPR_ASSERT(pargs.result == 1);
+ GPR_ASSERT(pfds[0].revents == 0);
+ GPR_ASSERT(pfds[1].revents == POLLIN);
+ GPR_ASSERT(pfds[2].revents == 0);
+ GPR_ASSERT(pfds[3].revents == 0);
+ GPR_ASSERT(pfds[4].revents == 0);
+ GPR_ASSERT(pfds[5].revents == 0);
}
{
- // Pollin on wakeupfd before poll()
- pargs.result = -2;
- grpc_core::Thread thd("grpc_background_poll", &background_poll, &pargs);
- thd.Start();
- thd.Join();
-
- GPR_ASSERT(pargs.result == 1);
- GPR_ASSERT(pfds[0].revents == 0);
- GPR_ASSERT(pfds[1].revents == POLLIN);
- GPR_ASSERT(pfds[2].revents == 0);
- GPR_ASSERT(pfds[3].revents == 0);
- GPR_ASSERT(pfds[4].revents == 0);
- GPR_ASSERT(pfds[5].revents == 0);
+ // Pollin on wakeupfd before poll()
+ pargs.result = -2;
+ grpc_core::Thread thd("grpc_background_poll", &background_poll, &pargs);
+ thd.Start();
+ thd.Join();
+
+ GPR_ASSERT(pargs.result == 1);
+ GPR_ASSERT(pfds[0].revents == 0);
+ GPR_ASSERT(pfds[1].revents == POLLIN);
+ GPR_ASSERT(pfds[2].revents == 0);
+ GPR_ASSERT(pfds[3].revents == 0);
+ GPR_ASSERT(pfds[4].revents == 0);
+ GPR_ASSERT(pfds[5].revents == 0);
}
{
- // No Events
- pargs.result = -2;
- pargs.timeout = 1000;
- reset_socket_event();
- GPR_ASSERT(grpc_wakeup_fd_consume_wakeup(&cvfd1) == GRPC_ERROR_NONE);
- GPR_ASSERT(grpc_wakeup_fd_consume_wakeup(&cvfd2) == GRPC_ERROR_NONE);
- grpc_core::Thread thd("grpc_background_poll", &background_poll, &pargs);
- thd.Start();
- thd.Join();
-
- GPR_ASSERT(pargs.result == 0);
- GPR_ASSERT(pfds[0].revents == 0);
- GPR_ASSERT(pfds[1].revents == 0);
- GPR_ASSERT(pfds[2].revents == 0);
- GPR_ASSERT(pfds[3].revents == 0);
- GPR_ASSERT(pfds[4].revents == 0);
- GPR_ASSERT(pfds[5].revents == 0);
+ // No Events
+ pargs.result = -2;
+ pargs.timeout = 1000;
+ reset_socket_event();
+ GPR_ASSERT(grpc_wakeup_fd_consume_wakeup(&cvfd1) == GRPC_ERROR_NONE);
+ GPR_ASSERT(grpc_wakeup_fd_consume_wakeup(&cvfd2) == GRPC_ERROR_NONE);
+ grpc_core::Thread thd("grpc_background_poll", &background_poll, &pargs);
+ thd.Start();
+ thd.Join();
+
+ GPR_ASSERT(pargs.result == 0);
+ GPR_ASSERT(pfds[0].revents == 0);
+ GPR_ASSERT(pfds[1].revents == 0);
+ GPR_ASSERT(pfds[2].revents == 0);
+ GPR_ASSERT(pfds[3].revents == 0);
+ GPR_ASSERT(pfds[4].revents == 0);
+ GPR_ASSERT(pfds[5].revents == 0);
}
}
diff --git a/test/core/network_benchmarks/low_level_ping_pong.cc b/test/core/network_benchmarks/low_level_ping_pong.cc
index afcd2da57a..df2d9b33aa 100644
--- a/test/core/network_benchmarks/low_level_ping_pong.cc
+++ b/test/core/network_benchmarks/low_level_ping_pong.cc
@@ -38,8 +38,8 @@
#include <grpc/support/log.h>
#include <grpc/support/time.h>
-#include "src/core/lib/gprpp/thd.h"
#include "src/core/lib/gpr/useful.h"
+#include "src/core/lib/gprpp/thd.h"
#include "src/core/lib/iomgr/error.h"
#include "src/core/lib/iomgr/socket_utils_posix.h"
#include "test/core/util/cmdline.h"
diff --git a/test/core/surface/completion_queue_threading_test.cc b/test/core/surface/completion_queue_threading_test.cc
index 391cbf39fa..1a76d7e6ae 100644
--- a/test/core/surface/completion_queue_threading_test.cc
+++ b/test/core/surface/completion_queue_threading_test.cc
@@ -24,8 +24,8 @@
#include <grpc/support/log.h>
#include <grpc/support/time.h>
-#include "src/core/lib/gprpp/thd.h"
#include "src/core/lib/gpr/useful.h"
+#include "src/core/lib/gprpp/thd.h"
#include "src/core/lib/iomgr/iomgr.h"
#include "test/core/util/test_config.h"
@@ -96,8 +96,8 @@ static void test_too_many_plucks(void) {
}
thread_states[i].cc = cc;
thread_states[i].tag = tags[i];
- new (&threads[i]) grpc_core::Thread("grpc_pluck_test", pluck_one,
- thread_states + i);
+ new (&threads[i])
+ grpc_core::Thread("grpc_pluck_test", pluck_one, thread_states + i);
threads[i].Start();
}
@@ -221,8 +221,7 @@ static void test_threading(size_t producers, size_t consumers) {
"test_threading", producers, consumers);
/* start all threads: they will wait for phase1 */
- grpc_core::Thread* threads =
- reinterpret_cast<grpc_core::Thread*>(
+ grpc_core::Thread* threads = reinterpret_cast<grpc_core::Thread*>(
gpr_malloc(sizeof(*threads) * (producers + consumers)));
for (i = 0; i < producers + consumers; i++) {
gpr_event_init(&options[i].on_started);
@@ -236,9 +235,8 @@ static void test_threading(size_t producers, size_t consumers) {
bool ok;
new (&threads[i]) grpc_core::Thread(
- i < producers ? "grpc_producer" : "grpc_consumer",
- i < producers ? producer_thread : consumer_thread,
- options + i, &ok);
+ i < producers ? "grpc_producer" : "grpc_consumer",
+ i < producers ? producer_thread : consumer_thread, options + i, &ok);
GPR_ASSERT(ok);
threads[i].Start();
gpr_event_wait(&options[i].on_started, ten_seconds_time());
diff --git a/test/core/surface/concurrent_connectivity_test.cc b/test/core/surface/concurrent_connectivity_test.cc
index 9f27bacce6..32b4ae1da8 100644
--- a/test/core/surface/concurrent_connectivity_test.cc
+++ b/test/core/surface/concurrent_connectivity_test.cc
@@ -22,9 +22,9 @@
headers. Therefore, sockaddr.h must always be included first */
#include "src/core/lib/iomgr/sockaddr.h"
-#include <new>
#include <memory.h>
#include <stdio.h>
+#include <new>
#include <grpc/grpc.h>
#include <grpc/support/alloc.h>
@@ -175,75 +175,78 @@ int run_concurrent_connectivity_test() {
/* First round, no server */
{
- gpr_log(GPR_DEBUG, "Wave 1");
- char* localhost = gpr_strdup("localhost:54321");
- grpc_core::Thread threads[NUM_THREADS];
- for (auto& th : threads) {
- new (&th) grpc_core::Thread("grpc_wave_1", create_loop_destroy, localhost);
- th.Start();
- }
- for (auto& th : threads) {
- th.Join();
- }
- gpr_free(localhost);
+ gpr_log(GPR_DEBUG, "Wave 1");
+ char* localhost = gpr_strdup("localhost:54321");
+ grpc_core::Thread threads[NUM_THREADS];
+ for (auto& th : threads) {
+ new (&th)
+ grpc_core::Thread("grpc_wave_1", create_loop_destroy, localhost);
+ th.Start();
+ }
+ for (auto& th : threads) {
+ th.Join();
+ }
+ gpr_free(localhost);
}
{
- /* Second round, actual grpc server */
- gpr_log(GPR_DEBUG, "Wave 2");
- int port = grpc_pick_unused_port_or_die();
- gpr_asprintf(&args.addr, "localhost:%d", port);
- args.server = grpc_server_create(nullptr, nullptr);
- grpc_server_add_insecure_http2_port(args.server, args.addr);
- args.cq = grpc_completion_queue_create_for_next(nullptr);
- grpc_server_register_completion_queue(args.server, args.cq, nullptr);
- grpc_server_start(args.server);
- grpc_core::Thread server2("grpc_wave_2_server", server_thread, &args);
- server2.Start();
-
- grpc_core::Thread threads[NUM_THREADS];
- for (auto& th : threads) {
- new (&th) grpc_core::Thread("grpc_wave_2", create_loop_destroy, args.addr);
- th.Start();
- }
- for (auto& th : threads) {
- th.Join();
- }
- grpc_server_shutdown_and_notify(args.server, args.cq, tag(0xd1e));
+ /* Second round, actual grpc server */
+ gpr_log(GPR_DEBUG, "Wave 2");
+ int port = grpc_pick_unused_port_or_die();
+ gpr_asprintf(&args.addr, "localhost:%d", port);
+ args.server = grpc_server_create(nullptr, nullptr);
+ grpc_server_add_insecure_http2_port(args.server, args.addr);
+ args.cq = grpc_completion_queue_create_for_next(nullptr);
+ grpc_server_register_completion_queue(args.server, args.cq, nullptr);
+ grpc_server_start(args.server);
+ grpc_core::Thread server2("grpc_wave_2_server", server_thread, &args);
+ server2.Start();
+
+ grpc_core::Thread threads[NUM_THREADS];
+ for (auto& th : threads) {
+ new (&th)
+ grpc_core::Thread("grpc_wave_2", create_loop_destroy, args.addr);
+ th.Start();
+ }
+ for (auto& th : threads) {
+ th.Join();
+ }
+ grpc_server_shutdown_and_notify(args.server, args.cq, tag(0xd1e));
- server2.Join();
- grpc_server_destroy(args.server);
- grpc_completion_queue_destroy(args.cq);
- gpr_free(args.addr);
+ server2.Join();
+ grpc_server_destroy(args.server);
+ grpc_completion_queue_destroy(args.cq);
+ gpr_free(args.addr);
}
{
- /* Third round, bogus tcp server */
- gpr_log(GPR_DEBUG, "Wave 3");
- args.pollset = static_cast<grpc_pollset*>(gpr_zalloc(grpc_pollset_size()));
- grpc_pollset_init(args.pollset, &args.mu);
- gpr_event_init(&args.ready);
- grpc_core::Thread server3("grpc_wave_3_server", bad_server_thread, &args);
- server3.Start();
- gpr_event_wait(&args.ready, gpr_inf_future(GPR_CLOCK_MONOTONIC));
-
- grpc_core::Thread threads[NUM_THREADS];
- for (auto& th : threads) {
- new (&th) grpc_core::Thread("grpc_wave_3", create_loop_destroy, args.addr);
- th.Start();
- }
- for (auto& th : threads) {
- th.Join();
- }
+ /* Third round, bogus tcp server */
+ gpr_log(GPR_DEBUG, "Wave 3");
+ args.pollset = static_cast<grpc_pollset*>(gpr_zalloc(grpc_pollset_size()));
+ grpc_pollset_init(args.pollset, &args.mu);
+ gpr_event_init(&args.ready);
+ grpc_core::Thread server3("grpc_wave_3_server", bad_server_thread, &args);
+ server3.Start();
+ gpr_event_wait(&args.ready, gpr_inf_future(GPR_CLOCK_MONOTONIC));
+
+ grpc_core::Thread threads[NUM_THREADS];
+ for (auto& th : threads) {
+ new (&th)
+ grpc_core::Thread("grpc_wave_3", create_loop_destroy, args.addr);
+ th.Start();
+ }
+ for (auto& th : threads) {
+ th.Join();
+ }
- gpr_atm_rel_store(&args.stop, 1);
- server3.Join();
- {
- grpc_core::ExecCtx exec_ctx;
- grpc_pollset_shutdown(
- args.pollset, GRPC_CLOSURE_CREATE(done_pollset_shutdown, args.pollset,
- grpc_schedule_on_exec_ctx));
- }
+ gpr_atm_rel_store(&args.stop, 1);
+ server3.Join();
+ {
+ grpc_core::ExecCtx exec_ctx;
+ grpc_pollset_shutdown(
+ args.pollset, GRPC_CLOSURE_CREATE(done_pollset_shutdown, args.pollset,
+ grpc_schedule_on_exec_ctx));
+ }
}
grpc_shutdown();
@@ -289,7 +292,7 @@ int run_concurrent_watches_with_short_timeouts_test() {
for (auto& th : threads) {
new (&th) grpc_core::Thread("grpc_short_watches",
- watches_with_short_timeouts, localhost);
+ watches_with_short_timeouts, localhost);
th.Start();
}
for (auto& th : threads) {