summaryrefslogtreecommitdiff
path: root/test/send_recv.c
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 /test/send_recv.c
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>
Diffstat (limited to 'test/send_recv.c')
-rw-r--r--test/send_recv.c10
1 files changed, 10 insertions, 0 deletions
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;