public inbox for [email protected]
 help / color / mirror / Atom feed
From: Pavel Begunkov <[email protected]>
To: Jens Axboe <[email protected]>, [email protected]
Subject: [PATCH liburing 1/1] tests: update reg-buf limits testing
Date: Wed,  9 Jun 2021 12:46:54 +0100	[thread overview]
Message-ID: <947234e13ba32fdc9b8ce45f679d78b9d08cb46a.1623239194.git.asml.silence@gmail.com> (raw)

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 <[email protected]>
---
 test/io_uring_register.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/test/io_uring_register.c b/test/io_uring_register.c
index 7bcb036..1d0981b 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);
-- 
2.31.1


             reply	other threads:[~2021-06-09 11:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-09 11:46 Pavel Begunkov [this message]
2021-06-09 15:13 ` [PATCH liburing 1/1] tests: update reg-buf limits testing Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=947234e13ba32fdc9b8ce45f679d78b9d08cb46a.1623239194.git.asml.silence@gmail.com \
    [email protected] \
    [email protected] \
    [email protected] \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox