This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

NCS IS_ENABLED macro and unit tests

Hello everyone,

I have added some unit tests to my project and some of them are failing because it seems like the IS_ENABLED macro is not evaluated correct. Even though I added the respective Kconfig define to the target_compile_options. The module has a number of Kconfig options to en-/disable certain functionality. In the code I check with the IS_ENABLED macro if such an option is enabled and then do something. You can find a basic example of what I have done in the archive below.

6153.app.zip

For the basic setup I followed this guide:
https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.7.1/nrf/ug_unity_testing.html

Has anyone experienced a similar issue and has a solution for it?

Thanks in advance!

Parents
  • I was able to pass all the test by adding this line to app/tests/app_startup/prj.conf:

    CONFIG_COMPILER_OPT="-DCONFIG_APP_STARTUP_TIMEOUT_ENABLE=1 -DCONFIG_APP_STARTUP_TIMEOUT_INTERVAL=200 -DCONFIG_APP_STARTUP_TIMEOUT_DURATION=1000"

    First I tried using -DCONFIG_APP_STARTUP_TIMEOUT_ENABLE=y, but then IS_ENABLED(CONFIG_APP_STARTUP_TIMEOUT_ENABLE) would not evaulate to true.

    Best regards,

    Simon

  • Hello Simon,

    thanks for your help, that's exactly what I needed.

    Best regards,
    David

Reply Children
No Data
Related