I have a project for the NRF5340 with SDK 2.6.1. I test the code with twister using Unity and CMock. That works great. But now I have to adapt the unity_cfg.yaml (which is generated via the ruby scripts) for certain tests, for example to deactivate passthrough.
I have found the following possible solutions:
- Via CMakeLists.txt: Generate mocks using
CMock_Handle(...NO_PASSTHROUGH TRUE)
. According to the official documentation (Testing with Unity and CMock), there is onlycmock_handle()
, which only allows the include file and an optional out path. - cmock.yml in the test directory where the CMakeLists.txt is located:
:cmock: :passthrough: false
. This option is not available in the cmock_config.rb. In addition, the contents of my cmock.yml is not merged, my file is simply ignored. It's still good for me to know how I can set other options (e.g. :treat_inlines: :include) via this. - Specify my cmock.yml via environment: via shell environment or "twister ...... -x CMOCK_CONFIG=<path>" or "twister ...... -x UNITY_CONFIG=<path>". Doesn't work.
- Environment variable CMOCK_PASSTHROUGH=false. Doesn't work.
I checked it by choosing a function with asserts and making sure that I get stuck there (CONFIG_ASSERT=y).
I hope someone can help me.
Thanx in advance,
svo