Update build flags, Jenkins scripts, and Travis configuration
Change-Id: I738e9a9cd21be6c94e1ae3f646c959cdb89ab6f0
diff --git a/.jenkins.d/00-deps.sh b/.jenkins.d/00-deps.sh
index 66dafb4..84c8ae1 100755
--- a/.jenkins.d/00-deps.sh
+++ b/.jenkins.d/00-deps.sh
@@ -28,7 +28,6 @@
libsqlite3-dev libssl-dev
if [[ $JOB_NAME == *"code-coverage" ]]; then
- sudo apt-get -qy install lcov libgd-perl python-setuptools
- sudo easy_install --upgrade gcovr
+ sudo apt-get -qy install gcovr lcov libgd-perl
fi
fi
diff --git a/.jenkins.d/10-ndn-cxx.sh b/.jenkins.d/01-ndn-cxx.sh
similarity index 96%
rename from .jenkins.d/10-ndn-cxx.sh
rename to .jenkins.d/01-ndn-cxx.sh
index c9e2a63..29a41ea 100755
--- a/.jenkins.d/10-ndn-cxx.sh
+++ b/.jenkins.d/01-ndn-cxx.sh
@@ -44,7 +44,7 @@
./waf configure --color=yes --enable-shared --disable-static --without-osx-keychain
./waf build --color=yes -j${WAF_JOBS:-1}
-sudo env "PATH=$PATH" ./waf install --color=yes
+sudo_preserve_env PATH -- ./waf install --color=yes
popd >/dev/null
popd >/dev/null
diff --git a/.jenkins.d/10-build.sh b/.jenkins.d/10-build.sh
new file mode 100755
index 0000000..8907de1
--- /dev/null
+++ b/.jenkins.d/10-build.sh
@@ -0,0 +1,47 @@
+#!/usr/bin/env bash
+set -e
+
+JDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
+source "$JDIR"/util.sh
+
+set -x
+
+if [[ $JOB_NAME == *"code-coverage" ]]; then
+ COVERAGE="--with-coverage"
+elif [[ -z $DISABLE_ASAN ]]; then
+ ASAN="--with-sanitizer=address"
+fi
+
+# Cleanup
+sudo_preserve_env PATH -- ./waf --color=yes distclean
+
+if [[ $JOB_NAME != *"code-coverage" && $JOB_NAME != *"limited-build" ]]; then
+ # Configure/build in optimized mode with tests
+ ./waf --color=yes configure --with-tests
+ ./waf --color=yes build -j${WAF_JOBS:-1}
+
+ # Cleanup
+ sudo_preserve_env PATH -- ./waf --color=yes distclean
+
+ # Configure/build in optimized mode without tests
+ ./waf --color=yes configure
+ ./waf --color=yes build -j${WAF_JOBS:-1}
+
+ # Cleanup
+ sudo_preserve_env PATH -- ./waf --color=yes distclean
+fi
+
+# Configure/build in debug mode with tests
+./waf --color=yes configure --debug --with-tests $ASAN $COVERAGE
+./waf --color=yes build -j${WAF_JOBS:-1}
+
+# (tests will be run against debug version)
+
+# Install
+sudo_preserve_env PATH -- ./waf --color=yes install
+
+if has Linux $NODE_LABELS; then
+ sudo ldconfig
+elif has FreeBSD $NODE_LABELS; then
+ sudo ldconfig -a
+fi
diff --git a/.jenkins.d/20-build.sh b/.jenkins.d/20-build.sh
deleted file mode 100755
index d8d5be9..0000000
--- a/.jenkins.d/20-build.sh
+++ /dev/null
@@ -1,50 +0,0 @@
-#!/usr/bin/env bash
-set -e
-
-JDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
-source "$JDIR"/util.sh
-
-set -x
-
-git submodule init
-git submodule sync
-git submodule update
-
-# Cleanup
-sudo ./waf -j1 --color=yes distclean
-
-if [[ "$JOB_NAME" != *"limited-build" ]]; then
- # Configure/build in optimized mode with tests
- ./waf -j1 --color=yes configure --with-tests
- ./waf -j1 --color=yes build
-
- # Cleanup
- sudo ./waf -j1 --color=yes distclean
-
- # Configure/build in optimized mode without tests
- ./waf -j1 --color=yes configure
- ./waf -j1 --color=yes build
-
- # Cleanup
- sudo ./waf -j1 --color=yes distclean
-fi
-
-# Configure/build in debug mode with tests and without precompiled headers
-if [[ "$JOB_NAME" == *"code-coverage" ]]; then
- COVERAGE="--with-coverage"
-elif ! has OSX-10.9 $NODE_LABELS && ! has OSX-10.11 $NODE_LABELS; then
- ASAN="--with-sanitizer=address"
-fi
-./waf -j1 --color=yes configure --debug --with-tests $COVERAGE $ASAN
-./waf -j1 --color=yes build
-
-# (tests will be run against debug version)
-
-# Install
-sudo ./waf -j1 --color=yes install
-
-if has Linux $NODE_LABELS; then
- sudo ldconfig
-elif has FreeBSD10 $NODE_LABELS; then
- sudo ldconfig -m
-fi
diff --git a/.jenkins.d/30-tests.sh b/.jenkins.d/20-tests.sh
similarity index 94%
rename from .jenkins.d/30-tests.sh
rename to .jenkins.d/20-tests.sh
index fe7981d..b4d8ec9 100755
--- a/.jenkins.d/30-tests.sh
+++ b/.jenkins.d/20-tests.sh
@@ -35,5 +35,8 @@
ASAN_OPTIONS+=":strip_path_prefix=${PWD}/"
export ASAN_OPTIONS
+export BOOST_TEST_BUILD_INFO=1
+export BOOST_TEST_COLOR_OUTPUT=1
+
# Run unit tests
./build/unit-tests $(ut_log_args)
diff --git a/.jenkins.d/30-coverage.sh b/.jenkins.d/30-coverage.sh
new file mode 100755
index 0000000..a96e999
--- /dev/null
+++ b/.jenkins.d/30-coverage.sh
@@ -0,0 +1,36 @@
+#!/usr/bin/env bash
+set -e
+
+JDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
+source "$JDIR"/util.sh
+
+set -x
+
+if [[ $JOB_NAME == *"code-coverage" ]]; then
+ gcovr --object-directory=build \
+ --output=build/coverage.xml \
+ --exclude="$PWD/tests" \
+ --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 "NDN-NAC unit tests" \
+ build/coverage.info
+fi
diff --git a/.jenkins.d/40-coverage.sh b/.jenkins.d/40-coverage.sh
deleted file mode 100755
index 7364c5a..0000000
--- a/.jenkins.d/40-coverage.sh
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/usr/bin/env bash
-set -e
-
-JDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
-source "$JDIR"/util.sh
-
-set -x
-
-if [[ $JOB_NAME == *"code-coverage" ]]; then
- gcovr --object-directory=build \
- --output=build/coverage.xml \
- --exclude="$PWD/(build|tests)" \
- --root=. \
- --xml
-fi
diff --git a/.jenkins.d/README.md b/.jenkins.d/README.md
index 39fa40b..5813349 100644
--- a/.jenkins.d/README.md
+++ b/.jenkins.d/README.md
@@ -27,7 +27,7 @@
Possible values:
* empty: default build process
- * `code-coverage` (Linux OS is assumed): debug build with tests and code coverage analysis
+ * `code-coverage` (Ubuntu Linux is assumed): debug build with tests and code coverage analysis
* `limited-build`: only a single debug build with tests
- `CACHE_DIR`: the variable defines a path to folder containing cached files from previous builds,
diff --git a/.jenkins.d/util.sh b/.jenkins.d/util.sh
index a89bc27..8ddc4ba 100644
--- a/.jenkins.d/util.sh
+++ b/.jenkins.d/util.sh
@@ -16,3 +16,22 @@
set ${saved_xtrace}
return ${ret}
}
+
+sudo_preserve_env() {
+ local saved_xtrace
+ [[ $- == *x* ]] && saved_xtrace=-x || saved_xtrace=+x
+ set +x
+
+ local vars=()
+ while [[ $# -gt 0 ]]; do
+ local arg=$1
+ shift
+ case ${arg} in
+ --) break ;;
+ *) vars+=("${arg}=${!arg}") ;;
+ esac
+ done
+
+ set ${saved_xtrace}
+ sudo env "${vars[@]}" "$@"
+}