For my next embedded systems project I want to embrace unit testing. It may not technically be test driven development, but I would at least like to instrument unit tests up front and have comprehensive unit testing.
I am using the IAR EWARM tool chain. I am considering using cmocka, unity, or cunit. I am learning towards using µC/OS-III as the RTOS.
Here's the question: How is unit testing going to work with an RTOS in the picture? E.G: Should I disable the kernel and unit test the code as a single threaded application and stub all/most kernel calls, or is there a better way?
Example: In µC/OS-III the entry point is still main. From main you call any init code and then make a call to OSStart() to begin multitasking. So when I am running the test harness I could just not make the call to OSStart()
#ifdef UNIT_TEST
test_runner();
#else
OSStart(&err);
#endif
Then in all of my application code in the tasks I would just need to mock message passing and delay calls to the kernel.
Is that the best way to do this. Or would I be better suited starting the kernel, creating a task for my test runner, and running all of the tasks from that as a single thread, or is there some other good approach involving spawning the other tasks from the test harness.