-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Apply toolset's testRunner
property in swift test
#8254
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
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
Per [SE-0378 toolsets can specify an optional `debugger` property](https://github.com/swiftlang/swift-evolution/blob/main/proposals/0387-cross-compilation-destinations.md#toolsetjson-files), which so far had no effect. We should respect this property in `swift run` invocations when any toolsets or Swift SDKs are selected. This allows running and debugging cross-compiled products in an environment other than the host, e.g. a container runtime when cross-compiled to Linux, qemu or a firmware flasher and serial port setup script with Swift Embedded for microcontrollers, or in a Wasm runtime for a WASI binary.
Per [SE-0378 toolsets can specify an optional `testRunner` property](https://github.com/swiftlang/swift-evolution/blob/main/proposals/0387-cross-compilation-destinations.md#toolsetjson-files), which so far had no effect. We should respect this property in `swift test` invocations when any toolsets or Swift SDKs are selected. This allows testing cross-compiled products in an environment other than the host, e.g. a container runtime when cross-compiled to Linux, qemu or a firmware flasher and serial port setup script with Swift Embedded for microcontrollers, or in a Wasm runtime for a WASI binary.
@swift-ci test |
@swift-ci test |
@swift-ci test |
@swift-ci test |
@swift-ci test |
dschaefer2
approved these changes
Jan 28, 2025
…o maxd/toolset-test-runner # Conflicts: # Fixtures/Miscellaneous/EchoExecutable/echo.sh # Fixtures/Miscellaneous/EchoExecutable/toolset.json # Tests/CommandsTests/RunCommandTests.swift
@swift-ci test |
bkhouri
reviewed
Jan 28, 2025
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.
Some comments from a testing perspective.
@swift-ci test |
@swift-ci test |
@swift-ci test windows |
1 similar comment
@swift-ci test windows |
MaxDesiatov
added a commit
that referenced
this pull request
Feb 4, 2025
Cherry-pick of #8254 merged as b14e431. **Explanation**: Per [SE-0378 toolsets can specify an optional `testRunner` property](https://github.com/swiftlang/swift-evolution/blob/main/proposals/0387-cross-compilation-destinations.md#toolsetjson-files), which so far had no effect. We should respect this property in `swift test` invocations when any toolsets or Swift SDKs are selected. This allows testing cross-compiled products in an environment other than the host, e.g. a container runtime when cross-compiled to Linux, QEMU or a firmware flasher and serial port setup script with Swift Embedded for microcontrollers, or in a Wasm runtime for a Wasm binary. **Scope**: Only impacts `swift-test` when a toolset or a Swift SDK are selected. **Risk**: Low, due to limited scope and automated testing. **Testing**: Added a new test cause to the existing XCTest suite. **Issue**: rdar://143815066 **Reviewer**: @dschaefer2
bripeticca
pushed a commit
to bripeticca/swift-package-manager
that referenced
this pull request
Feb 28, 2025
### Motivation: Per [SE-0378 toolsets can specify an optional `testRunner` property](https://github.com/swiftlang/swift-evolution/blob/main/proposals/0387-cross-compilation-destinations.md#toolsetjson-files), which so far had no effect. We should respect this property in `swift test` invocations when any toolsets or Swift SDKs are selected. This property specifies a path to a test harness that has implementation-specific knowledge of interpreting produced test bundles. This allows testing cross-compiled products in an environment other than the host, e.g. a container runtime when cross-compiled to Linux, qemu or a firmware flasher and serial port setup script with Swift Embedded for microcontrollers, or in a Wasm runtime for a WASI binary. ### Modifications: Updated SwiftRunCommand to check for the debugger property in toolsets or Swift SDKs when such are specified. Its value is then used to launch a freshly built binary. Changed test bundle extension from `.wasm` to `.xctest` used for other platforms to reduce special casing in corresponding code paths. Without this change, initial implementation crashed here in the `bundlePath` property, triggering `fatalError`, as lookup logic always assumes `.xctest` extension: https://github.com/swiftlang/swift-package-manager/blob/6aa009fd30992c3cba9af3fcb439ef57b61b75da/Sources/SPMBuildCore/BuiltTestProduct.swift#L35 ### Result: Cross-compiled tests can be directly launched with a `swift test` invocation.
kateinoigakukun
added a commit
to swiftwasm/carton
that referenced
this pull request
Mar 7, 2025
swiftlang/swift-package-manager#8254 introduced a change to produce `.xctest` files for test products instead of `.wasm` files. This change updates the CartonTestPlugin to support both formats and use the `.xctest` file if it is available.
kateinoigakukun
added a commit
to swiftwasm/carton
that referenced
this pull request
Mar 7, 2025
swiftlang/swift-package-manager#8254 introduced a change to produce `.xctest` files for test products instead of `.wasm` files. This change updates the CartonTestPlugin to support both formats and use the `.xctest` file if it is available.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Motivation:
Per SE-0378 toolsets can specify an optional
testRunner
property, which so far had no effect. We should respect this property inswift test
invocations when any toolsets or Swift SDKs are selected.This property specifies a path to a test harness that has implementation-specific knowledge of interpreting produced test bundles.
This allows testing cross-compiled products in an environment other than the host, e.g. a container runtime when cross-compiled to Linux, qemu or a firmware flasher and serial port setup script with Swift Embedded for microcontrollers, or in a Wasm runtime for a WASI binary.
Modifications:
Updated SwiftRunCommand to check for the debugger property in toolsets or Swift SDKs when such are specified. Its value is then used to launch a freshly built binary.
Changed test bundle extension from
.wasm
to.xctest
used for other platforms to reduce special casing in corresponding code paths. Without this change, initial implementation crashed here in thebundlePath
property, triggeringfatalError
, as lookup logic always assumes.xctest
extension:swift-package-manager/Sources/SPMBuildCore/BuiltTestProduct.swift
Line 35 in 6aa009f
Result:
Cross-compiled tests can be directly launched with a
swift test
invocation.