Alexander Afanasyev | 4d4e725 | 2014-10-25 12:21:53 -0700 | [diff] [blame] | 1 | #!/usr/bin/env bash |
Davide Pesavento | 69857c3 | 2020-04-05 16:36:26 -0400 | [diff] [blame] | 2 | set -ex |
Davide Pesavento | e0edc4c | 2016-09-13 18:29:52 +0000 | [diff] [blame] | 3 | |
Alexander Afanasyev | 4d4e725 | 2014-10-25 12:21:53 -0700 | [diff] [blame] | 4 | # Prepare environment |
Davide Pesavento | 69857c3 | 2020-04-05 16:36:26 -0400 | [diff] [blame] | 5 | rm -rf ~/.ndn |
Alexander Afanasyev | 4d4e725 | 2014-10-25 12:21:53 -0700 | [diff] [blame] | 6 | |
Alexander Afanasyev | f22ebaf | 2015-12-17 21:23:05 -0800 | [diff] [blame] | 7 | if has OSX $NODE_LABELS; then |
Davide Pesavento | 231ddd7 | 2016-09-02 22:20:00 +0000 | [diff] [blame] | 8 | security unlock-keychain -p named-data |
Alexander Afanasyev | 4d4e725 | 2014-10-25 12:21:53 -0700 | [diff] [blame] | 9 | fi |
| 10 | |
Davide Pesavento | d69070e | 2021-06-04 18:50:52 -0400 | [diff] [blame^] | 11 | ndnsec key-gen "/tmp/jenkins/$NODE_NAME" | ndnsec cert-install - |
Alexander Afanasyev | 4d4e725 | 2014-10-25 12:21:53 -0700 | [diff] [blame] | 12 | |
Davide Pesavento | 69857c3 | 2020-04-05 16:36:26 -0400 | [diff] [blame] | 13 | # https://github.com/google/sanitizers/wiki/AddressSanitizerFlags |
Davide Pesavento | 043c501 | 2016-09-19 17:23:32 +0000 | [diff] [blame] | 14 | ASAN_OPTIONS="color=always" |
Davide Pesavento | 69857c3 | 2020-04-05 16:36:26 -0400 | [diff] [blame] | 15 | ASAN_OPTIONS+=":check_initialization_order=1" |
| 16 | ASAN_OPTIONS+=":detect_stack_use_after_return=1" |
| 17 | ASAN_OPTIONS+=":strict_init_order=1" |
| 18 | ASAN_OPTIONS+=":strict_string_checks=1" |
Davide Pesavento | b93fb6c | 2020-04-12 14:10:45 -0400 | [diff] [blame] | 19 | ASAN_OPTIONS+=":detect_invalid_pointer_pairs=2" |
Davide Pesavento | 69857c3 | 2020-04-05 16:36:26 -0400 | [diff] [blame] | 20 | ASAN_OPTIONS+=":detect_container_overflow=0" |
| 21 | ASAN_OPTIONS+=":detect_leaks=0" |
Davide Pesavento | 043c501 | 2016-09-19 17:23:32 +0000 | [diff] [blame] | 22 | ASAN_OPTIONS+=":strip_path_prefix=${PWD}/" |
| 23 | export ASAN_OPTIONS |
| 24 | |
Davide Pesavento | dda258a | 2018-09-06 02:43:10 -0400 | [diff] [blame] | 25 | export BOOST_TEST_BUILD_INFO=1 |
| 26 | export BOOST_TEST_COLOR_OUTPUT=1 |
Davide Pesavento | 1752159 | 2020-05-14 19:01:32 -0400 | [diff] [blame] | 27 | export BOOST_TEST_DETECT_MEMORY_LEAK=0 |
| 28 | |
| 29 | ut_log_args() { |
| 30 | echo --logger=HRF,test_suite,stdout:XML,all,build/xunit-log${1:+-$1}.xml |
| 31 | } |
Davide Pesavento | dda258a | 2018-09-06 02:43:10 -0400 | [diff] [blame] | 32 | |
Davide Pesavento | 231ddd7 | 2016-09-02 22:20:00 +0000 | [diff] [blame] | 33 | # First run all tests as unprivileged user |
Davide Pesavento | 7de0444 | 2016-10-13 14:41:20 +0000 | [diff] [blame] | 34 | ./build/unit-tests-core $(ut_log_args core) |
| 35 | ./build/unit-tests-daemon $(ut_log_args daemon) |
| 36 | ./build/unit-tests-rib $(ut_log_args rib) |
| 37 | ./build/unit-tests-tools $(ut_log_args tools) |
Alexander Afanasyev | f22ebaf | 2015-12-17 21:23:05 -0800 | [diff] [blame] | 38 | |
Davide Pesavento | 231ddd7 | 2016-09-02 22:20:00 +0000 | [diff] [blame] | 39 | # Then use sudo to run those tests that need superuser powers |
Davide Pesavento | dda258a | 2018-09-06 02:43:10 -0400 | [diff] [blame] | 40 | sudo_preserve_env ASAN_OPTIONS BOOST_TEST_COLOR_OUTPUT -- \ |
Davide Pesavento | 2cae8ca | 2019-04-18 20:48:05 -0400 | [diff] [blame] | 41 | ./build/unit-tests-daemon -t TestPrivilegeHelper $(ut_log_args daemon-privilege-helper) |
Davide Pesavento | dda258a | 2018-09-06 02:43:10 -0400 | [diff] [blame] | 42 | sudo_preserve_env ASAN_OPTIONS BOOST_TEST_COLOR_OUTPUT -- \ |
| 43 | ./build/unit-tests-daemon -t Face/*Ethernet* $(ut_log_args daemon-ethernet) |
| 44 | sudo_preserve_env ASAN_OPTIONS BOOST_TEST_COLOR_OUTPUT -- \ |
Davide Pesavento | 7015694 | 2018-09-15 18:40:21 -0400 | [diff] [blame] | 45 | ./build/unit-tests-daemon -t Face/TestUdpFactory $(ut_log_args daemon-udp) |