diff options
author | Jens Axboe <axboe@kernel.dk> | 2020-06-30 09:58:23 -0600 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2020-06-30 09:58:23 -0600 |
commit | 16757041cc9cb495867ec1f7db062f51399247b9 (patch) | |
tree | 29960cd442b7308b5ade3234b61cf11317e5c4e6 /test | |
parent | 930da55e31b3b1e9c2257d51a58fe4d3564efc1b (diff) | |
download | liburing-16757041cc9cb495867ec1f7db062f51399247b9.tar.gz liburing-16757041cc9cb495867ec1f7db062f51399247b9.tar.bz2 |
test: various missing return checks from io_uring_wait_cqe()
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'test')
-rw-r--r-- | test/across-fork.c | 9 | ||||
-rw-r--r-- | test/send_recv.c | 7 | ||||
-rw-r--r-- | test/send_recvmsg.c | 13 |
3 files changed, 24 insertions, 5 deletions
diff --git a/test/across-fork.c b/test/across-fork.c index 5f9cc7b..14ee93a 100644 --- a/test/across-fork.c +++ b/test/across-fork.c @@ -68,10 +68,15 @@ static int submit_write(struct io_uring *ring, int fd, const char *str, static int wait_cqe(struct io_uring *ring, const char *stage) { struct io_uring_cqe *cqe; + int ret; - io_uring_wait_cqe(ring, &cqe); + ret = io_uring_wait_cqe(ring, &cqe); + if (ret) { + fprintf(stderr, "%s wait_cqe failed %d\n", stage, ret); + return 1; + } if (cqe->res < 0) { - fprintf(stderr, "%s cqe failed\n", stage); + fprintf(stderr, "%s cqe failed %d\n", stage, cqe->res); return 1; } diff --git a/test/send_recv.c b/test/send_recv.c index 5f4fe54..bc13235 100644 --- a/test/send_recv.c +++ b/test/send_recv.c @@ -79,8 +79,13 @@ err: static int do_recv(struct io_uring *ring, struct iovec *iov) { struct io_uring_cqe *cqe; + int ret; - io_uring_wait_cqe(ring, &cqe); + ret = io_uring_wait_cqe(ring, &cqe); + if (ret) { + fprintf(stdout, "wait_cqe: %d\n", ret); + goto err; + } if (cqe->res == -EINVAL) { fprintf(stdout, "recv not supported, skipping\n"); return 0; diff --git a/test/send_recvmsg.c b/test/send_recvmsg.c index 78bf8af..1be8cc6 100644 --- a/test/send_recvmsg.c +++ b/test/send_recvmsg.c @@ -90,8 +90,13 @@ static int do_recvmsg(struct io_uring *ring, struct iovec *iov, struct recv_data *rd) { struct io_uring_cqe *cqe; + int ret; - io_uring_wait_cqe(ring, &cqe); + ret = io_uring_wait_cqe(ring, &cqe); + if (ret) { + fprintf(stdout, "wait_cqe: %d\n", ret); + goto err; + } if (cqe->res < 0) { if (rd->no_buf_add && rd->buf_select) return 0; @@ -157,7 +162,11 @@ static void *recv_fn(void *data) goto err; } - io_uring_wait_cqe(&ring, &cqe); + ret = io_uring_wait_cqe(&ring, &cqe); + if (ret) { + fprintf(stderr, "wait_cqe=%d\n", ret); + goto err; + } ret = cqe->res; io_uring_cqe_seen(&ring, cqe); if (ret == -EINVAL) { |