Alexander Afanasyev | bc98fcf | 2014-08-16 23:18:50 -0700 | [diff] [blame] | 1 | #!/usr/bin/env bash |
Davide Pesavento | f6be8e3 | 2020-04-30 16:06:03 -0400 | [diff] [blame^] | 2 | set -ex |
Alexander Afanasyev | bc98fcf | 2014-08-16 23:18:50 -0700 | [diff] [blame] | 3 | |
Davide Pesavento | 813df80 | 2017-08-20 20:53:54 -0400 | [diff] [blame] | 4 | # Prepare environment |
Davide Pesavento | f6be8e3 | 2020-04-30 16:06:03 -0400 | [diff] [blame^] | 5 | rm -rf ~/.ndn |
Vince Lehman | b45eed2 | 2015-01-13 14:58:07 -0600 | [diff] [blame] | 6 | |
Davide Pesavento | f6be8e3 | 2020-04-30 16:06:03 -0400 | [diff] [blame^] | 7 | BOOST_VERSION=$(python3 -c "import sys; sys.path.append('build/c4che'); import _cache; print(_cache.BOOST_VERSION_NUMBER);") |
Davide Pesavento | 0b0eddd | 2019-03-19 14:42:15 -0400 | [diff] [blame] | 8 | |
Davide Pesavento | 813df80 | 2017-08-20 20:53:54 -0400 | [diff] [blame] | 9 | ut_log_args() { |
Davide Pesavento | 0b0eddd | 2019-03-19 14:42:15 -0400 | [diff] [blame] | 10 | if (( BOOST_VERSION >= 106200 )); then |
| 11 | echo --logger=HRF,test_suite,stdout:XML,all,build/xunit-${1:-report}.xml |
| 12 | else |
| 13 | if [[ -n $XUNIT ]]; then |
| 14 | echo --log_level=all $( (( BOOST_VERSION >= 106000 )) && echo -- ) \ |
| 15 | --log_format2=XML --log_sink2=build/xunit-${1:-report}.xml |
| 16 | else |
| 17 | echo --log_level=test_suite |
| 18 | fi |
| 19 | fi |
Davide Pesavento | 813df80 | 2017-08-20 20:53:54 -0400 | [diff] [blame] | 20 | } |
| 21 | |
Davide Pesavento | f6be8e3 | 2020-04-30 16:06:03 -0400 | [diff] [blame^] | 22 | # https://github.com/google/sanitizers/wiki/AddressSanitizerFlags |
Davide Pesavento | c58cc7f | 2017-08-08 16:51:28 -0500 | [diff] [blame] | 23 | ASAN_OPTIONS="color=always" |
Davide Pesavento | f6be8e3 | 2020-04-30 16:06:03 -0400 | [diff] [blame^] | 24 | ASAN_OPTIONS+=":check_initialization_order=1" |
| 25 | ASAN_OPTIONS+=":detect_stack_use_after_return=1" |
| 26 | ASAN_OPTIONS+=":strict_init_order=1" |
| 27 | ASAN_OPTIONS+=":strict_string_checks=1" |
| 28 | ASAN_OPTIONS+=":detect_invalid_pointer_pairs=2" |
| 29 | ASAN_OPTIONS+=":detect_container_overflow=0" |
Davide Pesavento | c58cc7f | 2017-08-08 16:51:28 -0500 | [diff] [blame] | 30 | ASAN_OPTIONS+=":strip_path_prefix=${PWD}/" |
| 31 | export ASAN_OPTIONS |
| 32 | |
Davide Pesavento | 0b0eddd | 2019-03-19 14:42:15 -0400 | [diff] [blame] | 33 | export BOOST_TEST_BUILD_INFO=1 |
| 34 | export BOOST_TEST_COLOR_OUTPUT=1 |
| 35 | |
Davide Pesavento | 813df80 | 2017-08-20 20:53:54 -0400 | [diff] [blame] | 36 | # Run unit tests |
| 37 | ./build/unit-tests-nlsr $(ut_log_args) |