-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
std.fs
: Improve tests and fix some bugs that were uncovered
#16847
Conversation
This fixes a few things: - Previously, CreateSymbolicLink would always create a relative link if a `dir` was provided, but the relative-ness of a link should be determined by the target path, not the null-ness of the `dir`. - Special handling is now done to symlink to 'rooted' paths correctly (they are treated as a relative link, which is different than how the xToPrefixedFileW functions treat them) - ReadLink now correctly supports UNC paths via a new `ntToWin32Namespace` function which intends to be an analog of `RtlNtPathNameToDosPathName` (RtlNtPathNameToDosPathName is not used because it seems to heap allocate as it takes an RTL_UNICODE_STRING_BUFFER)
(which path types will depend on which the target supports)
CI failed on master branch:
Do you want me to revert it, or do you want to work on a follow-up fix? |
I'm unable to reproduce it locally, unfortunately (I have been running the
If fails again, I'll submit a PR to disable/remove the UNC path type from these tests (unless you'd like me to do that now anyway). |
@andrewrk the intermittent
So, I'm unsure what to do. It's essentially a 'real' failure (in that the |
Thanks for looking into it. I think the standard procedure here works fine - file an issue to track the bug, and then disable the failing test case, with a link to the open bug report. Having non-flaky tests is more important than coverage for any one test in particular - especially if the implementation has a real bug. "steps to reproduce" in this bug report will be particularly valuable (and perhaps should contain the contents of @jacobly0's script) |
This PR changes many tests in
fs/test.zig
to use a helper that will run the test code for each path type that is supported on the target.For example:
relative
path typerelative
andabsolute
path typerelative
,absolute
, andunc
path types.Doing this also uncovered some Windows bugs in certain functions for certain path types, which have been fixed:
windows.GetFinalPathNameByHandle
windows.CreateSymbolicLink
/windows.ReadLink
did not handle non-relative paths correctlyTangentially related to #16736 since it will allow us to be confident that the
fs.Dir
functions can handle all path types.