3 ms·
How do you test the code that calls a OS function? (think of something like shutdown - you don't want your test to turn off your CI system) The obvious answer i
by bluGill 3y ago
How do you test the code that calls a OS function? (think of something like shutdown - you don't want your test to turn off your CI system) The obvious answer is write a wrapper and a mock implementation of the wrapper. Now you have the wrapper that is untested, so you write a wrapper for that so you - I actually had someone go down this 3 levels before giving up.
I work in embedded where we have to control real hardware.
- nickpsecurity 3y agoThe other thing you can do is composition of individually-verified parts. In your example, you make tests that really exercise the shutdown function. Also, note any preconditions these functions need to meet so the application calling it can be consistent with specs. From there, just assume shutdown works if used within the tested spec. This method also encourages reusing working specs, code, and tests. We see that in DO-178C with the RTOS’s, etc.