Skip to content

Commit 32568db

Browse files
Vexuandrewrk
authored andcommitted
std: handle stage2 function pointer semantics in test
1 parent 61c5d8f commit 32568db

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/std/os/test.zig

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -766,8 +766,10 @@ test "sigaction" {
766766
}
767767
};
768768

769+
const actual_handler = if (builtin.zig_backend == .stage1) S.handler else &S.handler;
770+
769771
var sa = os.Sigaction{
770-
.handler = .{ .sigaction = S.handler },
772+
.handler = .{ .sigaction = actual_handler },
771773
.mask = os.empty_sigset,
772774
.flags = os.SA.SIGINFO | os.SA.RESETHAND,
773775
};
@@ -776,7 +778,7 @@ test "sigaction" {
776778
try os.sigaction(os.SIG.USR1, &sa, null);
777779
// Check that we can read it back correctly.
778780
try os.sigaction(os.SIG.USR1, null, &old_sa);
779-
try testing.expectEqual(S.handler, old_sa.handler.sigaction.?);
781+
try testing.expectEqual(actual_handler, old_sa.handler.sigaction.?);
780782
try testing.expect((old_sa.flags & os.SA.SIGINFO) != 0);
781783
// Invoke the handler.
782784
try os.raise(os.SIG.USR1);

0 commit comments

Comments
 (0)