fix #5238
authorChristian Grothoff <christian@grothoff.org>
Fri, 12 Jan 2018 11:03:49 +0000 (12:03 +0100)
committerChristian Grothoff <christian@grothoff.org>
Fri, 12 Jan 2018 11:03:56 +0000 (12:03 +0100)
src/dht/gnunet-dht-get.c
src/dht/test_dht_tools.conf [new file with mode: 0644]
src/dht/test_dht_tools.sh

index e361df3361b4784e4e77fb8131745693eed15c05..842ec6270e92273149cdfde5be6e2995aa3eb699 100644 (file)
@@ -238,37 +238,32 @@ main (int argc, char *const *argv)
 {
 
   struct GNUNET_GETOPT_CommandLineOption options[] = {
-  
+
     GNUNET_GETOPT_option_string ('k',
                                  "key",
                                  "KEY",
                                  gettext_noop ("the query key"),
                                  &query_key),
-  
+
     GNUNET_GETOPT_option_uint ('r',
-                                   "replication",
-                                   "LEVEL",
-                                   gettext_noop ("how many parallel requests (replicas) to create"),
-                                   &replication),
-  
-  
+                               "replication",
+                               "LEVEL",
+                               gettext_noop ("how many parallel requests (replicas) to create"),
+                               &replication),
     GNUNET_GETOPT_option_uint ('t',
-                                   "type",
-                                   "TYPE",
-                                   gettext_noop ("the type of data to look for"),
-                                   &query_type),
-  
+                               "type",
+                               "TYPE",
+                               gettext_noop ("the type of data to look for"),
+                               &query_type),
     GNUNET_GETOPT_option_relative_time ('T',
-                                            "timeout",
-                                            "TIMEOUT",
-                                            gettext_noop ("how long to execute this query before giving up?"),
-                                            &timeout_request),
-  
+                                        "timeout",
+                                        "TIMEOUT",
+                                        gettext_noop ("how long to execute this query before giving up?"),
+                                        &timeout_request),
     GNUNET_GETOPT_option_flag ('x',
-                                  "demultiplex",
-                                  gettext_noop ("use DHT's demultiplex everywhere option"),
-                                  &demultixplex_everywhere),
-  
+                               "demultiplex",
+                               gettext_noop ("use DHT's demultiplex everywhere option"),
+                               &demultixplex_everywhere),
     GNUNET_GETOPT_option_verbose (&verbose),
     GNUNET_GETOPT_OPTION_END
   };
