Open PatrickKa opened 4 months ago
For testing the sad path we need to mock the flash code, create stubs for the startup tests and enable the Spi
class to run on Linux (probably with PImpl and a mock). This means that this issue is also related to #209.
Description
We should at least test the happy path. I think the easiest for this would be to
DEBUG_PRINT()
the results of the startup tests and every time the supervisor detects an error. Then we write a test where we write to all SPIs one after another and confirm that the supervisor does not interfere.Unfortunately, it is hard to test the sad path. Just decreasing the timeout doesn't work because the supervisor thread is not executed frequently enough to reliably catch such small timeouts. After all, it is supposed to check if the SPI is completely hung up. For that, we would need to make the SPI communication super slow as well.
Something we definitely need to and are able to test is whether the whole sleeping and resuming of the startup test threads works as planned.