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
I have some components in my application which I'd like to unit-test. However, I am not sure how to do this, especially in the presence
of shared resources.
Normally, I would mock some components so I have fine-grained control over input and output. I do not know how to do that with RTIC v2 idiomatically.
Would this be possible by somehow implementing lock for my mock data structures? Maybe some examples would help here as well.
Another problem I found is that I simply can not run even a simple test harness on my host computer.
I get errors like this:
va416xx-rs/flashloader on bootloader-flashloader [$!+?] is 📦 v0.1.0 via 🦀 v1.78.0
❯ cargo ut -p flashloader
Compiling flashloader v0.1.0(/home/rmueller/Rust/va416xx-rs/flashloader)
error[E0412]: cannot find type `Peripherals` in module `rtic::export`
--> flashloader/src/main.rs:86:1
|
86 | #[rtic::app(device = pac, dispatchers = [U1])]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in `rtic::export`
|
= note: this error originates in the attribute macro `rtic::app` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider importing one of these items
|
88 + use cortex_m::Peripherals;
|
88 + usecrate::pac::Peripherals;
|
I also get linker errors which I try a regular cargo test --<host-triplet>, so what I did now was to define an additional library like this
and now I can run tests using cargo test --<host-triplet> --lib . Some documentation related to unit-testing/automated testing might be useful. Embedded apps can have complex components where automated testing might be really useful, and ideally I'd like to do that inside the application without the need to create a new library just for that.
Kind Regards
Robin
The text was updated successfully, but these errors were encountered:
Hello,
I have some components in my application which I'd like to unit-test. However, I am not sure how to do this, especially in the presence
of shared resources.
Normally, I would mock some components so I have fine-grained control over input and output. I do not know how to do that with RTIC v2 idiomatically.
Would this be possible by somehow implementing
lock
for my mock data structures? Maybe some examples would help here as well.Another problem I found is that I simply can not run even a simple test harness on my host computer.
I get errors like this:
I also get linker errors which I try a regular
cargo test --<host-triplet>
, so what I did now was to define an additional library like thisand now I can run tests using
cargo test --<host-triplet> --lib
. Some documentation related to unit-testing/automated testing might be useful. Embedded apps can have complex components where automated testing might be really useful, and ideally I'd like to do that inside the application without the need to create a new library just for that.Kind Regards
Robin
The text was updated successfully, but these errors were encountered: