Alexander Afanasyev | a87e0a8 | 2014-10-21 14:09:19 -0400 | [diff] [blame] | 1 | #!/usr/bin/env bash |
Davide Pesavento | 2349e28 | 2020-03-24 14:28:03 -0400 | [diff] [blame] | 2 | set -ex |
Davide Pesavento | 0934888 | 2016-09-17 02:39:44 +0200 | [diff] [blame] | 3 | |
Alexander Afanasyev | a87e0a8 | 2014-10-21 14:09:19 -0400 | [diff] [blame] | 4 | # Prepare environment |
Davide Pesavento | 2349e28 | 2020-03-24 14:28:03 -0400 | [diff] [blame] | 5 | rm -rf ~/.ndn |
Alexander Afanasyev | a87e0a8 | 2014-10-21 14:09:19 -0400 | [diff] [blame] | 6 | |
Alexander Afanasyev | b346ddb | 2015-06-03 00:52:03 -0400 | [diff] [blame] | 7 | if has OSX $NODE_LABELS; then |
Davide Pesavento | 0934888 | 2016-09-17 02:39:44 +0200 | [diff] [blame] | 8 | security unlock-keychain -p named-data |
Alexander Afanasyev | a87e0a8 | 2014-10-21 14:09:19 -0400 | [diff] [blame] | 9 | fi |
| 10 | |
| 11 | ndnsec-keygen "/tmp/jenkins/$NODE_NAME" | ndnsec-install-cert - |
| 12 | |
Davide Pesavento | d776a93 | 2020-03-20 18:42:36 -0400 | [diff] [blame] | 13 | BOOST_VERSION=$(python3 -c "import sys; sys.path.append('build/c4che'); import _cache; print(_cache.BOOST_VERSION_NUMBER);") |
Alexander Afanasyev | 667370f | 2016-08-24 11:54:53 -0700 | [diff] [blame] | 14 | |
Davide Pesavento | 0934888 | 2016-09-17 02:39:44 +0200 | [diff] [blame] | 15 | ut_log_args() { |
Davide Pesavento | 0934888 | 2016-09-17 02:39:44 +0200 | [diff] [blame] | 16 | if (( BOOST_VERSION >= 106200 )); then |
Davide Pesavento | 69ec454 | 2016-10-12 20:03:09 +0200 | [diff] [blame] | 17 | echo --logger=HRF,test_suite,stdout:XML,all,build/xunit-${1:-report}.xml |
Alexander Afanasyev | 667370f | 2016-08-24 11:54:53 -0700 | [diff] [blame] | 18 | else |
Davide Pesavento | 0934888 | 2016-09-17 02:39:44 +0200 | [diff] [blame] | 19 | if [[ -n $XUNIT ]]; then |
| 20 | echo --log_level=all $( (( BOOST_VERSION >= 106000 )) && echo -- ) \ |
Davide Pesavento | 69ec454 | 2016-10-12 20:03:09 +0200 | [diff] [blame] | 21 | --log_format2=XML --log_sink2=build/xunit-${1:-report}.xml |
Davide Pesavento | 0934888 | 2016-09-17 02:39:44 +0200 | [diff] [blame] | 22 | else |
| 23 | echo --log_level=test_suite |
| 24 | fi |
Alexander Afanasyev | 667370f | 2016-08-24 11:54:53 -0700 | [diff] [blame] | 25 | fi |
Davide Pesavento | 0934888 | 2016-09-17 02:39:44 +0200 | [diff] [blame] | 26 | } |
Alexander Afanasyev | 667370f | 2016-08-24 11:54:53 -0700 | [diff] [blame] | 27 | |
Davide Pesavento | 2349e28 | 2020-03-24 14:28:03 -0400 | [diff] [blame] | 28 | # https://github.com/google/sanitizers/wiki/AddressSanitizerFlags |
Davide Pesavento | 50e2002 | 2016-09-17 18:50:27 +0200 | [diff] [blame] | 29 | ASAN_OPTIONS="color=always" |
Davide Pesavento | 2349e28 | 2020-03-24 14:28:03 -0400 | [diff] [blame] | 30 | ASAN_OPTIONS+=":check_initialization_order=1" |
| 31 | ASAN_OPTIONS+=":detect_stack_use_after_return=1" |
| 32 | ASAN_OPTIONS+=":strict_init_order=1" |
| 33 | ASAN_OPTIONS+=":strict_string_checks=1" |
| 34 | ASAN_OPTIONS+=":detect_invalid_pointer_pairs=2" |
Davide Pesavento | 50e2002 | 2016-09-17 18:50:27 +0200 | [diff] [blame] | 35 | ASAN_OPTIONS+=":strip_path_prefix=${PWD}/" |
| 36 | export ASAN_OPTIONS |
| 37 | |
Davide Pesavento | cdb5d8f | 2018-09-05 22:27:49 -0400 | [diff] [blame] | 38 | export BOOST_TEST_BUILD_INFO=1 |
| 39 | export BOOST_TEST_COLOR_OUTPUT=1 |
| 40 | |
Alexander Afanasyev | 667370f | 2016-08-24 11:54:53 -0700 | [diff] [blame] | 41 | # Run unit tests |
Davide Pesavento | 0934888 | 2016-09-17 02:39:44 +0200 | [diff] [blame] | 42 | ./build/unit-tests $(ut_log_args) |