Alexander Afanasyev | a87e0a8 | 2014-10-21 14:09:19 -0400 | [diff] [blame] | 1 | #!/usr/bin/env bash |
Alexander Afanasyev | 33ce4c3 | 2014-10-24 11:19:45 -0700 | [diff] [blame] | 2 | set -e |
Alexander Afanasyev | a87e0a8 | 2014-10-21 14:09:19 -0400 | [diff] [blame] | 3 | |
Alexander Afanasyev | b346ddb | 2015-06-03 00:52:03 -0400 | [diff] [blame] | 4 | JDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) |
| 5 | source "$JDIR"/util.sh |
Alexander Afanasyev | a87e0a8 | 2014-10-21 14:09:19 -0400 | [diff] [blame] | 6 | |
Davide Pesavento | 0934888 | 2016-09-17 02:39:44 +0200 | [diff] [blame] | 7 | set -x |
| 8 | |
| 9 | if [[ $JOB_NAME == *"code-coverage" ]]; then |
| 10 | gcovr --object-directory=build \ |
| 11 | --output=build/coverage.xml \ |
| 12 | --filter="$PWD/src" \ |
| 13 | --root=. \ |
| 14 | --xml |
Alexander Afanasyev | e19643d | 2017-01-15 23:56:32 -0800 | [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 |
Alexander Afanasyev | a87e0a8 | 2014-10-21 14:09:19 -0400 | [diff] [blame] | 32 | fi |