blob: c216d3c84871ee1b1d25f13f7b7f425802b0e2bc [file] [log] [blame]
Davide Pesavento956ac312016-09-20 19:11:30 +02001#!/usr/bin/env bash
2set -e
3
4JDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
5source "$JDIR"/util.sh
6
7set -x
8
9# Prepare environment
Davide Pesaventoa1a9d702020-03-29 00:58:15 -040010rm -rf ~/.ndn
Davide Pesavento956ac312016-09-20 19:11:30 +020011
Davide Pesaventoa1a9d702020-03-29 00:58:15 -040012BOOST_VERSION=$(python3 -c "import sys; sys.path.append('build/c4che'); import _cache; print(_cache.BOOST_VERSION_NUMBER);")
Davide Pesavento956ac312016-09-20 19:11:30 +020013
14ut_log_args() {
Davide Pesavento956ac312016-09-20 19:11:30 +020015 if (( BOOST_VERSION >= 106200 )); then
Davide Pesavento6a2b3da2016-10-15 04:10:37 +000016 echo --logger=HRF,test_suite,stdout:XML,all,build/xunit-${1:-report}.xml
Davide Pesavento956ac312016-09-20 19:11:30 +020017 else
18 if [[ -n $XUNIT ]]; then
19 echo --log_level=all $( (( BOOST_VERSION >= 106000 )) && echo -- ) \
Davide Pesavento6a2b3da2016-10-15 04:10:37 +000020 --log_format2=XML --log_sink2=build/xunit-${1:-report}.xml
Davide Pesavento956ac312016-09-20 19:11:30 +020021 else
22 echo --log_level=test_suite
23 fi
24 fi
25}
26
Davide Pesaventoa1a9d702020-03-29 00:58:15 -040027# https://github.com/google/sanitizers/wiki/AddressSanitizerFlags
Davide Pesavento956ac312016-09-20 19:11:30 +020028ASAN_OPTIONS="color=always"
Davide Pesaventoa1a9d702020-03-29 00:58:15 -040029ASAN_OPTIONS+=":check_initialization_order=1"
30ASAN_OPTIONS+=":detect_stack_use_after_return=1"
31ASAN_OPTIONS+=":strict_init_order=1"
32ASAN_OPTIONS+=":strict_string_checks=1"
Davide Pesavento956ac312016-09-20 19:11:30 +020033ASAN_OPTIONS+=":detect_invalid_pointer_pairs=1"
Davide Pesaventoa1a9d702020-03-29 00:58:15 -040034ASAN_OPTIONS+=":detect_container_overflow=0"
Davide Pesavento956ac312016-09-20 19:11:30 +020035ASAN_OPTIONS+=":strip_path_prefix=${PWD}/"
36export ASAN_OPTIONS
37
Davide Pesavento3f2f4862018-09-11 17:56:55 -040038export BOOST_TEST_BUILD_INFO=1
39export BOOST_TEST_COLOR_OUTPUT=1
40
Davide Pesavento956ac312016-09-20 19:11:30 +020041# Run unit tests
42./build/unit-tests $(ut_log_args)