A cancel of one request completes with 0, as io_uring_prep_cancel(3) documents. For a futex wait or a waitid, kernels so far complete it with 1, and the tests expect that. "io_uring/cancel: complete single futex or waitid cancel with 0" makes it 0. Accept both. Signed-off-by: agxr --- test/futex.c | 3 ++- test/waitid.c | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/test/futex.c b/test/futex.c index 265f3675..1aadfc0b 100644 --- a/test/futex.c +++ b/test/futex.c @@ -244,7 +244,8 @@ static int test_order(int vectored, int async) reg.addr = 2; ret = io_uring_register_sync_cancel(&ring, ®); - if (ret != 1) { + /* older kernels return 1 */ + if (ret != 0 && ret != 1) { fprintf(stderr, "Failed to cancel pending futex wait: %d\n", ret); return 1; } diff --git a/test/waitid.c b/test/waitid.c index 371b5e5e..a3828e6c 100644 --- a/test/waitid.c +++ b/test/waitid.c @@ -250,7 +250,9 @@ static int test_cancel(struct io_uring *ring, int nr) fprintf(stderr, "cqe res: %d\n", cqe->res); return T_EXIT_FAIL; } - if (cqe->user_data == 2 && cqe->res != nr) { + /* older kernels complete a single cancel with 1 */ + if (cqe->user_data == 2 && cqe->res != nr && + !(nr == 1 && cqe->res == 0)) { fprintf(stderr, "cqe res: %d\n", cqe->res); return T_EXIT_FAIL; } -- 2.56.0