-
Notifications
You must be signed in to change notification settings - Fork 104
Add partial WASI/Wasm support. #301
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
This PR allows building using the SwiftWasm toolchain from https://swiftwasm.org. As of right now, macro plugins do not build correctly for WASM, so swift-testing is not usable, but it is buildable! ## Testing A workaround is provided on the [jgrynspan/wasi-workaround](https://github.com/apple/swift-testing/tree/jgrynspan/wasi-workaround) branch in order to facilitate testing. Check out that branch, then set the environment variable `SWT_COMPILER_PLUGIN_ENABLED` to `0` when building: ```sh SWT_COMPILER_PLUGIN_ENABLED=0 swift build --triple wasm32-unknown-wasi ``` The macros target should build except for its main function (which will emit a warning about being unsupported) as should the primary library target. It is not possible to build the testing library's tests yet.
@swift-ci please test |
@swift-ci please test |
Neat! |
@@ -140,7 +140,7 @@ struct FileHandle: ~Copyable, Sendable { | |||
let fd: CInt = -1 | |||
#endif | |||
|
|||
if fd >= 0 { | |||
if Bool(fd >= 0) { |
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 file doesn't build for WASI, however there's a dead-code warning here on platforms where fileno()
isn't defined which is redundant in the face of our explicit warning, so this change silences it.
Holding until Yuta can take a look (it's 3AM in Tokyo so it may be a few minutes. 😄) |
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.
Fantastic! 🎉
This PR does not resolve #228 in its entirety, but it's a step toward it. |
@swift-ci please test |
This PR allows building using the SwiftWasm toolchain from https://swiftwasm.org. As of right now, macro plugins do not build correctly for Wasm, so swift-testing is not usable, but it is buildable!
Testing
A workaround is provided on the jgrynspan/wasi-workaround branch in order to facilitate testing. Check out that branch, then set the environment variable
SWT_COMPILER_PLUGIN_ENABLED
to0
when building:The macros target should build except for its main function (which will emit a warning about being unsupported) as should the primary library target. It is not possible to build the testing library's tests yet.
Checklist: