[PATCH liburing 1/2] tests: don't skip sqpoll needlessly
From: Pavel Begunkov <asml.silence@gmail.com>
Date: 2021-08-25 17:54:19
Subsystem:
the rest · Maintainer:
Linus Torvalds
Newer kernels support non-privileged SQPOLL, don't skip sqpoll testing in sq-poll-kthread and others when it would work just fine. Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> --- test/d4ae271dfaae-test.c | 5 ----- test/sq-poll-kthread.c | 14 ++++++-------- 2 files changed, 6 insertions(+), 13 deletions(-)
diff --git a/test/d4ae271dfaae-test.c b/test/d4ae271dfaae-test.c
index 80d3f71..10c7e98 100644
--- a/test/d4ae271dfaae-test.c
+++ b/test/d4ae271dfaae-test.c@@ -27,11 +27,6 @@ int main(int argc, char *argv[]) char *fname; void *buf; - if (geteuid()) { - fprintf(stdout, "Test requires root, skipping\n"); - return 0; - } - memset(&p, 0, sizeof(p)); p.flags = IORING_SETUP_SQPOLL; ret = t_create_ring_params(4, &ring, &p);
diff --git a/test/sq-poll-kthread.c b/test/sq-poll-kthread.c
index ed7d0bf..0a0a75a 100644
--- a/test/sq-poll-kthread.c
+++ b/test/sq-poll-kthread.c@@ -17,6 +17,7 @@ #include <sys/epoll.h> #include "liburing.h" +#include "helpers.h" #define SQ_THREAD_IDLE 2000 #define BUF_SIZE 128
@@ -38,23 +39,20 @@ static int do_test_sq_poll_kthread_stopped(bool do_exit) uint8_t buf[BUF_SIZE]; struct iovec iov; - if (geteuid()) { - fprintf(stderr, "sqpoll requires root!\n"); - return TEST_SKIPPED; - } - if (pipe(pipe1) != 0) { perror("pipe"); return TEST_FAILED; } memset(¶m, 0, sizeof(param)); - param.flags |= IORING_SETUP_SQPOLL; param.sq_thread_idle = SQ_THREAD_IDLE; - ret = io_uring_queue_init_params(16, &ring, ¶m); - if (ret) { + ret = t_create_ring_params(16, &ring, ¶m); + if (ret == T_SETUP_SKIP) { + ret = TEST_FAILED; + goto err_pipe; + } else if (ret != T_SETUP_OK) { fprintf(stderr, "ring setup failed\n"); ret = TEST_FAILED; goto err_pipe;
--
2.32.0