Alexander Afanasyev | a87e0a8 | 2014-10-21 14:09:19 -0400 | [diff] [blame] | 1 | #!/usr/bin/env bash |
Alexander Afanasyev | 33ce4c3 | 2014-10-24 11:19:45 -0700 | [diff] [blame] | 2 | set -e |
Alexander Afanasyev | a87e0a8 | 2014-10-21 14:09:19 -0400 | [diff] [blame] | 3 | |
Alexander Afanasyev | b346ddb | 2015-06-03 00:52:03 -0400 | [diff] [blame] | 4 | JDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) |
| 5 | source "$JDIR"/util.sh |
Alexander Afanasyev | a87e0a8 | 2014-10-21 14:09:19 -0400 | [diff] [blame] | 6 | |
Davide Pesavento | 0934888 | 2016-09-17 02:39:44 +0200 | [diff] [blame] | 7 | set -x |
| 8 | |
| 9 | if [[ $JOB_NAME == *"code-coverage" ]]; then |
| 10 | gcovr --object-directory=build \ |
| 11 | --output=build/coverage.xml \ |
| 12 | --filter="$PWD/src" \ |
| 13 | --root=. \ |
| 14 | --xml |
Alexander Afanasyev | e19643d | 2017-01-15 23:56:32 -0800 | [diff] [blame] | 15 | |
| 16 | # Generate also a detailed HTML output, but using lcov (better results) |
| 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 | c44cc83 | 2017-04-03 22:11:48 -0400 | [diff] [blame] | 20 | --no-external \ |
Alexander Afanasyev | e19643d | 2017-01-15 23:56:32 -0800 | [diff] [blame] | 21 | --rc lcov_branch_coverage=1 \ |
| 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 | |
Davide Pesavento | c44cc83 | 2017-04-03 22:11:48 -0400 | [diff] [blame] | 29 | genhtml --branch-coverage \ |
| 30 | --demangle-cpp \ |
| 31 | --frames \ |
| 32 | --legend \ |
| 33 | --output-directory build/coverage \ |
| 34 | --title "ndn-cxx unit tests" \ |
| 35 | build/coverage.info |
Alexander Afanasyev | a87e0a8 | 2014-10-21 14:09:19 -0400 | [diff] [blame] | 36 | fi |