From 6bf31841276d7b9d2c449da279c0de47c6850a82 Mon Sep 17 00:00:00 2001 From: yang-g Date: Tue, 26 Sep 2017 16:40:45 -0700 Subject: [PATCH] Fix bad_client_window_overflow_test at mac --- test/core/bad_client/bad_client.c | 11 ++++++++--- test/core/bad_client/bad_client.h | 1 + test/core/bad_client/tests/window_overflow.c | 3 ++- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/test/core/bad_client/bad_client.c b/test/core/bad_client/bad_client.c index 383d1240cb0..fff0c793ed6 100644 --- a/test/core/bad_client/bad_client.c +++ b/test/core/bad_client/bad_client.c @@ -134,9 +134,12 @@ void grpc_run_bad_client_test( grpc_endpoint_write(&exec_ctx, sfd.client, &outgoing, &done_write_closure); grpc_exec_ctx_finish(&exec_ctx); - /* Await completion */ - GPR_ASSERT( - gpr_event_wait(&a.done_write, grpc_timeout_seconds_to_deadline(5))); + /* Await completion, unless the request is large and write may not finish + * before the peer shuts down. */ + if (!(flags & GRPC_BAD_CLIENT_LARGE_REQUEST)) { + GPR_ASSERT( + gpr_event_wait(&a.done_write, grpc_timeout_seconds_to_deadline(5))); + } if (flags & GRPC_BAD_CLIENT_DISCONNECT) { grpc_endpoint_shutdown( @@ -186,6 +189,8 @@ void grpc_run_bad_client_test( grpc_exec_ctx_finish(&exec_ctx); } + GPR_ASSERT( + gpr_event_wait(&a.done_write, grpc_timeout_seconds_to_deadline(1))); shutdown_cq = grpc_completion_queue_create_for_pluck(NULL); grpc_server_shutdown_and_notify(a.server, shutdown_cq, NULL); GPR_ASSERT(grpc_completion_queue_pluck( diff --git a/test/core/bad_client/bad_client.h b/test/core/bad_client/bad_client.h index 22f1a3abc7a..a5b01f7f2c1 100644 --- a/test/core/bad_client/bad_client.h +++ b/test/core/bad_client/bad_client.h @@ -37,6 +37,7 @@ typedef bool (*grpc_bad_client_client_stream_validator)( grpc_slice_buffer *incoming); #define GRPC_BAD_CLIENT_DISCONNECT 1 +#define GRPC_BAD_CLIENT_LARGE_REQUEST 2 /* Test runner. diff --git a/test/core/bad_client/tests/window_overflow.c b/test/core/bad_client/tests/window_overflow.c index 1f29bd32fbd..18c647ad8a7 100644 --- a/test/core/bad_client/tests/window_overflow.c +++ b/test/core/bad_client/tests/window_overflow.c @@ -90,7 +90,8 @@ int main(int argc, char **argv) { addbuf(message, sizeof(message)); } } - grpc_run_bad_client_test(verifier, NULL, g_buffer, g_count, 0); + grpc_run_bad_client_test(verifier, NULL, g_buffer, g_count, + GRPC_BAD_CLIENT_LARGE_REQUEST); gpr_free(g_buffer); return 0;