From b909ff5fba7b260dab6677372bccf2e84940aced Mon Sep 17 00:00:00 2001 From: Bert Belder Date: Tue, 3 May 2011 05:19:23 +0200 Subject: [PATCH] Some test fixes --- test/test-tcp-writealot.c | 12 ++++-------- test/test-timeout.c | 2 ++ 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/test/test-tcp-writealot.c b/test/test-tcp-writealot.c index 3931cb51..3db3aa53 100644 --- a/test/test-tcp-writealot.c +++ b/test/test-tcp-writealot.c @@ -33,7 +33,6 @@ static char* send_buffer; -static char* receive_buffer; static int connect_cb_called = 0; @@ -69,9 +68,12 @@ static void read_cb(oio_handle* handle, int nread, oio_buf buf) { return; } - bytes_received_done += nread; + /* TODO: fix this when we support sending EOF. */ + if (bytes_received_done == TOTAL_BYTES) + oio_close(handle); + free(buf.base); } @@ -89,7 +91,6 @@ static void write_cb(oio_req* req, int status) { static void connect_cb(oio_req* req, int status) { oio_buf send_bufs[CHUNKS_PER_WRITE]; - oio_buf receive_buf; oio_handle* handle; int i, j, r; @@ -121,9 +122,6 @@ static void connect_cb(oio_req* req, int status) { req = (oio_req*)malloc(sizeof *req); ASSERT(req != NULL); - receive_buf.len = CHUNK_SIZE; - receive_buf.base = receive_buffer; - oio_req_init(req, handle, read_cb); r = oio_read_start(handle, read_cb); ASSERT(r == 0); @@ -148,10 +146,8 @@ TEST_IMPL(tcp_writealot) { ASSERT(connect_req != NULL); send_buffer = (char*)malloc(TOTAL_BYTES + 1); - receive_buffer = (char*)malloc(TOTAL_BYTES + 1); ASSERT(send_buffer != NULL); - ASSERT(receive_buffer != NULL); oio_init(alloc_cb); diff --git a/test/test-timeout.c b/test/test-timeout.c index 3fedfe63..03eac71b 100644 --- a/test/test-timeout.c +++ b/test/test-timeout.c @@ -55,7 +55,9 @@ static void dummy_timeout_cb(oio_req *req, int64_t skew, int status) { static oio_buf alloc_cb(oio_handle* handle, size_t size) { + oio_buf buf = {0, 0}; FATAL("alloc should not be called"); + return buf; }