Alexander Afanasyev | 4d4e725 | 2014-10-25 12:21:53 -0700 | [diff] [blame] | 1 | #!/usr/bin/env bash |
Davide Pesavento | 69857c3 | 2020-04-05 16:36:26 -0400 | [diff] [blame] | 2 | set -ex |
Davide Pesavento | e0edc4c | 2016-09-13 18:29:52 +0000 | [diff] [blame] | 3 | |
Davide Pesavento | 231ddd7 | 2016-09-02 22:20:00 +0000 | [diff] [blame] | 4 | if [[ $JOB_NAME == *"code-coverage" ]]; then |
Davide Pesavento | 0a5e5e2 | 2016-09-13 18:29:33 +0000 | [diff] [blame] | 5 | gcovr --object-directory=build \ |
| 6 | --output=build/coverage.xml \ |
Alexander Afanasyev | 465056e | 2016-12-29 16:43:01 -0800 | [diff] [blame] | 7 | --exclude="$PWD/(tests|websocketpp)" \ |
Davide Pesavento | 231ddd7 | 2016-09-02 22:20:00 +0000 | [diff] [blame] | 8 | --root=. \ |
Davide Pesavento | 0a5e5e2 | 2016-09-13 18:29:33 +0000 | [diff] [blame] | 9 | --xml |
Davide Pesavento | 8d61c03 | 2017-04-29 20:06:33 -0400 | [diff] [blame] | 10 | |
| 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 \ |
Davide Pesavento | 221f53b | 2017-06-04 17:17:31 -0400 | [diff] [blame] | 17 | --output-file build/coverage-with-tests-and-websocketpp.info |
| 18 | |
| 19 | lcov --quiet \ |
| 20 | --remove build/coverage-with-tests-and-websocketpp.info "$PWD/websocketpp/*" \ |
| 21 | --rc lcov_branch_coverage=1 \ |
Davide Pesavento | 8d61c03 | 2017-04-29 20:06:33 -0400 | [diff] [blame] | 22 | --output-file build/coverage-with-tests.info |
| 23 | |
| 24 | lcov --quiet \ |
| 25 | --remove build/coverage-with-tests.info "$PWD/tests/*" \ |
| 26 | --rc lcov_branch_coverage=1 \ |
| 27 | --output-file build/coverage.info |
| 28 | |
| 29 | genhtml --branch-coverage \ |
| 30 | --demangle-cpp \ |
Davide Pesavento | 8d61c03 | 2017-04-29 20:06:33 -0400 | [diff] [blame] | 31 | --legend \ |
| 32 | --output-directory build/coverage \ |
| 33 | --title "NFD unit tests" \ |
| 34 | build/coverage.info |
Alexander Afanasyev | 4d4e725 | 2014-10-25 12:21:53 -0700 | [diff] [blame] | 35 | fi |