diff options
author | rexxnor <rexxnor+gnunet@brief.li> | 2020-01-30 10:48:04 +0100 |
---|---|---|
committer | rexxnor <rexxnor+gnunet@brief.li> | 2020-01-30 10:48:04 +0100 |
commit | 015cd279bf43981c9edae0d0b2802d6237d172b8 (patch) | |
tree | d64b46dd6589768c20dc826dde9cbdb2d04980c0 /src/gns/test_dns2gns.sh | |
parent | 722119a361fac268c08f5fa0ec7199a40e64cbbc (diff) | |
download | gnunet-015cd279bf43981c9edae0d0b2802d6237d172b8.tar.gz gnunet-015cd279bf43981c9edae0d0b2802d6237d172b8.zip |
added testing scripts for dns2gns
Diffstat (limited to 'src/gns/test_dns2gns.sh')
-rw-r--r-- | src/gns/test_dns2gns.sh | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/src/gns/test_dns2gns.sh b/src/gns/test_dns2gns.sh new file mode 100644 index 000000000..295bcc766 --- /dev/null +++ b/src/gns/test_dns2gns.sh | |||
@@ -0,0 +1,50 @@ | |||
1 | #!/bin/bash | ||
2 | # This file is in the public domain. | ||
3 | trap "gnunet-arm -e -c test_dns2gns.conf" INT | ||
4 | which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 30" | ||
5 | |||
6 | LOCATION=$(which gnunet-config) | ||
7 | if [ -z $LOCATION ] | ||
8 | then | ||
9 | LOCATION="gnunet-config" | ||
10 | fi | ||
11 | $LOCATION --version 1> /dev/null | ||
12 | if test $? != 0 | ||
13 | then | ||
14 | echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" | ||
15 | exit 77 | ||
16 | fi | ||
17 | |||
18 | rm -rf `gnunet-config -c test_dns2gns.conf -f -s paths -o GNUNET_TEST_HOME` | ||
19 | MY_EGO="localego" | ||
20 | TEST_IP="127.0.0.1" | ||
21 | TEST_IPV6="dead::beef" | ||
22 | LABEL="fnord" | ||
23 | TEST_DOMAIN="gnunet.org" | ||
24 | |||
25 | gnunet-arm -s -c test_dns2gns.conf | ||
26 | PKEY=`gnunet-identity -V -C $MY_EGO -c test_dns2gns.conf` | ||
27 | gnunet-namestore -p -z $MY_EGO -a -n $LABEL -t A -V $TEST_IP -e 3600s -c test_dns2gns.conf | ||
28 | gnunet-namestore -p -z $MY_EGO -a -n $LABEL -t AAAA -V $TEST_IPV6 -e 3600s -c test_dns2gns.conf | ||
29 | |||
30 | # FIXME resolution works but always returns all available records | ||
31 | # also, the records seem to be returned twice if using GNS | ||
32 | |||
33 | if nslookup -port=12000 $LABEL.$PKEY localhost && nslookup -port=12000 $LABEL.$MY_EGO localhost; then | ||
34 | echo "PASS: GNS records can be resolved using dns2gns bridge" | ||
35 | else | ||
36 | echo "FAIL: GNS records can't be resolved using dns2gns bridge" | ||
37 | rm -rf `gnunet-config -c test_dns2gns.conf -f -s paths -o GNUNET_TEST_HOME` | ||
38 | exit 1 | ||
39 | fi | ||
40 | |||
41 | if nslookup -port=12000 gnunet.org localhost; then | ||
42 | echo "PASS: DNS records can be resolved using dns2gns bridge" | ||
43 | else | ||
44 | echo "FAIL: DNS records can't be resolved using dns2gns bridge" | ||
45 | rm -rf `gnunet-config -c test_dns2gns.conf -f -s paths -o GNUNET_TEST_HOME` | ||
46 | exit 1 | ||
47 | fi | ||
48 | gnunet-arm -e -c test_dns2gns.conf | ||
49 | |||
50 | rm -rf `gnunet-config -c test_dns2gns.conf -f -s paths -o GNUNET_TEST_HOME` | ||