I have some tests run via cargo-component that are failing. I would like to use the combination of the RUST_LOG=wasi_common=trace
env variable and the -D log-to-files
flag to get more in depth logs as to why. This comment in the cargo-component code seems to suggest that I can pass additional arguments to the wasmtime test runner, but I can't quite seem to figure that out.
This doesn't seem to be working, and even the env var doesn't seem to be picked up as I am still getting the minimum error:
RUST_LOG=wasi_common=trace cargo component test s3_upload_bytes --manifest-path ./packages/components/runtime/Cargo.toml -- --no-capture -D log-to-files
...
Error: failed to run main module `/Volumes/workplace/my-project/target/wasm32-wasi/debug/deps/my_project-cd29621f97f814b3.wasm`
Caused by:
0: import `wasi:http/types@0.2.0` has the wrong type
1: instance export `fields` has the wrong type
2: expected resource found nothing
I think it is likely that the error is also related to not being able to pass in extra arguments since it seems to be caused by the lack of -S http
Hi @Landon James, sorry for the late reply as I've been away until this week and now have started a new position with a huge ramp-up, so it's consuming my time considerably.
You can find an example of using a custom runner in this issue: https://github.com/bytecodealliance/cargo-component/issues/276
Effectively, you can set CARGO_TARGET_WASM32_WASI_RUNNER
to wasmtime
with any options / commands you want and cargo-component
will automatically spawn it with the build artifact passed as an argument
it's also possible to do the same with a .config/cargo.toml
file by setting target.wasm32-wasi.runner
(as documented here
Last updated: Nov 25 2024 at 19:03 UTC