blob: 7cd25f36d35be24ccab734913d32250dd30cb42e [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 Pesaventoa1b15192024-02-09 19:27:34 -05004# https://github.com/google/sanitizers/wiki/SanitizerCommonFlags
Davide Pesavento69857c32020-04-05 16:36:26 -04005# https://github.com/google/sanitizers/wiki/AddressSanitizerFlags
Davide Pesavento043c5012016-09-19 17:23:32 +00006ASAN_OPTIONS="color=always"
Davide Pesaventoa1b15192024-02-09 19:27:34 -05007ASAN_OPTIONS+=":strip_path_prefix=${PWD}/"
8ASAN_OPTIONS+=":detect_leaks=0"
Davide Pesavento69857c32020-04-05 16:36:26 -04009ASAN_OPTIONS+=":check_initialization_order=1"
10ASAN_OPTIONS+=":detect_stack_use_after_return=1"
11ASAN_OPTIONS+=":strict_init_order=1"
12ASAN_OPTIONS+=":strict_string_checks=1"
Davide Pesaventob93fb6c2020-04-12 14:10:45 -040013ASAN_OPTIONS+=":detect_invalid_pointer_pairs=2"
Davide Pesavento69857c32020-04-05 16:36:26 -040014ASAN_OPTIONS+=":detect_container_overflow=0"
Davide Pesavento043c5012016-09-19 17:23:32 +000015export ASAN_OPTIONS
16
Davide Pesavento72517b52022-08-13 18:50:55 -040017# https://www.boost.org/doc/libs/release/libs/test/doc/html/boost_test/runtime_config/summary.html
Davide Pesaventodda258a2018-09-06 02:43:10 -040018export BOOST_TEST_BUILD_INFO=1
19export BOOST_TEST_COLOR_OUTPUT=1
Davide Pesavento17521592020-05-14 19:01:32 -040020export BOOST_TEST_DETECT_MEMORY_LEAK=0
21
22ut_log_args() {
23 echo --logger=HRF,test_suite,stdout:XML,all,build/xunit-log${1:+-$1}.xml
24}
Davide Pesaventodda258a2018-09-06 02:43:10 -040025
Davide Pesavento72517b52022-08-13 18:50:55 -040026set -x
27
28# Prepare environment
29rm -rf ~/.ndn
30
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)
Davide Pesavento7de04442016-10-13 14:41:20 +000034./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)