Imported Upstream version 0.1.17
[platform/upstream/libnice.git] / tests / check-test-fullmode-with-stun.sh
1 #! /bin/sh
2
3 if test -n "${BUILT_WITH_MESON}"; then
4   STUND=$1
5   TEST_FULLMODE=$2
6 else
7   STUND=../stun/tools/stund
8   TEST_FULLMODE=./test-fullmode
9 fi
10
11 echo "Starting ICE full-mode with STUN unit test."
12
13 [ -e "$STUND" ] || {
14         echo "STUN server not found: Cannot run unit test!" >&2
15         exit 77
16 }
17
18 set -x
19 pidfile=./stund.pid
20
21 export NICE_STUN_SERVER=127.0.0.1
22 export NICE_STUN_SERVER_PORT=3800
23
24 echo "Launching $STUND on port ${NICE_STUN_SERVER_PORT}."
25
26 rm -f -- "$pidfile"
27 (sh -c "echo \$\$ > \"$pidfile\" && exec "$STUND" ${NICE_STUN_SERVER_PORT}") &
28 sleep 1
29
30 "${TEST_FULLMODE}"
31 error=$?
32
33 kill "$(cat "$pidfile")"
34 rm -f -- "$pidfile"
35 wait
36 exit ${error}