Skip to content

Commit

Permalink
Merge pull request grpc#12729 from yang-g/osxisdifferent
Browse files Browse the repository at this point in the history
Fix bad_client_window_overflow_test at mac
  • Loading branch information
yang-g authored Sep 28, 2017
2 parents a745825 + 6bf3184 commit 951f6fb
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
11 changes: 8 additions & 3 deletions test/core/bad_client/bad_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down
1 change: 1 addition & 0 deletions test/core/bad_client/bad_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
3 changes: 2 additions & 1 deletion test/core/bad_client/tests/window_overflow.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 951f6fb

Please sign in to comment.