| ... | @@ -1376,12 +1376,17 @@ test "timeout_remove" { | ... | @@ -1376,12 +1376,17 @@ test "timeout_remove" { |
| 1376 | testing.expectEqual(@as(u32, 2), try ring.submit()); | 1376 | testing.expectEqual(@as(u32, 2), try ring.submit()); |
| 1377 | | 1377 | |
| 1378 | const cqe_timeout = try ring.copy_cqe(); | 1378 | const cqe_timeout = try ring.copy_cqe(); |
| 1379 | if (cqe_timeout.user_data == 0x99999999 and cqe_timeout.res == -linux.EINVAL) { | 1379 | // IORING_OP_TIMEOUT_REMOVE is not supported by this kernel version: |
| | 1380 | // Timeout remove operations set the fd to -1, which results in EBADF before EINVAL. |
| | 1381 | // We use IORING_FEAT_RW_CUR_POS as a safety check here to make sure we are at least pre-5.6. |
| | 1382 | // We don't want to skip this test for newer kernels. |
| | 1383 | if ( |
| | 1384 | cqe_timeout.user_data == 0x99999999 and |
| | 1385 | cqe_timeout.res == -linux.EBADF and |
| | 1386 | (ring.features & linux.IORING_FEAT_RW_CUR_POS) == 0 |
| | 1387 | ) { |
| 1380 | return error.SkipZigTest; | 1388 | return error.SkipZigTest; |
| 1381 | } | 1389 | } |
| 1382 | if (cqe_timeout.user_data == 0x99999999) { | | |
| 1383 | std.debug.print("unexpected cqe={}\n", .{ cqe_timeout }); | | |
| 1384 | } | | |
| 1385 | testing.expectEqual(linux.io_uring_cqe{ | 1390 | testing.expectEqual(linux.io_uring_cqe{ |
| 1386 | .user_data = 0x88888888, | 1391 | .user_data = 0x88888888, |
| 1387 | .res = -linux.ECANCELED, | 1392 | .res = -linux.ECANCELED, |