From 8a4b3174b83d63bf4910dba6dd4bfb6c9d9b9080 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20=C5=A0tefka?= Date: Mon, 11 Dec 2023 04:29:02 +0100 Subject: [PATCH] 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 --- 01/tests/CMakeLists.txt | 3 +++ C_Tempate/tests/CMakeLists.txt | 3 +++ 2 files changed, 6 insertions(+) diff --git a/01/tests/CMakeLists.txt b/01/tests/CMakeLists.txt index f2a2124..7437db3 100644 --- a/01/tests/CMakeLists.txt +++ b/01/tests/CMakeLists.txt @@ -62,11 +62,14 @@ if(ENABLE_COVERAGE) add_dependencies(coverage tests ${PROJECT_NAME}) add_custom_command( 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} -r ${covname} -o ${covname} "*/tests/*" "*/_deps/**/*" "/usr/include/c++/**/*" "/usr/include/c++/11/**/*" COMMAND ${LCOV} -l ${covname} 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 rm -rf CMakeFiles/tests.dir/src/*.gcda CMakeFiles/tests.dir/src/*.gcno + COMMAND rm -f ${covname} ) set_directory_properties(PROPERTIES ADDITIONAL_CLEAN_FILES ${covname} diff --git a/C_Tempate/tests/CMakeLists.txt b/C_Tempate/tests/CMakeLists.txt index f2a2124..7437db3 100644 --- a/C_Tempate/tests/CMakeLists.txt +++ b/C_Tempate/tests/CMakeLists.txt @@ -62,11 +62,14 @@ if(ENABLE_COVERAGE) add_dependencies(coverage tests ${PROJECT_NAME}) add_custom_command( 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} -r ${covname} -o ${covname} "*/tests/*" "*/_deps/**/*" "/usr/include/c++/**/*" "/usr/include/c++/11/**/*" COMMAND ${LCOV} -l ${covname} 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 rm -rf CMakeFiles/tests.dir/src/*.gcda CMakeFiles/tests.dir/src/*.gcno + COMMAND rm -f ${covname} ) set_directory_properties(PROPERTIES ADDITIONAL_CLEAN_FILES ${covname}