Skip to content

Conversation

@rootbeer
Copy link
Contributor

Four tests in lib/std/posix/test.zig were disabled because they created fixed-name files in the current working directory, and this caused problems if tests were running in parallel with other build's tests.

This PR fixes those tests to all use std.testing.tmpDir to create unique temporary names and directories.

Also clean the tests up to more consistently use defer to clean up, or to just rely on tmpDir cleanup to remove individual files.

Working on these tests revealed a bunch of stale WASI code paths in posix.zig, fixed by replacing stale wast.AT.FDCWD references with just AT.FDCWD.

Fixes #14968.

Four tests in lib/std/posix/test.zig were disabled because they created
fixed-name files in the current working directory, and this caused
problems if tests were running in parallel with other build's tests.

This PR fixes those tests to all use `std.testing.tmpDir` to create unique
temporary names and directories.

Also clean the tests up to more consistently use `defer` to clean up, or
to just rely on tmpDir cleanup to remove individual files.

Working on these tests revealed a bunch of stale WASI code paths in
posix.zig, fixed by replacing stale `wast.AT.FDCWD` references with just
`AT.FDCWD`.

Fixes ziglang#14968.
@alexrp alexrp requested a review from squeek502 February 20, 2025 05:33
@alexrp
Copy link
Member

alexrp commented Feb 20, 2025

Seems reasonable to me, but will let @squeek502 check the WASI bits and merge.

@alexrp alexrp merged commit d0e288a into ziglang:master Feb 20, 2025
9 checks passed
@rootbeer rootbeer deleted the test-default-directory-races branch February 20, 2025 16:24
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.

unit tests that write files to cwd have racy failures

3 participants