Skip to content

Conversation

@rootbeer
Copy link
Contributor

Several tests of the std.posix API (including the "sigset_t bits" one) exercise global state that isn't reliably safe to use in a Zig unit test. This PR moves those cases over to test/standalone.

Also, while doing this I noticed a couple std.Thread tests in with the std.posix tests, so I moved those over to be with the existing Thread tests.

Fixes #24380

These tests aren't (directly) using Posix APIs, so they don't need to be
in posix/test.zig.  Put them over with the code and tests in Thread.zig.
Since the spawn/join test in the posix code was redundant, just dropped
that one.
Re-enable the test.  Will trigger ziglang#24380 as-is, but follow-on change moes
this code over to test/standalone.

Make the test a bit easier to debug by stashing the "seen" signal number
in the shared `seen_sig` (instead of just incrementing a counter for each
hit).  And only doing so if the `seen_sig` is zero.
Add build.zig, README and empty test files.
@rootbeer rootbeer marked this pull request as ready for review September 10, 2025 15:21
Copy link
Member

@andrewrk andrewrk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call, thank you

@andrewrk andrewrk merged commit 220c679 into ziglang:master Sep 18, 2025
14 checks passed
@rootbeer rootbeer deleted the 24380-flaky-sigset-test branch September 18, 2025 05:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

posix/test.zig: "sigset_t bits" test is flaky

2 participants