Skip to content
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

Fixing driver tests on Windows #20209

Merged
merged 1 commit into from Dec 11, 2018
Merged

Conversation

gmittert
Copy link
Contributor

@gmittert gmittert commented Nov 1, 2018

  • Path separator normalization
  • Appending .exe or .EXE to binaries

See also #20172

@compnerd
Copy link
Collaborator

compnerd commented Nov 2, 2018

The path separator changes are great. We are going to need a bunch of that in the debug info tests as we check the emitted paths. Why the change from swift to swiftc.EXE?

@compnerd
Copy link
Collaborator

compnerd commented Nov 2, 2018

CC: @jrose-apple

@jrose-apple
Copy link
Contributor

Thanks for doing this!

The path separator changes are great.

Since you missed a few and things are still passing, I question whether we actually need this! At least for inputs to swiftc and other LLVMish tools.

Why the change from swift to swiftc.EXE?

I'm guessing this is because swiftc isn't just a symlink to swift on Windows, and so the frontend invocations still have the "c" (and of course the ".exe"). I do think it's fine to write the regexes combined: swift{{c?(.EXE)?}}, which is slightly easier for me to read.

@gmittert
Copy link
Contributor Author

gmittert commented Nov 2, 2018

Yeah, not all the paths need changing. Swift for the most parts doesn't seem to have too many issues with backslashes. I think mostly just the ones that get written to .json files, since the unescaped backslashes make the json invalid.

On windows, %target-swiftc_driver gets resolved to "swiftc.EXE", e.g.

$ ":" "RUN: at line 1"
$ "not" "C:\\Users\\jmittertreiner\\LocalSwift\\build\\Ninja-ReleaseAssert\\swift-windows-amd64\\bin\\swiftc.EXE" "-target" "x86_64-unknown-windows-msvc" "-module-cache-path" "C:\\Users\\jmittertreiner\\LocalSwift\\build\\Ninja-ReleaseAssert\\swift-windows-amd64\\swift-test-results\\x86_64-unknown-windows-msvc\\clang-module-cache" "-Xfrontend" "-color-diagnostics" "-emit-executable" "-o" "C:\Users\jmittertreiner\LocalSwift\build\Ninja-ReleaseAssert\swift-windows-amd64\test-windows-x86_64\Driver\Output\color-diagnostics.swift.tmp" "C:\Users\jmittertreiner\LocalSwift\swift\test\Driver\color-diagnostics.swift"
$ "C:\\Python27\\python.exe" "C:\\Users\\jmittertreiner\\LocalSwift\\swift\\utils\\PathSanitizingFileCheck" "--sanitize" "BUILD_DIR=C:/Users/jmittertreiner/LocalSwift/build/Ninja-ReleaseAssert/swift-windows-amd64" "--sanitize" "SOURCE_DIR=C:/Users/jmittertreiner/LocalSwift/swift" "--use-filecheck" "C:\\Users\\jmittertreiner\\LocalSwift\\build\\Ninja-ReleaseAssert\\llvm-windows-amd64\\bin\\FileCheck.EXE" "C:\Users\jmittertreiner\LocalSwift\swift\test\Driver\color-diagnostics.swift"

which then gets used in the rest of the driver. Checking for c.EXE was just the easiest fix.

@gmittert gmittert force-pushed the MoreWinTestFixes branch 2 times, most recently from 2a6e035 to 358162e Compare November 2, 2018 19:04
@gmittert gmittert force-pushed the MoreWinTestFixes branch 2 times, most recently from d740106 to 4bbcf0d Compare December 4, 2018 22:35
@compnerd
Copy link
Collaborator

compnerd commented Dec 4, 2018

@jrose-apple also note that things aren't really passing from the perspective of the unit tests. There are a bunch of failing tests still.

@jrose-apple
Copy link
Contributor

The conversions from e.g. %t to %/t are starting to concern me. Aren't we going to need that for literally every test?

