Stream: wasmtime

Topic: trouble with `cargo test -p test-programs`


view this post on Zulip Joel Dice (Sep 06 2024 at 14:50):

I'm trying to run cargo test -p test-programs on the main branch per these instructions and getting the following error:

error: linking with `cc` failed: exit status: 1
  |
[long cc command omitted]
  = note: cc: error: unrecognized command-line option '--import-memory'
          cc: error: unrecognized command-line option '--export-memory'

It looks to me like Wasm-specific flags are being passed to my native (Linux/ARM64) compiler, which it clearly doesn't understand. What might I be doing wrong?

A fast and secure runtime for WebAssembly. Contribute to bytecodealliance/wasmtime development by creating an account on GitHub.

view this post on Zulip Joel Dice (Sep 06 2024 at 14:55):

Additional output, which might be relevant: error: could not compile test-programs (bin "dwarf_imported_memory" test) due to 1 previous error

view this post on Zulip Joel Dice (Sep 06 2024 at 14:56):

Also seeing this sometimes:

  = note: cc: error: unrecognized command-line option '--no-check-features'; did you mean '--no-check-data-deps'?
          cc: error: unrecognized command-line option '--shared-memory'


error: could not compile `test-programs` (bin "dwarf_shared_memory" test) due to 1 previous error

view this post on Zulip Joel Dice (Sep 06 2024 at 15:05):

After removing dwarf_shared_memory.rs and dwarf_imported_memory.rs (and also removing the corresponding lines in build.rs), everything builds fine, but only one test appears to actually run.

view this post on Zulip Alex Crichton (Sep 06 2024 at 15:13):

Oh these don't actually pass tests and it's why our ci/run-tests.sh script passes --exclude test-programs

view this post on Zulip Alex Crichton (Sep 06 2024 at 15:13):

ideally we'd skip tests for every binary but that would require adding [[bin]] ... test = false for everything which defeats the purpose of "just drop a file in here"

view this post on Zulip Alex Crichton (Sep 06 2024 at 15:14):

but otherwise yeah looksl ike you found the build.rs which is where these flags are coming from

view this post on Zulip Alex Crichton (Sep 06 2024 at 15:14):

ideally all the tests would build on native and wasm but there's not a great way to manage that afaik without requiring extra code in each test

view this post on Zulip Joel Dice (Sep 06 2024 at 15:15):

My primary goal is to fix a wasmtime-wasi-http bug and add a test for the fix. Given that these tests aren't run on CI, I guess I'll be relying on folks to run the tests manually from time to time? And if so, what is the right way to run those tests manually?

view this post on Zulip Joel Dice (Sep 06 2024 at 15:20):

Even when I run cargo test --workspace --no-fail-fast, I see stuff like this:

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

     Running unittests src/bin/api_proxy.rs (target/debug/deps/api_proxy-e276aa2a45c3e281)

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

     Running unittests src/bin/api_proxy_forward_request.rs (target/debug/deps/api_proxy_forward_request-a0bcb19b9356be76)

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

     Running unittests src/bin/api_proxy_streaming.rs (target/debug/deps/api_proxy_streaming-1ee8a5db9985e2a1)

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

     Running unittests src/bin/api_reactor.rs (target/debug/deps/api_reactor-7f1eda1d1aeafa68)

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

     Running unittests src/bin/api_read_only.rs (target/debug/deps/api_read_only-a916991a53a2da4e)

running 0 tests

... which makes me think the tests I care about aren't run at all (i.e. even without --exclude test-programs)

view this post on Zulip Joel Dice (Sep 06 2024 at 15:25):

Oh wait, I see now. They're tested here (I wrote some of this code, so I guess I should remember):

test wasi_http_proxy_tests ... ok
test sync::http_outbound_request_response_build ... ok
test sync::http_outbound_request_unknown_method ... ok
test sync::http_outbound_request_unsupported_scheme ... ok
test wasi_http_hash_all_with_reject ... ok
test wasi_http_hash_all_with_override ... ok
test wasi_http_hash_all ... ok
test wasi_http_echo ... ok
test wasi_http_double_echo ... ok
test wasi_http_without_port ... ok

view this post on Zulip Joel Dice (Sep 06 2024 at 15:26):

Looks like cargo test -p wasmtime-wasi-http is what I actually wanted.

view this post on Zulip Joel Dice (Sep 06 2024 at 15:28):

I'm still not sure what cargo test -p test-programs is actually meant for. Seems like that crate exists only for other crates to use in their tests.

view this post on Zulip Alex Crichton (Sep 06 2024 at 15:31):

ah sorry yes you found the right incantation, the test-programs stuff is just to provide binaries for other crates, and you want cargo test -p wasmtime-wasi-http

view this post on Zulip Alex Crichton (Sep 06 2024 at 15:31):

CI runs ./ci/run-tests.sh which excludes the test-programs crate but they're all built for other crates (see crates/test-programs/artifacts)

view this post on Zulip Joel Dice (Sep 06 2024 at 15:31):

Shall I update the docs to stop recommending cargo test -p test-programs then?

view this post on Zulip Alex Crichton (Sep 06 2024 at 15:41):

Oh dear yes please, that's dated documentation I didn't even realize existed!

view this post on Zulip Joel Dice (Sep 06 2024 at 15:48):

I'm not sure how to update this section. It refers to a directory, crates/test-programs/wasi-test, that doesn't exist, and I'm not sure if the rest of the content in that paragraph is accurate, i.e. I don't know that simply adding a program to the bin directory will magically make the test run. Should I just delete that whole section?

A fast and secure runtime for WebAssembly. Contribute to bytecodealliance/wasmtime development by creating an account on GitHub.

view this post on Zulip Alex Crichton (Sep 06 2024 at 15:49):

ah ok yes that's very dated documentation, I'll work on updating that so no need to handle that yourself

view this post on Zulip Alex Crichton (Sep 06 2024 at 16:11):

https://github.com/bytecodealliance/wasmtime/pull/9207

These docs have fallen a bit out of date so this is an attempt to bring them back up to speed with the current organization of tests in this repository.

Last updated: Oct 23 2024 at 20:03 UTC