"Hi embedded-wg,..." <- > <@mhatzl:matrix.org> Hi embedded-wg, > > I am a working student at Infineon trying to improve the tooling to test Rust code on embedded devices (target) and on desktop (host). Running tests on a host platform like Windows or Linux is quite easy with `cargo test`. > Testing code on embedded devices already becomes a bit harder, but `defmt-test` at least works well for integration tests. Unit tests are currently very limited, because it is unstable to include non-inline modules inside proc-macros, which kind of forces one to write all tests inside one inline test module. > > At Infineon, the goal is to write tests once and run them on targets and on the host, because testing on the host is much faster, but target tests are needed for quality assurance and certifications. > This combination is not as easily done as it could be, because the `harness` setting in Cargo.toml is target independent. > Therefore, the default `harness` must be enabled/disabled if one wants to switch between testing on host or target. > > I created a small demo project [here](https://github.com/mhatzl/misc-target-testing) that showcases the workarounds and pain points we faced. > > These limitations seem quite hard to resolve without changes to rustc and Cargo. > Allowing non-inline modules inside proc-macros may help, but this seems like another workaround. > Ideally, defmt-test could be integrated for no_std targets similar to how libtest is for std targets. > Note that this is just a rough idea. > > If someone from the WG or Knurling team has more information about the direction for defmt-test, rustc, Cargo, or embedded testing in general, I'd be happy to talk about this in more detail. > > Best regards, > Manuel Have you looked at probe-rs and embedded-test at all?