Including Preprocessor Directives in Unity/CMock

We have unit testing working with the Zephyr Unity/CMock setup, however the test runner (test_runner_generate) ignores preprocessor directives (#ifdef) and removes them when creating the runner_x.c file. This leads to the runner_x.c file including both the #ifdef and #else lines. 

We tried to modify the unity_cfg.yaml file with the line below as specified in the Ceedling documentation (https://github.com/ThrowTheSwitch/Ceedling/blob/master/docs/CeedlingPacket.md) but it had no effect.

:project:
  :use_test_preprocessor: TRUE
Is there another setting that can be configured, and are the Ceedling settings even available for the Unity/CMock framework available?
NCS Version: 2.4.2
Parents
  • Hi, 

    Thank you for your suggestion. I tried adding the defines to the yaml file, however the issue still persists.

    I have been editing the file \nrf\tests\unity\unity_cfg.yaml and it has a direct impact on build\mocks\unity_cfg.yaml. Should I add the changes in another file? Or add a project.yml file as the stack overflow post suggests?

    Thank you!

Reply
  • Hi, 

    Thank you for your suggestion. I tried adding the defines to the yaml file, however the issue still persists.

    I have been editing the file \nrf\tests\unity\unity_cfg.yaml and it has a direct impact on build\mocks\unity_cfg.yaml. Should I add the changes in another file? Or add a project.yml file as the stack overflow post suggests?

    Thank you!

Children
Related