summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2020-02-23 20:44:43 -0700
committerJens Axboe <axboe@kernel.dk>2020-02-23 20:44:43 -0700
commit1b5c910775a5967b63a7632add2f4d00d3722036 (patch)
treefb21d3b53df4a95b673844d4e2050299cec3b10b /test
parent122a80293a9d0c14550c6955bde50836f34dd4f2 (diff)
downloadliburing-1b5c910775a5967b63a7632add2f4d00d3722036.tar.gz
liburing-1b5c910775a5967b63a7632add2f4d00d3722036.tar.bz2
test/accept-link: update for FAST_POLL
We can actually cancel more easily with fast poll, as we don't have to return -EALREADY if a thread is running the work. Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'test')
-rw-r--r--test/accept-link.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/test/accept-link.c b/test/accept-link.c
index a6c2aef..8d7d212 100644
--- a/test/accept-link.c
+++ b/test/accept-link.c
@@ -168,10 +168,21 @@ err:
static int test_accept_timeout(int do_connect, unsigned long timeout)
{
+ struct io_uring ring;
+ struct io_uring_params p = {};
pthread_t t1, t2;
struct data d;
void *tret;
- int ret = 0;
+ int ret, fast_poll;
+
+ ret = io_uring_queue_init_params(1, &ring, &p);
+ if (ret) {
+ fprintf(stderr, "queue_init: %d\n", ret);
+ return 1;
+ };
+
+ fast_poll = (p.features & IORING_FEAT_FAST_POLL) != 0;
+ io_uring_queue_exit(&ring);
recv_thread_ready = 0;
recv_thread_done = 0;
@@ -179,8 +190,13 @@ static int test_accept_timeout(int do_connect, unsigned long timeout)
memset(&d, 0, sizeof(d));
d.timeout = timeout;
if (!do_connect) {
- d.expected[0] = -EINTR;
- d.expected[1] = -EALREADY;
+ if (fast_poll) {
+ d.expected[0] = -ECANCELED;
+ d.expected[1] = -ETIME;
+ } else {
+ d.expected[0] = -EINTR;
+ d.expected[1] = -EALREADY;
+ }
} else {
d.expected[0] = -1U;
d.just_positive[0] = 1;