Enable Library Evolution in package builds for public library targets#951
Merged
stmontgomery merged 3 commits intoFeb 12, 2025
Merged
Conversation
Fixes rdar://144655439
Contributor
Author
|
@swift-ci please test |
stmontgomery
commented
Feb 12, 2025
| /// records an issue indicating that it has not been configured. | ||
| @_spi(Experimental) | ||
| public var exitTestHandler: ExitTest.Handler = { _ in | ||
| public var exitTestHandler: ExitTest.Handler = { exitTest in |
Contributor
Author
There was a problem hiding this comment.
After I enabled Library Evolution, I got a compiler crash when building with a main snapshot toolchain which has asserts enabled:
Begin Error in Function: '$s7Testing13ConfigurationV15exitTestHandleryAA04ExitD9ArtifactsVAA02__fD0VYaYbKcvpfiAfHYaYbKcfU_'
Found outside of lifetime use?!
Value: %2 = load_borrow %1 : $*__ExitTest // users: %8, %4, %3
Consuming User: end_borrow %2 : $__ExitTest // id: %4
Non Consuming User: debug_value %2 : $__ExitTest, let, name "_0", argno 1 // id: %8
Block: bb0
End Error in Function: '$s7Testing13ConfigurationV15exitTestHandleryAA04ExitD9ArtifactsVAA02__fD0VYaYbKcvpfiAfHYaYbKcfU_'
Found ownership error?!
1. Apple Swift version 6.2-dev (LLVM 5805166b4c9eb06, Swift 57234f8034befac)
2. Compiling with the current language version
3. While evaluating request ExecuteSILPipelineRequest(Run pipelines { Non-Diagnostic Mandatory Optimizations, Serialization, Rest of Onone } on SIL for Testing)
4. While running pass #679 SILFunctionTransform "OwnershipModelEliminator" on SILFunction "@$s7Testing13ConfigurationV15exitTestHandleryAA04ExitD9ArtifactsVAA02__fD0VYaYbKcvpfiAfHYaYbKcfU_".
for expression at [/Users/stuart/Work/swift-testing/Sources/Testing/Running/Configuration.swift:221:50 - line:223:3] RangeText="{ (_: borrowing ExitTest) throws -> ExitTestArtifacts in
throw SystemError(description: "Exit test support has not been implemented by the current testing infrastructure.")
"
5. Found verification error when verifying before lowering ownership. Please re-run with -sil-verify-all to identify the actual pass that introduced the verification error.
6. While verifying SIL function "@$s7Testing13ConfigurationV15exitTestHandleryAA04ExitD9ArtifactsVAA02__fD0VYaYbKcvpfiAfHYaYbKcfU_".
for expression at [/Users/stuart/Work/swift-testing/Sources/Testing/Running/Configuration.swift:221:50 - line:223:3] RangeText="{ (_: borrowing ExitTest) throws -> ExitTestArtifacts in
throw SystemError(description: "Exit test support has not been implemented by the current testing infrastructure.")
"
The closure parameter is of type borrowing ExitTest, and as a workaround I found simply giving it a name instead of the wildcard _ resolves the crash. I can file an issue to track that separately tomorrow.
Contributor
There was a problem hiding this comment.
Actually I think this might be the same issue as the one you just had to work around? @jckarter?
Contributor
Author
There was a problem hiding this comment.
This is a different issue than swiftlang/swift#79304
…oss-import overlay
Contributor
Author
|
@swift-ci please test |
grynspan
reviewed
Feb 12, 2025
Contributor
Author
|
@swift-ci please test |
Contributor
Author
|
@swift-ci please test macOS |
briancroom
approved these changes
Feb 12, 2025
grynspan
approved these changes
Feb 12, 2025
2 tasks
stmontgomery
added a commit
that referenced
this pull request
Apr 17, 2025
…ry target (#1082) This enables Library Evolution (LE) for the `_TestDiscovery` target in Swift package-based builds. The CMake-based build is already configured to enable LE for this target, so this is just matching behavior. (Note that we already enable LE for several other targets which vend public API as of #951.) ### Checklist: - [x] Code and documentation should follow the style of the [Style Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md). - [x] If public symbols are renamed or modified, DocC references should be updated.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This modifies
Package.swiftto enable Library Evolution for builds of the package.Motivation:
I recently landed a change (#931) which passed our project-level CI but later failed in Swift CI. The difference ended up being due to the latter building with Library Evolution (LE) enabled, whereas our project-level CI builds via SwiftPM and does not enable LE. The change was reverted (#950) but this revealed a gap in our testing strategy. We should always build these targets with LE enabled.
Checklist:
Fixes rdar://144655439