![]() ![]() Generating cmock for header /tmp/ncs/zephyr/include/device.hĬMake Error at /tmp/ncs/zephyr/cmake/extensions.cmake:372 (add_library): Generating test runner /tmp/ncs/projects/builds/cmock_test/runner/runner_example_test.c Cache files will be written to: /root/.cache/zephyr The CXX compiler identification is GNU 9.3.0 The C compiler identification is GNU 9.3.0 Kconfig header saved to '/tmp/ncs/projects/builds/cmock_test/zephyr/include/generated/autoconf.h' ![]() Loaded configuration '/tmp/ncs/zephyr/boards/posix/native_posix/native_posix_defconfig'Ĭonfiguration saved to '/tmp/ncs/projects/builds/cmock_test/zephyr/.config' Parsing /tmp/ncs/projects/project-name/Kconfig Generated devicetree_unfixed.h: /tmp/ncs/projects/builds/cmock_test/zephyr/include/generated/devicetree_unfixed.h Generated zephyr.dts: /tmp/ncs/projects/builds/cmock_test/zephyr/zephyr.dts Found BOARD.dts: /tmp/ncs/zephyr/boards/posix/native_posix/native_posix.dts Found dtc: /usr/bin/dtc (found suitable version "1.4.7", minimum required is "1.4.6") Found west: /usr/local/bin/west (found suitable version "0.8.0", minimum required is "0.7.1") Found Python3: /usr/bin/python3.8 (found suitable exact version "3.8.5") found components: Interpreter Zephyr version: 2.3.0-rc1 (/tmp/ncs/zephyr) Application: /tmp/ncs/projects/project-name Including boilerplate (Zephyr base): /tmp/ncs/zephyr/cmake/app/boilerplate.cmake When including CONFIG_GPIO=y, building the project yields an error saying (which may come from native posix board?): Initially, CppUTest was used, but as it seemed more work to create the mocks and stubs, Unity / CMock has been used instead. The mocked header files are included in the test files, where the working unity test example has been used as a base. However, running the project with native_posix still gives undefined devicetree macros, redefinitions and unknown config variables (CONFIG_GPIO=y and necessary modules are enabled). From my understanding, it is possible to run unit tests on the functions inside main.c when these include headers have been mocked, i.e.,Ĭmock_handle($/include/drivers/gpio.h drivers) For instance, the blinky example consists of main.c which includes, , and. As mentioned in the guide, cmock_handle() can be called in CMakeLists.txt to mock zephyr include headers. Now I encounter some issues when integrating it into another Zephyr application (currently the blinky example to understand the procedure). I've been working with unit tests lately, and got the example unity project to run (from here). ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |