Alexander Afanasyev | 4d4e725 | 2014-10-25 12:21:53 -0700 | [diff] [blame] | 1 | #!/usr/bin/env bash |
Davide Pesavento | 72517b5 | 2022-08-13 18:50:55 -0400 | [diff] [blame] | 2 | set -eo pipefail |
Alexander Afanasyev | 4d4e725 | 2014-10-25 12:21:53 -0700 | [diff] [blame] | 3 | |
Davide Pesavento | a1b1519 | 2024-02-09 19:27:34 -0500 | [diff] [blame] | 4 | # https://github.com/google/sanitizers/wiki/SanitizerCommonFlags |
Davide Pesavento | 69857c3 | 2020-04-05 16:36:26 -0400 | [diff] [blame] | 5 | # https://github.com/google/sanitizers/wiki/AddressSanitizerFlags |
Davide Pesavento | 043c501 | 2016-09-19 17:23:32 +0000 | [diff] [blame] | 6 | ASAN_OPTIONS="color=always" |
Davide Pesavento | a1b1519 | 2024-02-09 19:27:34 -0500 | [diff] [blame] | 7 | ASAN_OPTIONS+=":strip_path_prefix=${PWD}/" |
| 8 | ASAN_OPTIONS+=":detect_leaks=0" |
Davide Pesavento | 69857c3 | 2020-04-05 16:36:26 -0400 | [diff] [blame] | 9 | ASAN_OPTIONS+=":check_initialization_order=1" |
| 10 | ASAN_OPTIONS+=":detect_stack_use_after_return=1" |
| 11 | ASAN_OPTIONS+=":strict_init_order=1" |
| 12 | ASAN_OPTIONS+=":strict_string_checks=1" |
Davide Pesavento | b93fb6c | 2020-04-12 14:10:45 -0400 | [diff] [blame] | 13 | ASAN_OPTIONS+=":detect_invalid_pointer_pairs=2" |
Davide Pesavento | 69857c3 | 2020-04-05 16:36:26 -0400 | [diff] [blame] | 14 | ASAN_OPTIONS+=":detect_container_overflow=0" |
Davide Pesavento | 043c501 | 2016-09-19 17:23:32 +0000 | [diff] [blame] | 15 | export ASAN_OPTIONS |
| 16 | |
Davide Pesavento | 72517b5 | 2022-08-13 18:50:55 -0400 | [diff] [blame] | 17 | # https://www.boost.org/doc/libs/release/libs/test/doc/html/boost_test/runtime_config/summary.html |
Davide Pesavento | dda258a | 2018-09-06 02:43:10 -0400 | [diff] [blame] | 18 | export BOOST_TEST_BUILD_INFO=1 |
| 19 | export BOOST_TEST_COLOR_OUTPUT=1 |
Davide Pesavento | 1752159 | 2020-05-14 19:01:32 -0400 | [diff] [blame] | 20 | export BOOST_TEST_DETECT_MEMORY_LEAK=0 |
| 21 | |
| 22 | ut_log_args() { |
| 23 | echo --logger=HRF,test_suite,stdout:XML,all,build/xunit-log${1:+-$1}.xml |
| 24 | } |
Davide Pesavento | dda258a | 2018-09-06 02:43:10 -0400 | [diff] [blame] | 25 | |
Davide Pesavento | 72517b5 | 2022-08-13 18:50:55 -0400 | [diff] [blame] | 26 | set -x |
| 27 | |
| 28 | # Prepare environment |
| 29 | rm -rf ~/.ndn |
| 30 | |
Davide Pesavento | 231ddd7 | 2016-09-02 22:20:00 +0000 | [diff] [blame] | 31 | # First run all tests as unprivileged user |
Davide Pesavento | 7de0444 | 2016-10-13 14:41:20 +0000 | [diff] [blame] | 32 | ./build/unit-tests-core $(ut_log_args core) |
| 33 | ./build/unit-tests-daemon $(ut_log_args daemon) |
Davide Pesavento | 7de0444 | 2016-10-13 14:41:20 +0000 | [diff] [blame] | 34 | ./build/unit-tests-tools $(ut_log_args tools) |
Alexander Afanasyev | f22ebaf | 2015-12-17 21:23:05 -0800 | [diff] [blame] | 35 | |
Davide Pesavento | 231ddd7 | 2016-09-02 22:20:00 +0000 | [diff] [blame] | 36 | # Then use sudo to run those tests that need superuser powers |
Davide Pesavento | 72517b5 | 2022-08-13 18:50:55 -0400 | [diff] [blame] | 37 | sudo --preserve-env=ASAN_OPTIONS,BOOST_TEST_COLOR_OUTPUT \ |
Davide Pesavento | 2cae8ca | 2019-04-18 20:48:05 -0400 | [diff] [blame] | 38 | ./build/unit-tests-daemon -t TestPrivilegeHelper $(ut_log_args daemon-privilege-helper) |
Davide Pesavento | 72517b5 | 2022-08-13 18:50:55 -0400 | [diff] [blame] | 39 | sudo --preserve-env=ASAN_OPTIONS,BOOST_TEST_COLOR_OUTPUT \ |
Davide Pesavento | dda258a | 2018-09-06 02:43:10 -0400 | [diff] [blame] | 40 | ./build/unit-tests-daemon -t Face/*Ethernet* $(ut_log_args daemon-ethernet) |
Davide Pesavento | 72517b5 | 2022-08-13 18:50:55 -0400 | [diff] [blame] | 41 | sudo --preserve-env=ASAN_OPTIONS,BOOST_TEST_COLOR_OUTPUT \ |
Davide Pesavento | 7015694 | 2018-09-15 18:40:21 -0400 | [diff] [blame] | 42 | ./build/unit-tests-daemon -t Face/TestUdpFactory $(ut_log_args daemon-udp) |