Install all source files with coverage package 65/237365/2
authorKrzysztof Jackiewicz <k.jackiewicz@samsung.com>
Mon, 29 Jun 2020 16:09:33 +0000 (18:09 +0200)
committerKrzysztof Jackiewicz <k.jackiewicz@samsung.com>
Mon, 29 Jun 2020 16:28:50 +0000 (18:28 +0200)
We only need to calculate code coverage for code in src subdirectory. However,
if unit-tests sourcess are not provided, the lcov fails to notice some of the
covered code paths in header files.

This commit installs all the sources, but removes irrelevant ones from the
report. It adds ~ +5% and +10% to line and function coverage respectively.

Change-Id: If17259ee4b8b76b8c7060c8d49ec92577d997eaf

unit-tests/CMakeLists.txt
unit-tests/key-manager-coverage.sh.in

index 095abcc..2e4dc1a 100644 (file)
@@ -7,7 +7,7 @@ IF (CMAKE_BUILD_TYPE MATCHES "DEBUG")
 
     # coverage data
     SET(COVERAGE_BUILD_DIR
-        ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${TARGET_UNIT_TESTS}.dir/__/src/
+        ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${TARGET_UNIT_TESTS}.dir/
     )
 
     # install gcno files
@@ -19,7 +19,7 @@ IF (CMAKE_BUILD_TYPE MATCHES "DEBUG")
 
     # install all the source & header files just as in the buildir
     INSTALL(
-        DIRECTORY ${PROJECT_SOURCE_DIR}/src
+        DIRECTORY ${PROJECT_SOURCE_DIR}/
         DESTINATION ${CMAKE_BINARY_DIR}
         FILES_MATCHING PATTERN "*.cpp" PATTERN "*.h"
     )
index f0656d4..9789feb 100644 (file)
@@ -21,6 +21,8 @@ cp -r "@COVERAGE_BUILD_DIR@"/* "@COVERAGE_DIR@"
 # prepare report
 rm -f $STDERR
 lcov --no-external -c -d "@COVERAGE_DIR@" -b "@CMAKE_BINARY_DIR@" -o $REPORT 2>$STDERR
+lcov -r $REPORT "@CMAKE_BINARY_DIR@/unit-tests/*" -o $REPORT
+lcov -r $REPORT "@CMAKE_BINARY_DIR@/common/*" -o $REPORT
 
 # check warnings
 if [ -s $STDERR ]