Add branch coverage. Lots more tests needed, particularly ones that fail at malloc.
diff --git a/cmake/CoverallsClear.cmake b/cmake/CoverallsClear.cmake
index eb68695..f6b0ace 100644
--- a/cmake/CoverallsClear.cmake
+++ b/cmake/CoverallsClear.cmake
@@ -20,5 +20,7 @@
# Copyright (C) 2014 Joakim Söderberg <joakim.soderberg@gmail.com>
#
+message ( "Clearing coverage data" )
file(REMOVE_RECURSE ${PROJECT_BINARY_DIR}/*.gcda)
-
+file(REMOVE ${PROJECT_BINARY_DIR}/*.gcov)
+file(REMOVE ${PROJECT_BINARY_DIR}/*.gcov_tmp)
diff --git a/cmake/CoverallsGenerateGcov.cmake b/cmake/CoverallsGenerateGcov.cmake
index bb8bd5f..2c26bd9 100644
--- a/cmake/CoverallsGenerateGcov.cmake
+++ b/cmake/CoverallsGenerateGcov.cmake
@@ -161,7 +161,7 @@
# If -p is not specified then the file is named only "the_file.c.gcov"
#
execute_process(
- COMMAND ${GCOV_EXECUTABLE} -p -o ${GCDA_DIR} ${GCDA}
+ COMMAND ${GCOV_EXECUTABLE} -c -p -o ${GCDA_DIR} ${GCDA}
WORKING_DIRECTORY ${COV_PATH}
)
endforeach()
diff --git a/cmake/LCov.cmake b/cmake/LCov.cmake
index ebdc665..1ac9ec3 100644
--- a/cmake/LCov.cmake
+++ b/cmake/LCov.cmake
@@ -1,6 +1,12 @@
-# TODO: parameterize for reuse
-add_custom_target(coverage_report
- COMMAND lcov --directory src/CMakeFiles/cn-cbor.dir --capture --output-file cn-cbor.info
- COMMAND genhtml --output-directory lcov cn-cbor.info
- COMMAND echo "Coverage report in: file://${CMAKE_BINARY_DIR}/lcov/index.html"
-)
+FIND_PROGRAM( LCOV_PATH lcov )
+FIND_PROGRAM( GENHTML_PATH genhtml )
+
+if (LCOV_PATH)
+ # message ( "lcov: ${LCOV_PATH}" )
+
+ add_custom_target(coverage_report
+ COMMAND "${LCOV_PATH}" --rc lcov_branch_coverage=1 --no-checksum --base-directory "${CMAKE_CURRENT_SOURCE_DIR}" --directory src/CMakeFiles/${PROJECT_NAME}.dir --no-external --capture --output-file ${PROJECT_NAME}.info
+ COMMAND "${GENHTML_PATH}" --rc genhtml_branch_coverage=1 --output-directory lcov ${PROJECT_NAME}.info
+ COMMAND echo "Coverage report in: file://${CMAKE_BINARY_DIR}/lcov/index.html"
+ )
+endif()