@gmittert
Copy link
Contributor Author

gmittert commented Dec 4, 2018

@jrose-apple no, just for ones that print paths to .json files since the backslashes are invalid without escaping. It's possible I added a few where they weren't strictly needed though.

Copy link
Contributor

@jrose-apple jrose-apple left a comment

Choose a reason for hiding this comment

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

Thanks for the explanation! Here are a few more specific questions I had, then.

@@ -1,3 +1,4 @@
// UNSUPPORTED: win32
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 this one unsupported on Windows?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This one uses driver-use-frontend-path, see also #21052

@@ -1,3 +1,4 @@
// UNSUPPORTED: win32
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think this can both be unsupported on Windows and have slash changes.

// CHECK: "{{[^"]*[/\\]}}Module2.swiftmodule"
// CHECK: "{{[^"]*[/\\]}}Module.swiftmodule"
// CHECK: "{{[^"]*[/\\]}}Swift.swiftmodule"
// CHECK: "{{[^"]*[/\\]}}SwiftOnoneSupport.swiftmodule"
Copy link
Contributor

Choose a reason for hiding this comment

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

This looks incorrect; this file is supposed to be JSON, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should be correct, it's looking for either a forwards or backslash, on windows the backslash gets escaped, so it'll be something like filepath\\Module2.swiftmodule which should match

Copy link
Contributor

Choose a reason for hiding this comment

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

Right, but the pattern you provided isn't checking for \\ because that's a character class.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, I guess it happens to work anyway because of the preceding character class. Okay.

@@ -1,44 +1,42 @@
// RUN: %swiftc_driver_plain -emit-executable %s -o %t.out -emit-module -emit-module-path %t.swiftmodule -emit-objc-header-path %t.h -serialize-diagnostics -emit-dependencies -parseable-output -driver-skip-execution 2>&1 | %FileCheck %s

// XFAIL: freebsd, linux
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this work now?

Copy link
Contributor Author

@gmittert gmittert Dec 5, 2018

Choose a reason for hiding this comment

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

Nope :( That shouldn't have been removed. I've added it back.

@@ -1,5 +1,5 @@
// RUN: echo "-DTEST0" > %t.0.resp
// RUN: %target-build-swift -typecheck @%t.0.resp %s 2>&1 | %FileCheck %s -check-prefix=SHORT
// RUN: %target-build-swift -typecheck %s @%/t.0.resp 2>&1 | %FileCheck %s -check-prefix=SHORT
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think this one would matter?

Copy link
Contributor Author

@gmittert gmittert Dec 5, 2018

Choose a reason for hiding this comment

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

Yup, it doesn't. I'll remove it. It's broken because response files don't work on windows right now, not because of the path.

@jrose-apple
Copy link
Contributor

@swift-ci Please test

@swift-ci
Copy link
Collaborator

swift-ci commented Dec 5, 2018

Build failed
Swift Test Linux Platform
Git Sha - 4bbcf0dcdc9f3bf4b4eea93d80c282a94ce095c3

@swift-ci
Copy link
Collaborator

swift-ci commented Dec 6, 2018

Build failed
Swift Test OS X Platform
Git Sha - 4bbcf0dcdc9f3bf4b4eea93d80c282a94ce095c3

@jrose-apple jrose-apple self-assigned this Dec 6, 2018
@gmittert
Copy link
Contributor Author

gmittert commented Dec 6, 2018

I should mention that this doesn't fix all the driver tests on windows, just the "easy" ones

  • color diagnostics work on windows, but don't get printed during testing, not sure why yet
  • response files don't work yet (I've got to fix that properly)
  • unicode file names don't work on windows yet (might be related to the response files not working)
  • the driver-frontend tests don't work (That should be fixable by adding additional arguments)
  • multi threading isn't implemented on windows yet

@jrose-apple jrose-apple merged commit 4e0b092 into apple:master Dec 11, 2018
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.

None yet

4 participants