io-uring.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH liburing 0/2] small test improvements
@ 2021-09-24 19:05 Pavel Begunkov
  2021-09-24 19:05 ` [PATCH liburing 1/2] tests: improve multicqe_drain Pavel Begunkov
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Pavel Begunkov @ 2021-09-24 19:05 UTC (permalink / raw)
  To: Jens Axboe, io-uring

fix types in rsrc_tags test, and make a few adjustments in multicqe_drain

Pavel Begunkov (2):
  tests: improve multicqe_drain
  tests: match kernel and pass fds in s32[]

 test/multicqes_drain.c | 12 ++++++++----
 test/rsrc_tags.c       |  2 +-
 2 files changed, 9 insertions(+), 5 deletions(-)

-- 
2.33.0


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

* [PATCH liburing 1/2] tests: improve multicqe_drain
  2021-09-24 19:05 [PATCH liburing 0/2] small test improvements Pavel Begunkov
@ 2021-09-24 19:05 ` Pavel Begunkov
  2021-09-24 19:05 ` [PATCH liburing 2/2] tests: match kernel and pass fds in s32[] Pavel Begunkov
  2021-09-24 19:59 ` [PATCH liburing 0/2] small test improvements Jens Axboe
  2 siblings, 0 replies; 4+ messages in thread
From: Pavel Begunkov @ 2021-09-24 19:05 UTC (permalink / raw)
  To: Jens Axboe, io-uring

Small improvements for multicqe_drain test.
- close pipes
- use a helper for multishot poll
- don't touch cqe after io_uring_cqe_seen()

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
---
 test/multicqes_drain.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/test/multicqes_drain.c b/test/multicqes_drain.c
index d04cf37..b107a48 100644
--- a/test/multicqes_drain.c
+++ b/test/multicqes_drain.c
@@ -288,9 +288,9 @@ static int test_simple_drain(struct io_uring *ring)
 		}
 	}
 
-	io_uring_prep_poll_add(sqe[0], pipe1[0], POLLIN);
-	sqe[0]->len |= IORING_POLL_ADD_MULTI;
+	io_uring_prep_poll_multishot(sqe[0], pipe1[0], POLLIN);
 	sqe[0]->user_data = 0;
+
 	io_uring_prep_poll_add(sqe[1], pipe2[0], POLLIN);
 	sqe[1]->user_data = 1;
 
@@ -320,6 +320,7 @@ static int test_simple_drain(struct io_uring *ring)
 
 	io_uring_prep_poll_remove(sqe[0], 0);
 	sqe[0]->user_data = 2;
+
 	io_uring_prep_nop(sqe[1]);
 	sqe[1]->flags |= IOSQE_IO_DRAIN;
 	sqe[1]->user_data = 3;
@@ -333,18 +334,21 @@ static int test_simple_drain(struct io_uring *ring)
 		goto err;
 	}
 
-
 	for (i = 0; i < 6; i++) {
 		ret = io_uring_wait_cqe(ring, &cqe);
 		if (ret < 0) {
 			printf("wait completion %d\n", ret);
 			goto err;
 		}
-		io_uring_cqe_seen(ring, cqe);
 		if ((i == 5) && (cqe->user_data != 3))
 			goto err;
+		io_uring_cqe_seen(ring, cqe);
 	}
 
+	close(pipe1[0]);
+	close(pipe1[1]);
+	close(pipe2[0]);
+	close(pipe2[1]);
 	return 0;
 err:
 	return 1;
-- 
2.33.0


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

* [PATCH liburing 2/2] tests: match kernel and pass fds in s32[]
  2021-09-24 19:05 [PATCH liburing 0/2] small test improvements Pavel Begunkov
  2021-09-24 19:05 ` [PATCH liburing 1/2] tests: improve multicqe_drain Pavel Begunkov
@ 2021-09-24 19:05 ` Pavel Begunkov
  2021-09-24 19:59 ` [PATCH liburing 0/2] small test improvements Jens Axboe
  2 siblings, 0 replies; 4+ messages in thread
From: Pavel Begunkov @ 2021-09-24 19:05 UTC (permalink / raw)
  To: Jens Axboe, io-uring

Follow the kernel ABI and pass fds in an array of s32 but not just ints.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
---
 test/rsrc_tags.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/rsrc_tags.c b/test/rsrc_tags.c
index a3fec0c..f441b5c 100644
--- a/test/rsrc_tags.c
+++ b/test/rsrc_tags.c
@@ -322,7 +322,7 @@ static int test_files(int ring_flags)
 	struct io_uring ring;
 	const int nr = 50;
 	int off = 5, i, ret, fd;
-	int files[nr];
+	__s32 files[nr];
 	__u64 tags[nr], tag;
 
 	for (i = 0; i < nr; ++i) {
-- 
2.33.0


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

* Re: [PATCH liburing 0/2] small test improvements
  2021-09-24 19:05 [PATCH liburing 0/2] small test improvements Pavel Begunkov
  2021-09-24 19:05 ` [PATCH liburing 1/2] tests: improve multicqe_drain Pavel Begunkov
  2021-09-24 19:05 ` [PATCH liburing 2/2] tests: match kernel and pass fds in s32[] Pavel Begunkov
@ 2021-09-24 19:59 ` Jens Axboe
  2 siblings, 0 replies; 4+ messages in thread
From: Jens Axboe @ 2021-09-24 19:59 UTC (permalink / raw)
  To: Pavel Begunkov, io-uring

On 9/24/21 1:05 PM, Pavel Begunkov wrote:
> fix types in rsrc_tags test, and make a few adjustments in multicqe_drain

Applied, thanks.

-- 
Jens Axboe


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

end of thread, other threads:[~2021-09-24 19:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-24 19:05 [PATCH liburing 0/2] small test improvements Pavel Begunkov
2021-09-24 19:05 ` [PATCH liburing 1/2] tests: improve multicqe_drain Pavel Begunkov
2021-09-24 19:05 ` [PATCH liburing 2/2] tests: match kernel and pass fds in s32[] Pavel Begunkov
2021-09-24 19:59 ` [PATCH liburing 0/2] small test improvements Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).