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 |
Davide Pesavento | 09d5662 | 2021-08-23 17:44:25 -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 | 5b4b27f | 2022-04-19 16:31:03 -0400 | [diff] [blame] | 7 | gcovr --object-directory build \ |
Davide Pesavento | 09d5662 | 2021-08-23 17:44:25 -0400 | [diff] [blame] | 8 | --filter ndn-cxx/ \ |
| 9 | --exclude ndn-cxx/detail/nonstd/ \ |
| 10 | --exclude-throw-branches \ |
| 11 | --exclude-unreachable-branches \ |
Davide Pesavento | 5b4b27f | 2022-04-19 16:31:03 -0400 | [diff] [blame] | 12 | --cobertura build/coverage.xml \ |
Davide Pesavento | 09d5662 | 2021-08-23 17:44:25 -0400 | [diff] [blame] | 13 | --html-details build/gcovr/ \ |
Davide Pesavento | 5b4b27f | 2022-04-19 16:31:03 -0400 | [diff] [blame] | 14 | --print-summary |
Alexander Afanasyev | e19643d | 2017-01-15 23:56:32 -0800 | [diff] [blame] | 15 | |
Davide Pesavento | 09d5662 | 2021-08-23 17:44:25 -0400 | [diff] [blame] | 16 | # Generate a detailed HTML report using lcov |
Alexander Afanasyev | e19643d | 2017-01-15 23:56:32 -0800 | [diff] [blame] | 17 | lcov --quiet \ |
Davide Pesavento | c44cc83 | 2017-04-03 22:11:48 -0400 | [diff] [blame] | 18 | --capture \ |
Alexander Afanasyev | e19643d | 2017-01-15 23:56:32 -0800 | [diff] [blame] | 19 | --directory . \ |
Davide Pesavento | 09d5662 | 2021-08-23 17:44:25 -0400 | [diff] [blame] | 20 | --exclude "$PWD/ndn-cxx/detail/nonstd/*" \ |
| 21 | --exclude "$PWD/tests/*" \ |
Davide Pesavento | c44cc83 | 2017-04-03 22:11:48 -0400 | [diff] [blame] | 22 | --no-external \ |
Alexander Afanasyev | e19643d | 2017-01-15 23:56:32 -0800 | [diff] [blame] | 23 | --rc lcov_branch_coverage=1 \ |
Alexander Afanasyev | e19643d | 2017-01-15 23:56:32 -0800 | [diff] [blame] | 24 | --output-file build/coverage.info |
| 25 | |
Davide Pesavento | c44cc83 | 2017-04-03 22:11:48 -0400 | [diff] [blame] | 26 | genhtml --branch-coverage \ |
| 27 | --demangle-cpp \ |
Davide Pesavento | c44cc83 | 2017-04-03 22:11:48 -0400 | [diff] [blame] | 28 | --legend \ |
Davide Pesavento | 09d5662 | 2021-08-23 17:44:25 -0400 | [diff] [blame] | 29 | --output-directory build/lcov \ |
Davide Pesavento | c44cc83 | 2017-04-03 22:11:48 -0400 | [diff] [blame] | 30 | --title "ndn-cxx unit tests" \ |
| 31 | build/coverage.info |
Alexander Afanasyev | a87e0a8 | 2014-10-21 14:09:19 -0400 | [diff] [blame] | 32 | fi |