jeudi 30 avril 2015

Unit Testing within an RTOS

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.

Here's the question: I am going to use an RTOS. I am learning towards using µC/OS-III. How is unit testng going to work with an RTOS in the picture?

Here's my assumtion: 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 would 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.

Am I on the right track?

OR

when I am unit testing would it be better to call OSStart(&err) but only setup one task: the test runner.

Aucun commentaire:

Enregistrer un commentaire