Skip to content

Conversation

grynspan
Copy link
Contributor

@grynspan grynspan commented Jul 16, 2024

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 affects swift build and swift 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

grynspan and others added 2 commits July 16, 2024 15:39
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 <[email protected]>
@grynspan grynspan added bug build system Changes to interactions with build systems performance Performance optimizations and improvements swift test Changes impacting `swift test` tool swift build Changes impacting `swift build` command-line interface swift 6.0 Related to Swift 6.0 release branch labels Jul 16, 2024
@grynspan grynspan self-assigned this Jul 16, 2024
@grynspan grynspan changed the base branch from main to release/6.0 July 16, 2024 19:51
@grynspan grynspan requested a review from a team as a code owner July 16, 2024 19:51
@grynspan
Copy link
Contributor Author

@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.
@grynspan
Copy link
Contributor Author

Updated to include #7783.

@grynspan
Copy link
Contributor Author

@swift-ci please test

@grynspan
Copy link
Contributor Author

@swift-ci please test Windows

The enable/disable testing library options are no longer used by `swift build`
and can be removed.
@grynspan
Copy link
Contributor Author

@swift-ci please test

@grynspan
Copy link
Contributor Author

@swift-ci please test Windows

@grynspan
Copy link
Contributor Author

Closing; will reopen fresh once we're satisfied with the changes on main.

@grynspan grynspan closed this Jul 17, 2024
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant