X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=src%2Fgns%2Ftest_gns_gns2dns_lookup.sh;h=f7299a57d3bf1d93874663c1604693c93545de91;hb=f9d80e03e9eb5d7956d60b8b7db2c36fd0be7b9e;hp=96505e9e2fb2630ddae3ff14048332e183b7c3c5;hpb=0339fb1c3eb6daeda7f1904815d8eb0101203567;p=oweals%2Fgnunet.git diff --git a/src/gns/test_gns_gns2dns_lookup.sh b/src/gns/test_gns_gns2dns_lookup.sh index 96505e9e2..f7299a57d 100755 --- a/src/gns/test_gns_gns2dns_lookup.sh +++ b/src/gns/test_gns_gns2dns_lookup.sh @@ -6,14 +6,14 @@ if [ -z $LOCATION ] then LOCATION="gnunet-config" fi -$LOCATION --version +$LOCATION --version 1> /dev/null if test $? != 0 then - echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" + echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" exit 77 fi -rm -r `gnunet-config -c test_gns_lookup.conf -s PATHS -o GNUNET_HOME -f` +rm -r rm -rf /tmp/test-gnunet-gns-peer-1/ # IP address of 'uk.gnunet.org' TEST_IP_ALT2="81.187.252.184" # IP address of 'www.gnunet.org' @@ -33,7 +33,7 @@ TEST_DOMAIN_ALT2="uk.${TEST_RECORD_NAME}.gnu" if ! nslookup gnunet.org $TEST_IP_GNS2DNS &> /dev/null then echo "Cannot reach DNS, skipping test" - exit 0 + exit 77 fi # helper record for pointing to the DNS resolver @@ -50,20 +50,24 @@ gnunet-namestore -p -z testego -a -n $TEST_RESOLVER_LABEL -t A -V $TEST_IP_GNS2D # map 'homepage.gnu' to 'gnunet.org' in DNS gnunet-namestore -p -z testego -a -n $TEST_RECORD_NAME -t GNS2DNS -V $TEST_RECORD_GNS2DNS -e never -c test_gns_lookup.conf +which timeout &> /dev/null && DO_TIMEOUT="timeout 15" + # lookup 'www.gnunet.org', IPv4 -RES_IP=$(timeout 5 gnunet-gns --raw -z testego -u $TEST_DOMAIN -t A -c test_gns_lookup.conf) +RES_IP=`$DO_TIMEOUT gnunet-gns --raw -z testego -u $TEST_DOMAIN -t A -c test_gns_lookup.conf` # lookup 'www.gnunet.org', IPv6 -RES_IP6=$(timeout 5 gnunet-gns --raw -z testego -u $TEST_DOMAIN -t AAAA -c test_gns_lookup.conf) +RES_IP6=`$DO_TIMEOUT gnunet-gns --raw -z testego -u $TEST_DOMAIN -t AAAA -c test_gns_lookup.conf` # lookup 'gnunet.org', IPv4 -RES_IP_ALT=$(timeout 5 gnunet-gns --raw -z testego -u $TEST_DOMAIN_ALT -t A -c test_gns_lookup.conf) +RES_IP_ALT=`$DO_TIMEOUT gnunet-gns --raw -z testego -u $TEST_DOMAIN_ALT -t A -c test_gns_lookup.conf` # lookup 'uk.gnunet.org', IPv4 -RES_IP_ALT2=$(timeout 5 gnunet-gns --raw -z testego -u $TEST_DOMAIN_ALT2 -t A -c test_gns_lookup.conf) +RES_IP_ALT2=`$DO_TIMEOUT gnunet-gns --raw -z testego -u $TEST_DOMAIN_ALT2 -t A -c test_gns_lookup.conf` # clean up gnunet-namestore -z testego -d -n $TEST_RESOLVER_LABEL -t A -V $TEST_IP_GNS2DNS -e never -c test_gns_lookup.conf gnunet-namestore -z testego -d -n $TEST_RECORD_NAME -t GNS2DNS -V $TEST_RECORD_GNS2DNS -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/ + ret=0 if [ "$RES_IP" == "$TEST_IP" ] then