-
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.) #7794
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
grynspan
merged 3 commits into
release/6.0
from
jgrynspan/one-test-product-two-libraries-take-2-6.0
Jul 19, 2024
Merged
[6.0] Build one test product for both Swift Testing and XCTest (with Swift Testing enabled by default.) #7794
grynspan
merged 3 commits into
release/6.0
from
jgrynspan/one-test-product-two-libraries-take-2-6.0
Jul 19, 2024
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.) (#7789) 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. This PR includes changes from the previous PRs numbered #7766, #7783, Resolves rdar://120864035. Co-authored-by: Pavel Yaskevich <xedin@apache.org>
@swift-ci please test |
Build failures right now are due to missing ICU content. |
@swift-ci please test |
Need #7796 too. |
…7796) This PR forces Swift Testing to write its xUnit output to a different path from what the user specifies. In the future, we should have the two testing libraries collate their XML output into a single file, but that requires the ability to parse and reformat XML output and that's a little beyond the capabilities of this feature right now. Since we expect most uses of xUnit output right now are existing ones with existing XCTest-based tests, moving Swift Testing aside seems like the right call. (If XCTest is explicitly disabled, the exact specified path is used.)
@swift-ci please test |
@swift-ci please test Windows |
bnbarham
approved these changes
Jul 19, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
build system
Changes to interactions with build systems
command-line interface
enhancement
performance
Performance optimizations and improvements
swift build
Changes impacting `swift build`
swift package init
Package templates command changes
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: rdar://120864035
Original PR: #7777, #7789, #7796
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