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?
Additional output, which might be relevant: error: could not compile test-programs (bin "dwarf_imported_memory" test) due to 1 previous error
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
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.
Oh these don't actually pass tests and it's why our ci/run-tests.sh
script passes --exclude test-programs
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"
but otherwise yeah looksl ike you found the build.rs
which is where these flags are coming from
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
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?
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
)
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
Looks like cargo test -p wasmtime-wasi-http
is what I actually wanted.
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.
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
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
)
Shall I update the docs to stop recommending cargo test -p test-programs
then?
Oh dear yes please, that's dated documentation I didn't even realize existed!
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?
ah ok yes that's very dated documentation, I'll work on updating that so no need to handle that yourself
https://github.com/bytecodealliance/wasmtime/pull/9207
Last updated: Dec 23 2024 at 13:07 UTC