Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add code coverage ignore file #279

Merged
merged 8 commits into from
Jul 25, 2022
Merged
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions cmake/IgnCodeCoverage.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,15 @@ FUNCTION(ign_setup_target_for_coverage)
MESSAGE(FATAL_ERROR "genhtml not found! Aborting...")
ENDIF() # NOT GENHTML_PATH

# Read ignore file list
if (EXISTS "${PROJECT_BINARY_DIR}/coverage.ignore")
AzulRadio marked this conversation as resolved.
Show resolved Hide resolved
file (STRINGS "${PROJECT_BINARY_DIR}/coverage.ignore" IGNORE_LIST_RAW)
string(REGEX REPLACE "([^;]+)" "'${PROJECT_SOURCE_DIR}/\\1'" IGNORE_LIST "${IGNORE_LIST_RAW}")
message(STATUS "Ignore coverage additions: " ${IGNORE_LIST})
else()
set(IGNORE_LIST "")
endif()

# Setup target
ADD_CUSTOM_TARGET(${_targetname}

Expand All @@ -132,8 +141,8 @@ FUNCTION(ign_setup_target_for_coverage)
# Remove negative counts
COMMAND sed -i '/,-/d' ${_outputname}.info
COMMAND ${LCOV_PATH} ${_branch_flags} -q
--remove ${_outputname}.info '*/test/*' '/usr/*' '*_TEST*' '*.cxx' 'moc_*.cpp' 'qrc_*.cpp' '*.pb.*' --output-file ${_outputname}.info.cleaned
COMMAND ${GENHTML_PATH} ${_branch_flags} -q
--remove ${_outputname}.info '*/test/*' '/usr/*' '*_TEST*' '*.cxx' 'moc_*.cpp' 'qrc_*.cpp' '*.pb.*' '*/build/*' '*/install/*' ${IGNORE_LIST} --output-file ${_outputname}.info.cleaned
COMMAND ${GENHTML_PATH} ${_branch_flags} -q --prefix ${PROJECT_SOURCE_DIR}
--legend -o ${_outputname} ${_outputname}.info.cleaned
COMMAND ${LCOV_PATH} --summary ${_outputname}.info.cleaned 2>&1 | grep "lines" | cut -d ' ' -f 4 | cut -d '%' -f 1 > ${_outputname}/lines.txt
COMMAND ${LCOV_PATH} --summary ${_outputname}.info.cleaned 2>&1 | grep "functions" | cut -d ' ' -f 4 | cut -d '%' -f 1 > ${_outputname}/functions.txt
Expand Down