0

I've used Ceedling in the past on bare-metal projects that don't have many vendor libraries, so creating unit tests and mocking dependencies was pretty easy.

Now I'm trying to integrate Ceedling on a very large project. On this project I'm implementing an application on top of an existing OS and set of libraries provided by some manufacturer. I have the source code for most of it, but not all of it, so my control over those libraries is limited, especially when it reaches low level modules like the scheduler and communications with the other CPU.

So... I decided to give it a go by implementing a very simple unit test that only has one dependency, which I tried to mock. It turned out to be a nightmare right off the bat. That file ended up including a bunch of unrelated modules, so my idea was to mock all those modules until Ceedling stopped complaining. However, I hit a wall when I saw that some of them are automatically generated at compile time in a very obscure way by the ADK.

My question is then, how does one unit test this kind of projects? I feel that I'm missing something very fundamental when dealing with this type of projects, but I can't figure out what.

Dani M
  • 1,173
  • 1
  • 15
  • 43
  • Can you characterize the auto-generated segments to either include or exclude them from being considered in your framework? Either that or look through documentation of library to see if there are compiler or build settings to suppress or limit auto-generation. (experience with gSoap included learning to go completely through the documentation where I learned to limit the output code to only those objects that were needed for my project. ) – ryyker Apr 06 '22 at 13:51
  • @ryyker What do you mean by characterizing? – Dani M Apr 07 '22 at 06:22
  • By _"characterize"_ I just meant to determine what it is comprised of. Once you know that, then It should be possible to create post process (post compile) tests designed to vet the generated code segments. I did find others [asking](https://stackoverflow.com/questions/845887/unit-tests-for-automatically-generated-code-automatic-or-manual) - [similar](https://stackoverflow.com/questions/11060/how-should-i-unit-test-a-code-generator) - [questions](https://softwareengineering.stackexchange.com/questions/348298/should-one-test-generated-code). I hope one of these helps. – ryyker Apr 07 '22 at 13:12
  • @ryyker Gotcha, I'll take a look at those questions and see if I can find some inspiration. Thanks. – Dani M Apr 08 '22 at 08:57

0 Answers0