wazero v1.0.0-pre.8 adds a filesystem configuration API that supports writes, tested by multiple third-party suites. It also brings CompilationCache out of experimental state, obviating a hard to explain Namespace API. Finally, this adds more logging scopes.
We don't expect any API changes next month, as we prepare for wazero 1.0 in March. Most of the scheduled work will be completing WASI and improving tests, so that our first formal release is trustworthy. Please upgrade to this version and give us feedback on how it's going.
The best way to contact us is to join gophers slack #wazero channel. Note: You may need an invite to join gophers. If you like what we are doing, please star our repo as folks appreciate it. Meanwhile, let's dig into this month's changes!
Writable filesystem support
An exciting change for many is the ability to configure writeable filesystems. To do that, we've added ModuleConfig.WithFSConfig which has options to mount directories or a fs.FS such that wasm can access it. Before, we had ModuleConfig.WithFS, and we'll leave that forever. This will help reduce complexity for simple-case configuration.
Here's an example of how to allow read access to the current directory as the root filesystem, while write access to a different directory as "/tmp"
moduleConfig = wazero.NewModuleConfig().
// Make the current directory read-only accessible to the guest.
WithReadOnlyDirMount(".", "/")
// Make "/tmp/wasm" accessible to the guest as "/tmp".
WithDirMount("/tmp/wasm", "/tmp")
Under the scenes, this maps to appropriate WebAssembly primitives, namely "preopens" for those compiling WASI or a virtual root if GOOS=js.
Those using the wazero CLI can take advantage of this with mount-based syntax, which looks very similar to Docker.
For example, here's the same configuration via the command line:
$ wazero run -mount=.:/:ro -mount=/tmp/wasm:/tmp ...
Under the scenes is more comprehensive than last time. Those compiling source via WASI or GOOS=js can take advantage of newly supported system calls, tested on Linux, MacOS and Windows operating systems. Thanks very much to @codefromthecrypt@evacchi@mathetake and @ncruces for collaborating on these!
fd_filestat_set_size
fd_filestat_set_times
fd_sync
fd_tell
fd_pwrite
Some of you may wonder about our progress on a custom filesystem plugin. We have plans to do that, but after version 1.0. This configuration API was designed to be forwards compatible with a raw filesystem plugin once it is ready.
Standard Library Integration Tests
For the first time, wazero change depends on 3rd party integration tests for aspects beyond the WebAssembly Core specification. Specifically, we use multiple tests to ensure WASI not only works based on what the spec leads define, but also work in practice in TinyGo and Zig programming languages. By running multiple tests we are able to get an implicit quorum of what certain functions are expected to do, and reduce the amount of surprise by end users who simply want things to work.
For example, we use wazero instead of wasmtime to run TinyGo wasi target tests. If any fails, our build breaks. We are nearly there with Zig, too, and will be by next month. Both of these are also thanks to the language communities themselves, who have helped champion patches needed to make things portable.
We also run the emerging wasi-testsuite, defined by the spec team. We pass tests they define for the AssemblyScript and C programming languages. We don't yet pass all rust tests recently added from wasmtime: 5 fail mostly due to some edge case functions we've not yet implemented. However, we expect to pass all of them by 1.0 or sooner, or have a very good reason if we don't.
Beyond WASI, we also test the GOARCH=wasm GOOS=js platform baked into the standard Go sdk. This is typically tested via the node.js runtime (which uses V8), but our CLI works in lieu of that also. As Go considers this experimental, we don't require passing all tests, yet. That said we test each function that also exists in WASI. This helps existing users of GOARCH=wasm GOOS=js as well paves an easier transition for those working on the upcoming Go WASI proposal.
Getting these tests understood and integrated into our CI took a lot of effort, with special thanks to @achille-roussel@evacchi and @mathetake for their hard work.
... (truncated)
Commits
f040753 fs: handles windows edge cases on rename (#1086)
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Bumps github.com/tetratelabs/wazero from 1.0.0-pre.7 to 1.0.0-pre.8.
Release notes
Sourced from github.com/tetratelabs/wazero's releases.
... (truncated)
Commits
f040753
fs: handles windows edge cases on rename (#1086)043da0d
wasi: prohibits closing pre-opens (#1085)67125fc
wasi: supports rewinding a directory and fixes seek error (#1084)9bb46eb
site: fix wasi chart (#1083)a60debc
wasi: implements fd_filestat_set_size and fd_filestat_set_times (#1082)f9db806
zig: bumps to latest (#1080)d04199d
cli,wasi: passes mounts directly as preopens to run rust wasi-testsuite (#1078)574b2a7
wasi: prepares for native support of preopens (#1067)282ffc5
logging: adds memory scope (#1076)da99a7f
logging: adds exit scope and fixes mtim bug (#1074)Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting
@dependabot rebase
.Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)