Davide Pesavento | 956ac31 | 2016-09-20 19:11:30 +0200 | [diff] [blame] | 1 | #!/usr/bin/env bash |
| 2 | set -e |
| 3 | |
| 4 | JDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) |
| 5 | source "$JDIR"/util.sh |
| 6 | |
| 7 | set -x |
| 8 | |
| 9 | # Prepare environment |
Davide Pesavento | a1a9d70 | 2020-03-29 00:58:15 -0400 | [diff] [blame^] | 10 | rm -rf ~/.ndn |
Davide Pesavento | 956ac31 | 2016-09-20 19:11:30 +0200 | [diff] [blame] | 11 | |
Davide Pesavento | a1a9d70 | 2020-03-29 00:58:15 -0400 | [diff] [blame^] | 12 | BOOST_VERSION=$(python3 -c "import sys; sys.path.append('build/c4che'); import _cache; print(_cache.BOOST_VERSION_NUMBER);") |
Davide Pesavento | 956ac31 | 2016-09-20 19:11:30 +0200 | [diff] [blame] | 13 | |
| 14 | ut_log_args() { |
Davide Pesavento | 956ac31 | 2016-09-20 19:11:30 +0200 | [diff] [blame] | 15 | if (( BOOST_VERSION >= 106200 )); then |
Davide Pesavento | 6a2b3da | 2016-10-15 04:10:37 +0000 | [diff] [blame] | 16 | echo --logger=HRF,test_suite,stdout:XML,all,build/xunit-${1:-report}.xml |
Davide Pesavento | 956ac31 | 2016-09-20 19:11:30 +0200 | [diff] [blame] | 17 | else |
| 18 | if [[ -n $XUNIT ]]; then |
| 19 | echo --log_level=all $( (( BOOST_VERSION >= 106000 )) && echo -- ) \ |
Davide Pesavento | 6a2b3da | 2016-10-15 04:10:37 +0000 | [diff] [blame] | 20 | --log_format2=XML --log_sink2=build/xunit-${1:-report}.xml |
Davide Pesavento | 956ac31 | 2016-09-20 19:11:30 +0200 | [diff] [blame] | 21 | else |
| 22 | echo --log_level=test_suite |
| 23 | fi |
| 24 | fi |
| 25 | } |
| 26 | |
Davide Pesavento | a1a9d70 | 2020-03-29 00:58:15 -0400 | [diff] [blame^] | 27 | # https://github.com/google/sanitizers/wiki/AddressSanitizerFlags |
Davide Pesavento | 956ac31 | 2016-09-20 19:11:30 +0200 | [diff] [blame] | 28 | ASAN_OPTIONS="color=always" |
Davide Pesavento | a1a9d70 | 2020-03-29 00:58:15 -0400 | [diff] [blame^] | 29 | ASAN_OPTIONS+=":check_initialization_order=1" |
| 30 | ASAN_OPTIONS+=":detect_stack_use_after_return=1" |
| 31 | ASAN_OPTIONS+=":strict_init_order=1" |
| 32 | ASAN_OPTIONS+=":strict_string_checks=1" |
Davide Pesavento | 956ac31 | 2016-09-20 19:11:30 +0200 | [diff] [blame] | 33 | ASAN_OPTIONS+=":detect_invalid_pointer_pairs=1" |
Davide Pesavento | a1a9d70 | 2020-03-29 00:58:15 -0400 | [diff] [blame^] | 34 | ASAN_OPTIONS+=":detect_container_overflow=0" |
Davide Pesavento | 956ac31 | 2016-09-20 19:11:30 +0200 | [diff] [blame] | 35 | ASAN_OPTIONS+=":strip_path_prefix=${PWD}/" |
| 36 | export ASAN_OPTIONS |
| 37 | |
Davide Pesavento | 3f2f486 | 2018-09-11 17:56:55 -0400 | [diff] [blame] | 38 | export BOOST_TEST_BUILD_INFO=1 |
| 39 | export BOOST_TEST_COLOR_OUTPUT=1 |
| 40 | |
Davide Pesavento | 956ac31 | 2016-09-20 19:11:30 +0200 | [diff] [blame] | 41 | # Run unit tests |
| 42 | ./build/unit-tests $(ut_log_args) |