summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillem Jover <guillem@hadrons.org>2020-02-11 00:45:47 +0100
committerGuillem Jover <guillem@hadrons.org>2020-02-14 14:39:28 +0100
commit1fb4160e7d3ae9e34ab88e0bc56f0bb831379649 (patch)
tree334aae2fcf46e82fcf05b1a8cf6aa7acb381112a
parentb6535233cc60328c38fbb3e1102213d531f47c22 (diff)
downloadliburing-1fb4160e7d3ae9e34ab88e0bc56f0bb831379649.tar.gz
liburing-1fb4160e7d3ae9e34ab88e0bc56f0bb831379649.tar.bz2
test: Skip tests where the kernel lacks support
Signed-off-by: Guillem Jover <guillem@hadrons.org>
-rw-r--r--test/poll-v-poll.c7
-rw-r--r--test/read-write.c4
-rw-r--r--test/send_recv.c10
3 files changed, 19 insertions, 2 deletions
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 @@ static int do_test_epoll(struct io_uring *ring, int iou_epoll_add)
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 @@ static int test_eventfd_read(void)
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 @@ static int do_recv(struct io_uring *ring, struct iovec *iov)
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 @@ static int do_send(void)
}
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;