Merge branch 'master' of gnunet.org:gnunet
[oweals/gnunet.git] / src / gns / test_gnunet_gns.sh
1 #!/bin/bash
2 # This file is in the public domain.
3 LOCATION=$(which gnunet-config)
4 if [ -z $LOCATION ]
5 then
6   LOCATION="gnunet-config"
7 fi
8 $LOCATION --version
9 if test $? != 0
10 then
11         echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" 
12         exit 77
13 fi
14
15 trap "gnunet-arm -e -c test_gns_lookup.conf" SIGINT
16 ME=`whoami`
17 if [ "$ME" != "root" ]
18 then
19   echo "This test only works if run as root.  Skipping."
20   exit 77
21 fi
22 export PATH=".:$PATH"
23 gnunet-service-gns -c gns.conf &
24 sleep 1
25 LO=`nslookup alice.gnu | grep Address | tail -n1`
26 if [ "$LO" != "Address: 1.2.3.4" ]
27 then
28  echo "Fail: $LO"
29 fi
30 LO=`nslookup www.bob.gnu | grep Address | tail -n1`
31 if [ "$LO" != "Address: 4.5.6.7" ]
32 then
33   echo "Fail: $LO"
34 fi
35 kill `jobs -p`