authorgravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2023-11-09 00:49:22+02:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2023-11-09 00:49:22+02:00
log10a28bc4c48cd50882a7a5e5c57fee02b8c34731
treeddf2387e14bf710211f308f8262a7efdaad5ac8d
parentbe14fe1fa18ec2ac0ead232a4e6035656e3f67dc
parent715e5f757f4768825d923ef473af1e02f6c7754c
signaturebadge-question-mark Signed by PGP key 4AEE18F83AFDEB23

Merge pull request #17935 from ianic/fix_io_uring_test_kernel_5_4

Fix io_uring tests on kernel 5.4

1 files changed, 8 insertions(+), 1 deletions(-)

lib/std/os/linux/io_uring.zig+8-1
...@@ -2072,6 +2072,7 @@ test "openat" {...@@ -2072,6 +2072,7 @@ test "openat" {
2072 const cqe_openat = try ring.copy_cqe();2072 const cqe_openat = try ring.copy_cqe();
2073 try testing.expectEqual(@as(u64, 0x33333333), cqe_openat.user_data);2073 try testing.expectEqual(@as(u64, 0x33333333), cqe_openat.user_data);
2074 if (cqe_openat.err() == .INVAL) return error.SkipZigTest;2074 if (cqe_openat.err() == .INVAL) return error.SkipZigTest;
2075 if (cqe_openat.err() == .BADF) return error.SkipZigTest;
2075 if (cqe_openat.res <= 0) std.debug.print("\ncqe_openat.res={}\n", .{cqe_openat.res});2076 if (cqe_openat.res <= 0) std.debug.print("\ncqe_openat.res={}\n", .{cqe_openat.res});
2076 try testing.expect(cqe_openat.res > 0);2077 try testing.expect(cqe_openat.res > 0);
2077 try testing.expectEqual(@as(u32, 0), cqe_openat.flags);2078 try testing.expectEqual(@as(u32, 0), cqe_openat.flags);
...@@ -2329,7 +2330,8 @@ test "timeout_remove" {...@@ -2329,7 +2330,8 @@ test "timeout_remove" {
2329 // * kernel 5.18 gives user data 0x99999999 first, 0x88888888 second2330 // * kernel 5.18 gives user data 0x99999999 first, 0x88888888 second
23302331
2331 var cqes: [2]os.linux.io_uring_cqe = undefined;2332 var cqes: [2]os.linux.io_uring_cqe = undefined;
2332 try testing.expectEqual(@as(u32, 2), try ring.copy_cqes(cqes[0..], 2));2333 cqes[0] = try ring.copy_cqe();
2334 cqes[1] = try ring.copy_cqe();
23332335
2334 for (cqes) |cqe| {2336 for (cqes) |cqe| {
2335 // IORING_OP_TIMEOUT_REMOVE is not supported by this kernel version:2337 // IORING_OP_TIMEOUT_REMOVE is not supported by this kernel version:
...@@ -2499,6 +2501,8 @@ test "statx" {...@@ -2499,6 +2501,8 @@ test "statx" {
2499 // The filesystem containing the file referred to by fd does not support this operation;2501 // The filesystem containing the file referred to by fd does not support this operation;
2500 // or the mode is not supported by the filesystem containing the file referred to by fd:2502 // or the mode is not supported by the filesystem containing the file referred to by fd:
2501 .OPNOTSUPP => return error.SkipZigTest,2503 .OPNOTSUPP => return error.SkipZigTest,
2504 // not supported on older kernels (5.4)
2505 .BADF => return error.SkipZigTest,
2502 else => |errno| std.debug.panic("unhandled errno: {}", .{errno}),2506 else => |errno| std.debug.panic("unhandled errno: {}", .{errno}),
2503 }2507 }
2504 try testing.expectEqual(linux.io_uring_cqe{2508 try testing.expectEqual(linux.io_uring_cqe{
...@@ -3144,6 +3148,7 @@ test "remove_buffers" {...@@ -3144,6 +3148,7 @@ test "remove_buffers" {
31443148
3145 const cqe = try ring.copy_cqe();3149 const cqe = try ring.copy_cqe();
3146 switch (cqe.err()) {3150 switch (cqe.err()) {
3151 .INVAL => return error.SkipZigTest,
3147 .SUCCESS => {},3152 .SUCCESS => {},
3148 else => |errno| std.debug.panic("unhandled errno: {}", .{errno}),3153 else => |errno| std.debug.panic("unhandled errno: {}", .{errno}),
3149 }3154 }
...@@ -3234,6 +3239,8 @@ test "provide_buffers: accept/connect/send/recv" {...@@ -3234,6 +3239,8 @@ test "provide_buffers: accept/connect/send/recv" {
3234 switch (cqe.err()) {3239 switch (cqe.err()) {
3235 // Happens when the kernel is < 5.73240 // Happens when the kernel is < 5.7
3236 .INVAL => return error.SkipZigTest,3241 .INVAL => return error.SkipZigTest,
3242 // Happens on the kernel 5.4
3243 .BADF => return error.SkipZigTest,
3237 .SUCCESS => {},3244 .SUCCESS => {},
3238 else => |errno| std.debug.panic("unhandled errno: {}", .{errno}),3245 else => |errno| std.debug.panic("unhandled errno: {}", .{errno}),
3239 }3246 }