clean up zone iteration logic
[oweals/gnunet.git] / src / namestore / test_namestore_delete.sh
index 8dabf1441685009eb5a3f9b554b6e890990a9855..8c776104a7b23565ab457278c47fc368455b5826 100755 (executable)
@@ -1,7 +1,20 @@
 #!/bin/bash
-CONFIGURATION="test_namestore_defaults.conf"
+CONFIGURATION="test_namestore_api.conf"
 trap "gnunet-arm -e -c $CONFIGURATION" SIGINT
-rm -rf `gnunet-config -c $CONFIGURATION -s PATHS -o SERVICEHOME`
+
+LOCATION=$(which gnunet-config)
+if [ -z $LOCATION ]
+then
+  LOCATION="gnunet-config"
+fi
+$LOCATION --version 1> /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 `$LOCATION -c $CONFIGURATION -s PATHS -o GNUNET_HOME`
 TEST_DOMAIN_PLUS="www.gnu"
 TEST_DOMAIN_DNS="www3.gnu"
 TEST_IP_PLUS="127.0.0.1"
@@ -17,7 +30,7 @@ which timeout &> /dev/null && DO_TIMEOUT="timeout 5"
 function start_peer
 {
        gnunet-arm -s -c $CONFIGURATION
-       gnunet-identity -C testego -c $CONFIGURATION    
+       gnunet-identity -C testego -c $CONFIGURATION
 }
 
 function stop_peer
@@ -32,8 +45,8 @@ start_peer
 gnunet-namestore -p -z testego -a -n $TEST_RECORD_NAME_DNS -t A -V $TEST_IP_PLUS -e never -c $CONFIGURATION
 # Delete record
 gnunet-namestore -p -z testego -d -n $TEST_RECORD_NAME_DNS -t A -V $TEST_IP_PLUS -e never -c $CONFIGURATION
-# Lookup specific name
-OUTPUT=`gnunet-namestore -p -z testego -n $TEST_RECORD_NAME_DNS -D`
+# List all records
+OUTPUT=`gnunet-namestore -p -z testego -D`
 FOUND_IP=false
 FOUND_NAME=false
 for LINE in $OUTPUT ;
@@ -43,7 +56,7 @@ for LINE in $OUTPUT ;
        fi
        if echo "$LINE" | grep -q "$TEST_IP_PLUS"; then
                FOUND_IP=true;
-       fi      
+       fi
  done
 stop_peer