Davide Pesavento | 4a315b3 | 2018-11-24 14:32:19 -0500 | [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 | |
| 9 | if [[ $JOB_NAME == *"code-coverage" ]]; then |
| 10 | gcovr --object-directory=build \ |
| 11 | --output=build/coverage.xml \ |
| 12 | --exclude="$PWD/tests" \ |
| 13 | --root=. \ |
| 14 | --xml |
| 15 | |
| 16 | # Generate also a detailed HTML output, but using lcov (better results) |
| 17 | lcov --quiet \ |
| 18 | --capture \ |
| 19 | --directory . \ |
| 20 | --no-external \ |
| 21 | --rc lcov_branch_coverage=1 \ |
| 22 | --output-file build/coverage-with-tests.info |
| 23 | |
| 24 | lcov --quiet \ |
| 25 | --remove build/coverage-with-tests.info "$PWD/tests/*" \ |
| 26 | --rc lcov_branch_coverage=1 \ |
| 27 | --output-file build/coverage.info |
| 28 | |
| 29 | genhtml --branch-coverage \ |
| 30 | --demangle-cpp \ |
| 31 | --frames \ |
| 32 | --legend \ |
| 33 | --output-directory build/coverage \ |
| 34 | --title "NDNS unit tests" \ |
| 35 | build/coverage.info |
| 36 | fi |