-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Wasi run tests #3730
Wasi run tests #3730
Conversation
@@ -33,7 +33,7 @@ fn cShrink(self: *Allocator, old_mem: []u8, old_align: u29, new_size: usize, new | |||
|
|||
/// This allocator makes a syscall directly for every allocation and free. | |||
/// Thread-safe and lock-free. | |||
pub const direct_allocator = &direct_allocator_state; | |||
pub const direct_allocator = if (builtin.arch == .wasm32) wasm_allocator else &direct_allocator_state; |
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.
Would this be better done on the DirectAllocator
type itself?
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'm not sure. Since the wasm allocator has global state, we need to ensure that direct_allocator and wasm_allocator refer to the same instance.
I put wasmtime in build.zig because it was slightly easier to slap in the CLI args than the alternative ( |
d74ce76
to
dc304d5
Compare
We are thinking on enabling |
@@ -649,6 +650,13 @@ pub const Target = union(enum) { | |||
} | |||
} | |||
|
|||
if (self.isWasm()) { | |||
switch (self.getArchPtrBitWidth()) { | |||
32 => return Executor{ .wasmtime = "wasmtime" }, |
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'm curious... have you tried this and it didn't worked? @fengb
32 => return Executor{ .wasi = "wasmer run" },
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.
Zig build args are generated separately --test-cmd wasmer --test-cmd run
so I'd have to update the plumbing to support multiple args.
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.
That make sense! Thanks for the info.
To support this use case, we are working now on allowing to pass a file as first argument without being explicit with run
(so you can do wasmer myfile.wasm
).
I'll post an update here once it's ready to be used (which should be very soon!)
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.
We just added support for running wasm files directly without the run
argument.
wasmerio/wasmer#990
We will publish a release soon :)
dc304d5
to
d27721f
Compare
@fengb we just released Wasmer 0.11. With it, you can run Thanks for your feedback, without it we wouldn't have improve the Wasmer CLI to make it a bit easier to use! |
@syrusakbary thanks for your help! Another question for you if you don't mind. We run CI tests in the following environments:
Can you advise on the best way to obtain Wasmer 0.11 in these environments (or at least a subset)? I'm guessing it won't be in, for example, apt-get for Ubuntu 18.04. |
I can provide a powershell script if needed, otherwise just install Wasmer from here: https://github.com/wasmerio/wasmer/releases/download/0.11.0/wasmer-windows.exe
curl https://get.wasmer.io -sSfL | sh
curl https://get.wasmer.io -sSfL | sh
We haven't tested on Alpine, but this should work in both architectures ( curl https://get.wasmer.io -sSfL | sh
I think we don't currently support FreeBSD, but hopefully should not very hard to add. |
@syrusakbary thanks for the info! I made a follow-up issue for this here: #3775 |
This patches in some missing functionality into
std.os.wasi
to get tests compiling and running.