blob: 111035f9d86268f662c8fa5bb7021dc35de93bea [file] [log] [blame]
Alexander Afanasyevbc98fcf2014-08-16 23:18:50 -07001#!/usr/bin/env bash
Davide Pesaventof6be8e32020-04-30 16:06:03 -04002set -ex
Alexander Afanasyevbc98fcf2014-08-16 23:18:50 -07003
Davide Pesavento813df802017-08-20 20:53:54 -04004# Prepare environment
Davide Pesaventof6be8e32020-04-30 16:06:03 -04005rm -rf ~/.ndn
Vince Lehmanb45eed22015-01-13 14:58:07 -06006
Davide Pesaventof6be8e32020-04-30 16:06:03 -04007BOOST_VERSION=$(python3 -c "import sys; sys.path.append('build/c4che'); import _cache; print(_cache.BOOST_VERSION_NUMBER);")
Davide Pesavento0b0eddd2019-03-19 14:42:15 -04008
Davide Pesavento813df802017-08-20 20:53:54 -04009ut_log_args() {
Davide Pesavento0b0eddd2019-03-19 14:42:15 -040010 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 Pesavento813df802017-08-20 20:53:54 -040020}
21
Davide Pesaventof6be8e32020-04-30 16:06:03 -040022# https://github.com/google/sanitizers/wiki/AddressSanitizerFlags
Davide Pesaventoc58cc7f2017-08-08 16:51:28 -050023ASAN_OPTIONS="color=always"
Davide Pesaventof6be8e32020-04-30 16:06:03 -040024ASAN_OPTIONS+=":check_initialization_order=1"
25ASAN_OPTIONS+=":detect_stack_use_after_return=1"
26ASAN_OPTIONS+=":strict_init_order=1"
27ASAN_OPTIONS+=":strict_string_checks=1"
28ASAN_OPTIONS+=":detect_invalid_pointer_pairs=2"
29ASAN_OPTIONS+=":detect_container_overflow=0"
Davide Pesaventoc58cc7f2017-08-08 16:51:28 -050030ASAN_OPTIONS+=":strip_path_prefix=${PWD}/"
31export ASAN_OPTIONS
32
Davide Pesavento0b0eddd2019-03-19 14:42:15 -040033export BOOST_TEST_BUILD_INFO=1
34export BOOST_TEST_COLOR_OUTPUT=1
35
Davide Pesavento813df802017-08-20 20:53:54 -040036# Run unit tests
37./build/unit-tests-nlsr $(ut_log_args)