Alexander Afanasyev | 4d4e725 | 2014-10-25 12:21:53 -0700 | [diff] [blame] | 1 | #!/usr/bin/env bash |
Alexander Afanasyev | 4d4e725 | 2014-10-25 12:21:53 -0700 | [diff] [blame] | 2 | set -e |
| 3 | |
Alexander Afanasyev | f22ebaf | 2015-12-17 21:23:05 -0800 | [diff] [blame] | 4 | JDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) |
| 5 | source "$JDIR"/util.sh |
| 6 | |
Davide Pesavento | e0edc4c | 2016-09-13 18:29:52 +0000 | [diff] [blame] | 7 | set -x |
| 8 | |
Alexander Afanasyev | 4d4e725 | 2014-10-25 12:21:53 -0700 | [diff] [blame] | 9 | # Prepare environment |
Davide Pesavento | e0edc4c | 2016-09-13 18:29:52 +0000 | [diff] [blame] | 10 | rm -Rf ~/.ndn |
Alexander Afanasyev | 4d4e725 | 2014-10-25 12:21:53 -0700 | [diff] [blame] | 11 | |
Alexander Afanasyev | f22ebaf | 2015-12-17 21:23:05 -0800 | [diff] [blame] | 12 | if has OSX $NODE_LABELS; then |
Davide Pesavento | 231ddd7 | 2016-09-02 22:20:00 +0000 | [diff] [blame] | 13 | security unlock-keychain -p named-data |
Alexander Afanasyev | 4d4e725 | 2014-10-25 12:21:53 -0700 | [diff] [blame] | 14 | fi |
| 15 | |
| 16 | ndnsec-keygen "/tmp/jenkins/$NODE_NAME" | ndnsec-install-cert - |
| 17 | |
Davide Pesavento | e0edc4c | 2016-09-13 18:29:52 +0000 | [diff] [blame] | 18 | BOOST_VERSION=$(python -c "import sys; sys.path.append('build/c4che'); import _cache; print(_cache.BOOST_VERSION_NUMBER);") |
Alexander Afanasyev | 4d4e725 | 2014-10-25 12:21:53 -0700 | [diff] [blame] | 19 | |
Davide Pesavento | e0edc4c | 2016-09-13 18:29:52 +0000 | [diff] [blame] | 20 | ut_log_args() { |
Davide Pesavento | e0edc4c | 2016-09-13 18:29:52 +0000 | [diff] [blame] | 21 | if (( BOOST_VERSION >= 106200 )); then |
Davide Pesavento | 7de0444 | 2016-10-13 14:41:20 +0000 | [diff] [blame] | 22 | echo --logger=HRF,test_suite,stdout:XML,all,build/xunit-${1:-report}.xml |
Davide Pesavento | 231ddd7 | 2016-09-02 22:20:00 +0000 | [diff] [blame] | 23 | else |
Davide Pesavento | e0edc4c | 2016-09-13 18:29:52 +0000 | [diff] [blame] | 24 | if [[ -n $XUNIT ]]; then |
| 25 | echo --log_level=all $( (( BOOST_VERSION >= 106000 )) && echo -- ) \ |
Davide Pesavento | 7de0444 | 2016-10-13 14:41:20 +0000 | [diff] [blame] | 26 | --log_format2=XML --log_sink2=build/xunit-${1:-report}.xml |
Davide Pesavento | e0edc4c | 2016-09-13 18:29:52 +0000 | [diff] [blame] | 27 | else |
| 28 | echo --log_level=test_suite |
| 29 | fi |
Davide Pesavento | 231ddd7 | 2016-09-02 22:20:00 +0000 | [diff] [blame] | 30 | fi |
| 31 | } |
Alexander Afanasyev | f22ebaf | 2015-12-17 21:23:05 -0800 | [diff] [blame] | 32 | |
Davide Pesavento | 043c501 | 2016-09-19 17:23:32 +0000 | [diff] [blame] | 33 | ASAN_OPTIONS="color=always" |
| 34 | ASAN_OPTIONS+=":detect_leaks=false" |
| 35 | ASAN_OPTIONS+=":detect_stack_use_after_return=true" |
| 36 | ASAN_OPTIONS+=":check_initialization_order=true" |
| 37 | ASAN_OPTIONS+=":strict_init_order=true" |
| 38 | ASAN_OPTIONS+=":detect_invalid_pointer_pairs=1" |
| 39 | ASAN_OPTIONS+=":detect_container_overflow=false" |
| 40 | ASAN_OPTIONS+=":strict_string_checks=true" |
| 41 | ASAN_OPTIONS+=":strip_path_prefix=${PWD}/" |
| 42 | export ASAN_OPTIONS |
| 43 | |
Davide Pesavento | 231ddd7 | 2016-09-02 22:20:00 +0000 | [diff] [blame] | 44 | # First run all tests as unprivileged user |
Davide Pesavento | 7de0444 | 2016-10-13 14:41:20 +0000 | [diff] [blame] | 45 | ./build/unit-tests-core $(ut_log_args core) |
| 46 | ./build/unit-tests-daemon $(ut_log_args daemon) |
| 47 | ./build/unit-tests-rib $(ut_log_args rib) |
| 48 | ./build/unit-tests-tools $(ut_log_args tools) |
Alexander Afanasyev | f22ebaf | 2015-12-17 21:23:05 -0800 | [diff] [blame] | 49 | |
Davide Pesavento | 231ddd7 | 2016-09-02 22:20:00 +0000 | [diff] [blame] | 50 | # Then use sudo to run those tests that need superuser powers |
Davide Pesavento | 8a84773 | 2017-01-20 16:01:36 -0500 | [diff] [blame] | 51 | sudo -E ./build/unit-tests-core -t TestPrivilegeHelper $(ut_log_args core-privilege) |
Davide Pesavento | 43ff2a9 | 2017-05-18 19:50:57 -0400 | [diff] [blame^] | 52 | sudo -E ./build/unit-tests-daemon -t Face/*Ethernet* $(ut_log_args daemon-ethernet) |
Davide Pesavento | 8a84773 | 2017-01-20 16:01:36 -0500 | [diff] [blame] | 53 | sudo -E ./build/unit-tests-daemon -t Face/*Factory/ProcessConfig $(ut_log_args daemon-face-config) |
| 54 | sudo -E ./build/unit-tests-daemon -t Mgmt/TestGeneralConfigSection/UserAndGroupConfig,NoUserConfig $(ut_log_args daemon-user-config) |