2 # This file is in the public domain.
3 trap "gnunet-arm -e -c test_gns_lookup.conf" INT
5 LOCATION=$(which gnunet-config)
8 LOCATION="gnunet-config"
10 $LOCATION --version 1> /dev/null
13 echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX"
17 which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 5"
19 rm -rf `gnunet-config -c test_gns_lookup.conf -f -s paths -o GNUNET_TEST_HOME`
21 TEST_DOMAIN="homepage.$MY_EGO"
22 # some public DNS resolver we can use
23 #TEST_IP_GNS2DNS="184.172.157.218" # This one seems currently down.
24 TEST_IP_GNS2DNS="8.8.8.8"
25 TEST_RECORD_NAME="homepage"
26 TEST_RECORD_GNS2DNS="gnunet.org"
28 if ! nslookup $TEST_RECORD_GNS2DNS $TEST_IP_GNS2DNS > /dev/null 2>&1
30 echo "Cannot reach DNS, skipping test"
34 gnunet-arm -s -c test_gns_lookup.conf
35 gnunet-identity -C $MY_EGO -c test_gns_lookup.conf
36 gnunet-namestore -p -z $MY_EGO -a -n $TEST_RECORD_NAME -t GNS2DNS -V ${TEST_RECORD_GNS2DNS}@${TEST_IP_GNS2DNS} -e never -c test_gns_lookup.conf
37 RES_SOA=`$DO_TIMEOUT gnunet-gns --raw -u $TEST_DOMAIN -t SOA -c test_gns_lookup.conf`
38 gnunet-namestore -z $MY_EGO -d -n $TEST_RECORD_NAME -t GNS2DNS -V ${TEST_RECORD_GNS2DNS}@${TEST_IP_GNS2DNS} -e never -c test_gns_lookup.conf > /dev/null 2>&1
39 gnunet-identity -D $MY_EGO -c test_gns_lookup.conf
40 gnunet-arm -e -c test_gns_lookup.conf
41 rm -rf `gnunet-config -c test_gns_lookup.conf -f -s paths -o GNUNET_TEST_HOME`
43 if [ "x$RES_SOA" != "x" ]
45 echo "PASS: Resolved SOA for $TEST_DOMAIN to $RES_SOA."
48 echo "Failed to resolve to proper SOA for $TEST_DOMAIN, got no result."