Hello!
We have developed a product that we would like to add some testing for and I have looked at both ztest and unity testing. Currently I am struggling with running the examples for unity testing that is available under the nrf sdk in "ncs/v2.5.3/nrf/applications/asset_tracker_v2/tests/debug_module". I am navigating to the path and then trying to run it with both twister and west but can't get it to work. I am running this under WSL in windows and I am able to build and flash devices but not to run this tests. Followed this guide: docs.nordicsemi.com/.../unit_test.html
twister -T . -p native_sim or west build -b native_sim -t run
error: Aborting due to Kconfig warnings CMake Error at /home/hd/zephyrproject/zephyr/cmake/modules/kconfig.cmake:396 (message): command failed with return code: 1 Call Stack (most recent call first): /home/hd/zephyrproject/zephyr/cmake/modules/zephyr_default.cmake:133 (include) /home/hd/zephyrproject/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include) /home/hd/zephyrproject/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:92 (include_boilerplate) CMakeLists.txt:9 (find_package) -- Configuring incomplete, errors occurred! INFO - /home/haddek/ncs/v2.5.3/nrf/applications/asset_tracker_v2/tests/debug_module/twister-out/qemu_cortex_m3_ti_lm3s6965/zephyr/asset_tracker_v2.debug_module_test.tester/build.log INFO - Total complete: 1/ 1 100% built (not run): 0, filtered: 0, failed: 0, error: 1 INFO - 1 test scenarios (1 configurations) selected, 0 configurations filtered (0 by static filter, 0 at runtime). INFO - 0 of 1 executed test configurations passed (0.00%), 0 built (not run), 0 failed, 1 errored, with no warnings in 8.09 seconds. INFO - 0 of 1 executed test cases passed (0.00%), 1 errored on 1 out of total 926 platforms (0.11%). INFO - 0 test configurations executed on platforms, 1 test configurations were only built. INFO - Saving reports... INFO - Writing JSON report /home/haddek/ncs/v2.5.3/nrf/applications/asset_tracker_v2/tests/debug_module/twister-out/twister.json INFO - Writing xunit report /home/haddek/ncs/v2.5.3/nrf/applications/asset_tracker_v2/tests/debug_module/twister-out/twister.xml... INFO - Writing xunit report /home/haddek/ncs/v2.5.3/nrf/applications/asset_tracker_v2/tests/debug_module/twister-out/twister_report.xml... INFO - -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ INFO - The following issues were found (showing the top 10 items): INFO - 1) asset_tracker_v2.debug_module_test.tester on qemu_cortex_m3/ti_lm3s6965 error (CMake build failure) INFO - INFO - To rerun the tests, call twister using the following commandline: INFO - west twister -p <PLATFORM> -s <TEST ID>, for example: INFO - INFO - west twister -p qemu_cortex_m3/ti_lm3s6965 -s asset_tracker_v2.debug_module_test.tester INFO - or with west: INFO - west build -p -b qemu_cortex_m3/ti_lm3s6965 . -T asset_tracker_v2.debug_module_test.tester INFO - -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ INFO - Run completed
error: Aborting due to Kconfig warnings CMake Error at /home/hd/zephyrproject/zephyr/cmake/modules/kconfig.cmake:396 (message): command failed with return code: 1 Call Stack (most recent call first): /home/hd/zephyrproject/zephyr/cmake/modules/zephyr_default.cmake:133 (include) /home/hd/zephyrproject/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include) /home/hd/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:97 (include_boilerplate) CMakeLists.txt:9 (find_package) -- Configuring incomplete, errors occurred! FATAL ERROR: command exited with status 1: /usr/bin/cmake -DWEST_PYTHON=/home/haddek/zephyrproject/.venv/bin/python3 -B/home/haddek/ncs/v2.5.3/nrf/applications/asset_tracker_v2/tests/debug_module/build -GNinja -S/home/haddek/ncs/v2.5.3/nrf/applications/asset_tracker_v2/tests/debug_module
I then tried checked the logs (or ran with -i and got following):
Renaming output directory to /home/hd/ncs/v2.5.3/nrf/applications/asset_tracker_v2/tests/debug_module/twister-out.2 INFO - Using Ninja.. INFO - Zephyr version: v4.0.0-4212-gefe94a9a291c INFO - Using 'zephyr' toolchain. INFO - Building initial testsuite list... INFO - Writing JSON report /home/hd/ncs/v2.5.3/nrf/applications/asset_tracker_v2/tests/debug_module/twister-out/testplan.json INFO - JOBS: 16 INFO - Adding tasks to the queue... INFO - Added initial list of jobs to queue ERROR - CMake build failure: /home/hd/ncs/v2.5.3/nrf/applications/asset_tracker_v2/tests/debug_module for qemu_cortex_m3/ti_lm3s6965 ERROR - qemu_cortex_m3/ti_lm3s6965 asset_tracker_v2.debug_module_test.tester ERROR: CMake build failure INFO - /home/hd/ncs/v2.5.3/nrf/applications/asset_tracker_v2/tests/debug_module/twister-out/qemu_cortex_m3_ti_lm3s6965/zephyr/asset_tracker_v2.debug_module_test.tester/build.log ERROR - Loading Zephyr default modules (Zephyr base). -- Application: /home/hd/ncs/v2.5.3/nrf/applications/asset_tracker_v2/tests/debug_module -- CMake version: 3.28.3 -- Found Python3: /home/hd/zephyrproject/.venv/bin/python3 (found suitable version "3.12.3", minimum required is "3.10") found components: Interpreter -- Cache files will be written to: /home/hd/.cache/zephyr -- Zephyr version: 4.0.99 (/home/hd/zephyrproject/zephyr) -- Found west (found suitable version "1.3.0", minimum required is "0.14.0") -- Board: qemu_cortex_m3, qualifiers: ti_lm3s6965 -- Found host-tools: zephyr 0.17.0 (/home/hd/zephyr-sdk-0.17.0) -- Found toolchain: zephyr 0.17.0 (/home/hd/zephyr-sdk-0.17.0) -- Found Dtc: /home/hd/zephyr-sdk-0.17.0/sysroots/x86_64-pokysdk-linux/usr/bin/dtc (found suitable version "1.6.0", minimum required is "1.4.6") -- Found BOARD.dts: /home/hd/zephyrproject/zephyr/boards/qemu/cortex_m3/qemu_cortex_m3.dts -- Generated zephyr.dts: /home/hd/ncs/v2.5.3/nrf/applications/asset_tracker_v2/tests/debug_module/twister-out/qemu_cortex_m3_ti_lm3s6965/zephyr/asset_tracker_v2.debug_module_test.tester/zephyr/zephyr.dts -- Generated pickled edt: /home/hd/ncs/v2.5.3/nrf/applications/asset_tracker_v2/tests/debug_module/twister-out/qemu_cortex_m3_ti_lm3s6965/zephyr/asset_tracker_v2.debug_module_test.tester/zephyr/edt.pickle -- Generated devicetree_generated.h: /home/hd/ncs/v2.5.3/nrf/applications/asset_tracker_v2/tests/debug_module/twister-out/qemu_cortex_m3_ti_lm3s6965/zephyr/asset_tracker_v2.debug_module_test.tester/zephyr/include/generated/zephyr/devicetree_generated.h -- Including generated dts.cmake file: /home/hd/ncs/v2.5.3/nrf/applications/asset_tracker_v2/tests/debug_module/twister-out/qemu_cortex_m3_ti_lm3s6965/zephyr/asset_tracker_v2.debug_module_test.tester/zephyr/dts.cmake /home/hd/ncs/v2.5.3/nrf/applications/asset_tracker_v2/tests/debug_module/prj.conf:7: warning: attempt to assign the value 'y' to the undefined symbol UNITY /home/hd/ncs/v2.5.3/nrf/applications/asset_tracker_v2/tests/debug_module/prj.conf:14: warning: attempt to assign the value 'y' to the undefined symbol APP_EVENT_MANAGER Parsing /home/hd/ncs/v2.5.3/nrf/applications/asset_tracker_v2/tests/debug_module/Kconfig Loaded configuration '/home/hd/zephyrproject/zephyr/boards/qemu/cortex_m3/qemu_cortex_m3_defconfig' Merged configuration '/home/hd/ncs/v2.5.3/nrf/applications/asset_tracker_v2/tests/debug_module/prj.conf' Merged configuration '/home/hd/ncs/v2.5.3/nrf/applications/asset_tracker_v2/tests/debug_module/twister-out/qemu_cortex_m3_ti_lm3s6965/zephyr/asset_tracker_v2.debug_module_test.tester/zephyr/misc/generated/extra_kconfig_options.conf' error: Aborting due to Kconfig warnings CMake Error at /home/hd/zephyrproject/zephyr/cmake/modules/kconfig.cmake:396 (message): command failed with return code: 1 Call Stack (most recent call first): /home/hd/zephyrproject/zephyr/cmake/modules/zephyr_default.cmake:133 (include) /home/hd/zephyrproject/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include) /home/hd/zephyrproject/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:92 (include_boilerplate) CMakeLists.txt:9 (find_package) -- Configuring incomplete, errors occurred! INFO - /home/hd/ncs/v2.5.3/nrf/applications/asset_tracker_v2/tests/debug_module/twister-out/qemu_cortex_m3_ti_lm3s6965/zephyr/asset_tracker_v2.debug_module_test.tester/build.log INFO - Total complete: 1/ 1 100% built (not run): 0, filtered: 0, failed: 0, error: 1 INFO - 1 test scenarios (1 configurations) selected, 0 configurations filtered (0 by static filter, 0 at runtime). INFO - 0 of 1 executed test configurations passed (0.00%), 0 built (not run), 0 failed, 1 errored, with no warnings in 4.93 seconds. INFO - 0 of 1 executed test cases passed (0.00%), 1 errored on 1 out of total 926 platforms (0.11%). INFO - 0 test configurations executed on platforms, 1 test configurations were only built. INFO - Saving reports... INFO - Writing JSON report /home/hd/ncs/v2.5.3/nrf/applications/asset_tracker_v2/tests/debug_module/twister-out/twister.json INFO - Writing xunit report /home/hd/ncs/v2.5.3/nrf/applications/asset_tracker_v2/tests/debug_module/twister-out/twister.xml... INFO - Writing xunit report /home/hd/ncs/v2.5.3/nrf/applications/asset_tracker_v2/tests/debug_module/twister-out/twister_report.xml...
I tried also to setup a test using ZTEST and this I got to work with having very simple asert true is true,but when I tried to include my project headers in the code it started to complain about missing includes "bluetooth/gatt_dm.h: No such file or directory" even if I had in the prj file set up CONFIG_BT=y.