-
Notifications
You must be signed in to change notification settings - Fork 205
Add arguments when creating Driver for tests so that tests can run #449
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
Add arguments when creating Driver for tests so that tests can run #449
Conversation
@swift-ci please test |
@swift-ci please test |
@swift-ci please test |
@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.
I think the idea is good, but I'm wondering if we should make this opt-in so there's an indication that it's happening when writing/debugging tests. As far as I know it should only be required for the relatively small number of tests that are running jobs.
@@ -81,7 +81,9 @@ final class SwiftDriverTests: XCTestCase { | |||
XCTAssertNoThrow(try Driver(args: ["swift", ".foo"])) | |||
XCTAssertNoThrow(try Driver(args: ["swift", "/foo"])) | |||
|
|||
XCTAssertThrowsError(try Driver(args: ["swift", "foo"])) | |||
XCTAssertThrowsError(try Driver(args: ["swift", "foo", |
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.
It took me a while to figure out that the extra arguments were added to prevent the initializer from inserting them between "swift" and "foo", this seems kind of error-prone.
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.
Yes, I think you are right.
} | ||
} | ||
|
||
private func augment(args: [String]) throws -> [String] { |
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.
Nit: Perhaps a more descriptive name than 'augment(args:)' could be used here.
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.
I'll try to come up with something; it's a good point.
// The frontend fails to load the standard library because it cannot | ||
// find it relative to the execution path used by the Swift Driver. | ||
// So, pass in the sdk path explicitly. | ||
if let sdkPath = try cachedSDKPath.get(), !args.contains("-sdk") { |
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.
We don't search for the SDK except in immediate mode. The expectation is that users and tests will provide SDKROOT
in the environment or invoke swiftc
via xcrun
so the environment is configured for them. I recommend we provide SDKROOT
in the testing environment until we land in a toolchain.
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.
Yes, that might be better.
I'll rework this PR--thanks all for your ideas! |
Ensure the diagnostics are not colored, and that the frontend jobs can find the sdk.