Stefan Jaritz
Hey,
I like to do some code tests for parts of my firmware. I struggling to find out how to setup testing. There is some explanation at https://docs.zephyrproject.org/1.12.0/subsystems/test/ztest.html but I am missing something like a tutorial like "how to integrate unit testing into my project?". So I am asking if you can help me to get a clear top down approach. Let's setup a fictional project, called myProject. This project defines an own board "myBoard" based on the stm32f412. For this board we wrote some firmware containing several code files and a config. We created a ztest that should check some part of the firmware. The filesystem structure looks like that: myProject/ myProject/myBoard/ myProject/myBoard/myBoard.dts myProject/myBoard/myBoard_defconfig myProject/src/ myProject/src/drv/myDrv.c myProject/src/drv/myDrv.h myProject/src/main.c myProject/CMakeLists.txt myProject/prj.conf myProject/myTest/ myProject/myTest/testa.c myProject/myTest/main.c @CMakeLists.txt cmake_minimum_required(VERSION 3.10) set(BOARD "myBoard") set(BOARD_ROOT "${CMAKE_SOURCE_DIR}") include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) project(NONE) list(APPEND INC src/drv/ ) list(APPEND SRC src/drv/myDrv.c src/main.c ) target_sources(app PRIVATE ${SRC}) target_include_directories(app PRIVATE ${INC}) @prj.conf # CONFIG_TEST=y # CONFIG_ZTEST=y # CONFIG_DEBUG=y CONFIG_STDOUT_CONSOLE=y CONFIG_PRINTK=y CONFIG_SYS_LOG=y CONFIG_SYS_LOG_SHOW_COLOR=y CONFIG_UART_LINE_CTRL=y CONFIG_SEGGER_SYSTEMVIEW=y How do I need to modify the cmake, configs and file structure to run the test while building the firmware? Stefan
|
|