blob: 88c994889a35c054d1a51484f5634c9606d38e23 [file] [log] [blame]
Alexander Afanasyev4d4e7252014-10-25 12:21:53 -07001#!/usr/bin/env bash
Alexander Afanasyev4d4e7252014-10-25 12:21:53 -07002set -e
3
Alexander Afanasyevf22ebaf2015-12-17 21:23:05 -08004JDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
5source "$JDIR"/util.sh
6
Davide Pesaventoe0edc4c2016-09-13 18:29:52 +00007set -x
8
Alexander Afanasyev4d4e7252014-10-25 12:21:53 -07009# Prepare environment
Davide Pesaventoe0edc4c2016-09-13 18:29:52 +000010rm -Rf ~/.ndn
Alexander Afanasyev4d4e7252014-10-25 12:21:53 -070011
Alexander Afanasyevf22ebaf2015-12-17 21:23:05 -080012if has OSX $NODE_LABELS; then
Davide Pesavento231ddd72016-09-02 22:20:00 +000013 security unlock-keychain -p named-data
Alexander Afanasyev4d4e7252014-10-25 12:21:53 -070014fi
15
16ndnsec-keygen "/tmp/jenkins/$NODE_NAME" | ndnsec-install-cert -
17
Davide Pesaventoe0edc4c2016-09-13 18:29:52 +000018BOOST_VERSION=$(python -c "import sys; sys.path.append('build/c4che'); import _cache; print(_cache.BOOST_VERSION_NUMBER);")
Alexander Afanasyev4d4e7252014-10-25 12:21:53 -070019
Davide Pesaventoe0edc4c2016-09-13 18:29:52 +000020ut_log_args() {
21 ((ut_count+=1))
22 if (( BOOST_VERSION >= 106200 )); then
23 echo --logger=HRF,test_suite,stdout:XML,all,build/xunit-report-${ut_count}.xml
Davide Pesavento231ddd72016-09-02 22:20:00 +000024 else
Davide Pesaventoe0edc4c2016-09-13 18:29:52 +000025 if [[ -n $XUNIT ]]; then
26 echo --log_level=all $( (( BOOST_VERSION >= 106000 )) && echo -- ) \
27 --log_format2=XML --log_sink2=build/xunit-report-${ut_count}.xml
28 else
29 echo --log_level=test_suite
30 fi
Davide Pesavento231ddd72016-09-02 22:20:00 +000031 fi
32}
Alexander Afanasyevf22ebaf2015-12-17 21:23:05 -080033
Davide Pesavento231ddd72016-09-02 22:20:00 +000034# First run all tests as unprivileged user
Davide Pesaventoe0edc4c2016-09-13 18:29:52 +000035./build/unit-tests-core $(ut_log_args)
36./build/unit-tests-daemon $(ut_log_args)
37./build/unit-tests-rib $(ut_log_args)
38./build/unit-tests-tools $(ut_log_args)
Alexander Afanasyevf22ebaf2015-12-17 21:23:05 -080039
Davide Pesavento231ddd72016-09-02 22:20:00 +000040# Then use sudo to run those tests that need superuser powers
Davide Pesaventoe0edc4c2016-09-13 18:29:52 +000041sudo ./build/unit-tests-core -t TestPrivilegeHelper $(ut_log_args)
42sudo ./build/unit-tests-daemon -t Face/TestEthernetFactory,TestEthernetTransport $(ut_log_args)
43sudo ./build/unit-tests-daemon -t Mgmt/TestGeneralConfigSection/UserAndGroupConfig,NoUserConfig $(ut_log_args)
44sudo ./build/unit-tests-daemon -t Mgmt/TestFaceManager/ProcessConfig/ProcessSectionUdp,ProcessSectionUdpMulticastReinit,ProcessSectionEther,ProcessSectionEtherMulticastReinit $(ut_log_args)
Junxiao Shi38f4ce92016-08-04 10:01:52 +000045
Davide Pesaventoe0edc4c2016-09-13 18:29:52 +000046unset ut_count