-
Notifications
You must be signed in to change notification settings - Fork 79
Support a Unified Test Binary #986
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
Support a Unified Test Binary #986
Conversation
f29db87
to
6551f60
Compare
Are we certain |
@adam-fowler I consulted @grynspan who mentioned looking for the |
There's a window of maybe two nightly builds where the tool is available but the new build mechanism is not yet implemented. I think that's narrow enough we don't need to worry about it, and the solution for anybody affected is to slightly upgrade or downgrade their nightly toolchains. :) |
There's a |
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.
6551f60
to
9f92d15
Compare
Yeah you’re probably right |
Woohoo! |
Verified |
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. Themtime
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.