-
Notifications
You must be signed in to change notification settings - Fork 1.4k
[6.0] Build one test product for both Swift Testing and XCTest (with Swift Testing enabled by default.) #7782
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
grynspan
wants to merge
4
commits into
release/6.0
from
jgrynspan/one-test-product-two-libraries-6.0
Closed
[6.0] Build one test product for both Swift Testing and XCTest (with Swift Testing enabled by default.) #7782
grynspan
wants to merge
4
commits into
release/6.0
from
jgrynspan/one-test-product-two-libraries-6.0
Conversation
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 PR detects when a Swift Testing run returns `EXIT_NO_TESTS_FOUND` and treats it as a successful test run. This change handles the change from swiftlang/swift-testing#536. Separately, the refactor in #7766 stops Swift Package Manager from reporting `"No matching test cases were run"` when XCTest has no tests matching passed `--filter` arguments. A third PR after these two have been merged will restore that functionality by collating results from both XCTest and Swift Testing. > [!NOTE] > Test coverage can be added after Swift Testing is in the Swift toolchain. This change partially resolves rdar://131704587.
…Testing enabled by default.) (#7766) This PR refactors the previously-experimental Swift Testing support logic so that only a single build product is produced when using both XCTest and Swift Testing, and detection of Swift Testing usage is no longer needed at compile time. On macOS, Xcode 16 is responsible for hosting Swift Testing content, so additional changes may be needed in Xcode to support this refactoring. Such changes are beyond the purview of the Swift open source project. Resolves rdar://120864035. --------- Co-authored-by: Pavel Yaskevich <xedin@apache.org>
@swift-ci please test |
This PR turns Swift Testing back off by default when running `swift package init` because it's not available in the toolchain yet and the package dependency may come as a surprise (also, it breaks CI, but who's counting?) Follow-up to #7766.
Updated to include #7783. |
@swift-ci please test |
@swift-ci please test Windows |
The enable/disable testing library options are no longer used by `swift build` and can be removed.
@swift-ci please test |
@swift-ci please test Windows |
Closing; will reopen fresh once we're satisfied with the changes on main. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
bug
build system
Changes to interactions with build systems
command-line interface
performance
Performance optimizations and improvements
swift build
Changes impacting `swift build`
swift test
Changes impacting `swift test` tool
swift 6.0
Related to Swift 6.0 release branch
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.
Explanation: Refactors the previously-experimental Swift Testing support logic so that only a single build product is produced when using both XCTest and Swift Testing, and detection of Swift Testing usage is no longer needed at compile time.
Scope: Implementation of Swift Testing/SwiftPM integration; touches mostly
swift test
but affectsswift build
andswift package init
as well.Issue: N/A (tracked in Apple Radar)
Original PR: #7766, #7777, #7783, #7784
Risk: Moderate—refactors how we build and run tests.
Testing: Existing test coverage in the package as well as test coverage in the Swift Testing package; additional integration testing will be added once Swift Testing is in the toolchain.
Reviewer: @bnbarham @xedin @briancroom @dennisweissmann