Zhiyi Zhang | 8617a79 | 2017-01-17 16:45:56 -0800 | [diff] [blame] | 1 | #!/usr/bin/env bash |
Davide Pesavento | 552174c | 2020-04-16 01:54:08 -0400 | [diff] [blame] | 2 | set -ex |
Zhiyi Zhang | 8617a79 | 2017-01-17 16:45:56 -0800 | [diff] [blame] | 3 | |
| 4 | if [[ $JOB_NAME == *"code-coverage" ]]; then |
| 5 | gcovr --object-directory=build \ |
| 6 | --output=build/coverage.xml \ |
Davide Pesavento | cf9ffe4 | 2018-01-21 22:21:53 -0500 | [diff] [blame] | 7 | --exclude="$PWD/tests" \ |
Zhiyi Zhang | 8617a79 | 2017-01-17 16:45:56 -0800 | [diff] [blame] | 8 | --root=. \ |
| 9 | --xml |
| 10 | |
Davide Pesavento | cf9ffe4 | 2018-01-21 22:21:53 -0500 | [diff] [blame] | 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 \ |
| 26 | --frames \ |
| 27 | --legend \ |
| 28 | --output-directory build/coverage \ |
| 29 | --title "ndncert unit tests" \ |
| 30 | build/coverage.info |
Zhiyi Zhang | 8617a79 | 2017-01-17 16:45:56 -0800 | [diff] [blame] | 31 | fi |