tests+ci: Enable dual XML and HRF output of unit test results
This commit also makes unit tests to run against a debug build, to
ensure assertions are properly evaluated (based on suggestion
in I5f4419ea48d4eb333e9d107115ef3df4123f76e5).
Change-Id: I1bbf14f75aab155ed80a36fc4006f7a5d13f1289
Refs: #2252, #2805
diff --git a/.jenkins.d/20-tests.sh b/.jenkins.d/20-tests.sh
index b4bf79a..dcd2b9d 100755
--- a/.jenkins.d/20-tests.sh
+++ b/.jenkins.d/20-tests.sh
@@ -2,19 +2,19 @@
set -x
set -e
+JDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
+source "$JDIR"/util.sh
+
# Prepare environment
rm -Rf ~/.ndnx ~/.ndn
-echo $NODE_LABELS
-IS_OSX=$( python -c "print 'yes' if 'OSX' in '$NODE_LABELS'.strip().split(' ') else 'no'" )
-IS_LINUX=$( python -c "print 'yes' if 'Linux' in '$NODE_LABELS'.strip().split(' ') else 'no'" )
-
-if [[ $IS_OSX == "yes" ]]; then
+if has OSX $NODE_LABELS; then
security unlock-keychain -p "named-data"
sudo chgrp admin /dev/bpf*
sudo chmod g+rw /dev/bpf*
fi
-if [[ $IS_LINUX = "yes" ]]; then
+
+if has Linux $NODE_LABELS; then
sudo setcap cap_net_raw,cap_net_admin=eip `pwd`/build/unit-tests-core || true
sudo setcap cap_net_raw,cap_net_admin=eip `pwd`/build/unit-tests-daemon || true
sudo setcap cap_net_raw,cap_net_admin=eip `pwd`/build/unit-tests-rib || true
@@ -24,11 +24,18 @@
# Run unit tests
# Core
-./build/unit-tests-core -l test_suite
-sudo ./build/unit-tests-core -t TestPrivilegeHelper -l test_suite
+if [[ -n $XUNIT ]]; then
+ ./build/unit-tests-core -l all --log_format2=XML --log_sink2=build/xunit-core-report.xml
+ sudo ./build/unit-tests-core -t TestPrivilegeHelper -l all --log_format2=XML --log_sink2=build/xunit-core-sudo-report.xml
-# Daemon
-./build/unit-tests-daemon -l test_suite
+ ./build/unit-tests-daemon -l all --log_format2=XML --log_sink2=build/xunit-daemon-report.xml
-# RIB
-./build/unit-tests-rib -l test_suite
+ ./build/unit-tests-rib -l all --log_format2=XML --log_sink2=build/xunit-rib-report.xml
+else
+ ./build/unit-tests-core -l test_suite
+ sudo ./build/unit-tests-core -t TestPrivilegeHelper -l test_suite
+
+ ./build/unit-tests-daemon -l test_suite
+
+ ./build/unit-tests-rib -l test_suite
+fi