2 trap "gnunet-arm -e -c test_gns_lookup.conf" SIGINT
3 rm -r `gnunet-config -c test_gns_lookup.conf -s PATHS -o GNUNET_HOME -f`
4 TEST_DOMAIN="www.homepage.gnu"
5 TEST_DOMAIN_ALT="homepage.gnu"
6 TEST_DOMAIN_ALT2="uk.homepage.gnu"
7 TEST_IP_ALT2="81.187.252.184"
8 TEST_IP="131.159.74.67"
9 TEST_IP6="2001:4ca0:2001:42:225:90ff:fe6b:d60"
10 TEST_IP_GNS2DNS="184.172.157.218"
11 TEST_RECORD_NAME="homepage"
12 TEST_RECORD_GNS2DNS="gnunet.org"
13 gnunet-arm -s -c test_gns_lookup.conf
14 gnunet-identity -C testego -c test_gns_lookup.conf
15 gnunet-namestore -p -z testego -a -n $TEST_RECORD_NAME -t A -V $TEST_IP_GNS2DNS -e never -c test_gns_lookup.conf
16 gnunet-namestore -p -z testego -a -n $TEST_RECORD_NAME -t GNS2DNS -V $TEST_RECORD_GNS2DNS -e never -c test_gns_lookup.conf
17 RES_IP=$(timeout 5 gnunet-gns --raw -z testego -u $TEST_DOMAIN -t A -c test_gns_lookup.conf)
18 RES_IP6=$(timeout 5 gnunet-gns --raw -z testego -u $TEST_DOMAIN -t AAAA -c test_gns_lookup.conf)
19 RES_IP_ALT=$(timeout 5 gnunet-gns --raw -z testego -u $TEST_DOMAIN_ALT -t A -c test_gns_lookup.conf)
20 RES_IP_ALT2=$(timeout 5 gnunet-gns --raw -z testego -u $TEST_DOMAIN_ALT2 -t A -c test_gns_lookup.conf)
21 gnunet-namestore -z testego -d -n www -t A -V $TEST_IP -e never -c test_gns_lookup.conf
22 gnunet-namestore -z testego -d -n $TEST_RECORD_NAME -t GNS2DNS -V $TEST_RECORD_GNS2DNS -e never -c test_gns_lookup.conf
23 gnunet-identity -D testego -c test_gns_lookup.conf
24 gnunet-arm -e -c test_gns_lookup.conf
26 if [ "$RES_IP" == "$TEST_IP" ]
28 echo "PASS: Resolved $TEST_DOMAIN to $RES_IP."
30 echo "Failed to resolve to proper IP for $TEST_DOMAIN, got $RES_IP, wanted $TEST_IP."
34 if [ "$RES_IP6" == "$TEST_IP6" ]
36 echo "PASS: Resolved $TEST_DOMAIN to $RES_IP6."
38 echo "Failed to resolve to proper IP for $TEST_DOMAIN, got $RES_IP6, wanted $TEST_IP6."
42 if [ "$RES_IP_ALT" == "$TEST_IP" ]
44 echo "PASS: Resolved $TEST_DOMAIN_ALT to $RES_IP_ALT."
46 echo "Failed to resolve to proper IP for $TEST_DOMAIN_ALT, got $RES_IP_ALT, wanted $TEST_IP."
50 if [ "$RES_IP_ALT2" == "$TEST_IP_ALT2" ]
52 echo "PASS: Resolved $TEST_DOMAIN_ALT2 to $RES_IP_ALT2."
55 echo "Failed to resolve to proper IP for $TEST_DOMAIN_ALT2, got $RES_IP_ALT2, wanted $TEST_IP_ALT2."