summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2019-05-01 16:06:59 -0600
committerJens Axboe <axboe@kernel.dk>2019-05-01 16:06:59 -0600
commit10a5903db84cdb741472f895af5efa84c9a14c8e (patch)
tree97f19b6a0b9afd21be518e93193b2fae82d44e64
parentff73ac71a171663b5879f7dc3e0eba696239db3e (diff)
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 <axboe@kernel.dk>
-rw-r--r--test/io_uring_setup.c11
1 files 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;
}