Adding new stun API stun_agent_forget_transaction to forget a saved transaction id...
[sipe-libnice.git] / stun / tests / check-bind.sh
blobc702e005a9e7fdee34ba38735b1147a1f0da1d8d
1 #! /bin/sh
3 STUNC=../tools/stunbdc
4 STUND=../tools/stund
6 set -xe
8 # Dummy command line parsing tests
9 $STUNC -h
10 $STUNC -V
11 ! $STUNC server port dummy
13 # Timeout tests
14 ! $STUNC -4 127.0.0.1 1
15 ! $STUNC -6 ::1 1
17 # Allocate a likely unused port number
18 PORT=$((32768+$$))
19 if test $PORT -le 1024; then
20 PORT=$(($PORT+1024))
23 echo "Using local UDP port number $PORT ..."
25 # Start the STUN test daemon if needed
26 rm -f stund?.pid stund?.fail stunc?.log
28 for v in 4 6; do
29 (($SHELL -c "echo \$\$ > stund$v.pid ; exec $STUND -$v $PORT") || \
30 touch stund$v.fail) &
31 done
33 # Run the test client
34 $STUNC -4 127.0.0.1 $PORT > stunc4.log || test -f stund4.fail
35 $STUNC -6 ::1 $PORT > stunc6.log || test -f stund6.fail
37 # Terminate the test daemon
38 for v in 4 6; do kill -INT $(cat stund$v.pid) || true; done
39 wait
41 # Check client results
42 if test -f stund4.fail; then exit 77; fi
43 grep -e "^Mapped address: 127.0.0.1" stunc4.log || exit 4
45 if test -f stund6.fail; then exit 77; fi
46 grep -e "^Mapped address: ::1" stunc6.log || exit 6
48 rm -f stund?.fail stund?.pid stunc?.log