blob: 9500206f97852a8f8a874881b4a2e71835866807 [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
Davide Pesavento69857c32020-04-05 16:36:26 -040011# https://github.com/google/sanitizers/wiki/AddressSanitizerFlags
Davide Pesavento043c5012016-09-19 17:23:32 +000012ASAN_OPTIONS="color=always"
Davide Pesavento69857c32020-04-05 16:36:26 -040013ASAN_OPTIONS+=":check_initialization_order=1"
14ASAN_OPTIONS+=":detect_stack_use_after_return=1"
15ASAN_OPTIONS+=":strict_init_order=1"
16ASAN_OPTIONS+=":strict_string_checks=1"
Davide Pesaventob93fb6c2020-04-12 14:10:45 -040017ASAN_OPTIONS+=":detect_invalid_pointer_pairs=2"
Davide Pesavento69857c32020-04-05 16:36:26 -040018ASAN_OPTIONS+=":detect_container_overflow=0"
19ASAN_OPTIONS+=":detect_leaks=0"
Davide Pesavento043c5012016-09-19 17:23:32 +000020ASAN_OPTIONS+=":strip_path_prefix=${PWD}/"
21export ASAN_OPTIONS
22
Davide Pesaventodda258a2018-09-06 02:43:10 -040023export BOOST_TEST_BUILD_INFO=1
24export BOOST_TEST_COLOR_OUTPUT=1
Davide Pesavento17521592020-05-14 19:01:32 -040025export BOOST_TEST_DETECT_MEMORY_LEAK=0
26
27ut_log_args() {
28 echo --logger=HRF,test_suite,stdout:XML,all,build/xunit-log${1:+-$1}.xml
29}
Davide Pesaventodda258a2018-09-06 02:43:10 -040030
Davide Pesavento231ddd72016-09-02 22:20:00 +000031# First run all tests as unprivileged user
Davide Pesavento7de04442016-10-13 14:41:20 +000032./build/unit-tests-core $(ut_log_args core)
33./build/unit-tests-daemon $(ut_log_args daemon)
34./build/unit-tests-rib $(ut_log_args rib)
35./build/unit-tests-tools $(ut_log_args tools)
Alexander Afanasyevf22ebaf2015-12-17 21:23:05 -080036
Davide Pesavento231ddd72016-09-02 22:20:00 +000037# Then use sudo to run those tests that need superuser powers
Davide Pesaventodda258a2018-09-06 02:43:10 -040038sudo_preserve_env ASAN_OPTIONS BOOST_TEST_COLOR_OUTPUT -- \
Davide Pesavento2cae8ca2019-04-18 20:48:05 -040039 ./build/unit-tests-daemon -t TestPrivilegeHelper $(ut_log_args daemon-privilege-helper)
Davide Pesaventodda258a2018-09-06 02:43:10 -040040sudo_preserve_env ASAN_OPTIONS BOOST_TEST_COLOR_OUTPUT -- \
41 ./build/unit-tests-daemon -t Face/*Ethernet* $(ut_log_args daemon-ethernet)
42sudo_preserve_env ASAN_OPTIONS BOOST_TEST_COLOR_OUTPUT -- \
Davide Pesavento70156942018-09-15 18:40:21 -040043 ./build/unit-tests-daemon -t Face/TestUdpFactory $(ut_log_args daemon-udp)