unittest: add support for coverage

Some missing features for getting coverage data for unit tests:
- Setting the unit_testing board to have coverage support and native
  application.
- Fixing the CONFIG_COVERAGE check

Signed-off-by: Yuval Peress <peress@google.com>
This commit is contained in:
Yuval Peress 2022-11-28 11:33:11 -07:00 committed by Christopher Friedt
commit 49ca6f8f7d
2 changed files with 3 additions and 1 deletions

View file

@ -93,7 +93,7 @@ target_link_libraries(testbinary PRIVATE
${EXTRA_LDFLAGS_AS_LIST} ${EXTRA_LDFLAGS_AS_LIST}
) )
if(COVERAGE) if(CONFIG_COVERAGE)
target_compile_options(test_interface INTERFACE $<TARGET_PROPERTY:compiler,coverage>) target_compile_options(test_interface INTERFACE $<TARGET_PROPERTY:compiler,coverage>)
target_link_libraries(testbinary PRIVATE $<TARGET_PROPERTY:linker,coverage>) target_link_libraries(testbinary PRIVATE $<TARGET_PROPERTY:linker,coverage>)

View file

@ -4,5 +4,7 @@
config BOARD_UNIT_TESTING config BOARD_UNIT_TESTING
bool "Unit testing board" bool "Unit testing board"
select HAS_COVERAGE_SUPPORT
select NATIVE_APPLICATION
help help
Board for unit testing Board for unit testing