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 | 69857c3 | 2020-04-05 16:36:26 -0400 | [diff] [blame] | 4 | # https://github.com/google/sanitizers/wiki/AddressSanitizerFlags |
Davide Pesavento | 043c501 | 2016-09-19 17:23:32 +0000 | [diff] [blame] | 5 | ASAN_OPTIONS="color=always" |
Davide Pesavento | 69857c3 | 2020-04-05 16:36:26 -0400 | [diff] [blame] | 6 | ASAN_OPTIONS+=":check_initialization_order=1" |
| 7 | ASAN_OPTIONS+=":detect_stack_use_after_return=1" |
| 8 | ASAN_OPTIONS+=":strict_init_order=1" |
| 9 | ASAN_OPTIONS+=":strict_string_checks=1" |
Davide Pesavento | b93fb6c | 2020-04-12 14:10:45 -0400 | [diff] [blame] | 10 | ASAN_OPTIONS+=":detect_invalid_pointer_pairs=2" |
Davide Pesavento | 69857c3 | 2020-04-05 16:36:26 -0400 | [diff] [blame] | 11 | ASAN_OPTIONS+=":detect_container_overflow=0" |
| 12 | ASAN_OPTIONS+=":detect_leaks=0" |
Davide Pesavento | 043c501 | 2016-09-19 17:23:32 +0000 | [diff] [blame] | 13 | ASAN_OPTIONS+=":strip_path_prefix=${PWD}/" |
| 14 | export ASAN_OPTIONS |
| 15 | |
Davide Pesavento | 72517b5 | 2022-08-13 18:50:55 -0400 | [diff] [blame^] | 16 | # 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] | 17 | export BOOST_TEST_BUILD_INFO=1 |
| 18 | export BOOST_TEST_COLOR_OUTPUT=1 |
Davide Pesavento | 1752159 | 2020-05-14 19:01:32 -0400 | [diff] [blame] | 19 | export BOOST_TEST_DETECT_MEMORY_LEAK=0 |
| 20 | |
| 21 | ut_log_args() { |
| 22 | echo --logger=HRF,test_suite,stdout:XML,all,build/xunit-log${1:+-$1}.xml |
| 23 | } |
Davide Pesavento | dda258a | 2018-09-06 02:43:10 -0400 | [diff] [blame] | 24 | |
Davide Pesavento | 72517b5 | 2022-08-13 18:50:55 -0400 | [diff] [blame^] | 25 | set -x |
| 26 | |
| 27 | # Prepare environment |
| 28 | rm -rf ~/.ndn |
| 29 | |
Davide Pesavento | 231ddd7 | 2016-09-02 22:20:00 +0000 | [diff] [blame] | 30 | # First run all tests as unprivileged user |
Davide Pesavento | 7de0444 | 2016-10-13 14:41:20 +0000 | [diff] [blame] | 31 | ./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 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) |