Skip to content

Build one test product for both Swift Testing and XCTest (with Swift Testing enabled by default.) #7789

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
merged 1 commit into from
Jul 18, 2024

Conversation

grynspan
Copy link
Contributor

@grynspan grynspan commented Jul 17, 2024

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, #7784, and #7787.

Resolves rdar://120864035.

@grynspan grynspan added enhancement 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` swift package init Package templates command changes command-line interface labels Jul 17, 2024
@grynspan grynspan self-assigned this Jul 17, 2024
@grynspan
Copy link
Contributor Author

@swift-ci please test

@grynspan
Copy link
Contributor Author

@swift-ci please test

@grynspan grynspan force-pushed the jgrynspan/one-test-product-two-libraries-take-2 branch from 58abe35 to 19a986d Compare July 17, 2024 21:47
@grynspan
Copy link
Contributor Author

@swift-ci please test

@grynspan
Copy link
Contributor Author

@swift-ci please test Windows

…Testing enabled by default.)

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, and #7787.

Resolves rdar://120864035.

---------

Co-authored-by: Pavel Yaskevich <xedin@apache.org>
@grynspan grynspan force-pushed the jgrynspan/one-test-product-two-libraries-take-2 branch from 19a986d to b667027 Compare July 17, 2024 21:57
@grynspan
Copy link
Contributor Author

@swift-ci please test

@grynspan
Copy link
Contributor Author

@swift-ci please test Windows

@@ -177,7 +171,7 @@ enum TestingSupport {
// execution but is required when the tests are running in parallel as
// SwiftPM repeatedly invokes the test binary with the test case name as
// the filter.
let codecovProfile = buildParameters.buildPath.appending(components: "codecov", "default%m.profraw")
let codecovProfile = buildParameters.buildPath.appending(components: "codecov", "\(library)%m.profraw")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this use buildParameters.codeCovPath as the base?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Presumably. This bit's not new though and I'd be tempting fate changing it in this PR. We can look at a change separately.

@grynspan grynspan merged commit ee95ea8 into main Jul 18, 2024
5 checks passed
@grynspan grynspan deleted the jgrynspan/one-test-product-two-libraries-take-2 branch July 18, 2024 17:33
grynspan added a commit that referenced this pull request Jul 18, 2024
…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>
grynspan added a commit that referenced this pull request Jul 19, 2024
…Swift Testing enabled by default.) (#7794)

**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:** 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

---------

Co-authored-by: Pavel Yaskevich <xedin@apache.org>
kateinoigakukun added a commit to kateinoigakukun/swift-package-manager that referenced this pull request Oct 7, 2024
`SWIFT_PM_TEST_LIBRARY` was renamed to `SWIFT_TESTING_ENABLED` in
swiftlang#7789, but we
forgot to update the test because `XCTAssertAsyncNoThrow` always
succeeded and we didn't notice the failure.
kateinoigakukun added a commit to kateinoigakukun/swift-package-manager that referenced this pull request Oct 7, 2024
`SWIFT_PM_TEST_LIBRARY` was renamed to `SWIFT_TESTING_ENABLED` in
swiftlang#7789, but we
forgot to update the test because `XCTAssertAsyncNoThrow` always
succeeded and we didn't notice the failure.
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants