Davide Pesavento | 8f9d062 | 2018-11-27 01:23:37 -0500 | [diff] [blame] | 1 | #!/usr/bin/env bash |
Davide Pesavento | ec61b74 | 2020-04-18 01:00:12 -0400 | [diff] [blame] | 2 | set -ex |
Davide Pesavento | 8f9d062 | 2018-11-27 01:23:37 -0500 | [diff] [blame] | 3 | |
| 4 | if [[ $JOB_NAME == *"code-coverage" ]]; then |
| 5 | gcovr --object-directory=build \ |
| 6 | --output=build/coverage.xml \ |
| 7 | --exclude="$PWD/tests" \ |
| 8 | --root=. \ |
| 9 | --xml |
| 10 | |
| 11 | # Generate also a detailed HTML output, but using lcov (better results) |
| 12 | lcov --quiet \ |
| 13 | --capture \ |
| 14 | --directory . \ |
| 15 | --no-external \ |
| 16 | --rc lcov_branch_coverage=1 \ |
| 17 | --output-file build/coverage-with-tests.info |
| 18 | |
| 19 | lcov --quiet \ |
| 20 | --remove build/coverage-with-tests.info "$PWD/tests/*" \ |
| 21 | --rc lcov_branch_coverage=1 \ |
| 22 | --output-file build/coverage.info |
| 23 | |
| 24 | genhtml --branch-coverage \ |
| 25 | --demangle-cpp \ |
Davide Pesavento | 8f9d062 | 2018-11-27 01:23:37 -0500 | [diff] [blame] | 26 | --legend \ |
| 27 | --output-directory build/coverage \ |
Davide Pesavento | ec61b74 | 2020-04-18 01:00:12 -0400 | [diff] [blame] | 28 | --title "ndn-nac unit tests" \ |
Davide Pesavento | 8f9d062 | 2018-11-27 01:23:37 -0500 | [diff] [blame] | 29 | build/coverage.info |
| 30 | fi |