-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Build one test product for both Swift Testing and XCTest (with Swift Testing enabled by default.) #7766
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
Conversation
de3ea52
to
6743d46
Compare
@main | ||
@available(*, deprecated, message: "Not actually deprecated. Marked as deprecated to allow inclusion of deprecated tests (which test deprecated functionality) without warnings") | ||
struct Runner { | ||
private static func testingLibrary() -> String { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's probably a better way to disambiguate here. I am open to suggestions.
@@ -175,23 +175,20 @@ public struct SwiftBuildCommand: AsyncSwiftCommand { | |||
} | |||
|
|||
if case .allIncludingTests = subset { | |||
func updateTestingParameters(of buildParameters: inout BuildParameters, library: BuildParameters.Testing.Library) { | |||
func updateTestingParameters(of buildParameters: inout BuildParameters) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This helper function is probably redundant now.
9ce3698
to
c89a951
Compare
@swift-ci please test |
@@ -113,18 +109,14 @@ extension BuildParameters { | |||
} | |||
} | |||
|
|||
/// Which testing library to use for this build. | |||
public var library: Library |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I should probably move the Library
type out of BuildParameters
(since it ain't one anymore) but I'm going to save that for a separate PR due to its potential impact to Xcode 16 betas.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@swift-ci please test |
1 similar comment
@swift-ci please test |
@swift-ci please test Windows |
Mac CI failures are due to the |
244f1b4
to
7dfb5e8
Compare
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. This change partially resolves rdar://131704587.
Okay then. |
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]>
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.
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.
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.
…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. This PR includes changes from the previous PRs numbered #7766, #7783, and #7787. Resolves rdar://120864035. --------- Co-authored-by: Pavel Yaskevich <[email protected]>
…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 <[email protected]>
…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 <[email protected]>
…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, #7784, and #7787. Resolves rdar://120864035. Co-authored-by: Pavel Yaskevich <[email protected]>
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 <[email protected]>
With the merge of swiftlang/swift-package-manager#7766 a `swift build --build-tests` produces a single binary that contains both XCTests and swift-testing tests. Update the build configs when debugging tests to use this new unified test binary if it exists. To determine if we're running a unified binary on macOS we can check for the presence of the swiftpm-testing-helper, which is used to run the swift-testing tests in the unified binary. This utility isn't required on Windows and Linux as the test binary can be invoked directly. To determine if we're running a unified binary we check if the latest build produced a .swift-testing binary in the build folder. If it doesn't exist, or if it does exist but its `mtime` is older than the last build start time, we know its a unified binary. The `mtime` check is required in case the user updates their toolchain to a version that produces a unified binary but still has a .swift-testing binary in their .build folder left over from an old build. In the future we can remove these checks once we're confident users on 6.0 and main toolchains have moved on to versions that generate a unified test binary. Tentatively I propose this to be around when Swift 6.0 is finalized and released. This change only affects debugging tests. All other testing code paths use `swift test` which lets SwiftPM automatically handle the switch to the new unified binary.
With the merge of swiftlang/swift-package-manager#7766 a `swift build --build-tests` produces a single binary that contains both XCTests and swift-testing tests. Update the build configs when debugging tests to use this new unified test binary if it exists. To determine if we're running a unified binary on macOS we can check for the presence of the swiftpm-testing-helper, which is used to run the swift-testing tests in the unified binary. This utility isn't required on Windows and Linux as the test binary can be invoked directly. To determine if we're running a unified binary we check if the latest build produced a .swift-testing binary in the build folder. If it doesn't exist, or if it does exist but its `mtime` is older than the last build start time, we know its a unified binary. The `mtime` check is required in case the user updates their toolchain to a version that produces a unified binary but still has a .swift-testing binary in their .build folder left over from an old build. In the future we can remove these checks once we're confident users on 6.0 and main toolchains have moved on to versions that generate a unified test binary. Tentatively I propose this to be around when Swift 6.0 is finalized and released. This change only affects debugging tests. All other testing code paths use `swift test` which lets SwiftPM automatically handle the switch to the new unified binary.
With the merge of swiftlang/swift-package-manager#7766 a `swift build --build-tests` produces a single binary that contains both XCTests and swift-testing tests. Update the build configs when debugging tests to use this new unified test binary if it exists. To determine if we're running a unified binary on macOS we can check for the presence of the swiftpm-testing-helper, which is used to run the swift-testing tests in the unified binary. This utility isn't required on Windows and Linux as the test binary can be invoked directly. To determine if we're running a unified binary we check if the latest build produced a .swift-testing binary in the build folder. If it doesn't exist, or if it does exist but its `mtime` is older than the last build start time, we know its a unified binary. The `mtime` check is required in case the user updates their toolchain to a version that produces a unified binary but still has a .swift-testing binary in their .build folder left over from an old build. In the future we can remove these checks once we're confident users on 6.0 and main toolchains have moved on to versions that generate a unified test binary. Tentatively I propose this to be around when Swift 6.0 is finalized and released. This change only affects debugging tests. All other testing code paths use `swift test` which lets SwiftPM automatically handle the switch to the new unified binary.
With the merge of swiftlang/swift-package-manager#7766 a `swift build --build-tests` produces a single binary that contains both XCTests and swift-testing tests. Update the build configs when debugging tests to use this new unified test binary if it exists. To determine if we're running a unified binary on macOS we can check for the presence of the swiftpm-testing-helper, which is used to run the swift-testing tests in the unified binary. This utility isn't required on Windows and Linux as the test binary can be invoked directly. To determine if we're running a unified binary we check if the latest build produced a .swift-testing binary in the build folder. If it doesn't exist, or if it does exist but its `mtime` is older than the last build start time, we know its a unified binary. The `mtime` check is required in case the user updates their toolchain to a version that produces a unified binary but still has a .swift-testing binary in their .build folder left over from an old build. In the future we can remove these checks once we're confident users on 6.0 and main toolchains have moved on to versions that generate a unified test binary. Tentatively I propose this to be around when Swift 6.0 is finalized and released. This change only affects debugging tests. All other testing code paths use `swift test` which lets SwiftPM automatically handle the switch to the new unified binary.
With the merge of swiftlang/swift-package-manager#7766 a `swift build --build-tests` produces a single binary that contains both XCTests and swift-testing tests. Update the build configs when debugging tests to use this new unified test binary if it exists. To determine if we're running a unified binary on macOS we can check for the presence of the swiftpm-testing-helper, which is used to run the swift-testing tests in the unified binary. This utility isn't required on Windows and Linux as the test binary can be invoked directly. To determine if we're running a unified binary we check if the latest build produced a .swift-testing binary in the build folder. If it doesn't exist, or if it does exist but its `mtime` is older than the last build start time, we know its a unified binary. The `mtime` check is required in case the user updates their toolchain to a version that produces a unified binary but still has a .swift-testing binary in their .build folder left over from an old build. In the future we can remove these checks once we're confident users on 6.0 and main toolchains have moved on to versions that generate a unified test binary. Tentatively I propose this to be around when Swift 6.0 is finalized and released. This change only affects debugging tests. All other testing code paths use `swift test` which lets SwiftPM automatically handle the switch to the new unified binary.
With the merge of swiftlang/swift-package-manager#7766 a `swift build --build-tests` produces a single binary that contains both XCTests and swift-testing tests. Update the build configs when debugging tests to use this new unified test binary if it exists. To determine if we're running a unified binary on macOS we can check for the presence of the swiftpm-testing-helper, which is used to run the swift-testing tests in the unified binary. This utility isn't required on Windows and Linux as the test binary can be invoked directly. To determine if we're running a unified binary we check if the latest build produced a .swift-testing binary in the build folder. If it doesn't exist, or if it does exist but its `mtime` is older than the last build start time, we know its a unified binary. The `mtime` check is required in case the user updates their toolchain to a version that produces a unified binary but still has a .swift-testing binary in their .build folder left over from an old build. In the future we can remove these checks once we're confident users on 6.0 and main toolchains have moved on to versions that generate a unified test binary. Tentatively I propose this to be around when Swift 6.0 is finalized and released. This change only affects debugging tests. All other testing code paths use `swift test` which lets SwiftPM automatically handle the switch to the new unified binary.
With the merge of swiftlang/swift-package-manager#7766 a `swift build --build-tests` produces a single binary that contains both XCTests and swift-testing tests. Update the build configs when debugging tests to use this new unified test binary if it exists. To determine if we're running a unified binary on macOS we can check for the presence of the swiftpm-testing-helper, which is used to run the swift-testing tests in the unified binary. This utility isn't required on Windows and Linux as the test binary can be invoked directly. To determine if we're running a unified binary we check if the latest build produced a .swift-testing binary in the build folder. If it doesn't exist, or if it does exist but its `mtime` is older than the last build start time, we know its a unified binary. The `mtime` check is required in case the user updates their toolchain to a version that produces a unified binary but still has a .swift-testing binary in their .build folder left over from an old build. In the future we can remove these checks once we're confident users on 6.0 and main toolchains have moved on to versions that generate a unified test binary. Tentatively I propose this to be around when Swift 6.0 is finalized and released. This change only affects debugging tests. All other testing code paths use `swift test` which lets SwiftPM automatically handle the switch to the new unified binary.
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.