Skip to content

Fix SourceKit/CursorInfo Tests on Windows #24171

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

Merged
merged 1 commit into from
Apr 23, 2019

Conversation

gmittert
Copy link
Contributor

sourcekitd-test only prints the file path if it's different than the one it's passed. Since on Windows, paths get normalized to start with \\?\ all paths fail this check and get printed.

Also fixed the symlink resolving to follow symlinks and to support unicode.

FILE_SHARE_READ | FILE_SHARE_WRITE,
nullptr,
OPEN_EXISTING,
FILE_FLAG_BACKUP_SEMANTICS,
Copy link
Member

Choose a reason for hiding this comment

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

Why the backup semantics?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's required to obtain a directory to a handle.


if (fileHandle == INVALID_HANDLE_VALUE)
return InputPath;

DWORD success = GetFinalPathNameByHandleA(
fileHandle, full_path, sizeof(full_path), FILE_NAME_NORMALIZED);
DWORD getPathSuccess = GetFinalPathNameByHandleW(
Copy link
Member

Choose a reason for hiding this comment

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

Why the rename of success?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added a convertSuccess check and it seemed weird to have a success and convertSuccess.

Copy link
Member

Choose a reason for hiding this comment

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

You could just do success &= ... ;-)

@compnerd
Copy link
Member

CC: @akyrtzi @benlangmuir

@compnerd
Copy link
Member

@swift-ci please test

@akyrtzi
Copy link
Contributor

akyrtzi commented Apr 20, 2019

Instead of updating the tests by optionally checking for the filename (which I think is unlikely that we will be able to remember to do every time we add new tests), why not updating sourcekitd-test to deal with this difference in Windows, in the place where it compares the paths ?

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 6f27ffaf7914b66906fbfd17f4886de37f3f88e5

@gmittert gmittert force-pushed the SourceKitTests branch 6 times, most recently from 8f32c19 to a9c83f1 Compare April 22, 2019 22:03
@gmittert
Copy link
Contributor Author

Looking at the realpath implementation on Windows, it was using GetFullPathName rather than GetFinalPathName which explains why the paths were getting normalized differently. I've fixed it to call GetFinalPathByHandle which removes the need for changing the tests themselves.

@gmittert
Copy link
Contributor Author

Checking again if I can trigger ci yet

@swift-ci please test

@akyrtzi
Copy link
Contributor

akyrtzi commented Apr 22, 2019

@swift-ci Please test

@akyrtzi
Copy link
Contributor

akyrtzi commented Apr 22, 2019

@gmittert try with smoke test

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 6f27ffaf7914b66906fbfd17f4886de37f3f88e5

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 6f27ffaf7914b66906fbfd17f4886de37f3f88e5

@gmittert gmittert merged commit cac35ca into swiftlang:master Apr 23, 2019
@gmittert gmittert deleted the SourceKitTests branch April 23, 2019 17:30
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.

4 participants