You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
benstockil opened this issue
May 29, 2024
· 1 comment
Labels
C-bugCategory: This is a bug.O-ESP-IDFTarget: Espressif IoT Development FrameworkT-libsRelevant to the library team, which will review and decide on the PR/issue.
Running cargo check --tests fails to compile test for the esp-idf-template (tested on mcu esp32-c3, default template options).
Compiling test v0.0.0 (/home/ben/.local/share/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/test)
error[E0308]: mismatched types
--> /home/ben/.local/share/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/test/src/test_result.rs:102:18
|
101 | None => match status.signal() {
| --------------- this expression has type `Option<i32>`
102 | Some(libc::SIGABRT) => TestResult::TrFailed,
| ^^^^^^^^^^^^^ expected `i32`, found `usize`
For more information about this error, try `rustc --explain E0308`.
error: could not compile `test` (lib) due to 1 previous error
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
jieyouxu
added
T-libs
Relevant to the library team, which will review and decide on the PR/issue.
O-ESP-IDF
Target: Espressif IoT Development Framework
and removed
needs-triage
This issue may need triage. Remove it if it has been sufficiently triaged.
labels
Jun 4, 2024
C-bugCategory: This is a bug.O-ESP-IDFTarget: Espressif IoT Development FrameworkT-libsRelevant to the library team, which will review and decide on the PR/issue.
Running
cargo check --tests
fails to compiletest
for the esp-idf-template (tested on mcu esp32-c3, default template options).rust-lang/libc#3658 introduced these constants for espidf, where previously the error was a missing constant altogether (rust-lang/rust-analyzer#16552).
Steps to Reproduce
cargo generate esp-rs/esp-idf-template cargo
cd <project name> && cargo check --tests
Meta
rustc --version --verbose
:The text was updated successfully, but these errors were encountered: