test: Skip tests where the kernel lacks support
Signed-off-by: Guillem Jover <guillem@hadrons.org>
diff --git a/test/poll-v-poll.c b/test/poll-v-poll.c
index 61d40dd..c8ba6f1 100644
--- a/test/poll-v-poll.c
+++ b/test/poll-v-poll.c
@@ -259,8 +259,13 @@
return 1;
}
} else {
- if (iou_epoll_ctl(ring, fd, pipe1[0], &ev))
+ ret = iou_epoll_ctl(ring, fd, pipe1[0], &ev);
+ if (ret == -EINVAL) {
+ fprintf(stdout, "epoll not supported, skipping\n");
+ return 0;
+ } else if (ret < 0) {
return 1;
+ }
}
td.ring = ring;
diff --git a/test/read-write.c b/test/read-write.c
index c3c10f9..3e6f1d2 100644
--- a/test/read-write.c
+++ b/test/read-write.c
@@ -344,7 +344,9 @@
fprintf(stderr, "wait_cqe=%d\n", ret);
return 1;
}
- if (cqe->res != sizeof(eventfd_t)) {
+ if (cqe->res == -EINVAL) {
+ fprintf(stdout, "eventfd IO not supported, skipping\n");
+ } else if (cqe->res != sizeof(eventfd_t)) {
fprintf(stderr, "cqe res %d, wanted %ld\n", cqe->res, sizeof(eventfd_t));
return 1;
}
diff --git a/test/send_recv.c b/test/send_recv.c
index 2455163..0715f6f 100644
--- a/test/send_recv.c
+++ b/test/send_recv.c
@@ -2,6 +2,7 @@
/*
* Simple test case showing using send and recv through io_uring
*/
+#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -69,6 +70,10 @@
struct io_uring_cqe *cqe;
io_uring_wait_cqe(ring, &cqe);
+ if (cqe->res == -EINVAL) {
+ fprintf(stdout, "recv not supported, skipping\n");
+ return 0;
+ }
if (cqe->res < 0) {
fprintf(stderr, "failed cqe: %d\n", cqe->res);
goto err;
@@ -157,6 +162,11 @@
}
ret = io_uring_wait_cqe(&ring, &cqe);
+ if (cqe->res == -EINVAL) {
+ fprintf(stdout, "send not supported, skipping\n");
+ close(sockfd);
+ return 0;
+ }
if (cqe->res != iov.iov_len) {
fprintf(stderr, "failed cqe: %d\n", cqe->res);
goto err;