public inbox for io-uring@vger.kernel.org
 help / color / mirror / Atom feed
From: Pavel Begunkov <asml.silence@gmail.com>
To: io-uring@vger.kernel.org
Cc: asml.silence@gmail.com
Subject: [PATCH liburing 2/6] tests: add t_submit_and_wait_single helper
Date: Thu, 11 Sep 2025 12:26:27 +0100	[thread overview]
Message-ID: <d65fe2ea1b1e5c4c680ea977da51dbef5cb6795d.1757589613.git.asml.silence@gmail.com> (raw)
In-Reply-To: <cover.1757589613.git.asml.silence@gmail.com>

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
---
 test/helpers.c | 17 +++++++++++++++++
 test/helpers.h |  2 ++
 2 files changed, 19 insertions(+)

diff --git a/test/helpers.c b/test/helpers.c
index 05895486..18af2be8 100644
--- a/test/helpers.c
+++ b/test/helpers.c
@@ -509,3 +509,20 @@ void t_clear_nonblock(int fd)
 {
 	__t_toggle_nonblock(fd, 0);
 }
+
+int t_submit_and_wait_single(struct io_uring *ring, struct io_uring_cqe **cqe)
+{
+	int ret;
+
+	ret = io_uring_submit(ring);
+	if (ret <= 0) {
+		fprintf(stderr, "sqe submit failed: %d\n", ret);
+		return -1;
+	}
+	ret = io_uring_wait_cqe(ring, cqe);
+	if (ret < 0) {
+		fprintf(stderr, "wait completion %d\n", ret);
+		return ret;
+	}
+	return 0;
+}
diff --git a/test/helpers.h b/test/helpers.h
index 3f0c11ab..b7465890 100644
--- a/test/helpers.h
+++ b/test/helpers.h
@@ -122,6 +122,8 @@ unsigned long long mtime_since_now(struct timeval *tv);
 unsigned long long utime_since(const struct timeval *s, const struct timeval *e);
 unsigned long long utime_since_now(struct timeval *tv);
 
+int t_submit_and_wait_single(struct io_uring *ring, struct io_uring_cqe **cqe);
+
 #ifdef __cplusplus
 }
 #endif
-- 
2.49.0


  parent reply	other threads:[~2025-09-11 11:25 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-11 11:26 [PATCH liburing 0/6] Add query and mock tests Pavel Begunkov
2025-09-11 11:26 ` [PATCH liburing 1/6] tests: test the query interface Pavel Begunkov
2025-09-19 14:11   ` Pavel Begunkov
2025-09-11 11:26 ` Pavel Begunkov [this message]
2025-09-11 11:26 ` [PATCH liburing 3/6] tests: introduce t_iovec_data_length helper Pavel Begunkov
2025-09-11 11:26 ` [PATCH liburing 4/6] tests: add t_sqe_prep_cmd helper Pavel Begunkov
2025-09-11 11:26 ` [PATCH liburing 5/6] tests: add helper for iov data verification Pavel Begunkov
2025-09-11 11:26 ` [PATCH liburing 6/6] tests: add mock file based tests Pavel Begunkov
2025-09-19 13:15 ` [PATCH liburing 0/6] Add query and mock tests Jens Axboe
2025-09-19 16:56   ` Jens Axboe
2025-09-22  7:55     ` Pavel Begunkov
2025-09-22 12:00       ` 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=d65fe2ea1b1e5c4c680ea977da51dbef5cb6795d.1757589613.git.asml.silence@gmail.com \
    --to=asml.silence@gmail.com \
    --cc=io-uring@vger.kernel.org \
    /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