2 trap "gnunet-arm -e -c test_gns_lookup.conf" SIGINT
3 which timeout &> /dev/null && DO_TIMEOUT="timeout 5"
7 TEST_NAME="www.mybestfriendalice.gnu"
8 TEST_NAME_SHORT="www.alice.short.gnu"
9 gnunet-arm -s -c test_gns_lookup.conf
10 DELEGATED_PKEY=$(gnunet-identity -d -c test_gns_lookup.conf | grep delegatedego | awk '{print $3}')
11 gnunet-identity -c test_gns_lookup.conf -d
12 gnunet-identity -C short-zone -c test_gns_lookup.conf
13 gnunet-identity -C delegatedego -c test_gns_lookup.conf
14 gnunet-identity -e short-zone -s gns-short -c test_gns_lookup.conf
15 gnunet-identity -C testego -c test_gns_lookup.conf -c test_gns_lookup.conf
16 DELEGATED_PKEY=$(gnunet-identity -d -c test_gns_lookup.conf | grep delegatedego | awk '{print $3}')
17 SHORT=$(gnunet-identity -c test_gns_lookup.conf -d | grep short-zone | awk '{print $3}')
18 gnunet-namestore -p -z testego -a -n mybestfriendalice -t PKEY -V $DELEGATED_PKEY -e never -c test_gns_lookup.conf
19 gnunet-namestore -p -z testego -a -n short -t PKEY -V $SHORT -e never -c test_gns_lookup.conf
20 gnunet-namestore -p -z delegatedego -a -n www -t A -V $TEST_IP -e never -c test_gns_lookup.conf
21 gnunet-namestore -p -z delegatedego -a -n "+" -t PSEU -V $TEST_PSEU -e never -c test_gns_lookup.conf
22 RES_IP=`$DO_TIMEOUT gnunet-gns --raw -z testego -u $TEST_NAME -t A -c test_gns_lookup.conf`
23 RES_IP_PSEU=`$DO_TIMEOUT gnunet-gns --raw -z testego -u www.alice.short.gnu -t A -c test_gns_lookup.conf`
24 gnunet-namestore -z testego -d -n b -t PKEY -V $DELEGATED_PKEY -e never -c test_gns_lookup.conf
25 gnunet-namestore -z delegatedego -d -n www -t A -V $TEST_IP -e never -c test_gns_lookup.conf
26 gnunet-arm -e -c test_gns_lookup.conf
28 if [ "$RES_IP" == "$TEST_IP" ]
30 echo "$TEST_NAME resolved , got $RES_IP."
32 echo "Failed to resolve $TEST_NAME to proper IP, got $RES_IP."
36 if [ "$RES_IP_PSEU" == "$TEST_IP" ]
38 echo "$TEST_NAME_SHORT resolved , got $RES_IP."
41 echo "Failed to resolve $TEST_NAME_SHORT to proper IP, got $RES_IP_PSEU."