diff options
Diffstat (limited to 'src/gns/test_gnunet_gns.sh.in')
-rwxr-xr-x | src/gns/test_gnunet_gns.sh.in | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/src/gns/test_gnunet_gns.sh.in b/src/gns/test_gnunet_gns.sh.in new file mode 100755 index 000000000..1c149b141 --- /dev/null +++ b/src/gns/test_gnunet_gns.sh.in | |||
@@ -0,0 +1,43 @@ | |||
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 | . @pkgdatadir@/existence.sh | ||
10 | |||
11 | LOCATION=`existence gnunet-config` | ||
12 | if test -z $LOCATION; then | ||
13 | LOCATION="gnunet-config" | ||
14 | fi | ||
15 | $LOCATION --version | ||
16 | if test $? != 0 | ||
17 | then | ||
18 | echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" | ||
19 | exit 77 | ||
20 | fi | ||
21 | |||
22 | trap "gnunet-arm -e -c test_gns_lookup.conf" SIGINT | ||
23 | ME=`whoami` | ||
24 | if [ "$ME" != "root" ] | ||
25 | then | ||
26 | echo "This test only works if run as root. Skipping." | ||
27 | exit 77 | ||
28 | fi | ||
29 | export PATH=".:$PATH" | ||
30 | gnunet-service-gns -c gns.conf & | ||
31 | sleep 1 | ||
32 | LO=`nslookup alice.gnu | grep Address | tail -n1` | ||
33 | if [ "$LO" != "Address: 1.2.3.4" ] | ||
34 | then | ||
35 | echo "Fail: $LO" | ||
36 | fi | ||
37 | LO=`nslookup www.bob.gnu | grep Address | tail -n1` | ||
38 | if [ "$LO" != "Address: 4.5.6.7" ] | ||
39 | then | ||
40 | echo "Fail: $LO" | ||
41 | fi | ||
42 | # XXX: jobs. a builtin by bash, netbsd sh, maybe leave it be for now. | ||
43 | kill `jobs -p` | ||