[PATCH liburing 1/2] tests: non-privileged defer test

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux