commit 0662f1d52204b9c3bce22b3bd72bf4faf2df3559 (tree)
parent 885d96735de0fb771403c06d258cac316b792de3
Author: Vincent Rischmann <vincent@rischmann.fr>
Date: Fri, 31 Dec 2021 20:57:49 +0100
io_uring: fix version check in tests
For renameat, unlinkat, mkdirat, symlinkat and linkat the error code
differs between kernel 5.4 which returns EBADF and kernel 5.10 which returns EINVAL.
Fixes #10466
Diffstat:
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/lib/std/os/linux/io_uring.zig b/lib/std/os/linux/io_uring.zig
@@ -2471,7 +2471,7 @@ test "renameat" {
switch (cqe.err()) {
.SUCCESS => {},
// This kernel's io_uring does not yet implement renameat (kernel version < 5.11)
- .INVAL => return error.SkipZigTest,
+ .BADF, .INVAL => return error.SkipZigTest,
else => |errno| std.debug.panic("unhandled errno: {}", .{errno}),
}
try testing.expectEqual(linux.io_uring_cqe{
@@ -2533,7 +2533,7 @@ test "unlinkat" {
switch (cqe.err()) {
.SUCCESS => {},
// This kernel's io_uring does not yet implement unlinkat (kernel version < 5.11)
- .INVAL => return error.SkipZigTest,
+ .BADF, .INVAL => return error.SkipZigTest,
else => |errno| std.debug.panic("unhandled errno: {}", .{errno}),
}
try testing.expectEqual(linux.io_uring_cqe{
@@ -2579,7 +2579,7 @@ test "mkdirat" {
switch (cqe.err()) {
.SUCCESS => {},
// This kernel's io_uring does not yet implement mkdirat (kernel version < 5.15)
- .INVAL => return error.SkipZigTest,
+ .BADF, .INVAL => return error.SkipZigTest,
else => |errno| std.debug.panic("unhandled errno: {}", .{errno}),
}
try testing.expectEqual(linux.io_uring_cqe{
@@ -2628,7 +2628,7 @@ test "symlinkat" {
switch (cqe.err()) {
.SUCCESS => {},
// This kernel's io_uring does not yet implement symlinkat (kernel version < 5.15)
- .INVAL => return error.SkipZigTest,
+ .BADF, .INVAL => return error.SkipZigTest,
else => |errno| std.debug.panic("unhandled errno: {}", .{errno}),
}
try testing.expectEqual(linux.io_uring_cqe{
@@ -2683,7 +2683,7 @@ test "linkat" {
switch (cqe.err()) {
.SUCCESS => {},
// This kernel's io_uring does not yet implement linkat (kernel version < 5.15)
- .INVAL => return error.SkipZigTest,
+ .BADF, .INVAL => return error.SkipZigTest,
else => |errno| std.debug.panic("unhandled errno: {}", .{errno}),
}
try testing.expectEqual(linux.io_uring_cqe{