Davide Pesavento | 956ac31 | 2016-09-20 19:11:30 +0200 | [diff] [blame] | 1 | #!/usr/bin/env bash |
Davide Pesavento | bd3642f | 2022-08-12 18:19:31 -0400 | [diff] [blame] | 2 | set -exo pipefail |
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 | 8c35390 | 2021-08-30 19:10:36 -0400 | [diff] [blame] | 5 | # Generate an XML report (Cobertura format) and a detailed HTML report using gcovr |
| 6 | # Note: trailing slashes are important in the paths below. Do not remove them! |
Davide Pesavento | 824c45b | 2022-04-03 18:30:41 -0400 | [diff] [blame] | 7 | gcovr --object-directory build \ |
Davide Pesavento | 8c35390 | 2021-08-30 19:10:36 -0400 | [diff] [blame] | 8 | --filter tools/ \ |
| 9 | --exclude-throw-branches \ |
| 10 | --exclude-unreachable-branches \ |
Davide Pesavento | 824c45b | 2022-04-03 18:30:41 -0400 | [diff] [blame] | 11 | --cobertura build/coverage.xml \ |
Davide Pesavento | 8c35390 | 2021-08-30 19:10:36 -0400 | [diff] [blame] | 12 | --html-details build/gcovr/ \ |
Davide Pesavento | 824c45b | 2022-04-03 18:30:41 -0400 | [diff] [blame] | 13 | --print-summary |
Eric Newberry | 716ab60 | 2016-12-29 21:49:57 -0700 | [diff] [blame] | 14 | |
Davide Pesavento | 8c35390 | 2021-08-30 19:10:36 -0400 | [diff] [blame] | 15 | # Generate a detailed HTML report using lcov |
Eric Newberry | 716ab60 | 2016-12-29 21:49:57 -0700 | [diff] [blame] | 16 | lcov --quiet \ |
Davide Pesavento | 931dfe8 | 2017-04-29 20:33:45 -0400 | [diff] [blame] | 17 | --capture \ |
Eric Newberry | 716ab60 | 2016-12-29 21:49:57 -0700 | [diff] [blame] | 18 | --directory . \ |
Davide Pesavento | 8c35390 | 2021-08-30 19:10:36 -0400 | [diff] [blame] | 19 | --exclude "$PWD/tests/*" \ |
Davide Pesavento | 931dfe8 | 2017-04-29 20:33:45 -0400 | [diff] [blame] | 20 | --no-external \ |
Eric Newberry | 716ab60 | 2016-12-29 21:49:57 -0700 | [diff] [blame] | 21 | --rc lcov_branch_coverage=1 \ |
Eric Newberry | 716ab60 | 2016-12-29 21:49:57 -0700 | [diff] [blame] | 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 \ |
Davide Pesavento | 931dfe8 | 2017-04-29 20:33:45 -0400 | [diff] [blame] | 26 | --legend \ |
Davide Pesavento | 8c35390 | 2021-08-30 19:10:36 -0400 | [diff] [blame] | 27 | --output-directory build/lcov \ |
Davide Pesavento | 931dfe8 | 2017-04-29 20:33:45 -0400 | [diff] [blame] | 28 | --title "ndn-tools unit tests" \ |
| 29 | build/coverage.info |
Davide Pesavento | 956ac31 | 2016-09-20 19:11:30 +0200 | [diff] [blame] | 30 | fi |