Sync build flags and CI scripts with ndn-cxx
Change-Id: I977af445cd989996d3938d4a3edad0175cc6038a
diff --git a/.jenkins.d/00-deps.sh b/.jenkins.d/00-deps.sh
index d4d9c33..0b589d5 100755
--- a/.jenkins.d/00-deps.sh
+++ b/.jenkins.d/00-deps.sh
@@ -3,13 +3,13 @@
if has OSX $NODE_LABELS; then
FORMULAE=(boost openssl pkg-config)
- if has OSX-10.13 $NODE_LABELS || has OSX-10.14 $NODE_LABELS; then
- FORMULAE+=(python)
+ if [[ $JOB_NAME == *"Docs" ]]; then
+ FORMULAE+=(doxygen graphviz)
fi
- if [[ -n $TRAVIS ]]; then
- # Travis images come with a large number of pre-installed
- # brew packages, don't waste time upgrading all of them
+ if [[ -n $GITHUB_ACTIONS ]]; then
+ # GitHub Actions runners have a large number of pre-installed
+ # Homebrew packages. Don't waste time upgrading all of them.
brew list --versions "${FORMULAE[@]}" || brew update
for FORMULA in "${FORMULAE[@]}"; do
brew list --versions "$FORMULA" || brew install "$FORMULA"
@@ -25,10 +25,16 @@
elif has Ubuntu $NODE_LABELS; then
sudo apt-get -qq update
- sudo apt-get -qy install g++ pkg-config python3-minimal \
+ sudo apt-get -qy install build-essential pkg-config python3-minimal \
libboost-all-dev libssl-dev libsqlite3-dev
- if [[ $JOB_NAME == *"code-coverage" ]]; then
- sudo apt-get -qy install gcovr lcov
- fi
+ case $JOB_NAME in
+ *code-coverage)
+ sudo apt-get -qy install lcov python3-pip
+ pip3 install --user --upgrade --upgrade-strategy=eager 'gcovr~=5.0'
+ ;;
+ *Docs)
+ sudo apt-get -qy install doxygen graphviz
+ ;;
+ esac
fi
diff --git a/.jenkins.d/01-ndn-cxx.sh b/.jenkins.d/01-ndn-cxx.sh
index 7bf1cfe..4e0e154 100755
--- a/.jenkins.d/01-ndn-cxx.sh
+++ b/.jenkins.d/01-ndn-cxx.sh
@@ -35,16 +35,12 @@
pushd ndn-cxx >/dev/null
-if has Linux $NODE_LABELS && [[ $CXX != clang* && -z $DISABLE_ASAN ]]; then
- # https://stackoverflow.com/a/47022141
- ASAN="--with-sanitizer=address"
-fi
if has CentOS-8 $NODE_LABELS; then
# https://bugzilla.redhat.com/show_bug.cgi?id=1721553
PCH="--without-pch"
fi
-./waf --color=yes configure --disable-static --enable-shared --without-osx-keychain $ASAN $PCH
+./waf --color=yes configure --disable-static --enable-shared --without-osx-keychain $PCH
./waf --color=yes build -j$WAF_JOBS
sudo_preserve_env PATH -- ./waf --color=yes install
diff --git a/.jenkins.d/09-cleanup.sh b/.jenkins.d/09-cleanup.sh
new file mode 100755
index 0000000..26254a5
--- /dev/null
+++ b/.jenkins.d/09-cleanup.sh
@@ -0,0 +1,9 @@
+#!/usr/bin/env bash
+set -ex
+
+PROJ=ndncert
+
+sudo rm -f /usr/local/bin/"$PROJ"*
+sudo rm -fr /usr/local/include/"$PROJ"
+sudo rm -f /usr/local/lib{,64}/lib"$PROJ"*
+sudo rm -f /usr/local/lib{,64}/pkgconfig/{,lib}"$PROJ".pc
diff --git a/.jenkins.d/20-tests.sh b/.jenkins.d/20-tests.sh
index 226c77d..455c8f7 100755
--- a/.jenkins.d/20-tests.sh
+++ b/.jenkins.d/20-tests.sh
@@ -3,21 +3,7 @@
# Prepare environment
rm -rf ~/.ndn
-
-BOOST_VERSION=$(python3 -c "import sys; sys.path.append('build/c4che'); import _cache; print(_cache.BOOST_VERSION_NUMBER);")
-
-ut_log_args() {
- if (( BOOST_VERSION >= 106200 )); then
- echo --logger=HRF,test_suite,stdout:XML,all,build/xunit-${1:-report}.xml
- else
- if [[ -n $XUNIT ]]; then
- echo --log_level=all $( (( BOOST_VERSION >= 106000 )) && echo -- ) \
- --log_format2=XML --log_sink2=build/xunit-${1:-report}.xml
- else
- echo --log_level=test_suite
- fi
- fi
-}
+ndnsec key-gen "/tmp/jenkins/$NODE_NAME" | ndnsec cert-install -
# https://github.com/google/sanitizers/wiki/AddressSanitizerFlags
ASAN_OPTIONS="color=always"
@@ -31,6 +17,8 @@
export BOOST_TEST_BUILD_INFO=1
export BOOST_TEST_COLOR_OUTPUT=1
+export BOOST_TEST_DETECT_MEMORY_LEAK=0
+export BOOST_TEST_LOGGER=HRF,test_suite,stdout:XML,all,build/xunit-log.xml
# Run unit tests
-./build/unit-tests $(ut_log_args)
+./build/unit-tests
diff --git a/.jenkins.d/30-coverage.sh b/.jenkins.d/30-coverage.sh
index 4cce87d..a38ed0b 100755
--- a/.jenkins.d/30-coverage.sh
+++ b/.jenkins.d/30-coverage.sh
@@ -2,29 +2,30 @@
set -ex
if [[ $JOB_NAME == *"code-coverage" ]]; then
- gcovr --object-directory=build \
- --output=build/coverage.xml \
- --exclude="$PWD/tests" \
- --root=. \
- --xml
+ # Generate an XML report (Cobertura format) and a detailed HTML report using gcovr
+ # Note: trailing slashes are important in the paths below. Do not remove them!
+ gcovr -j$WAF_JOBS \
+ --object-directory build \
+ --filter src/ \
+ --exclude-throw-branches \
+ --exclude-unreachable-branches \
+ --print-summary \
+ --html-details build/gcovr/ \
+ --xml build/coverage.xml
- # Generate also a detailed HTML output, but using lcov (better results)
+ # Generate a detailed HTML report using lcov
lcov --quiet \
--capture \
--directory . \
+ --exclude "$PWD/tests/*" \
--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 \
--legend \
- --output-directory build/coverage \
+ --output-directory build/lcov \
--title "ndncert unit tests" \
build/coverage.info
fi