public inbox for [email protected]
 help / color / mirror / Atom feed
From: Dylan Yudaken <[email protected]>
To: Jens Axboe <[email protected]>, Pavel Begunkov <[email protected]>
Cc: <[email protected]>, Dylan Yudaken <[email protected]>
Subject: [PATCH liburing] fix recv-multishot test skipping in 6.1
Date: Fri, 21 Oct 2022 01:12:07 -0700	[thread overview]
Message-ID: <[email protected]> (raw)

This test was skipping in IORING_SETUP_DEFER_TASKRUN as it was not
flushing the work queue before checking for completions.

Additionally fix the test to only skip if it is the first loop.

Fixes: f91105d54955 ("update existing tests for defer taskrun")
Signed-off-by: Dylan Yudaken <[email protected]>
---
 test/recv-multishot.c | 23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)

diff --git a/test/recv-multishot.c b/test/recv-multishot.c
index 1a041f8e865a..e7c1a99dc0a6 100644
--- a/test/recv-multishot.c
+++ b/test/recv-multishot.c
@@ -13,7 +13,7 @@
 #include "liburing.h"
 #include "helpers.h"
 
-static int no_recv_mshot;
+#define ENORECVMULTISHOT 9999
 
 enum early_error_t {
 	ERROR_NONE  = 0,
@@ -139,6 +139,7 @@ static int test(struct args *args)
 		sqe = io_uring_get_sqe(&ring);
 		io_uring_prep_provide_buffers(sqe, recv_buffs[i],
 					buffer_size, 1, 7, i);
+		io_uring_sqe_set_data64(sqe, 0x999);
 		memset(recv_buffs[i], 0xcc, buffer_size);
 		if (io_uring_submit_and_wait_timeout(&ring, &cqe, 1, &timeout, NULL) != 0) {
 			fprintf(stderr, "provide buffers failed: %d\n", ret);
@@ -186,13 +187,19 @@ static int test(struct args *args)
 			if (args->early_error == ERROR_EARLY_CLOSE_RECEIVER) {
 				/* allow previous sends to complete */
 				usleep(1000);
+				io_uring_get_events(&ring);
 
 				sqe = io_uring_get_sqe(&ring);
 				io_uring_prep_recv(sqe, fds[0], NULL, 0, 0);
 				io_uring_prep_cancel64(sqe, 1234, 0);
+				io_uring_sqe_set_data64(sqe, 0x888);
 				sqe->flags |= IOSQE_CQE_SKIP_SUCCESS;
 				io_uring_submit(&ring);
 				early_error_started = true;
+
+				/* allow the cancel to complete */
+				usleep(1000);
+				io_uring_get_events(&ring);
 			}
 			if (args->early_error == ERROR_EARLY_CLOSE_SENDER) {
 				early_error_started = true;
@@ -246,12 +253,10 @@ static int test(struct args *args)
 	at = &send_buff[0];
 	if (recv_cqes < min_cqes) {
 		if (recv_cqes > 0 && recv_cqe[0].res == -EINVAL) {
-			no_recv_mshot = 1;
-			return 0;
+			return -ENORECVMULTISHOT;
 		}
 		/* some kernels apparently don't check ->ioprio, skip */
-		ret = 0;
-		no_recv_mshot = 1;
+		ret = -ENORECVMULTISHOT;
 		goto cleanup;
 	}
 	for (i = 0; i < recv_cqes; i++) {
@@ -481,14 +486,18 @@ int main(int argc, char *argv[])
 			a.early_error = (enum early_error_t)early_error;
 			ret = test(&a);
 			if (ret) {
+				if (ret == -ENORECVMULTISHOT) {
+					if (loop == 0)
+						return T_EXIT_SKIP;
+					fprintf(stderr,
+						"ENORECVMULTISHOT received but loop>0\n");
+				}
 				fprintf(stderr,
 					"test stream=%d wait_each=%d recvmsg=%d early_error=%d "
 					" defer=%d failed\n",
 					a.stream, a.wait_each, a.recvmsg, a.early_error, a.defer);
 				return T_EXIT_FAIL;
 			}
-			if (no_recv_mshot)
-				return T_EXIT_SKIP;
 		}
 	}
 

base-commit: 1ddd58dab67ea21b94463326ddfda0388ca21ca2
-- 
2.30.2


             reply	other threads:[~2022-10-21  8:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-21  8:12 Dylan Yudaken [this message]
2022-10-21 10:44 ` [PATCH liburing] fix recv-multishot test skipping in 6.1 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 \
    [email protected] \
    [email protected] \
    [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