gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] [gnunet] 05/06: add test for gns2dns records pointing to DN


From: gnunet
Subject: [GNUnet-SVN] [gnunet] 05/06: add test for gns2dns records pointing to DNS name
Date: Sun, 20 May 2018 19:06:53 +0200

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository gnunet.

commit bd4d98e353daae5820c7afd32f651c1e5e0876b8
Author: Christian Grothoff <address@hidden>
AuthorDate: Sun May 20 18:55:54 2018 +0200

    add test for gns2dns records pointing to DNS name
---
 src/gns/test_gns_gns2dns_cname_lookup.sh | 89 ++++++++++++++++++++++++++++++++
 1 file changed, 89 insertions(+)

diff --git a/src/gns/test_gns_gns2dns_cname_lookup.sh 
b/src/gns/test_gns_gns2dns_cname_lookup.sh
new file mode 100755
index 000000000..32e730d4c
--- /dev/null
+++ b/src/gns/test_gns_gns2dns_cname_lookup.sh
@@ -0,0 +1,89 @@
+#!/bin/bash
+trap "gnunet-arm -e -c test_gns_lookup.conf" SIGINT
+
+LOCATION=$(which gnunet-config)
+if [ -z $LOCATION ]
+then
+  LOCATION="gnunet-config"
+fi
+$LOCATION --version 1> /dev/null
+if test $? != 0
+then
+       echo "GNUnet command line tools cannot be found, check environmental 
variables PATH and GNUNET_PREFIX"
+       exit 77
+fi
+
+rm -rf `gnunet-config -c test_gns_lookup.conf -f -s paths -o GNUNET_TEST_HOME`
+# IP address of 'www.gnunet.org'
+TEST_IP="131.159.74.67"
+# IPv6 address of 'gnunet.org'
+TEST_IP6="2001:4ca0:2001:42:225:90ff:fe6b:d60"
+
+# main label used during resolution
+TEST_RECORD_NAME="homepage"
+
+XNS=ns.joker.com
+
+if ! nslookup gnunet.org a.$XNS &> /dev/null
+then
+  echo "Cannot reach DNS, skipping test"
+  exit 77
+fi
+
+# helper record for pointing to the DNS resolver
+TEST_RESOLVER_LABEL="resolver"
+# GNS2DNS record value: delegate to DNS domain 'gnunet.org'
+# using the TEST_RESOLVER_LABEL DNS server for resolution
+TEST_RECORD_GNS2DNS1="address@hidden"
+TEST_RECORD_GNS2DNS2="address@hidden"
+TEST_RECORD_GNS2DNS3="address@hidden"
+
+MY_EGO="myego"
+# various names we will use for resolution
+TEST_DOMAIN="www.${TEST_RECORD_NAME}.$MY_EGO"
+
+gnunet-arm -s -c test_gns_lookup.conf
+gnunet-identity -C $MY_EGO -c test_gns_lookup.conf
+
+# set IP address for DNS resolver for resolving in gnunet.org domain
+# map '$TEST_RECORD_NAME.$MY_EGO' to 'gnunet.org' in DNS
+gnunet-namestore -p -z $MY_EGO -a -n $TEST_RECORD_NAME -t GNS2DNS -V 
$TEST_RECORD_GNS2DNS1 -e never -c test_gns_lookup.conf
+gnunet-namestore -p -z $MY_EGO -a -n $TEST_RECORD_NAME -t GNS2DNS -V 
$TEST_RECORD_GNS2DNS2 -e never -c test_gns_lookup.conf
+gnunet-namestore -p -z $MY_EGO -a -n $TEST_RECORD_NAME -t GNS2DNS -V 
$TEST_RECORD_GNS2DNS3 -e never -c test_gns_lookup.conf
+
+which timeout &> /dev/null && DO_TIMEOUT="timeout 15"
+
+echo "EGOs:"
+gnunet-identity -d
+
+# lookup 'www.gnunet.org', IPv4
+RES_IP=`$DO_TIMEOUT gnunet-gns --raw -u $TEST_DOMAIN -t A -c 
test_gns_lookup.conf`
+# lookup 'www.gnunet.org', IPv6
+RES_IP6=`$DO_TIMEOUT gnunet-gns --raw -u $TEST_DOMAIN -t AAAA -c 
test_gns_lookup.conf`
+
+# clean up
+gnunet-namestore -z $MY_EGO -d -n $TEST_RECORD_NAME -t GNS2DNS -V 
$TEST_RECORD_GNS2DNS1 -e never -c test_gns_lookup.conf
+gnunet-namestore -z $MY_EGO -d -n $TEST_RECORD_NAME -t GNS2DNS -V 
$TEST_RECORD_GNS2DNS2 -e never -c test_gns_lookup.conf
+gnunet-namestore -z $MY_EGO -d -n $TEST_RECORD_NAME -t GNS2DNS -V 
$TEST_RECORD_GNS2DNS3 -e never -c test_gns_lookup.conf
+gnunet-identity -D $MY_EGO -c test_gns_lookup.conf
+gnunet-arm -e -c test_gns_lookup.conf
+rm -rf `gnunet-config -c test_gns_lookup.conf -f -s paths -o GNUNET_TEST_HOME`
+
+ret=0
+if [ "$RES_IP" == "$TEST_IP" ]
+then
+  echo "PASS: Resolved $TEST_DOMAIN to $RES_IP."
+else
+  echo "Failed to resolve to proper IP for $TEST_DOMAIN, got $RES_IP, wanted 
$TEST_IP."
+  ret=1
+fi
+
+if [ "$RES_IP6" == "$TEST_IP6" ]
+then
+  echo "PASS: Resolved $TEST_DOMAIN to $RES_IP6."
+else
+  echo "Failed to resolve to proper IP for $TEST_DOMAIN, got $RES_IP6, wanted 
$TEST_IP6."
+  ret=1
+fi
+
+exit $ret

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]