aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavel Begunkov <asml.silence@gmail.com>2021-06-09 12:46:54 +0100
committerJens Axboe <axboe@kernel.dk>2021-06-09 09:13:17 -0600
commitee551425c1d25ed1d7febf673df75cc1222fc4ee (patch)
tree24b99225f0999237063cb71f71c26053d5852ee8
parent9ef0e54099230ac7d3a44820f8431ddb87688f30 (diff)
downloadliburing-ee551425c1d25ed1d7febf673df75cc1222fc4ee.tar.gz
tests: update reg-buf limits testing
We now allow more fixed buffers to be registered, update tests from the previous UIO_MAXIOV limit to something that will definitely fail. Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--test/io_uring_register.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/test/io_uring_register.c b/test/io_uring_register.c
index cf6987c..53e3987 100644
--- a/test/io_uring_register.c
+++ b/test/io_uring_register.c
@@ -280,12 +280,16 @@ int
test_iovec_nr(int fd)
{
int i, ret, status = 0;
- unsigned int nr = UIO_MAXIOV + 1;
+ unsigned int nr = 1000000;
struct iovec *iovs;
void *buf;
+ iovs = malloc(nr * sizeof(struct iovec));
+ if (!iovs) {
+ fprintf(stdout, "can't allocate iovecs, skip\n");
+ return 0;
+ }
buf = t_malloc(pagesize);
- iovs = t_malloc(nr * sizeof(struct iovec));
for (i = 0; i < nr; i++) {
iovs[i].iov_base = buf;
@@ -295,7 +299,7 @@ test_iovec_nr(int fd)
status |= expect_fail(fd, IORING_REGISTER_BUFFERS, iovs, nr, EINVAL);
/* reduce to UIO_MAXIOV */
- nr--;
+ nr = UIO_MAXIOV;
printf("io_uring_register(%d, %u, %p, %u)\n",
fd, IORING_REGISTER_BUFFERS, iovs, nr);
ret = __sys_io_uring_register(fd, IORING_REGISTER_BUFFERS, iovs, nr);