From 49ca6f8f7da1b6c139808f89781465b60c0e0feb Mon Sep 17 00:00:00 2001 From: Yuval Peress Date: Mon, 28 Nov 2022 11:33:11 -0700 Subject: [PATCH] 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 --- cmake/modules/unittest.cmake | 2 +- subsys/testsuite/boards/unit_testing/unit_testing/Kconfig.board | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/cmake/modules/unittest.cmake b/cmake/modules/unittest.cmake index 5bc6765338d..be5fa56741a 100644 --- a/cmake/modules/unittest.cmake +++ b/cmake/modules/unittest.cmake @@ -93,7 +93,7 @@ target_link_libraries(testbinary PRIVATE ${EXTRA_LDFLAGS_AS_LIST} ) -if(COVERAGE) +if(CONFIG_COVERAGE) target_compile_options(test_interface INTERFACE $) target_link_libraries(testbinary PRIVATE $) diff --git a/subsys/testsuite/boards/unit_testing/unit_testing/Kconfig.board b/subsys/testsuite/boards/unit_testing/unit_testing/Kconfig.board index 88c43c26dc8..2b10e976b8c 100644 --- a/subsys/testsuite/boards/unit_testing/unit_testing/Kconfig.board +++ b/subsys/testsuite/boards/unit_testing/unit_testing/Kconfig.board @@ -4,5 +4,7 @@ config BOARD_UNIT_TESTING bool "Unit testing board" + select HAS_COVERAGE_SUPPORT + select NATIVE_APPLICATION help Board for unit testing