zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit b5a9fd9f98b65aea174700caa01e026e9225dfd7 (tree)
parent dd3eac2eb195037d198fb594775075cadf70808f
Author: Joran Dirk Greef <joran@ronomon.com>
Date:   Thu, 10 Dec 2020 11:34:20 +0200

Skip timeout_remove test where not supported by the kernel

Diffstat:
Mlib/std/os/linux/io_uring.zig | 13+++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)

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