-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Look for runtime library modules in the SDK, too #23175
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
beccadax
merged 2 commits into
swiftlang:master
from
beccadax:theres-a-path-for-everyone
Mar 13, 2019
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/// Tests the fallback behavior for runtime library import paths. These should | ||
/// prefer the resource directory, but fall back to the SDK. | ||
|
||
// Assumption: We build the standard library with the compiler, so the default | ||
// resource directory will contain a swiftmodule for the standard library. | ||
|
||
// %t/good-sdk contains a loadable standard library. | ||
// RUN: %empty-directory(%t/good-sdk/usr/lib/swift) | ||
// RUN: cp -r %platform-module-dir/Swift.swiftmodule %t/good-sdk/usr/lib/swift/Swift.swiftmodule | ||
|
||
// %t/bad-sdk contains an invalid standard library that cannot be loaded. | ||
// RUN: %empty-directory(%t/bad-sdk/usr/lib/swift/Swift.swiftmodule) | ||
// RUN: touch %t/bad-sdk/usr/lib/swift/Swift.swiftmodule/garbage-garbage-garbage.swiftmodule | ||
|
||
// %t/empty-toolchain does not contain a standard library. | ||
// RUN: %empty-directory(%t/empty-toolchain/usr/lib/swift) | ||
|
||
// FIXME: Until we have private imports, we need SwiftShims in the toolchain. | ||
// RUN: cp -r %test-resource-dir/shims %t/empty-toolchain/usr/lib/swift/shims | ||
|
||
// If the compiler's resource directory does not contain a runtime swiftmodule, | ||
// we should fall back to the SDK. | ||
|
||
// RUN: %empty-directory(%t/mcp) | ||
// RUN: %target-swift-frontend(mock-sdk: -sdk %t/good-sdk) -resource-dir %t/empty-toolchain/usr/lib/swift -module-cache-path %t/mcp -typecheck -verify %s | ||
|
||
// If the compiler's resource directory *does* contain a runtime swiftmodule, we | ||
// should *not* use the one in the SDK. (We assume that the resource directory | ||
// built with this compiler does contain a standard library.) | ||
|
||
// RUN: %empty-directory(%t/mcp) | ||
// RUN: %target-swift-frontend(mock-sdk: -sdk %t/bad-sdk) -module-cache-path %t/mcp -typecheck -verify %s | ||
beccadax marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
// If neither the resource directory nor the SDK contains a runtime swiftmodule, | ||
// loading should fail. This just proves that we aren't getting runtime imports | ||
// some other way. | ||
|
||
// FIXME: We can't properly test this on a non-Darwin platform because we'll get | ||
// the same error message for "unloadable standard library" and "no standard | ||
// library". (SR-10097) | ||
// REQUIRES: objc_interop | ||
|
||
// RUN: %empty-directory(%t/mcp) | ||
// RUN: not %target-swift-frontend(mock-sdk: -sdk %t/bad-sdk) -resource-dir %t/empty-toolchain/usr/lib/swift -module-cache-path %t/mcp -typecheck %s 2>&1 | %FileCheck %s | ||
// CHECK: error: could not find module 'Swift' for target '{{.*}}'; found: garbage-garbage-garbage | ||
|
||
let x: Int = 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.