-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Avoid realpath drive resolution to fix symlink-related test failures on Windows #68124
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
Avoid realpath drive resolution to fix symlink-related test failures on Windows #68124
Conversation
@swift-ci please test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Tristan! Just a couple changes left :)
@swift-ci please test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks again Tristan! The failing test is because you fixed a bug by the looks of it. I had:
// TODO: This should be B/b.swift, but there's currently a bug with multiple overlays.
// See rdar://90578880 or https://github.com/llvm/llvm-project/issues/53306.
// Replace with CHECK-FIXED when that's fixed.
In that test case, but that issue is actually already fixed. So seems like the real filesystem was still being used somewhere here and that's now fixed? You should just be able to remove the CHECK
line and replace CHECK-FIXED
with CHECK
.
I pushed a fix to the substitute drive check failing with the old Python version installed in the CI. The |
@swift-ci please test |
See my comment above:
The change you linked has been in forever (and is the one I mention there). We must have been using the real filesystem somewhere. |
@bnbarham Ok this failure turns out to be tricky :/. With my changes, it works on macOS but fails on Windows. My understanding is that there are layered FileSystems: a The better fix would be to have the realpath-on-same-drive logic be either in
|
Hmmm... Is there any way we can realpath and then map back to the substituted drive? To give some context on the use of the VFS overlay here (actually a RedirectingFileSystem, names are confusing 😅) - consider the case where there's a separate "build arena" for indexing, where rather than a full build it only contains the necessary files required to be able to build the AST for a given file. So eg. if A depends on B and we want to build the AST of a file in A, that build arena would contain the minimal module of B. This arena is the "overlay" on top of the full build. If a file is somehow missing in that overlay but is in the full build, this test is checking that cursor info gives back the path in the full build, rather than the overlay (where it doesn't exist). |
Fixes the
SourceKit/Indexing/indexstore_multifile.swift
test and several others (mostly in sourcekit) which would performrealpath
path substitution and expand substitute paths on Windows, resulting in failing string comparisons. This is the swift repo counterpart of https://reviews.llvm.org/D154130 , where we eliminated the use of realpath resolution inlit.py
since this prevented us from using substitute drives on Windows to avoid running intoMAX_PATH
issues. The new symbolic link resolution logic attempts to usereal_path
on Windows, but will fall back tomake_absolute
if that would change the drive on which the path is based. Some symbolic link tests must thus be skipped because we will not honor the symlink resolution if the source tree is on a substitute drive.