Skip to content
Snippets Groups Projects
Commit ebbb1481 authored by Stéphane Del Pino's avatar Stéphane Del Pino
Browse files

Add a mechanism to remove old corverage data files

The idea is that if a source file is removed, its associated .gcno and
.gcda files remained, leading to a crash of lcov (non finding expected
sources)
parent bf18a188
No related branches found
No related tags found
1 merge request!79Utils/gitlab
......@@ -367,6 +367,20 @@ add_custom_target(run_unit_tests
# unit tests coverage
if("${CMAKE_BUILD_TYPE}" STREQUAL "Coverage")
file(GLOB_RECURSE GCNO_FILE_LIST RELATIVE "${PUGS_BINARY_DIR}" "*.gcno")
list(FILTER GCNO_FILE_LIST EXCLUDE REGEX "^\.\./.*" )
file(GLOB_RECURSE GCDA_FILE_LIST RELATIVE "${PUGS_BINARY_DIR}" "*.gcda")
list(FILTER GCDA_FILE_LIST EXCLUDE REGEX "^\.\./.*" )
foreach(COV_INFO_FILE IN LISTS GCNO_FILE_LIST GCDA_FILE_LIST)
string(REGEX REPLACE "/CMakeFiles/.*\.dir/" "/" COV_SRC_FILE "${PUGS_SOURCE_DIR}/${COV_INFO_FILE}")
string(REGEX REPLACE "\.gcda$" "" COV_SRC_FILE "${COV_SRC_FILE}")
string(REGEX REPLACE "\.gcno$" "" COV_SRC_FILE "${COV_SRC_FILE}")
if (NOT EXISTS "${COV_SRC_FILE}")
file(REMOVE "${PUGS_BINARY_DIR}/${COV_INFO_FILE}")
message(STATUS "removed file ${COV_INFO_FILE}: no longer needed")
endif()
endforeach()
find_program(LCOV lcov)
if(NOT LCOV)
message(FATAL_ERROR "lcov not found, cannot perform coverage.")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment