io-uring.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pavel Begunkov <asml.silence@gmail.com>
To: Jens Axboe <axboe@kernel.dk>, io-uring@vger.kernel.org
Subject: [PATCH liburing 1/2] tests: non-privileged defer test
Date: Tue, 24 Aug 2021 12:39:27 +0100	[thread overview]
Message-ID: <726e3cd30a1e5689e6b87c252ddd2770aa431b41.1629805109.git.asml.silence@gmail.com> (raw)
In-Reply-To: <cover.1629805109.git.asml.silence@gmail.com>

Reduce ring sizes because non-privileged users can't create them, clean
up dead code, and SQPOLL testing to the end, so it doesn't stop all
other tests if not supported.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
---
 test/defer.c | 39 +++++++++++++++++++--------------------
 1 file changed, 19 insertions(+), 20 deletions(-)

diff --git a/test/defer.c b/test/defer.c
index 885cf5c..825b69f 100644
--- a/test/defer.c
+++ b/test/defer.c
@@ -11,6 +11,8 @@
 #include "helpers.h"
 #include "liburing.h"
 
+#define RING_SIZE 128
+
 struct test_context {
 	struct io_uring *ring;
 	struct io_uring_sqe **sqes;
@@ -243,30 +245,24 @@ int main(int argc, char *argv[])
 {
 	struct io_uring ring, poll_ring, sqthread_ring;
 	struct io_uring_params p;
-	int ret, no_sqthread = 0;
+	int ret;
 
 	if (argc > 1)
 		return 0;
 
 	memset(&p, 0, sizeof(p));
-	ret = io_uring_queue_init_params(1000, &ring, &p);
+	ret = io_uring_queue_init_params(RING_SIZE, &ring, &p);
 	if (ret) {
-		printf("ring setup failed\n");
+		printf("ring setup failed %i\n", ret);
 		return 1;
 	}
 
-	ret = io_uring_queue_init(1000, &poll_ring, IORING_SETUP_IOPOLL);
+	ret = io_uring_queue_init(RING_SIZE, &poll_ring, IORING_SETUP_IOPOLL);
 	if (ret) {
 		printf("poll_ring setup failed\n");
 		return 1;
 	}
 
-	ret = t_create_ring(1000, &sqthread_ring,
-				IORING_SETUP_SQPOLL | IORING_SETUP_IOPOLL);
-	if (ret == T_SETUP_SKIP)
-		return 0;
-	else if (ret < 0)
-		return 1;
 
 	ret = test_cancelled_userdata(&poll_ring);
 	if (ret) {
@@ -274,16 +270,6 @@ int main(int argc, char *argv[])
 		return ret;
 	}
 
-	if (no_sqthread) {
-		printf("test_thread_link_cancel: skipped, not root\n");
-	} else {
-		ret = test_thread_link_cancel(&sqthread_ring);
-		if (ret) {
-			printf("test_thread_link_cancel failed\n");
-			return ret;
-		}
-	}
-
 	if (!(p.features & IORING_FEAT_NODROP)) {
 		ret = test_overflow_hung(&ring);
 		if (ret) {
@@ -304,5 +290,18 @@ int main(int argc, char *argv[])
 		return ret;
 	}
 
+	ret = t_create_ring(RING_SIZE, &sqthread_ring,
+				IORING_SETUP_SQPOLL | IORING_SETUP_IOPOLL);
+	if (ret == T_SETUP_SKIP)
+		return 0;
+	else if (ret < 0)
+		return 1;
+
+	ret = test_thread_link_cancel(&sqthread_ring);
+	if (ret) {
+		printf("test_thread_link_cancel failed\n");
+		return ret;
+	}
+
 	return 0;
 }
-- 
2.32.0


  reply	other threads:[~2021-08-24 11:40 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-24 11:39 [PATCH liburing 0/2] non-privileged tests Pavel Begunkov
2021-08-24 11:39 ` Pavel Begunkov [this message]
2021-08-24 11:39 ` [PATCH liburing 2/2] tests: non-privileged io_uring_enter Pavel Begunkov
2021-08-24 14:09 ` [PATCH liburing 0/2] non-privileged tests 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=726e3cd30a1e5689e6b87c252ddd2770aa431b41.1629805109.git.asml.silence@gmail.com \
    --to=asml.silence@gmail.com \
    --cc=axboe@kernel.dk \
    --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;
as well as URLs for NNTP newsgroup(s).