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