Skip to content

[windows] SourceKit tests with VFS fixes #28250

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 2 commits into from
Nov 16, 2019

Conversation

drodriguez
Copy link
Contributor

The VFS tests were using Unix absolute paths, which does not play well
when Windows see them as relative to the current drive letter.

By using the temporal directory, both Windows and Unix can use the same
paths and avoid the problem.

Additionally, a couple of inputs have to be transformed into the native
path format, because sourcekitd-test compares the inputs as strings, and
they need to match exactly. So the source file and the name of the VFS
entries are transformed into native using the helper from LLVM support.

@drodriguez
Copy link
Contributor Author

@swift-ci please clean test Windows platform

@drodriguez
Copy link
Contributor Author

    Swift(windows-x86_64) :: SourceKit/Sema/injected_vfs_sourcetext.swift
    Swift(windows-x86_64) :: SourceKit/Sema/injected_vfs.swift

Fail for me also locally with the same LLVM ERROR: Never got notification for semantic info. I don't understand exactly why.

Swift(windows-x86_64) :: SourceKit/InterfaceGen/gen_swift_module.swift

Regression.

    Swift(windows-x86_64) :: Driver/sanitize_recover.swift

Unrelated. Broken in master since https://ci-external.swift.org/job/oss-swift-windows-x86_64/1953/. Probably introduced in #28126

@gmittert
Copy link
Contributor

cc @akyrtzi

@@ -10,7 +10,7 @@ func foo(

// CHECK-CMODULE: key.kind: source.lang.swift.ref.struct
// CHECK-CMODULE: key.name: "StructDefinedInCModule"
// CHECK-CMODULE: key.filepath: "/CModule/CModule.h"
// CHECK-CMODULE: key.filepath: "{{.*}}/CModule{{/|\\\\}}CModule.h"
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is one slash here always a forward slash, but the other can be a backslash?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Welcome to Windows™️! :D

(Yes, one of them was a / even on Windows, so I didn't replace it. Adding the {{.*}} accounts for the new path relative to %t, while the {{/|\\\\}} accounts for an escaped \ in Windows.

@gmittert
Copy link
Contributor

@swift-ci please smoke test

@drodriguez drodriguez force-pushed the windows-sourcekit-vfs-tests branch from 75d012a to 6a67065 Compare November 14, 2019 18:26
@drodriguez
Copy link
Contributor Author

drodriguez commented Nov 14, 2019

The gen_swift_interface.swift should be fixed with the latest changes.

@swift-ci please clean test Windows platform

[Edit: https://ci-external.swift.org/view/Pull%20Request/job/swift-PR-windows/173/ in case it doesn't get linked below]

@drodriguez
Copy link
Contributor Author

@swift-ci please clean test Windows platform

@drodriguez
Copy link
Contributor Author

    Swift(windows-x86_64) :: SourceKit/Sema/injected_vfs_sourcetext.swift
    Swift(windows-x86_64) :: SourceKit/Sema/injected_vfs.swift

Still happening (expected)

   Swift(windows-x86_64) :: SourceKit/InterfaceGen/gen_stdlib.swift

Regression :(

    Swift(windows-x86_64) :: ClangImporter/pcm-emit-and-import.swift

Failing in master. Sigh.

@akyrtzi akyrtzi requested a review from benlangmuir November 14, 2019 20:33
@drodriguez drodriguez force-pushed the windows-sourcekit-vfs-tests branch from 6a67065 to 97143a4 Compare November 14, 2019 21:12
@drodriguez
Copy link
Contributor Author

Changes to make gen_stdlib.swift pass. Thanks to @gmittert for the solution.

@swift-ci please test Windows platform

@benlangmuir
Copy link
Contributor

@swift-ci please test

1 similar comment
@benlangmuir
Copy link
Contributor

@swift-ci please test

@drodriguez drodriguez force-pushed the windows-sourcekit-vfs-tests branch from 97143a4 to 95fb21b Compare November 15, 2019 01:53
@drodriguez
Copy link
Contributor Author

drodriguez commented Nov 15, 2019

Thanks again to @gmittert, who found the last point in the code that was creating problems.

@swift-ci please smoke test

@drodriguez
Copy link
Contributor Author

@swift-ci please test Windows platform

@drodriguez
Copy link
Contributor Author

https://ci-external.swift.org/view/Pull%20Request/job/swift-PR-windows/177/ failed because of #28280, which is testing and I hope to land soon. Sigh.

@drodriguez
Copy link
Contributor Author

@swift-ci please test Windows platform

The VFS tests were using Unix absolute paths, which does not play well
when Windows see them as relative to the current drive letter.

By using the temporal directory, both Windows and Unix can use the same
paths and avoid the problem.

Additionally, a couple of inputs have to be transformed into the native
path format, because sourcekitd-test compares the inputs as strings, and
they need to match exactly. So the source file and the name of the VFS
entries are transformed into native using the helper from LLVM support.
@drodriguez drodriguez force-pushed the windows-sourcekit-vfs-tests branch from 95fb21b to a1a891e Compare November 15, 2019 23:30
@drodriguez
Copy link
Contributor Author

Removed the explicit slashes in the unit test, which should make it work in both OS.

@swift-ci please smoke test

@drodriguez
Copy link
Contributor Author

@swift-ci please test Windows platform

1 similar comment
@gmittert
Copy link
Contributor

@swift-ci please test Windows platform

@gmittert
Copy link
Contributor

Thanks for doing all that tedious path fiddling!

@gmittert gmittert merged commit 46e2e5e into swiftlang:master Nov 16, 2019
@drodriguez drodriguez deleted the windows-sourcekit-vfs-tests branch November 16, 2019 01:29
@drodriguez
Copy link
Contributor Author

Thanks to you for all the help!

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.

3 participants