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>
This commit is contained in:
@@ -78,7 +78,7 @@ dump_resv(struct io_uring_params *p)
|
|||||||
int
|
int
|
||||||
try_io_uring_setup(unsigned entries, struct io_uring_params *p, int expect, int error)
|
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",
|
printf("io_uring_setup(%u, %p), flags: %s, resv: %s, sq_thread_cpu: %u\n",
|
||||||
entries, p, flags_string(p), dump_resv(p),
|
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);
|
close(ret);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if (expect == -1 && error != errno) {
|
__errno = errno;
|
||||||
printf("expected errno %d, got %d\n", error, 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;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user