blob: 0cf69902860f3915ed4dcc9525c5ec4f948675f8 [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 Pesavento043c5012016-09-19 17:23:32 +000034ASAN_OPTIONS="color=always"
35ASAN_OPTIONS+=":detect_leaks=false"
36ASAN_OPTIONS+=":detect_stack_use_after_return=true"
37ASAN_OPTIONS+=":check_initialization_order=true"
38ASAN_OPTIONS+=":strict_init_order=true"
39ASAN_OPTIONS+=":detect_invalid_pointer_pairs=1"
40ASAN_OPTIONS+=":detect_container_overflow=false"
41ASAN_OPTIONS+=":strict_string_checks=true"
42ASAN_OPTIONS+=":strip_path_prefix=${PWD}/"
43export ASAN_OPTIONS
44
Davide Pesavento231ddd72016-09-02 22:20:00 +000045# First run all tests as unprivileged user
Davide Pesaventoe0edc4c2016-09-13 18:29:52 +000046./build/unit-tests-core $(ut_log_args)
47./build/unit-tests-daemon $(ut_log_args)
48./build/unit-tests-rib $(ut_log_args)
49./build/unit-tests-tools $(ut_log_args)
Alexander Afanasyevf22ebaf2015-12-17 21:23:05 -080050
Davide Pesavento231ddd72016-09-02 22:20:00 +000051# Then use sudo to run those tests that need superuser powers
Davide Pesaventoe0edc4c2016-09-13 18:29:52 +000052sudo ./build/unit-tests-core -t TestPrivilegeHelper $(ut_log_args)
53sudo ./build/unit-tests-daemon -t Face/TestEthernetFactory,TestEthernetTransport $(ut_log_args)
54sudo ./build/unit-tests-daemon -t Mgmt/TestGeneralConfigSection/UserAndGroupConfig,NoUserConfig $(ut_log_args)
55sudo ./build/unit-tests-daemon -t Mgmt/TestFaceManager/ProcessConfig/ProcessSectionUdp,ProcessSectionUdpMulticastReinit,ProcessSectionEther,ProcessSectionEtherMulticastReinit $(ut_log_args)
Junxiao Shi38f4ce92016-08-04 10:01:52 +000056
Davide Pesaventoe0edc4c2016-09-13 18:29:52 +000057unset ut_count