diff options
Diffstat (limited to 'test/core/surface/concurrent_connectivity_test.cc')
-rw-r--r-- | test/core/surface/concurrent_connectivity_test.cc | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/test/core/surface/concurrent_connectivity_test.cc b/test/core/surface/concurrent_connectivity_test.cc index 8fa15ab331..2ff1ca3d79 100644 --- a/test/core/surface/concurrent_connectivity_test.cc +++ b/test/core/surface/concurrent_connectivity_test.cc @@ -49,10 +49,11 @@ #define NUM_OUTER_LOOPS_SHORT_TIMEOUTS 10 #define NUM_INNER_LOOPS_SHORT_TIMEOUTS 100 #define DELAY_MILLIS_SHORT_TIMEOUTS 1 -// in a successful test run, POLL_MILLIS should never be reached beause all runs -// should -// end after the shorter delay_millis +// in a successful test run, POLL_MILLIS should never be reached because all +// runs should end after the shorter delay_millis #define POLL_MILLIS_SHORT_TIMEOUTS 30000 +// it should never take longer that this to shutdown the server +#define SERVER_SHUTDOWN_TIMEOUT 30000 static void* tag(int n) { return (void*)(uintptr_t)n; } static int detag(void* p) { return (int)(uintptr_t)p; } @@ -95,7 +96,8 @@ struct server_thread_args { void server_thread(void* vargs) { struct server_thread_args* args = (struct server_thread_args*)vargs; grpc_event ev; - gpr_timespec deadline = gpr_inf_future(GPR_CLOCK_MONOTONIC); + gpr_timespec deadline = + grpc_timeout_milliseconds_to_deadline(SERVER_SHUTDOWN_TIMEOUT); ev = grpc_completion_queue_next(args->cq, deadline, nullptr); GPR_ASSERT(ev.type == GRPC_OP_COMPLETE); GPR_ASSERT(detag(ev.tag) == 0xd1e); @@ -180,7 +182,8 @@ int run_concurrent_connectivity_test() { /* First round, no server */ gpr_log(GPR_DEBUG, "Wave 1"); for (size_t i = 0; i < NUM_THREADS; ++i) { - gpr_thd_new(&threads[i], create_loop_destroy, localhost, &options); + gpr_thd_new(&threads[i], "grpc_wave_1", create_loop_destroy, localhost, + &options); } for (size_t i = 0; i < NUM_THREADS; ++i) { gpr_thd_join(threads[i]); @@ -196,10 +199,11 @@ int run_concurrent_connectivity_test() { args.cq = grpc_completion_queue_create_for_next(nullptr); grpc_server_register_completion_queue(args.server, args.cq, nullptr); grpc_server_start(args.server); - gpr_thd_new(&server, server_thread, &args, &options); + gpr_thd_new(&server, "grpc_wave_2_server", server_thread, &args, &options); for (size_t i = 0; i < NUM_THREADS; ++i) { - gpr_thd_new(&threads[i], create_loop_destroy, args.addr, &options); + gpr_thd_new(&threads[i], "grpc_wave_2", create_loop_destroy, args.addr, + &options); } for (size_t i = 0; i < NUM_THREADS; ++i) { gpr_thd_join(threads[i]); @@ -216,11 +220,13 @@ int run_concurrent_connectivity_test() { args.pollset = static_cast<grpc_pollset*>(gpr_zalloc(grpc_pollset_size())); grpc_pollset_init(args.pollset, &args.mu); gpr_event_init(&args.ready); - gpr_thd_new(&server, bad_server_thread, &args, &options); + gpr_thd_new(&server, "grpc_wave_3_server", bad_server_thread, &args, + &options); gpr_event_wait(&args.ready, gpr_inf_future(GPR_CLOCK_MONOTONIC)); for (size_t i = 0; i < NUM_THREADS; ++i) { - gpr_thd_new(&threads[i], create_loop_destroy, args.addr, &options); + gpr_thd_new(&threads[i], "grpc_wave_3", create_loop_destroy, args.addr, + &options); } for (size_t i = 0; i < NUM_THREADS; ++i) { gpr_thd_join(threads[i]); @@ -278,7 +284,8 @@ int run_concurrent_watches_with_short_timeouts_test() { gpr_thd_options_set_joinable(&options); for (size_t i = 0; i < NUM_THREADS; ++i) { - gpr_thd_new(&threads[i], watches_with_short_timeouts, localhost, &options); + gpr_thd_new(&threads[i], "grpc_short_watches", watches_with_short_timeouts, + localhost, &options); } for (size_t i = 0; i < NUM_THREADS; ++i) { gpr_thd_join(threads[i]); |