diff options
author | Juan Quintela <quintela@redhat.com> | 2017-08-23 10:25:26 +0200 |
---|---|---|
committer | Juan Quintela <quintela@redhat.com> | 2017-09-05 22:34:40 +0200 |
commit | e3ff9f0e57472e6411dc446b41789cbd9e2cf887 (patch) | |
tree | 726a1a18d7bd62c7b627d090a97fd97ccbf7e2dc /tests/test-iov.c | |
parent | b07d1c2f5607489d4d4a6a65ce36a3e896ac065e (diff) |
tests: Use real size for iov tests
We were using -1 instead of the real size because the functions check
what is bigger, size in bytes or the size of the iov. Recent gcc's
barf at this.
Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Tested-by: Cleber Rosa <crosa@redhat.com>
--
Remove comments about this feature.
Fix missing -1.
Diffstat (limited to 'tests/test-iov.c')
-rw-r--r-- | tests/test-iov.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/tests/test-iov.c b/tests/test-iov.c index fa3d75aee1..458ca25099 100644 --- a/tests/test-iov.c +++ b/tests/test-iov.c @@ -81,17 +81,17 @@ static void test_to_from_buf_1(void) * skip whole vector and process exactly 0 bytes */ /* first set bytes [i..sz) to some "random" value */ - n = iov_memset(iov, niov, 0, 0xff, -1); + n = iov_memset(iov, niov, 0, 0xff, sz); g_assert(n == sz); /* next copy bytes [i..sz) from ibuf to iovec */ - n = iov_from_buf(iov, niov, i, ibuf + i, -1); + n = iov_from_buf(iov, niov, i, ibuf + i, sz - i); g_assert(n == sz - i); /* clear part of obuf */ memset(obuf + i, 0, sz - i); /* and set this part of obuf to values from iovec */ - n = iov_to_buf(iov, niov, i, obuf + i, -1); + n = iov_to_buf(iov, niov, i, obuf + i, sz - i); g_assert(n == sz - i); /* now compare resulting buffers */ @@ -109,7 +109,7 @@ static void test_to_from_buf_1(void) * with j in [i..sz]. */ /* clear iovec */ - n = iov_memset(iov, niov, 0, 0xff, -1); + n = iov_memset(iov, niov, 0, 0xff, sz); g_assert(n == sz); /* copy bytes [i..j) from ibuf to iovec */ @@ -225,7 +225,7 @@ static void test_io(void) for (i = 0; i <= sz; ++i) { for (j = i; j <= sz; ++j) { k = i; - iov_memset(iov, niov, 0, 0xff, -1); + iov_memset(iov, niov, 0, 0xff, sz); do { s = g_test_rand_int_range(0, j - k + 1); r = iov_recv(sv[0], iov, niov, k, s); |