fix(CMake/coverage): remove cov.info, *.gcda and *.gcno for coverage

GCov and LCOV don't overwrite the files when new data is available
... for whatever reason
This commit is contained in:
Jiří Štefka 2023-12-11 04:29:02 +01:00
parent c64b0d008c
commit 8a4b3174b8
Signed by: jiriks74
GPG Key ID: 1D5E30D3DB2264DE
2 changed files with 6 additions and 0 deletions

@ -62,11 +62,14 @@ if(ENABLE_COVERAGE)
add_dependencies(coverage tests ${PROJECT_NAME}) add_dependencies(coverage tests ${PROJECT_NAME})
add_custom_command( add_custom_command(
OUTPUT ${covname} OUTPUT ${covname}
COMMAND rm -rf **/coverage
COMMAND ${LCOV} -c -o ${covname} -d ${CMAKE_BINARY_DIR}/tests/CMakeFiles/tests.dir/ -b . --gcov-tool ${GCOV} COMMAND ${LCOV} -c -o ${covname} -d ${CMAKE_BINARY_DIR}/tests/CMakeFiles/tests.dir/ -b . --gcov-tool ${GCOV}
COMMAND ${LCOV} -r ${covname} -o ${covname} "*/tests/*" "*/_deps/**/*" "/usr/include/c++/**/*" "/usr/include/c++/11/**/*" COMMAND ${LCOV} -r ${covname} -o ${covname} "*/tests/*" "*/_deps/**/*" "/usr/include/c++/**/*" "/usr/include/c++/11/**/*"
COMMAND ${LCOV} -l ${covname} COMMAND ${LCOV} -l ${covname}
COMMAND ${GENHTML} ${covname} -output coverage COMMAND ${GENHTML} ${covname} -output coverage
COMMAND ${LCOV} -l ${covname} 2>/dev/null | grep Total | sed 's/|//g' | sed 's/Total://g' | awk '{print $1}' | sed s/%//g > coverage/total COMMAND ${LCOV} -l ${covname} 2>/dev/null | grep Total | sed 's/|//g' | sed 's/Total://g' | awk '{print $1}' | sed s/%//g > coverage/total
COMMAND rm -rf CMakeFiles/tests.dir/src/*.gcda CMakeFiles/tests.dir/src/*.gcno
COMMAND rm -f ${covname}
) )
set_directory_properties(PROPERTIES set_directory_properties(PROPERTIES
ADDITIONAL_CLEAN_FILES ${covname} ADDITIONAL_CLEAN_FILES ${covname}

@ -62,11 +62,14 @@ if(ENABLE_COVERAGE)
add_dependencies(coverage tests ${PROJECT_NAME}) add_dependencies(coverage tests ${PROJECT_NAME})
add_custom_command( add_custom_command(
OUTPUT ${covname} OUTPUT ${covname}
COMMAND rm -rf **/coverage
COMMAND ${LCOV} -c -o ${covname} -d ${CMAKE_BINARY_DIR}/tests/CMakeFiles/tests.dir/ -b . --gcov-tool ${GCOV} COMMAND ${LCOV} -c -o ${covname} -d ${CMAKE_BINARY_DIR}/tests/CMakeFiles/tests.dir/ -b . --gcov-tool ${GCOV}
COMMAND ${LCOV} -r ${covname} -o ${covname} "*/tests/*" "*/_deps/**/*" "/usr/include/c++/**/*" "/usr/include/c++/11/**/*" COMMAND ${LCOV} -r ${covname} -o ${covname} "*/tests/*" "*/_deps/**/*" "/usr/include/c++/**/*" "/usr/include/c++/11/**/*"
COMMAND ${LCOV} -l ${covname} COMMAND ${LCOV} -l ${covname}
COMMAND ${GENHTML} ${covname} -output coverage COMMAND ${GENHTML} ${covname} -output coverage
COMMAND ${LCOV} -l ${covname} 2>/dev/null | grep Total | sed 's/|//g' | sed 's/Total://g' | awk '{print $1}' | sed s/%//g > coverage/total COMMAND ${LCOV} -l ${covname} 2>/dev/null | grep Total | sed 's/|//g' | sed 's/Total://g' | awk '{print $1}' | sed s/%//g > coverage/total
COMMAND rm -rf CMakeFiles/tests.dir/src/*.gcda CMakeFiles/tests.dir/src/*.gcno
COMMAND rm -f ${covname}
) )
set_directory_properties(PROPERTIES set_directory_properties(PROPERTIES
ADDITIONAL_CLEAN_FILES ${covname} ADDITIONAL_CLEAN_FILES ${covname}