ci: add generation of HTML coverage report using lcov
Copied from ndn-cxx
Change-Id: Ie8c08a570afe67c9eb232b37ad0038566ad49572
diff --git a/.jenkins.d/00-deps.sh b/.jenkins.d/00-deps.sh
index 4a4db28..6146177 100755
--- a/.jenkins.d/00-deps.sh
+++ b/.jenkins.d/00-deps.sh
@@ -18,4 +18,9 @@
sudo apt-get -qq install build-essential pkg-config libboost-all-dev \
libcrypto++-dev libsqlite3-dev libssl-dev \
libpcap-dev
+
+ if [[ $JOB_NAME == *"code-coverage" ]]; then
+ sudo apt-get -qq install lcov libgd-perl python-setuptools
+ sudo easy_install --upgrade gcovr
+ fi
fi
diff --git a/.jenkins.d/30-coverage.sh b/.jenkins.d/30-coverage.sh
index b00354c..0a83447 100755
--- a/.jenkins.d/30-coverage.sh
+++ b/.jenkins.d/30-coverage.sh
@@ -12,4 +12,25 @@
--exclude="$PWD/(tests|websocketpp)" \
--root=. \
--xml
+
+ # Generate also a detailed HTML output, but using lcov (better results)
+ lcov --quiet \
+ --capture \
+ --directory . \
+ --no-external \
+ --rc lcov_branch_coverage=1 \
+ --output-file build/coverage-with-tests.info
+
+ lcov --quiet \
+ --remove build/coverage-with-tests.info "$PWD/tests/*" \
+ --rc lcov_branch_coverage=1 \
+ --output-file build/coverage.info
+
+ genhtml --branch-coverage \
+ --demangle-cpp \
+ --frames \
+ --legend \
+ --output-directory build/coverage \
+ --title "NFD unit tests" \
+ build/coverage.info
fi