blob: 380366e09b538899b79d9666b38ae23b946b0c61 [file] [log] [blame]
Alexander Afanasyev4d4e7252014-10-25 12:21:53 -07001#!/usr/bin/env bash
Davide Pesavento69857c32020-04-05 16:36:26 -04002set -ex
Davide Pesaventoe0edc4c2016-09-13 18:29:52 +00003
Davide Pesavento231ddd72016-09-02 22:20:00 +00004if [[ $JOB_NAME == *"code-coverage" ]]; then
Davide Pesavento0a5e5e22016-09-13 18:29:33 +00005 gcovr --object-directory=build \
6 --output=build/coverage.xml \
Alexander Afanasyev465056e2016-12-29 16:43:01 -08007 --exclude="$PWD/(tests|websocketpp)" \
Davide Pesavento231ddd72016-09-02 22:20:00 +00008 --root=. \
Davide Pesavento0a5e5e22016-09-13 18:29:33 +00009 --xml
Davide Pesavento8d61c032017-04-29 20:06:33 -040010
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 Pesavento221f53b2017-06-04 17:17:31 -040017 --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 Pesavento8d61c032017-04-29 20:06:33 -040022 --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 \
31 --frames \
32 --legend \
33 --output-directory build/coverage \
34 --title "NFD unit tests" \
35 build/coverage.info
Alexander Afanasyev4d4e7252014-10-25 12:21:53 -070036fi