513e557a45106b112627137e74b6427c82eb0368
[oweals/gnunet.git] / src / gns / test_gns_soa_lookup.sh
1 #!/bin/bash
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="homepage.gnu"
5 TEST_IP_GNS2DNS="184.172.157.218"
6 TEST_RECORD_NAME="homepage"
7 TEST_RECORD_GNS2DNS="gnunet.org"
8 gnunet-arm -s -c test_gns_lookup.conf
9 gnunet-identity -C testego -c test_gns_lookup.conf
10 gnunet-namestore -p -z testego -a -n $TEST_RECORD_NAME -t A -V $TEST_IP_GNS2DNS -e never -c test_gns_lookup.conf
11 gnunet-namestore -p -z testego -a -n $TEST_RECORD_NAME -t GNS2DNS -V $TEST_RECORD_GNS2DNS -e never -c test_gns_lookup.conf
12 RES_SOA=$(timeout 5 gnunet-gns --raw -z testego -u $TEST_DOMAIN -t SOA -c test_gns_lookup.conf)
13 gnunet-namestore -z testego -d -n $TEST_RECORD_NAME -t A -V $TEST_IP_GNS2DNS -e never -c test_gns_lookup.conf
14 gnunet-namestore -z testego -d -n $TEST_RECORD_NAME -t GNS2DNS -V $TEST_RECORD_GNS2DNS -e never -c test_gns_lookup.conf &> /dev/null
15 gnunet-identity -D testego -c test_gns_lookup.conf
16 gnunet-arm -e -c test_gns_lookup.conf
17
18 if [ "x$RES_SOA" != "x" ]
19 then
20   echo "PASS: Resolved SOA for $TEST_DOMAIN to $RES_SOA."
21   exit 0
22 else
23   echo "Failed to resolve to proper SOA for $TEST_DOMAIN, got no result."
24   exit 1
25 fi