Open benstockil opened 1 month ago
First of a short general remark, while we can push for making it possible to build crossplatform test this way they will never be runnable. For us the way forward is to build tests and use an external test harness, in the concrete case we are using the embedded-test crate for such adventures.
A current workaround to don't have rust-analyzer go insane on trying to build that tests the normal way is:
Explicitly tell it inside your Cargo.toml
by defining a section - depending on if you are building a lib, bin or a test - with the harness=false
field.
That will tell the system to not use the inbuilt rust test harness.
For your example project you would add a section like this
[[bin]]
name = "your project name"
harness = false
That said this answer is only trying to answer to the underlying issue of building test against espidf as a crossplatform target and not going into the detail of defining the right or wrong things inside rust libc
Running
cargo check --tests
fails to compiletest
for the esp-idf-template (tested on mcu esp32-c3, default template options).https://github.com/rust-lang/libc/pull/3658 introduced these constants for espidf, where previously the error was a missing constant altogether (https://github.com/rust-lang/rust-analyzer/issues/16552).
Steps to Reproduce
cargo generate esp-rs/esp-idf-template cargo
cd <project name> && cargo check --tests
Meta
rustc --version --verbose
: