Skip to content

Commit

Permalink
[WIP] Checking line coverage in codecov (#1713)
Browse files Browse the repository at this point in the history
* Add parsers options

* Disable all branch detection option

* Replace lcov with gcov

* Revert changes in codecov.yaml and remove branch coverage from coverage bash script
  • Loading branch information
shivaang12 authored May 12, 2020
1 parent 536ed1f commit 433c6ac
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions tools/code_coverage_report.bash
Original file line number Diff line number Diff line change
Expand Up @@ -43,28 +43,28 @@ mkdir -p $LCOVDIR
lcov --capture --initial \
--directory build \
--output-file ${LCOVDIR}/initial_coverage.info \
--rc lcov_branch_coverage=1
--rc lcov_branch_coverage=0

# Capture executed code data.
lcov --capture \
--directory build \
--output-file ${LCOVDIR}/test_coverage.info \
--rc lcov_branch_coverage=1
--rc lcov_branch_coverage=0

# Combine the initial zero-coverage report with the executed lines report.
lcov \
--add-tracefile ${LCOVDIR}/initial_coverage.info \
--add-tracefile ${LCOVDIR}/test_coverage.info \
--output-file ${LCOVDIR}/full_coverage.info \
--rc lcov_branch_coverage=1
--rc lcov_branch_coverage=0

# Only include files that are within this workspace.
# (eg filter out stdio.h etc)
lcov \
--extract ${LCOVDIR}/full_coverage.info \
"${PWD}/*" \
--output-file ${LCOVDIR}/workspace_coverage.info \
--rc lcov_branch_coverage=1
--rc lcov_branch_coverage=0

# Remove files in the build subdirectory.
# Those are generated files (like messages, services, etc)
Expand All @@ -81,14 +81,13 @@ lcov \
--remove ${LCOVDIR}/workspace_coverage.info \
"${PWD}/*/nav2_system_tests/*" \
--output-file ${LCOVDIR}/project_coverage.info \
--rc lcov_branch_coverage=1
--rc lcov_branch_coverage=0

if [ $COVERAGE_REPORT_VIEW = codecovio ]; then
bash <(curl -s https://codecov.io/bash) \
-f ${LCOVDIR}/project_coverage.info \
-R src/navigation2
elif [ $COVERAGE_REPORT_VIEW = genhtml ]; then
genhtml ${LCOVDIR}/project_coverage.info \
--output-directory ${LCOVDIR}/html \
--branch-coverage -p ${PWD}
--output-directory ${LCOVDIR}/html
fi

0 comments on commit 433c6ac

Please sign in to comment.