All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH liburing 1/1] tests: update reg-buf limits testing
@ 2021-06-09 11:46 Pavel Begunkov
  2021-06-09 15:13 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Pavel Begunkov @ 2021-06-09 11:46 UTC (permalink / raw)
  To: Jens Axboe, io-uring

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>
---
 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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH liburing 1/1] tests: update reg-buf limits testing
  2021-06-09 11:46 [PATCH liburing 1/1] tests: update reg-buf limits testing Pavel Begunkov
@ 2021-06-09 15:13 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2021-06-09 15:13 UTC (permalink / raw)
  To: Pavel Begunkov, io-uring

On 6/9/21 5:46 AM, Pavel Begunkov wrote:
> We now allow more fixed buffers to be registered, update tests from the
> previous UIO_MAXIOV limit to something that will definitely fail.

Applied, thanks.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-06-09 15:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-09 11:46 [PATCH liburing 1/1] tests: update reg-buf limits testing Pavel Begunkov
2021-06-09 15:13 ` Jens Axboe

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.