From d9fdaf204cbca6472f5588eba83f37c01bb6c8a4 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 22 Sep 2015 08:31:23 -0700 Subject: Fix tests --- test/core/iomgr/endpoint_tests.c | 20 +++++++------------- test/core/iomgr/tcp_server_posix_test.c | 3 ++- test/core/security/secure_endpoint_test.c | 3 +-- 3 files changed, 10 insertions(+), 16 deletions(-) (limited to 'test') diff --git a/test/core/iomgr/endpoint_tests.c b/test/core/iomgr/endpoint_tests.c index 02618dfd66..31743167cd 100644 --- a/test/core/iomgr/endpoint_tests.c +++ b/test/core/iomgr/endpoint_tests.c @@ -151,18 +151,12 @@ static void read_and_write_test_write_handler(void *data, int success, size_t nslices; if (success) { - for (;;) { - /* Need to do inline writes until they don't succeed synchronously or we - finish writing */ - state->bytes_written += state->current_write_size; - if (state->target_bytes - state->bytes_written < - state->current_write_size) { - state->current_write_size = state->target_bytes - state->bytes_written; - } - if (state->current_write_size == 0) { - break; - } - + state->bytes_written += state->current_write_size; + if (state->target_bytes - state->bytes_written < + state->current_write_size) { + state->current_write_size = state->target_bytes - state->bytes_written; + } + if (state->current_write_size != 0) { slices = allocate_blocks(state->current_write_size, 8192, &nslices, &state->current_write_data); gpr_slice_buffer_reset_and_unref(&state->outgoing); @@ -170,8 +164,8 @@ static void read_and_write_test_write_handler(void *data, int success, grpc_endpoint_write(state->write_ep, &state->outgoing, &state->done_write, call_list); free(slices); + return; } - GPR_ASSERT(state->bytes_written == state->target_bytes); } gpr_log(GPR_INFO, "Write handler done"); diff --git a/test/core/iomgr/tcp_server_posix_test.c b/test/core/iomgr/tcp_server_posix_test.c index b80506bc51..6ce78d2088 100644 --- a/test/core/iomgr/tcp_server_posix_test.c +++ b/test/core/iomgr/tcp_server_posix_test.c @@ -159,7 +159,8 @@ static void test_connect(int n) { gpr_mu_unlock(GRPC_POLLSET_MU(&g_pollset)); - grpc_tcp_server_destroy(s, NULL, NULL); + grpc_tcp_server_destroy(s, NULL, &call_list); + grpc_call_list_run(&call_list); } static void destroy_pollset(void *p, int success, grpc_call_list *call_list) { diff --git a/test/core/security/secure_endpoint_test.c b/test/core/security/secure_endpoint_test.c index f7948b56af..2e0f17f3ab 100644 --- a/test/core/security/secure_endpoint_test.c +++ b/test/core/security/secure_endpoint_test.c @@ -140,7 +140,6 @@ static grpc_endpoint_test_config configs[] = { static void inc_call_ctr(void *arg, int success, grpc_call_list *call_list) { ++*(int *)arg; - ; } static void test_leftover(grpc_endpoint_test_config config, size_t slice_size) { @@ -155,7 +154,7 @@ static void test_leftover(grpc_endpoint_test_config config, size_t slice_size) { gpr_slice_buffer_init(&incoming); grpc_closure_init(&done_closure, inc_call_ctr, &n); - grpc_endpoint_read(f.client_ep, &incoming, NULL, &call_list); + grpc_endpoint_read(f.client_ep, &incoming, &done_closure, &call_list); grpc_call_list_run(&call_list); GPR_ASSERT(n == 1); GPR_ASSERT(incoming.count == 1); -- cgit v1.2.3