summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2019-11-12 08:22:28 -0700
committerJens Axboe <axboe@kernel.dk>2019-11-12 09:50:16 -0700
commit46eaedd374f9fde6bda294aa911775edefa12f07 (patch)
tree55b9385ea117b54a3538b5526a7b6421c900b852
parent4bce856d43ab1f9a64477aa5a8f9f02f53e64b74 (diff)
downloadliburing-46eaedd374f9fde6bda294aa911775edefa12f07.tar.gz
liburing-46eaedd374f9fde6bda294aa911775edefa12f07.tar.bz2
test/poll-link: use mask check for completion success
Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--test/poll-link.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/test/poll-link.c b/test/poll-link.c
index 05216a0..52fd4e1 100644
--- a/test/poll-link.c
+++ b/test/poll-link.c
@@ -39,6 +39,7 @@ static void wait_for_var(int *var)
struct data {
unsigned expected[2];
+ unsigned is_mask[2];
unsigned long timeout;
int port;
int stop;
@@ -135,7 +136,12 @@ void *recv_thread(void *arg)
goto err;
}
idx = cqe->user_data - 1;
- if (cqe->res != data->expected[idx]) {
+ if (data->is_mask[idx] && !(data->expected[idx] & cqe->res)) {
+ fprintf(stderr, "cqe %llu got %x, wanted mask %x\n",
+ cqe->user_data, cqe->res,
+ data->expected[idx]);
+ goto err;
+ } else if (!data->is_mask[idx] && cqe->res != data->expected[idx]) {
fprintf(stderr, "cqe %llu got %d, wanted %d\n",
cqe->user_data, cqe->res,
data->expected[idx]);
@@ -144,13 +150,15 @@ void *recv_thread(void *arg)
io_uring_cqe_seen(&ring, cqe);
}
- signal_var(&recv_thread_done);
-
out:
+ signal_var(&recv_thread_done);
close(s0);
+ io_uring_queue_exit(&ring);
return NULL;
err:
+ signal_var(&recv_thread_done);
close(s0);
+ io_uring_queue_exit(&ring);
return (void *) 1;
}
@@ -164,12 +172,14 @@ static int test_poll_timeout(int do_connect, unsigned long timeout)
recv_thread_ready = 0;
recv_thread_done = 0;
+ memset(&d, 0, sizeof(d));
d.timeout = timeout;
if (!do_connect) {
d.expected[0] = 0;
d.expected[1] = 0;
} else {
- d.expected[0] = POLLRDBAND | POLLRDNORM | POLLIN | POLLPRI;
+ d.expected[0] = POLLIN;
+ d.is_mask[0] = 1;
d.expected[1] = -ECANCELED;
}