| ... | @@ -1054,11 +1054,6 @@ test "access smoke test" { | ... | @@ -1054,11 +1054,6 @@ test "access smoke test" { |
| 1054 | } | 1054 | } |
| 1055 | | 1055 | |
| 1056 | test "timerfd" { | 1056 | test "timerfd" { |
| 1057 | if (true) { | | |
| 1058 | // https://github.com/ziglang/zig/issues/13721 | | |
| 1059 | return error.SkipZigTest; | | |
| 1060 | } | | |
| 1061 | | | |
| 1062 | if (native_os != .linux) | 1057 | if (native_os != .linux) |
| 1063 | return error.SkipZigTest; | 1058 | return error.SkipZigTest; |
| 1064 | | 1059 | |
| ... | @@ -1066,16 +1061,16 @@ test "timerfd" { | ... | @@ -1066,16 +1061,16 @@ test "timerfd" { |
| 1066 | var tfd = try os.timerfd_create(linux.CLOCK.MONOTONIC, linux.TFD.CLOEXEC); | 1061 | var tfd = try os.timerfd_create(linux.CLOCK.MONOTONIC, linux.TFD.CLOEXEC); |
| 1067 | defer os.close(tfd); | 1062 | defer os.close(tfd); |
| 1068 | | 1063 | |
| | 1064 | // Fire event 10_000_000ns = 10ms after the os.timerfd_settime call. |
| 1069 | var sit: linux.itimerspec = .{ .it_interval = .{ .tv_sec = 0, .tv_nsec = 0 }, .it_value = .{ .tv_sec = 0, .tv_nsec = 10 * (1000 * 1000) } }; | 1065 | var sit: linux.itimerspec = .{ .it_interval = .{ .tv_sec = 0, .tv_nsec = 0 }, .it_value = .{ .tv_sec = 0, .tv_nsec = 10 * (1000 * 1000) } }; |
| 1070 | try os.timerfd_settime(tfd, 0, &sit, null); | 1066 | try os.timerfd_settime(tfd, 0, &sit, null); |
| 1071 | | 1067 | |
| 1072 | var fds: [1]os.pollfd = .{.{ .fd = tfd, .events = os.linux.POLL.IN, .revents = 0 }}; | 1068 | var fds: [1]os.pollfd = .{.{ .fd = tfd, .events = os.linux.POLL.IN, .revents = 0 }}; |
| 1073 | try expectEqual(try os.poll(&fds, -1), 1); | 1069 | try expectEqual(@as(usize, 1), try os.poll(&fds, -1)); // -1 => infinite waiting |
| 1074 | var git = try os.timerfd_gettime(tfd); | | |
| 1075 | try expectEqual(git, .{ .it_interval = .{ .tv_sec = 0, .tv_nsec = 0 }, .it_value = .{ .tv_sec = 0, .tv_nsec = 0 } }); | | |
| 1076 | | 1070 | |
| 1077 | try os.timerfd_settime(tfd, 0, &sit, null); | 1071 | var git = try os.timerfd_gettime(tfd); |
| 1078 | try expectEqual(try os.poll(&fds, 5), 0); | 1072 | var expect_disarmed_timer: linux.itimerspec = .{ .it_interval = .{ .tv_sec = 0, .tv_nsec = 0 }, .it_value = .{ .tv_sec = 0, .tv_nsec = 0 } }; |
| | 1073 | try expectEqual(expect_disarmed_timer, git); |
| 1079 | } | 1074 | } |
| 1080 | | 1075 | |
| 1081 | test "isatty" { | 1076 | test "isatty" { |