X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=src%2Fgns%2Ftest_gns_cname_lookup.sh;h=00614f0382975e70fa41df84c8215120bb072cbe;hb=ea8c85c55b9df1b491713b79bb221b7476949742;hp=14e14c5703d56dc744fa0c9bb0e79ab4367b0213;hpb=02e344b557bfb88630df2c6d04f028c602f0f009;p=oweals%2Fgnunet.git diff --git a/src/gns/test_gns_cname_lookup.sh b/src/gns/test_gns_cname_lookup.sh index 14e14c570..00614f038 100755 --- a/src/gns/test_gns_cname_lookup.sh +++ b/src/gns/test_gns_cname_lookup.sh @@ -1,6 +1,20 @@ #!/bin/bash trap "gnunet-arm -e -c test_gns_lookup.conf" SIGINT -rm -rf `gnunet-config -c test_gns_lookup.conf -s PATHS -o SERVICEHOME` + +LOCATION=$(which gnunet-config) +if [ -z $LOCATION ] +then + LOCATION="gnunet-config" +fi +$LOCATION --version &> /dev/null +if test $? != 0 +then + echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" + exit 77 +fi + +rm -rf /tmp/test-gnunet-gns-peer-1/ + TEST_DOMAIN_PLUS="www.gnu" TEST_DOMAIN_DNS="www3.gnu" TEST_IP_PLUS="127.0.0.1" @@ -19,12 +33,23 @@ gnunet-namestore -p -z testego -a -n $TEST_RECORD_NAME_DNS -t CNAME -V $TEST_REC gnunet-namestore -p -z testego -a -n $TEST_RECORD_NAME_PLUS -t CNAME -V $TEST_RECORD_CNAME_PLUS -e never -c test_gns_lookup.conf gnunet-namestore -p -z testego -a -n $TEST_RECORD_CNAME_SERVER -t A -V $TEST_IP_PLUS -e never -c test_gns_lookup.conf RES_CNAME=`$DO_TIMEOUT gnunet-gns --raw -z testego -u www.gnu -t A -c test_gns_lookup.conf` +RES_CNAME_RAW=`$DO_TIMEOUT gnunet-gns --raw -z testego -u www.gnu -t CNAME -c test_gns_lookup.conf` RES_CNAME_DNS=`$DO_TIMEOUT gnunet-gns --raw -z testego -u www3.gnu -t A -c test_gns_lookup.conf` +TESTEGOZONE=`gnunet-identity -c test_gns_lookup.conf -d | awk '{print $3}'` gnunet-namestore -p -z testego -d -n $TEST_RECORD_NAME_DNS -t CNAME -V $TEST_RECORD_CNAME_DNS -e never -c test_gns_lookup.conf gnunet-namestore -p -z testego -d -n $TEST_RECORD_NAME_PLUS -t CNAME -V $TEST_RECORD_CNAME_PLUS -e never -c test_gns_lookup.conf gnunet-namestore -p -z testego -d -n $TEST_RECORD_CNAME_SERVER -t A -V $TEST_IP_PLUS -e never -c test_gns_lookup.conf gnunet-identity -D testego -c test_gns_lookup.conf gnunet-arm -e -c test_gns_lookup.conf +rm -rf /tmp/test-gnunet-gns-peer-1/ + +if [ "$RES_CNAME_RAW" == "server.$TESTEGOZONE.zkey" ] +then + echo "PASS: CNAME resulution from GNS" +else + echo "FAIL: CNAME resolution from GNS, got $RES_CNAME_RAW." + exit 1 +fi if [ "$RES_CNAME" == "$TEST_IP_PLUS" ] then