1#!/bin/sh
2
3export RIOTBASE="$(pwd)/../vendor/RIOT"
4
5testsuite() {
6 local name="${1}" log= pid=0 ret=0
7 shift
8
9 log="${name}.log"
10 truncate -s 0 "${log}"
11
12 printf "\n##\n# %s\n##\n\n" "Running ${name} tests"
13
14 (./${name}/server/server $@ 1>"${log}" 2>&1) &
15 pid=$!
16 trap "kill ${pid}" INT
17
18 cd ./${name}/client
19 "${RIOTBASE}"/tests/unittests/tests/01-run.py
20 ret=$?
21 cd ./../..
22
23 kill ${pid}
24 trap - INT
25
26 return ${ret}
27}
28
29if [ $# -ne 1 ]; then
30 echo "USAGE: ${0##*/} ADDR" 2>&1
31 exit 1
32fi
33
34export NINERIOT_ADDR="${1}"
35export NINERIOT_CPORT="${NINERIOT_CPORT:-1338}"
36export NINERIOT_PPORT="${NINERIOT_PPORT:-5543}"
37
38testsuite unit \
39 -ca ":${NINERIOT_CPORT}" \
40 -pa ":${NINERIOT_PPORT}" \
41 || exit 1
42
43testsuite integration \
44 -ntype tcp \
45 -addr ":${NINERIOT_PPORT}" \
46 -root integration/server/testdata \
47 || exit 1