Hi. We’re pretty new to freertos and rtos in general. Is there a unit test framework that is used with freertos? If not, what are the problems with using one?
We use CMock and Unity - FreeRTOS/FreeRTOS/Test/CMock at main · FreeRTOS/FreeRTOS · GitHub.
Hi and welcome!
Using unit tests to test asynchronously driven systems such as RTOS is not a very meaningful endavour, we discussed this many times before, just query the forum for unit test (eg here: What is the minimal FreeRTOS environment to execute unit-tests? - Kernel - FreeRTOS Community Forums)
Well, let’s say I skipped unit tests in a project using RTOS. Then I will need to run software integration tests. How can I automate these tests?
you will need to run integration tests either way, with or without preceding unit tests. I am not aware of existing frameworks for that.
I wouldn’t just “skip” unit tests, as parts of the project will still be unit testable, so you should unit test those. I suspect that there are unit tests that are run, at least informally, on parts of FreeRTOS to verify the parts that are unit testable. (It is always best to find problems earlier than later).
When you get to the integration tests, the ability to automate those tests rests on YOUR project, have you provided hooks at the higher level to allow some test framework to exercise the pieces.
The website has a little information on FreeRTOS’s traditional integration test method, which in part could also be considered unit test, if you squint a bit. The actual unit tests are newer and augment the integration tests.
Essentially, the standard demo tasks started as just that, but over time became the tests too (example). They perform tests in tasks that just repeat over and over in an infinite loop - running them all pseudo simultaneously. There are a few platforms we run these on for weeks at a time, with a 16-bit tick so the tick count overflows regularly too.
Can you give an example? How can I create hooks?
Did you mean [this]
Typically, it means that the operations you want to integrate test need to have some way of being “triggered” by your test harness. You need to design how that is to happen.
In many of my systems, I add a debug console, and command from that can initiate most of the actions of the system, and then they report if they were successful.