blob: a8615287361fcb2596a738107ae0ee3aeb488adf [file] [log] [blame]
Alexander Afanasyev4d4e7252014-10-25 12:21:53 -07001#!/usr/bin/env bash
Davide Pesavento72517b52022-08-13 18:50:55 -04002set -eo pipefail
Alexander Afanasyev4d4e7252014-10-25 12:21:53 -07003
Davide Pesavento69857c32020-04-05 16:36:26 -04004# https://github.com/google/sanitizers/wiki/AddressSanitizerFlags
Davide Pesavento043c5012016-09-19 17:23:32 +00005ASAN_OPTIONS="color=always"
Davide Pesavento69857c32020-04-05 16:36:26 -04006ASAN_OPTIONS+=":check_initialization_order=1"
7ASAN_OPTIONS+=":detect_stack_use_after_return=1"
8ASAN_OPTIONS+=":strict_init_order=1"
9ASAN_OPTIONS+=":strict_string_checks=1"
Davide Pesaventob93fb6c2020-04-12 14:10:45 -040010ASAN_OPTIONS+=":detect_invalid_pointer_pairs=2"
Davide Pesavento69857c32020-04-05 16:36:26 -040011ASAN_OPTIONS+=":detect_container_overflow=0"
12ASAN_OPTIONS+=":detect_leaks=0"
Davide Pesavento043c5012016-09-19 17:23:32 +000013ASAN_OPTIONS+=":strip_path_prefix=${PWD}/"
14export ASAN_OPTIONS
15
Davide Pesavento72517b52022-08-13 18:50:55 -040016# https://www.boost.org/doc/libs/release/libs/test/doc/html/boost_test/runtime_config/summary.html
Davide Pesaventodda258a2018-09-06 02:43:10 -040017export BOOST_TEST_BUILD_INFO=1
18export BOOST_TEST_COLOR_OUTPUT=1
Davide Pesavento17521592020-05-14 19:01:32 -040019export BOOST_TEST_DETECT_MEMORY_LEAK=0
20
21ut_log_args() {
22 echo --logger=HRF,test_suite,stdout:XML,all,build/xunit-log${1:+-$1}.xml
23}
Davide Pesaventodda258a2018-09-06 02:43:10 -040024
Davide Pesavento72517b52022-08-13 18:50:55 -040025set -x
26
27# Prepare environment
28rm -rf ~/.ndn
29
Davide Pesavento231ddd72016-09-02 22:20:00 +000030# First run all tests as unprivileged user
Davide Pesavento7de04442016-10-13 14:41:20 +000031./build/unit-tests-core $(ut_log_args core)
32./build/unit-tests-daemon $(ut_log_args daemon)
33./build/unit-tests-rib $(ut_log_args rib)
34./build/unit-tests-tools $(ut_log_args tools)
Alexander Afanasyevf22ebaf2015-12-17 21:23:05 -080035
Davide Pesavento231ddd72016-09-02 22:20:00 +000036# Then use sudo to run those tests that need superuser powers
Davide Pesavento72517b52022-08-13 18:50:55 -040037sudo --preserve-env=ASAN_OPTIONS,BOOST_TEST_COLOR_OUTPUT \
Davide Pesavento2cae8ca2019-04-18 20:48:05 -040038 ./build/unit-tests-daemon -t TestPrivilegeHelper $(ut_log_args daemon-privilege-helper)
Davide Pesavento72517b52022-08-13 18:50:55 -040039sudo --preserve-env=ASAN_OPTIONS,BOOST_TEST_COLOR_OUTPUT \
Davide Pesaventodda258a2018-09-06 02:43:10 -040040 ./build/unit-tests-daemon -t Face/*Ethernet* $(ut_log_args daemon-ethernet)
Davide Pesavento72517b52022-08-13 18:50:55 -040041sudo --preserve-env=ASAN_OPTIONS,BOOST_TEST_COLOR_OUTPUT \
Davide Pesavento70156942018-09-15 18:40:21 -040042 ./build/unit-tests-daemon -t Face/TestUdpFactory $(ut_log_args daemon-udp)