Davide Pesavento | 956ac31 | 2016-09-20 19:11:30 +0200 | [diff] [blame] | 1 | #!/usr/bin/env bash |
| 2 | set -e |
| 3 | |
| 4 | JDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) |
| 5 | source "$JDIR"/util.sh |
| 6 | |
| 7 | set -x |
| 8 | |
Eric Newberry | 716ab60 | 2016-12-29 21:49:57 -0700 | [diff] [blame^] | 9 | if [[ $JOB_NAME == *"code-coverage" ]]; then |
Davide Pesavento | 956ac31 | 2016-09-20 19:11:30 +0200 | [diff] [blame] | 10 | gcovr --object-directory=build \ |
| 11 | --output=build/coverage.xml \ |
Eric Newberry | 716ab60 | 2016-12-29 21:49:57 -0700 | [diff] [blame^] | 12 | --exclude="$PWD/tests" \ |
Davide Pesavento | 956ac31 | 2016-09-20 19:11:30 +0200 | [diff] [blame] | 13 | --root=. \ |
| 14 | --xml |
Eric Newberry | 716ab60 | 2016-12-29 21:49:57 -0700 | [diff] [blame^] | 15 | |
| 16 | # Generate also a detailed HTML output, but using lcov (better results) |
| 17 | lcov --quiet \ |
| 18 | --capture --no-external \ |
| 19 | --directory . \ |
| 20 | --rc lcov_branch_coverage=1 \ |
| 21 | --output-file build/coverage-with-tests.info |
| 22 | |
| 23 | lcov --quiet \ |
| 24 | --remove build/coverage-with-tests.info "$PWD/tests/*" \ |
| 25 | --rc lcov_branch_coverage=1 \ |
| 26 | --output-file build/coverage.info |
| 27 | |
| 28 | genhtml --legend \ |
| 29 | --rc genhtml_branch_coverage=1 \ |
| 30 | build/coverage.info \ |
| 31 | --output-directory build/coverage |
Davide Pesavento | 956ac31 | 2016-09-20 19:11:30 +0200 | [diff] [blame] | 32 | fi |