-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding code coverage report to build (#553)
* Script to generate coverage report. Should be run after test. * Add helper script for test suite * Modified travis to use runtestsuite.bash script * Add coverage to .travis.yml file. * Add coverage badge to main page * Run the code coverage report in the docker container. * Add lcov dependency. * Trying to add lcov tool to build. * Add coverage args to build script. * Fixing passing code coverage args. * Fixing setting env variable. * Fixing docker file coverage_enabled flag. * Fixing coverage report script. * Pass ci env through to docker * Fixing the filter rules for this workspace. * Removing unneeded dependency install line. * Add comments explaining what lcov lines do. * Rebasing on top of circle CI and common Cmake functions changes. * Fixing test suite script name. * Add codecov to CircleCI jobs * Add conditional to skip codecov if enable is false * Remove unnecessary export for codecov * Update workflow for paralel release and debug jobs * Forgot to append coverage step to job * Comment out travis codecove
- Loading branch information
Carl Delsey
authored
Feb 13, 2019
1 parent
0deebc1
commit 357e303
Showing
8 changed files
with
140 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#!/bin/bash | ||
|
||
if [ ! -d build ]; then | ||
echo "Please run this script from the root of your workspace." | ||
echo "Expected directory hierarchy is:" | ||
echo "example_ws" | ||
echo " - build" | ||
echo " - - package_a" | ||
echo " - - package_b" | ||
exit 1 | ||
fi | ||
|
||
set -e | ||
|
||
LCOVDIR=lcov | ||
PWD=`pwd` | ||
|
||
COVERAGE_REPORT=genhtml | ||
|
||
for opt in "$@" ; do | ||
case "$opt" in | ||
clean) | ||
rm -rf install build log $LCOVDIR | ||
exit 0 | ||
;; | ||
codecovio) | ||
COVERAGE_REPORT=codecovio | ||
;; | ||
esac | ||
done | ||
|
||
mkdir -p $LCOVDIR | ||
|
||
# Generate initial zero-coverage data. This adds files that were otherwise not run to the report | ||
lcov -c --initial --rc lcov_branch_coverage=1 --directory build --output-file ${LCOVDIR}/initialcoverage.info | ||
|
||
# Capture executed code data. | ||
lcov -c --rc lcov_branch_coverage=1 --directory build --output-file ${LCOVDIR}/testcoverage.info | ||
|
||
# Combine the initial zero-coverage report with the executed lines report | ||
lcov -a ${LCOVDIR}/initialcoverage.info -a ${LCOVDIR}/testcoverage.info --rc lcov_branch_coverage=1 --o ${LCOVDIR}/fullcoverage.info | ||
|
||
# Only include files that are within this workspace (eg filter out stdio.h etc) | ||
lcov -e ${LCOVDIR}/fullcoverage.info "${PWD}/*" --rc lcov_branch_coverage=1 --output-file ${LCOVDIR}/workspacecoverage.info | ||
|
||
# Remove files in the build subdirectory because they are generated files (like messages, services, etc) | ||
lcov -r ${LCOVDIR}/workspacecoverage.info "${PWD}/build/*" --rc lcov_branch_coverage=1 --output-file ${LCOVDIR}/projectcoverage.info | ||
|
||
if [ $COVERAGE_REPORT = codecovio ]; then | ||
bash <(curl -s https://codecov.io/bash) -f ${LCOVDIR}/projectcoverage.info | ||
else | ||
genhtml ${LCOVDIR}/projectcoverage.info --output-directory ${LCOVDIR}/html --branch-coverage -p ${PWD} | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/bash | ||
|
||
set -ex | ||
|
||
colcon test --packages-skip nav2_system_tests | ||
colcon test-result --verbose | ||
cp src/navigation2/tools/ctest_retry.bash build/nav2_system_tests | ||
cd build/nav2_system_tests | ||
./ctest_retry.bash 3 |