blob: 512842b27c8de20ab051430e90af29aca4daa784 [file] [log] [blame]
Alexander Afanasyev4d4e7252014-10-25 12:21:53 -07001#!/usr/bin/env bash
Davide Pesavento69857c32020-04-05 16:36:26 -04002set -ex
Davide Pesaventoe0edc4c2016-09-13 18:29:52 +00003
Alexander Afanasyev4d4e7252014-10-25 12:21:53 -07004# Prepare environment
Davide Pesavento69857c32020-04-05 16:36:26 -04005rm -rf ~/.ndn
Alexander Afanasyev4d4e7252014-10-25 12:21:53 -07006
Alexander Afanasyevf22ebaf2015-12-17 21:23:05 -08007if has OSX $NODE_LABELS; then
Davide Pesavento231ddd72016-09-02 22:20:00 +00008 security unlock-keychain -p named-data
Alexander Afanasyev4d4e7252014-10-25 12:21:53 -07009fi
10
11ndnsec-keygen "/tmp/jenkins/$NODE_NAME" | ndnsec-install-cert -
12
Davide Pesavento69857c32020-04-05 16:36:26 -040013# https://github.com/google/sanitizers/wiki/AddressSanitizerFlags
Davide Pesavento043c5012016-09-19 17:23:32 +000014ASAN_OPTIONS="color=always"
Davide Pesavento69857c32020-04-05 16:36:26 -040015ASAN_OPTIONS+=":check_initialization_order=1"
16ASAN_OPTIONS+=":detect_stack_use_after_return=1"
17ASAN_OPTIONS+=":strict_init_order=1"
18ASAN_OPTIONS+=":strict_string_checks=1"
Davide Pesaventob93fb6c2020-04-12 14:10:45 -040019ASAN_OPTIONS+=":detect_invalid_pointer_pairs=2"
Davide Pesavento69857c32020-04-05 16:36:26 -040020ASAN_OPTIONS+=":detect_container_overflow=0"
21ASAN_OPTIONS+=":detect_leaks=0"
Davide Pesavento043c5012016-09-19 17:23:32 +000022ASAN_OPTIONS+=":strip_path_prefix=${PWD}/"
23export ASAN_OPTIONS
24
Davide Pesaventodda258a2018-09-06 02:43:10 -040025export BOOST_TEST_BUILD_INFO=1
26export BOOST_TEST_COLOR_OUTPUT=1
Davide Pesavento17521592020-05-14 19:01:32 -040027export BOOST_TEST_DETECT_MEMORY_LEAK=0
28
29ut_log_args() {
30 echo --logger=HRF,test_suite,stdout:XML,all,build/xunit-log${1:+-$1}.xml
31}
Davide Pesaventodda258a2018-09-06 02:43:10 -040032
Davide Pesavento231ddd72016-09-02 22:20:00 +000033# First run all tests as unprivileged user
Davide Pesavento7de04442016-10-13 14:41:20 +000034./build/unit-tests-core $(ut_log_args core)
35./build/unit-tests-daemon $(ut_log_args daemon)
36./build/unit-tests-rib $(ut_log_args rib)
37./build/unit-tests-tools $(ut_log_args tools)
Alexander Afanasyevf22ebaf2015-12-17 21:23:05 -080038
Davide Pesavento231ddd72016-09-02 22:20:00 +000039# Then use sudo to run those tests that need superuser powers
Davide Pesaventodda258a2018-09-06 02:43:10 -040040sudo_preserve_env ASAN_OPTIONS BOOST_TEST_COLOR_OUTPUT -- \
Davide Pesavento2cae8ca2019-04-18 20:48:05 -040041 ./build/unit-tests-daemon -t TestPrivilegeHelper $(ut_log_args daemon-privilege-helper)
Davide Pesaventodda258a2018-09-06 02:43:10 -040042sudo_preserve_env ASAN_OPTIONS BOOST_TEST_COLOR_OUTPUT -- \
43 ./build/unit-tests-daemon -t Face/*Ethernet* $(ut_log_args daemon-ethernet)
44sudo_preserve_env ASAN_OPTIONS BOOST_TEST_COLOR_OUTPUT -- \
Davide Pesavento70156942018-09-15 18:40:21 -040045 ./build/unit-tests-daemon -t Face/TestUdpFactory $(ut_log_args daemon-udp)