flipperzero-rs / flipperzero

Rust on the Flipper Zero
MIT License
518 stars 34 forks source link

Test harness #53

Closed str4d closed 1 year ago

str4d commented 1 year ago

Currently all testing facilities are disabled for the crates in this repo. It makes sense because everything will only run on an actual Flipper Zero, but it does make verification of things tricky.

It would be useful to have a test harness, that runs the test binaries on a connected Flipper Zero. I'm imagining something like the integration tests for the yubikey crate, which require setting a YUBIKEY_SERIAL environment variable in order to run. The test-with crate might also be helpful here, specifically #[test_with::env(FLIPPER_ZERO_SERIAL_PORT)] or something, that can be used to enable at compilation time tests that require a connected Flipper Zero.

str4d commented 1 year ago

Ideally the test harness would make it easy to write normal Rust tests that Just Work.™️ What I'm imagining is something like this:

dcoles commented 1 year ago

Relevant: flipperzero-firmware Unit Tests documentation

dcoles commented 1 year ago

I also have a ST-Link USB dongle around somewhere which could be used to catch crashes with the in-circuit debugging feature.

JarvisCraft commented 1 year ago

It may also be worth looking at something like QEMU (as mentioned in The Embedded Rust Book) for running some tests, at least the ones which don't access periphery (screen, GPIO, iButton, etc). This would probably allow running these tests on CI.

JarvisCraft commented 1 year ago

Also to add to the list os useful links:

str4d commented 1 year ago

Okay, #57 now implements on-device unit and integration tests with the kind of usability I was aiming for.

dcoles commented 1 year ago

I'm traveling overseas this week, but should be able to take a look in the evening.