Davide Pesavento | 956ac31 | 2016-09-20 19:11:30 +0200 | [diff] [blame] | 1 | #!/usr/bin/env bash |
Davide Pesavento | d839882 | 2020-03-29 18:46:19 -0400 | [diff] [blame^] | 2 | set -ex |
Davide Pesavento | 956ac31 | 2016-09-20 19:11:30 +0200 | [diff] [blame] | 3 | |
Eric Newberry | 716ab60 | 2016-12-29 21:49:57 -0700 | [diff] [blame] | 4 | if [[ $JOB_NAME == *"code-coverage" ]]; then |
Davide Pesavento | 956ac31 | 2016-09-20 19:11:30 +0200 | [diff] [blame] | 5 | gcovr --object-directory=build \ |
| 6 | --output=build/coverage.xml \ |
Eric Newberry | 716ab60 | 2016-12-29 21:49:57 -0700 | [diff] [blame] | 7 | --exclude="$PWD/tests" \ |
Davide Pesavento | 956ac31 | 2016-09-20 19:11:30 +0200 | [diff] [blame] | 8 | --root=. \ |
| 9 | --xml |
Eric Newberry | 716ab60 | 2016-12-29 21:49:57 -0700 | [diff] [blame] | 10 | |
| 11 | # Generate also a detailed HTML output, but using lcov (better results) |
| 12 | lcov --quiet \ |
Davide Pesavento | 931dfe8 | 2017-04-29 20:33:45 -0400 | [diff] [blame] | 13 | --capture \ |
Eric Newberry | 716ab60 | 2016-12-29 21:49:57 -0700 | [diff] [blame] | 14 | --directory . \ |
Davide Pesavento | 931dfe8 | 2017-04-29 20:33:45 -0400 | [diff] [blame] | 15 | --no-external \ |
Eric Newberry | 716ab60 | 2016-12-29 21:49:57 -0700 | [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 | 931dfe8 | 2017-04-29 20:33:45 -0400 | [diff] [blame] | 24 | genhtml --branch-coverage \ |
| 25 | --demangle-cpp \ |
| 26 | --frames \ |
| 27 | --legend \ |
| 28 | --output-directory build/coverage \ |
| 29 | --title "ndn-tools unit tests" \ |
| 30 | build/coverage.info |
Davide Pesavento | 956ac31 | 2016-09-20 19:11:30 +0200 | [diff] [blame] | 31 | fi |