From 10a5903db84cdb741472f895af5efa84c9a14c8e Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Wed, 1 May 2019 16:06:59 -0600 Subject: test/io_uring_setup: don't fail SQPOLL test case for non-root SQPOLL requires root, if the tests are run as a user, we'll get EPERM instead of EINVAL. Don't fail the test because of that, just mention it in the log. Signed-off-by: Jens Axboe --- test/io_uring_setup.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/test/io_uring_setup.c b/test/io_uring_setup.c index 19fb8c5..09e16e5 100644 --- a/test/io_uring_setup.c +++ b/test/io_uring_setup.c @@ -78,7 +78,7 @@ dump_resv(struct io_uring_params *p) int try_io_uring_setup(unsigned entries, struct io_uring_params *p, int expect, int error) { - int ret; + int ret, __errno; printf("io_uring_setup(%u, %p), flags: %s, resv: %s, sq_thread_cpu: %u\n", entries, p, flags_string(p), dump_resv(p), @@ -92,8 +92,13 @@ try_io_uring_setup(unsigned entries, struct io_uring_params *p, int expect, int close(ret); return 1; } - if (expect == -1 && error != errno) { - printf("expected errno %d, got %d\n", error, errno); + __errno = errno; + if (expect == -1 && error != __errno) { + if (__errno == EPERM && geteuid() != 0) { + printf("Needs root, not flagging as an error\n"); + return 0; + } + printf("expected errno %d, got %d\n", error, __errno); return 1; } -- cgit