knurling-rs / probe-run

Run embedded programs just like native ones
Apache License 2.0
646 stars 75 forks source link

Simplify snapshot tests #334

Closed Urhengulas closed 2 years ago

Urhengulas commented 2 years ago

This PR simplifies the probe-run snapshot tests by using the rstest macro. Additionally we update the dependencies used in the tests.

How to test the tests

These tests are ignored by default, since they require the hardware (nrf52840dk) to be present. You can run them locally by connecting your computer to the nrf52 and executing cargo test -- --ignored.

Reviewer notes

Please don't get intimidated by the number of files and lines changed. Most of the files are just renamed to work with rstest and the new name of the test file. The many deleted lines are because the stack overflow test got simplified in the past, but the output wasn't adapted yet. You should mainly focus on tests/snapshot.rs.

Remarks

Note that the panic_verbose test will fail in most cases. It's because this test output contains timing related numbers, which will slightly change from run to run. This also happened before this PR, therefore isn't a regression, but should be fixed in the future.

Note that updating serial_test pulls in many futures-* libraries, which seems unnecessary since we are not using any async functions. I've asked if that can be avoided: https://github.com/palfrey/serial_test/issues/73


Edit(1): Drop dependency update from this PR, in order to unblock it. Edit(2): Add reviewer notes. Edit(3): Add section on how to tests the tests and structure the PR description.

Urhengulas commented 2 years ago

bors try

bors[bot] commented 2 years ago

try

Build succeeded:

Urhengulas commented 2 years ago

bors r=justahero

bors[bot] commented 2 years ago

Build succeeded: