@Dan Gohman I am on the process of testing the new WASI functions. I manage to run test-programs
successfully, however when writing a new test my WASI functions doesn't seem to be available. After some poking around, I found that the build.rs
that is inside test-programs
is using cargo to compile the tests with target wasm32-wasi
. It seems to me that the installed target wasm32-wasi
ain't picking up my change (understandably so, why would it?). Question is, how can I make this work.
@Emiliano Lesende this is probably a problem with Cargo not picking up on the fact you've just dropped a brand new test case into test-programs/wasi-tests/src/bin
. If you run cargo clean
and then re-run the tests with cargo test --features test-programs/test_programs --package test-programs
, this should hopefully include your tests as well.
@Jakub Konka It does include my test. The problem is the fact that my test doesn't compile because the WASI functions I added they are not found.
--- stderr
Compiling libc v0.2.69
Compiling wasi v0.9.0+wasi-snapshot-preview1
Compiling more-asserts v0.2.1
Compiling wasi-tests v0.16.0 (/Users/emilianolesende/Source/wasmtime/crates/test-programs/wasi-tests)
error[E0412]: cannot find type `Addr` in crate `wasi`
--> src/bin/addr_resolve.rs:6:54
|
6 | unsafe fn exec_addr_resolve(host: &str) -> Vec<wasi::Addr> {
| ^^^^ not found in `wasi`
Oh, I see. It looks to me like you'd like to find Addr
struct/enum in the wasi
which so happens is a crate totally separate from anything we have in wasmtime
. In fact, wasi
crate the error is pointing at is here: https://github.com/bytecodealliance/wasi
What you should then do, at least for testing/debugging, fork wasi
crate, add your bindings, and then depend on your fork as a git dependency in test-programs
@Jakub Konka Ohhh. That was the part I was missing. I'll try that right now. Thank you. I definitely didn't do that. :)
@Jakub Konka I've tried compiling my own wasi, I've successfully regenerated lib_generated.rs but now when I try to compile test-programs I get a:
error[E0609]: no field `pr_type` on type `wasi::lib_generated::Prestat`
--> src/lib.rs:18:21
|
18 | if stat.pr_type != wasi::PREOPENTYPE_DIR {
| ^^^^^^^ unknown field
|
= note: available fields are: `tag`, `u`
@Pat Hickey It seems that test-programs
hasn't been updated to use your tagged unions change on generate-raw
. How I can build a pre-tagged union or is there a version of test-programs
that use wasi API that is tagged union compatible?
hi, sorry about that, i'm not familiar with test-programs
or was aware that it broke
the tagged unions change was carefully designed to be ABI compatible, but codegen and tools that consume struct and union fields names needed to be updated as part of the tagged unions change. can you point me to the place this is causing an issue?
@Pat Hickey I figured that much, I added a PR for the change. https://github.com/bytecodealliance/wasmtime/pull/1810/files
@Pat Hickey You will need to release wasi again as 0.9.1 with the tagged unions.
ah, sorry, i didnt realize the wasi
crate never got a release after the tagged unions merged. @Alex Crichton takes care of releases for that crate
it may be more appropriate to call it 0.10.0 given that its a breaking change, not an addition
I don't mind, I figured 0.9.1 since it wasn't wasi what changed but the generated code, 0.10.0 wounds good to me.
@Alex Crichton Once you tell me the version for the crate I'll update the PR
@Dan Gohman mind publishing the wasi
crate? I don't think I have access on crates.io
ah ok I've been added, will publish today
thanks alex!
Ok @Emiliano Lesende I've published wasi 0.10.0
@Alex Crichton Thanks
@Alex Crichton @Pat Hickey PR updated.
https://github.com/bytecodealliance/wasmtime/pull/1810
Last updated: Nov 22 2024 at 16:03 UTC