remove 'illegal' (non-reentrant) log logic from signal handler
[oweals/gnunet.git] / src / gns / test_gnunet_gns.sh.in
1 #!/bin/sh
2 # This file is in the public domain.
3 # test -z being correct was a false assumption here.
4 # I have no executable 'fooble', but this will
5 # return 1:
6 # if test -z "`which fooble`"; then echo 1; fi
7 # The command builtin might not work with busybox's ash
8 # but this works for now.
9 dir=$(dirname "$0")
10
11 if test -e @PKGDATADIRECTORY@/existence.sh
12 then
13     . @PKGDATADIRECTORY@/existence.sh
14 else
15     . $dir/../../contrib/build-common/sh/lib.sh/existence.sh
16 fi
17
18 LOCATION=`existence gnunet-config`
19 if test -z $LOCATION; then
20     LOCATION="gnunet-config"
21 fi
22 $LOCATION --version
23 if test $? != 0
24 then
25     echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX"
26     exit 77
27 fi
28
29 trap "gnunet-arm -e -c test_gns_lookup.conf" SIGINT
30 ME=`whoami`
31 if [ "$ME" != "root" ]
32 then
33   echo "This test only works if run as root.  Skipping."
34   exit 77
35 fi
36 export PATH=".:$PATH"
37 gnunet-service-gns -c gns.conf &
38 sleep 1
39 LO=`nslookup alice.gnu | grep Address | tail -n1`
40 if [ "$LO" != "Address: 1.2.3.4" ]
41 then
42  echo "Fail: $LO"
43 fi
44 LO=`nslookup www.bob.gnu | grep Address | tail -n1`
45 if [ "$LO" != "Address: 4.5.6.7" ]
46 then
47   echo "Fail: $LO"
48 fi
49 # XXX: jobs. a builtin by bash, netbsd sh, maybe leave it be for now.
50 kill `jobs -p`