authorgravatar for igor.anic@gmail.comIgor Anić <igor.anic@gmail.com> 2023-11-17 22:17:00+01:00
committergravatar for igor.anic@gmail.comIgor Anić <igor.anic@gmail.com> 2023-11-17 22:17:00+01:00
logccf5a6cc5c5070a130f4879069390933f9c738f1
tree0957f28b2ae015b435e420b6a852a1fef1086c59
parenta7001b86f1dccb3e10aca5666b8fd9aed042400f

io_uring: make Linux version check runtime instead od comptime

Reverting previous change. I'm building test bin and then running it in virtual machines with different kernels. So Linux kernel checks has to be runtime instead of comptime.

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

lib/std/os/linux/io_uring.zig+12-1
...@@ -4123,5 +4123,16 @@ test "openat_direct/close_direct" {...@@ -4123,5 +4123,16 @@ test "openat_direct/close_direct" {
4123/// For use in tests. Returns SkipZigTest is kernel version is less than required.4123/// For use in tests. Returns SkipZigTest is kernel version is less than required.
4124fn skipKernelLessThan(required: std.SemanticVersion) !void {4124fn skipKernelLessThan(required: std.SemanticVersion) !void {
4125 if (builtin.os.tag != .linux) return error.SkipZigTest;4125 if (builtin.os.tag != .linux) return error.SkipZigTest;
4126 if (required.order(builtin.os.version_range.linux.range.max) == .gt) return error.SkipZigTest;4126
4127 var uts: linux.utsname = undefined;
4128 const res = linux.uname(&uts);
4129 switch (linux.getErrno(res)) {
4130 .SUCCESS => {},
4131 else => |errno| return os.unexpectedErrno(errno),
4132 }
4133
4134 const release = mem.sliceTo(&uts.release, 0);
4135 var current = try std.SemanticVersion.parse(release);
4136 current.pre = null; // don't check pre field
4137 if (required.order(current) == .gt) return error.SkipZigTest;
4127}4138}