blob: 76d0d3425b23efd4c053c5de822b577d42a1c7ea [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() {
Davide Pesaventoe0edc4c2016-09-13 18:29:52 +000021 if (( BOOST_VERSION >= 106200 )); then
Davide Pesavento7de04442016-10-13 14:41:20 +000022 echo --logger=HRF,test_suite,stdout:XML,all,build/xunit-${1:-report}.xml
Davide Pesavento231ddd72016-09-02 22:20:00 +000023 else
Davide Pesaventoe0edc4c2016-09-13 18:29:52 +000024 if [[ -n $XUNIT ]]; then
25 echo --log_level=all $( (( BOOST_VERSION >= 106000 )) && echo -- ) \
Davide Pesavento7de04442016-10-13 14:41:20 +000026 --log_format2=XML --log_sink2=build/xunit-${1:-report}.xml
Davide Pesaventoe0edc4c2016-09-13 18:29:52 +000027 else
28 echo --log_level=test_suite
29 fi
Davide Pesavento231ddd72016-09-02 22:20:00 +000030 fi
31}
Alexander Afanasyevf22ebaf2015-12-17 21:23:05 -080032
Davide Pesavento043c5012016-09-19 17:23:32 +000033ASAN_OPTIONS="color=always"
34ASAN_OPTIONS+=":detect_leaks=false"
35ASAN_OPTIONS+=":detect_stack_use_after_return=true"
36ASAN_OPTIONS+=":check_initialization_order=true"
37ASAN_OPTIONS+=":strict_init_order=true"
38ASAN_OPTIONS+=":detect_invalid_pointer_pairs=1"
39ASAN_OPTIONS+=":detect_container_overflow=false"
40ASAN_OPTIONS+=":strict_string_checks=true"
41ASAN_OPTIONS+=":strip_path_prefix=${PWD}/"
42export ASAN_OPTIONS
43
Davide Pesavento231ddd72016-09-02 22:20:00 +000044# First run all tests as unprivileged user
Davide Pesavento7de04442016-10-13 14:41:20 +000045./build/unit-tests-core $(ut_log_args core)
46./build/unit-tests-daemon $(ut_log_args daemon)
47./build/unit-tests-rib $(ut_log_args rib)
48./build/unit-tests-tools $(ut_log_args tools)
Alexander Afanasyevf22ebaf2015-12-17 21:23:05 -080049
Davide Pesavento231ddd72016-09-02 22:20:00 +000050# Then use sudo to run those tests that need superuser powers
Davide Pesavento8a847732017-01-20 16:01:36 -050051sudo -E ./build/unit-tests-core -t TestPrivilegeHelper $(ut_log_args core-privilege)
Davide Pesavento43ff2a92017-05-18 19:50:57 -040052sudo -E ./build/unit-tests-daemon -t Face/*Ethernet* $(ut_log_args daemon-ethernet)
Davide Pesaventobb734df2017-10-24 18:05:36 -040053sudo -E ./build/unit-tests-daemon -t Face/TestUdpFactory $(ut_log_args daemon-udp-factory)
Davide Pesavento8a847732017-01-20 16:01:36 -050054sudo -E ./build/unit-tests-daemon -t Mgmt/TestGeneralConfigSection/UserAndGroupConfig,NoUserConfig $(ut_log_args daemon-user-config)