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