diff --git a/src/dht/test_dht_tools.conf b/src/dht/test_dht_tools.conf
new file mode 100644 (file)
index 0000000..9306c5d
--- /dev/null
@@ -0,0 +1,157 @@
+[dhtcache]
+QUOTA = 1 MB
+DATABASE = heap
+
+[transport]
+PLUGINS = tcp
+ACCEPT_FROM6 = ::1;
+ACCEPT_FROM = 127.0.0.1;
+NEIGHBOUR_LIMIT = 50
+PORT = 12365
+
+[ats]
+WAN_QUOTA_IN = 1 GB
+WAN_QUOTA_OUT = 1 GB
+
+[transport-tcp]
+TIMEOUT = 300 s
+BINDTO = 127.0.0.1
+
+[PATHS]
+GNUNET_TEST_HOME = /tmp/test-gnunet-dht-peer-1/
+
+[nat]
+DISABLEV6 = YES
+ENABLE_UPNP = NO
+BEHIND_NAT = NO
+ALLOW_NAT = NO
+INTERNAL_ADDRESS = 127.0.0.1
+EXTERNAL_ADDRESS = 127.0.0.1
+USE_LOCALADDR = NO
+
+[dht]
+AUTOSTART = YES
+FORCESTART = YES
+
+[nse]
+AUTOSTART = YES
+WORKBITS = 1
+# Configuration to disable autostarting of
+# all services above the 'core' level.
+# (including resolver)
+
+[dns]
+AUTOSTART = NO
+
+[cadet]
+AUTOSTART = NO
+
+[datastore]
+AUTOSTART = NO
+
+[fs]
+AUTOSTART = NO
+
+[dv]
+AUTOSTART = NO
+
+[vpn]
+AUTOSTART = NO
+
+[consensus]
+AUTOSTART = NO
+
+[resolver]
+AUTOSTART = NO
+
+[namestore]
+AUTOSTART = NO
+
+[namecache]
+AUTOSTART = NO
+
+[identity]
+AUTOSTART = NO
+
+[revocation]
+AUTOSTART = NO
+
+[conversation]
+AUTOSTART = NO
+
+[peerstore]
+AUTOSTART = NO
+
+[psycstore]
+AUTOSTART = NO
+
+[gns]
+AUTOSTART = NO
+
+[regex]
+AUTOSTART = NO
+
+[set]
+AUTOSTART = NO
+
+[scalarproduct-bob]
+AUTOSTART = NO
+
+[scalarproduct-alice]
+AUTOSTART = NO
+
+[social]
+AUTOSTART = NO
+
+[psyc]
+AUTOSTART = NO
+
+[rps]
+AUTOSTART = NO
+
+[multicast]
+AUTOSTART = NO
+
+[sensordashboard]
+AUTOSTART = NO
+
+[sensor]
+AUTOSTART = NO
+# Configuration file that can be included to prevent ANY of the usual
+# FORCESTART = YES to be set.  Also disables NSE POW calculation.
+#
+# This configuration is included from various configuration test files.
+# Whenever a new service is added that has FORCESTART = YES for
+# production should be disabled for (most) test suites, the option should
+# be added here instead of all over the place ;-).
+
+[core]
+FORCESTART = NO
+
+[fs]
+FORCESTART = NO
+
+[dht]
+FORCESTART = NO
+
+[cadet]
+FORCESTART = NO
+
+[nse]
+FORCESTART = NO
+WORKBITS = 0
+
+[revocation]
+FORCESTART = NO
+
+[topology]
+FORCESTART = NO
+
+[hostlist]
+FORCESTART = NO
+
+[gns]
+FORCESTART = NO
+
+[zonemaster]
+FORCESTART = NO
\ No newline at end of file
index f83c26a1a615272be4f19e7fa920e3fc28e9532a..56cc99e157ed0a1b4acdc2924540156f977e7c39 100755 (executable)
@@ -1,7 +1,8 @@
 #!/bin/sh
+# This file is in the public domain.
 
 out=`mktemp /tmp/test-gnunet-dht-logXXXXXXXX`
-tempcfg=`mktemp /tmp/test_dht_api_peer1.XXXXXXXX`
+tempcfg=`mktemp /tmp/test-dht-tools.XXXXXXXX`
 checkout="check.out"
 armexe="gnunet-arm -c $tempcfg "
 putexe="gnunet-dht-put -c $tempcfg "
@@ -19,16 +20,7 @@ stop_arm()
   rm -f $out $tempcfg
 }
 
-cp test_dht_api_peer1.conf $tempcfg
-
-echo -n "TEST: Generating hostkey..."
-if ! $peerinfo > $out ; then
-  echo "FAIL: error running $peerinfo"
-  echo "Command output was:"
-  cat $out 
-  exit 1
-fi
-echo "PASS"
+cp test_dht_tools.conf $tempcfg
 
 echo -n "TEST: Starting ARM..."
 if ! $armexe $DEBUG -s > $out ; then
@@ -39,7 +31,6 @@ if ! $armexe $DEBUG -s > $out ; then
   exit 1
 fi
 echo "PASS"
-sleep 1
 
 echo -n "TEST: Testing put..."
 if ! $putexe -k testkey -d testdata -t 8 > $out ; then
@@ -50,13 +41,12 @@ if ! $putexe -k testkey -d testdata -t 8 > $out ; then
   exit 1
 fi
 echo "PASS"
-sleep 1
 
 echo -n "TEST: Testing get..."
 echo "Result 0, type 8:" > $checkout
 echo "testdata" >> $checkout
 
-if ! $getexe -k testkey -T 5 -t 8 > $out ; then
+if ! $getexe -k testkey -T 100ms -t 8 > $out ; then
   echo "FAIL: error running $putexe"
   echo "Command output was:"
   cat $out
@@ -65,7 +55,8 @@ if ! $getexe -k testkey -T 5 -t 8 > $out ; then
 fi
 
 if ! diff --strip-trailing-cr -q $out $checkout ; then
-  echo "FAIL: $out and $checkout differ"
+  echo "FAIL: $out and $checkout differ:"
+  diff --strip-trailing-cr $out $checkout
   stop_arm
   exit 1
 fi