blob: 17419ce686a7e31052c99fb1b0b8e0ce8ca662b5 [file] [log] [blame]
Alexander Afanasyev4d4e7252014-10-25 12:21:53 -07001#!/usr/bin/env bash
2set -x
3set -e
4
Alexander Afanasyevf22ebaf2015-12-17 21:23:05 -08005JDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
6source "$JDIR"/util.sh
7
Alexander Afanasyev4d4e7252014-10-25 12:21:53 -07008# Prepare environment
9rm -Rf ~/.ndnx ~/.ndn
10
Alexander Afanasyevf22ebaf2015-12-17 21:23:05 -080011if has OSX $NODE_LABELS; then
Davide Pesavento231ddd72016-09-02 22:20:00 +000012 security unlock-keychain -p named-data
Alexander Afanasyev4d4e7252014-10-25 12:21:53 -070013fi
14
15ndnsec-keygen "/tmp/jenkins/$NODE_NAME" | ndnsec-install-cert -
16
Davide Pesavento231ddd72016-09-02 22:20:00 +000017count=0
Alexander Afanasyev4d4e7252014-10-25 12:21:53 -070018
Davide Pesavento231ddd72016-09-02 22:20:00 +000019# Helper function
20run_tests() {
21 local sudo=
22 if [[ $1 == sudo ]]; then
23 sudo=$1
24 shift
25 fi
Alexander Afanasyev4d4e7252014-10-25 12:21:53 -070026
Davide Pesavento231ddd72016-09-02 22:20:00 +000027 local module=$1
28 shift
Junxiao Shi38f4ce92016-08-04 10:01:52 +000029
Davide Pesavento231ddd72016-09-02 22:20:00 +000030 if [[ -n $XUNIT ]]; then
31 ${sudo} ./build/unit-tests-${module} -l all "$@" -- --log_format2=XML --log_sink2="build/xunit-${count}-${module}${sudo:+-}${sudo}.xml"
32 ((count+=1))
33 else
34 ${sudo} ./build/unit-tests-${module} -l test_suite "$@"
35 fi
36}
Alexander Afanasyevf22ebaf2015-12-17 21:23:05 -080037
Davide Pesavento231ddd72016-09-02 22:20:00 +000038# First run all tests as unprivileged user
39run_tests core
40run_tests daemon
41run_tests rib
42run_tests tools
Alexander Afanasyevf22ebaf2015-12-17 21:23:05 -080043
Davide Pesavento231ddd72016-09-02 22:20:00 +000044# Then use sudo to run those tests that need superuser powers
45run_tests sudo core -t TestPrivilegeHelper
46run_tests sudo daemon -t Face/TestEthernetFactory,TestEthernetTransport
47run_tests sudo daemon -t Mgmt/TestGeneralConfigSection/UserAndGroupConfig,NoUserConfig
48run_tests sudo daemon -t Mgmt/TestFaceManager/ProcessConfig/ProcessSectionUdp,ProcessSectionUdpMulticastReinit,ProcessSectionEther,ProcessSectionEtherMulticastReinit
Junxiao Shi38f4ce92016-08-04 10:01:52 +000049
Davide Pesavento231ddd72016-09-02 22:20:00 +000050unset count