blob: 226c77d188bbab7302ccf2c07bed7e164063b2fd [file] [log] [blame]
Davide Pesavento956ac312016-09-20 19:11:30 +02001#!/usr/bin/env bash
Davide Pesaventod8398822020-03-29 18:46:19 -04002set -ex
Davide Pesavento956ac312016-09-20 19:11:30 +02003
4# Prepare environment
Davide Pesaventoa1a9d702020-03-29 00:58:15 -04005rm -rf ~/.ndn
Davide Pesavento956ac312016-09-20 19:11:30 +02006
Davide Pesaventoa1a9d702020-03-29 00:58:15 -04007BOOST_VERSION=$(python3 -c "import sys; sys.path.append('build/c4che'); import _cache; print(_cache.BOOST_VERSION_NUMBER);")
Davide Pesavento956ac312016-09-20 19:11:30 +02008
9ut_log_args() {
Davide Pesavento956ac312016-09-20 19:11:30 +020010 if (( BOOST_VERSION >= 106200 )); then
Davide Pesavento6a2b3da2016-10-15 04:10:37 +000011 echo --logger=HRF,test_suite,stdout:XML,all,build/xunit-${1:-report}.xml
Davide Pesavento956ac312016-09-20 19:11:30 +020012 else
13 if [[ -n $XUNIT ]]; then
14 echo --log_level=all $( (( BOOST_VERSION >= 106000 )) && echo -- ) \
Davide Pesavento6a2b3da2016-10-15 04:10:37 +000015 --log_format2=XML --log_sink2=build/xunit-${1:-report}.xml
Davide Pesavento956ac312016-09-20 19:11:30 +020016 else
17 echo --log_level=test_suite
18 fi
19 fi
20}
21
Davide Pesaventoa1a9d702020-03-29 00:58:15 -040022# https://github.com/google/sanitizers/wiki/AddressSanitizerFlags
Davide Pesavento956ac312016-09-20 19:11:30 +020023ASAN_OPTIONS="color=always"
Davide Pesaventoa1a9d702020-03-29 00:58:15 -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"
Davide Pesaventod8398822020-03-29 18:46:19 -040028ASAN_OPTIONS+=":detect_invalid_pointer_pairs=2"
Davide Pesavento956ac312016-09-20 19:11:30 +020029ASAN_OPTIONS+=":strip_path_prefix=${PWD}/"
30export ASAN_OPTIONS
31
Davide Pesavento3f2f4862018-09-11 17:56:55 -040032export BOOST_TEST_BUILD_INFO=1
33export BOOST_TEST_COLOR_OUTPUT=1
34
Davide Pesavento956ac312016-09-20 19:11:30 +020035# Run unit tests
36./build/unit-tests $(ut_log_args)