Unit Testing on NRF Connect / Zephyr on Windows

Good morning,

I am trying to figure out how to write unit-tests using NRF Connect and Zephyr on Windows.  Therefore I am trying to use unity as described here:

http://194.19.86.155/nRF_Connect_SDK/doc/latest/nrf/ug_unity_testing.html

It is not clear to me if this test framework is prepared to run also in Windows. Is the board "native_posix" only supported on Linux at the moment?

When I try to compile the test example running:

west build -b native_posix -t run

I get following error

[5/104] Building C object zephyr/CMakeFiles/offsets.dir/arch/posix/core/offsets/offsets.c.obj
FAILED: zephyr/CMakeFiles/offsets.dir/arch/posix/core/offsets/offsets.c.obj
C:\MinGW\bin\gcc.exe -DBUILD_VERSION=v2.7.99-ncs1-1 -DKERNEL -DUNITY_INCLUDE_CONFIG_H -DUSE_PARTITION_MANAGER=0 -D_FORTIFY_SOURCE=2 -D_POSIX_C_SOURCE=200809 -D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED -D__ZEPHYR__=1 -IC:/HOME/git-repos/matter/ncs/zephyr/kernel/include -IC:/HOME/git-repos/matter/ncs/zephyr/arch/posix/include -IC:/HOME/git-repos/matter/ncs/zephyr/include -Izephyr/include/generated -IC:/HOME/git-repos/matter/ncs/zephyr/soc/posix/inf_clock -IC:/HOME/git-repos/matter/ncs/zephyr/boards/posix/native_posix -IC:/HOME/git-repos/matter/ncs/nrf/include -IC:/HOME/git-repos/matter/ncs/zephyr/../test/cmock/vendor/unity/src -IC:/HOME/git-repos/matter/ncs/zephyr/../test/cmock/src -IC:/HOME/git-repos/matter/ncs/nrf/tests/unity -Os -imacros C:/HOME/git-repos/matter/matter-app/build/zephyr/include/generated/autoconf.h -ffreestanding -fno-common -g -gdwarf-4 -fdiagnostics-color=always -Wall -Wformat -Wformat-security -Wno-format-zero-length -Wno-main -Wno-pointer-sign -Wpointer-arith -Wexpansion-to-defined -Wno-unused-but-set-variable -Werror=implicit-int -fno-asynchronous-unwind-tables -fno-pie -fno-pic -fno-strict-overflow -fno-reorder-functions -fno-defer-pop -fmacro-prefix-map=C:/HOME/git-repos/matter/matter-app/src/dali/tests=CMAKE_SOURCE_DIR -fmacro-prefix-map=C:/HOME/git-repos/matter/ncs/zephyr=ZEPHYR_BASE -fmacro-prefix-map=C:/HOME/git-repos/matter=WEST_TOPDIR -ffunction-sections -fdata-sections -m32 -include C:/HOME/git-repos/matter/ncs/zephyr/arch/posix/include/posix_cheats.h -fno-freestanding -std=c11 -MD -MT zephyr/CMakeFiles/offsets.dir/arch/posix/core/offsets/offsets.c.obj -MF zephyr\CMakeFiles\offsets.dir\arch\posix\core\offsets\offsets.c.obj.d -o zephyr/CMakeFiles/offsets.dir/arch/posix/core/offsets/offsets.c.obj -c C:/HOME/git-repos/matter/ncs/zephyr/arch/posix/core/offsets/offsets.c
In file included from C:/HOME/git-repos/matter/ncs/zephyr/arch/posix/core/offsets/offsets.c:26:
C:/HOME/git-repos/matter/ncs/zephyr/include/kernel.h: In function 'k_delayed_work_cancel':
C:/HOME/git-repos/matter/ncs/zephyr/include/kernel.h:3944:10: error: 'EALREADY' undeclared (first use in this function)
 3944 |  return -EALREADY;
      |          ^~~~~~~~
C:/HOME/git-repos/matter/ncs/zephyr/include/kernel.h:3944:10: note: each undeclared identifier is reported only once for each function it appears in
ninja: build stopped: subcommand failed.
FATAL ERROR: command exited with status 1: 'C:\HOME\git-repos\matter\ncs-toolchain\v1.9.1\opt\bin\cmake.EXE' --build 'C:\HOME\git-repos\matter\matter-app\build'

If  I try to compile for other boards, the test compiles, but the error happen on running. It complains there is no emulation available for the board I chose. Is there no way to run the tests on the target hardware using this framework? Could you provide some examples?

Parents Reply Children
No Data
Related