blob: e2db89c086a438a90b393b5905c46aed486ea8e3 [file] [log] [blame]
Alexander Afanasyev6e64ac92018-06-14 17:25:38 -04001#!/usr/bin/env bash
Davide Pesaventoec61b742020-04-18 01:00:12 -04002set -ex
Alexander Afanasyev6e64ac92018-06-14 17:25:38 -04003
4# Prepare environment
Davide Pesaventoec61b742020-04-18 01:00:12 -04005rm -rf ~/.ndn
Alexander Afanasyev6e64ac92018-06-14 17:25:38 -04006
Davide Pesaventoec61b742020-04-18 01:00:12 -04007BOOST_VERSION=$(python3 -c "import sys; sys.path.append('build/c4che'); import _cache; print(_cache.BOOST_VERSION_NUMBER);")
Alexander Afanasyev6e64ac92018-06-14 17:25:38 -04008
9ut_log_args() {
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
20}
21
Davide Pesaventoec61b742020-04-18 01:00:12 -040022# https://github.com/google/sanitizers/wiki/AddressSanitizerFlags
Alexander Afanasyev6e64ac92018-06-14 17:25:38 -040023ASAN_OPTIONS="color=always"
Davide Pesaventoec61b742020-04-18 01:00:12 -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"
Alexander Afanasyev6e64ac92018-06-14 17:25:38 -040030ASAN_OPTIONS+=":strip_path_prefix=${PWD}/"
31export ASAN_OPTIONS
32
Davide Pesavento8f9d0622018-11-27 01:23:37 -050033export BOOST_TEST_BUILD_INFO=1
34export BOOST_TEST_COLOR_OUTPUT=1
35
Alexander Afanasyev6e64ac92018-06-14 17:25:38 -040036# Run unit tests
37./build/unit-tests $(ut_log_args)