Stream: cargo-component

Topic: Debug logs from cargo-component test


view this post on Zulip Landon James (Apr 23 2024 at 22:12):

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

A Cargo subcommand for creating WebAssembly components based on the component model proposal. - bytecodealliance/cargo-component

view this post on Zulip Peter Huene (May 01 2024 at 01:05):

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

This would make running wasi:http components easier. Currently users have to set CARGO_TARGET_WASM32_WASI_RUNNER environment variable to get it to work: CARGO_TARGET_WASM32_WASI_RUNNER="wasmtime se...

view this post on Zulip Peter Huene (May 01 2024 at 01:07):

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: Oct 23 2024 at 20:03 UTC