2 # This file is in the public domain.
3 trap "gnunet-arm -e -c test_gns_lookup.conf" SIGINT
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"
24 TEST_RECORD_NAME="homepage"
25 TEST_RECORD_GNS2DNS="gnunet.org"
27 if ! nslookup $TEST_RECORD_GNS2DNS $TEST_IP_GNS2DNS > /dev/null 2>&1
29 echo "Cannot reach DNS, skipping test"
33 gnunet-arm -s -c test_gns_lookup.conf
34 gnunet-identity -C $MY_EGO -c test_gns_lookup.conf
35 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
36 RES_SOA=`$DO_TIMEOUT gnunet-gns --raw -u $TEST_DOMAIN -t SOA -c test_gns_lookup.conf`
37 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
38 gnunet-identity -D $MY_EGO -c test_gns_lookup.conf
39 gnunet-arm -e -c test_gns_lookup.conf
40 rm -rf `gnunet-config -c test_gns_lookup.conf -f -s paths -o GNUNET_TEST_HOME`
42 if [ "x$RES_SOA" != "x" ]
44 echo "PASS: Resolved SOA for $TEST_DOMAIN to $RES_SOA."
47 echo "Failed to resolve to proper SOA for $TEST_DOMAIN, got no result."