Skip to content

Commit

Permalink
test/sync-cancel: don't fail on missing IORING_ASYNC_CANCEL_OP
Browse files Browse the repository at this point in the history
6.1-stable fails this test case, as it does have sync cancel support,
but does not support IORING_ASYNC_CANCEL_OP. Hence we pass the initial
testing, but fail when we start using this flag.

Return T_EXIT_PASS if we get this far, as the initial sync cancel
testing did pass.

Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
axboe committed Oct 7, 2024
1 parent 3d84be4 commit 3e6c9b9
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion test/sync-cancel.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include "liburing.h"
#include "helpers.h"

static int no_sync_cancel;
static int no_sync_cancel, no_sync_cancel_op;

static int test_sync_cancel_timeout(struct io_uring *ring, int async, int by_op)
{
Expand Down Expand Up @@ -47,6 +47,11 @@ static int test_sync_cancel_timeout(struct io_uring *ring, int async, int by_op)
reg.opcode = IORING_OP_READ;
reg.timeout.tv_nsec = 1;
ret = io_uring_register_sync_cancel(ring, &reg);
/* earlier kernels had sync cancel, but not per-op */
if (ret == -EINVAL) {
no_sync_cancel_op = 1;
return 0;
}
if (async) {
/* we expect -ETIME here, but can race and get 0 */
if (ret != -ETIME && ret != 0) {
Expand Down Expand Up @@ -244,6 +249,8 @@ int main(int argc, char *argv[])
fprintf(stderr, "test_sync_cancel_timeout 0 0\n");
return T_EXIT_FAIL;
}
if (no_sync_cancel_op)
return T_EXIT_PASS;

ret = test_sync_cancel_timeout(&ring, 0, 1);
if (ret) {
Expand Down

0 comments on commit 3e6c9b9

Please sign in to comment.