Skip to content

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

Closed

Conversation

davidungar
Copy link
Contributor

Ensure the diagnostics are not colored, and that the frontend jobs can find the sdk.

@davidungar
Copy link
Contributor Author

@swift-ci please test

@davidungar davidungar requested review from owenv and CodaFi January 30, 2021 23:04
@davidungar
Copy link
Contributor Author

@swift-ci please test

@davidungar
Copy link
Contributor Author

@swift-ci please test

@davidungar
Copy link
Contributor Author

@swift-ci please test

Copy link
Contributor

@owenv owenv left a 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",
Copy link
Contributor

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.

Copy link
Contributor Author

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] {
Copy link
Contributor

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.

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'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") {
Copy link
Contributor

@CodaFi CodaFi Feb 1, 2021

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.

Copy link
Contributor Author

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.

@davidungar
Copy link
Contributor Author

I'll rework this PR--thanks all for your ideas!

@davidungar
Copy link
Contributor Author

Closing this PR in favor of #454 and #453

@davidungar davidungar closed this Feb 1, 2021
@davidungar davidungar deleted the get-incremental-tests-to-run branch February 16, 2021 18:11
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