zig

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

commit 72bdfa5bdda561e640206082f1deb5f80ebebfa7 (tree)
parent 9091fcbe9d9161b12bb2229eb9b30b1b14153a0c
Author: Joran Dirk Greef <joran@ronomon.com>
Date:   Sun,  4 Oct 2020 16:05:52 +0200

Skip openat test only for older kernels that do not fully support AT_FDCWD

Diffstat:
Mlib/std/os/linux/io_uring.zig | 8+++++++-
1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/lib/std/os/linux/io_uring.zig b/lib/std/os/linux/io_uring.zig @@ -1095,8 +1095,14 @@ test "openat/close" { testing.expectEqual(@as(u32, 1), try ring.submit()); var cqe_openat = try ring.copy_cqe(); - if (cqe_openat.res == -linux.EINVAL) return error.SkipZigTest; testing.expectEqual(@as(u64, 789), cqe_openat.user_data); + if (cqe_openat.res == -linux.EINVAL) return error.SkipZigTest; + // AT_FDCWD is not fully supported before kernel 5.6: + // See https://lore.kernel.org/io-uring/20200207155039.12819-1-axboe@kernel.dk/T/ + // We use IORING_FEAT_RW_CUR_POS to know if we are pre-5.6 since that feature was added in 5.6. + if (cqe_openat.res == -linux.EBADF and (ring.features & linux.IORING_FEAT_RW_CUR_POS) == 0) { + return error.SkipZigTest; + } if (cqe_openat.res <= 0) std.debug.print("\ncqe_openat.res={}\n", .{ cqe_openat.res }); testing.expect(cqe_openat.res > 0); testing.expectEqual(@as(u32, 0), cqe_openat.flags);