Fix tests
This commit is contained in:
parent
40cd820fd6
commit
d9fdaf204c
|
|
@ -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");
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in New Issue