Alexander Afanasyev | a87e0a8 | 2014-10-21 14:09:19 -0400 | [diff] [blame] | 1 | #!/usr/bin/env bash |
Davide Pesavento | 2349e28 | 2020-03-24 14:28:03 -0400 | [diff] [blame] | 2 | set -ex |
Davide Pesavento | 0934888 | 2016-09-17 02:39:44 +0200 | [diff] [blame] | 3 | |
| 4 | if [[ $JOB_NAME == *"code-coverage" ]]; then |
| 5 | gcovr --object-directory=build \ |
| 6 | --output=build/coverage.xml \ |
Davide Pesavento | cf8a368 | 2018-11-24 19:52:21 -0500 | [diff] [blame] | 7 | --exclude="$PWD/(examples|tests)" \ |
Davide Pesavento | 0934888 | 2016-09-17 02:39:44 +0200 | [diff] [blame] | 8 | --root=. \ |
| 9 | --xml |
Alexander Afanasyev | e19643d | 2017-01-15 23:56:32 -0800 | [diff] [blame] | 10 | |
| 11 | # Generate also a detailed HTML output, but using lcov (better results) |
| 12 | lcov --quiet \ |
Davide Pesavento | c44cc83 | 2017-04-03 22:11:48 -0400 | [diff] [blame] | 13 | --capture \ |
Alexander Afanasyev | e19643d | 2017-01-15 23:56:32 -0800 | [diff] [blame] | 14 | --directory . \ |
Davide Pesavento | c44cc83 | 2017-04-03 22:11:48 -0400 | [diff] [blame] | 15 | --no-external \ |
Alexander Afanasyev | e19643d | 2017-01-15 23:56:32 -0800 | [diff] [blame] | 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 | |
Davide Pesavento | c44cc83 | 2017-04-03 22:11:48 -0400 | [diff] [blame] | 24 | genhtml --branch-coverage \ |
| 25 | --demangle-cpp \ |
| 26 | --frames \ |
| 27 | --legend \ |
| 28 | --output-directory build/coverage \ |
| 29 | --title "ndn-cxx unit tests" \ |
| 30 | build/coverage.info |
Alexander Afanasyev | a87e0a8 | 2014-10-21 14:09:19 -0400 | [diff] [blame] | 31 | fi |