-
Notifications
You must be signed in to change notification settings - Fork 34
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
Add fizzy-wasi tool #329
Add fizzy-wasi tool #329
Conversation
deff052
to
86939f0
Compare
There seems to be a linking error:
|
c626416
to
cb723fb
Compare
tools/wasi/wasi.cpp
Outdated
uvwasi_errno_t ret = uvwasi_serdes_readv_ciovec_t(instance.memory->data(), | ||
instance.memory->size(), iovptr, iovs.data(), static_cast<uvwasi_size_t>(iovs.size())); | ||
if (ret != UVWASI_ESUCCESS) | ||
return {false, {ret}}; |
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.
Need to double check the spec whether we return error code here or trpa.
// Global state. | ||
// NOTE: we do not care about uvwasi_destroy(), because it only clears file descriptors (currently) | ||
// and we are a single-run tool. This may change in the future and should reevaluate. | ||
uvwasi_t 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.
uvwasi_t state; | |
uvwasi_t state; | |
std::unique_ptr<uvwasi_t, decltype(&uvwasi_destroy)> state_destroyer{&state, &uvwasi_destroy}; |
The idea how to test at least some aspects of WASI. Although, I'm still ok with merging this in the current from, and leave more extensive testing to some other day. |
@chfast your magic does not compile:
|
a2a3e19
to
c573a92
Compare
@@ -132,7 +132,7 @@ bool run(int argc, const char** argv) | |||
nullptr, // NOTE: no special allocator | |||
}; | |||
|
|||
uvwasi_errno_t err = uvwasi_init(&state, &options); | |||
const uvwasi_errno_t err = uvwasi_init(&state, &options); |
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.
Why is this const stuff so important on this?
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.
The const
should be the default.
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.
Should protest C++ to follow Rust with making const-by-default and have a mutable specifier on others :)
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 both know this is not possible.
…n_sizes_get And also add two dummy implementations of fd_prestat_dir_name and environ_get.
TODO:
fd_write
(add memory translation helpers)wasi_unstable
towasi_snapshot_preview1
helloworld.wasm
and expect "hello world\n" on coutOptional: support helloworld from rust
Use hello world from https://github.com/bytecodealliance/wasmtime/blob/master/docs/WASI-tutorial.md#web-assembly-text-example as test.
Also supports running hello world generated by Rust (using wasilibc).
Spec explanation: https://github.com/WebAssembly/WASI/blob/master/phases/README.md