From 1feaad6d5563a37cec0d959e6e4b685ab812d026 Mon Sep 17 00:00:00 2001 From: Falk Werner Date: Fri, 20 Mar 2020 18:18:35 +0100 Subject: [PATCH] fixed report branch coverage --- cmake/unit_tests.cmake | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/cmake/unit_tests.cmake b/cmake/unit_tests.cmake index 13b91f9..b541706 100644 --- a/cmake/unit_tests.cmake +++ b/cmake/unit_tests.cmake @@ -86,16 +86,17 @@ enable_testing() gtest_discover_tests(alltests TEST_PREFIX alltests:) add_custom_target(coverage - ./alltests - COMMAND mkdir -p coverage - COMMAND lcov --capture --directory . --output-file coverage/lcov.info - COMMAND lcov --remove coverage/lcov.info '/usr/*' --output-file coverage/lcov.info - COMMAND lcov --remove coverage/lcov.info '*/test/*' --output-file coverage/lcov.info + mkdir -p coverage + COMMAND lcov --initial --capture --directory . --output-file coverage/lcov_base.info --rc lcov_branch_coverage=1 + COMMAND ./alltests + COMMAND lcov --capture --directory . --output-file coverage/lcov.info --rc lcov_branch_coverage=1 + COMMAND lcov --remove coverage/lcov.info '/usr/*' --output-file coverage/lcov.info --rc lcov_branch_coverage=1 + COMMAND lcov --remove coverage/lcov.info '*/test/*' --output-file coverage/lcov.info --rc lcov_branch_coverage=1 ) add_dependencies(coverage alltests) add_custom_target(coverage-report - COMMAND genhtml coverage/lcov.info --output-directory coverage/report + COMMAND genhtml --branch-coverage --highlight --legend --prefix "${CMAKE_SOURCE_DIR}" coverage/lcov.info --output-directory coverage/report ) add_dependencies(coverage-report coverage)