From 2dd837124cd405982b0fcfa0057a688e2f34ab9d Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Fri, 12 Jan 2018 12:03:49 +0100 Subject: [PATCH] fix #5238 --- src/dht/gnunet-dht-get.c | 39 ++++----- src/dht/test_dht_tools.conf | 157 ++++++++++++++++++++++++++++++++++++ src/dht/test_dht_tools.sh | 21 ++--- 3 files changed, 180 insertions(+), 37 deletions(-) create mode 100644 src/dht/test_dht_tools.conf diff --git a/src/dht/gnunet-dht-get.c b/src/dht/gnunet-dht-get.c index e361df336..842ec6270 100644 --- a/src/dht/gnunet-dht-get.c +++ b/src/dht/gnunet-dht-get.c @@ -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 index 000000000..9306c5dc9 --- /dev/null +++ b/src/dht/test_dht_tools.conf @@ -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 diff --git a/src/dht/test_dht_tools.sh b/src/dht/test_dht_tools.sh index f83c26a1a..56cc99e15 100755 --- a/src/dht/test_dht_tools.sh +++ b/src/dht/test_dht_tools.sh @@ -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 -- 2.25.1