aboutsummaryrefslogtreecommitdiff
path: root/src/dht
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2018-01-12 12:03:49 +0100
committerChristian Grothoff <christian@grothoff.org>2018-01-12 12:03:56 +0100
commit2dd837124cd405982b0fcfa0057a688e2f34ab9d (patch)
tree7a72181fab80df7fcdb413eaa75e95bb84d3c6f6 /src/dht
parentbca8edf17fc90862e7267ff22b70a1b7dc94ec96 (diff)
downloadgnunet-2dd837124cd405982b0fcfa0057a688e2f34ab9d.tar.gz
gnunet-2dd837124cd405982b0fcfa0057a688e2f34ab9d.zip
fix #5238
Diffstat (limited to 'src/dht')
-rw-r--r--src/dht/gnunet-dht-get.c39
-rw-r--r--src/dht/test_dht_tools.conf157
-rwxr-xr-xsrc/dht/test_dht_tools.sh21
3 files changed, 180 insertions, 37 deletions
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)
238{ 238{
239 239
240 struct GNUNET_GETOPT_CommandLineOption options[] = { 240 struct GNUNET_GETOPT_CommandLineOption options[] = {
241 241
242 GNUNET_GETOPT_option_string ('k', 242 GNUNET_GETOPT_option_string ('k',
243 "key", 243 "key",
244 "KEY", 244 "KEY",
245 gettext_noop ("the query key"), 245 gettext_noop ("the query key"),
246 &query_key), 246 &query_key),
247 247
248 GNUNET_GETOPT_option_uint ('r', 248 GNUNET_GETOPT_option_uint ('r',
249 "replication", 249 "replication",
250 "LEVEL", 250 "LEVEL",
251 gettext_noop ("how many parallel requests (replicas) to create"), 251 gettext_noop ("how many parallel requests (replicas) to create"),
252 &replication), 252 &replication),
253
254
255 GNUNET_GETOPT_option_uint ('t', 253 GNUNET_GETOPT_option_uint ('t',
256 "type", 254 "type",
257 "TYPE", 255 "TYPE",
258 gettext_noop ("the type of data to look for"), 256 gettext_noop ("the type of data to look for"),
259 &query_type), 257 &query_type),
260
261 GNUNET_GETOPT_option_relative_time ('T', 258 GNUNET_GETOPT_option_relative_time ('T',
262 "timeout", 259 "timeout",
263 "TIMEOUT", 260 "TIMEOUT",
264 gettext_noop ("how long to execute this query before giving up?"), 261 gettext_noop ("how long to execute this query before giving up?"),
265 &timeout_request), 262 &timeout_request),
266
267 GNUNET_GETOPT_option_flag ('x', 263 GNUNET_GETOPT_option_flag ('x',
268 "demultiplex", 264 "demultiplex",
269 gettext_noop ("use DHT's demultiplex everywhere option"), 265 gettext_noop ("use DHT's demultiplex everywhere option"),
270 &demultixplex_everywhere), 266 &demultixplex_everywhere),
271
272 GNUNET_GETOPT_option_verbose (&verbose), 267 GNUNET_GETOPT_option_verbose (&verbose),
273 GNUNET_GETOPT_OPTION_END 268 GNUNET_GETOPT_OPTION_END
274 }; 269 };
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 @@
1[dhtcache]
2QUOTA = 1 MB
3DATABASE = heap
4
5[transport]
6PLUGINS = tcp
7ACCEPT_FROM6 = ::1;
8ACCEPT_FROM = 127.0.0.1;
9NEIGHBOUR_LIMIT = 50
10PORT = 12365
11
12[ats]
13WAN_QUOTA_IN = 1 GB
14WAN_QUOTA_OUT = 1 GB
15
16[transport-tcp]
17TIMEOUT = 300 s
18BINDTO = 127.0.0.1
19
20[PATHS]
21GNUNET_TEST_HOME = /tmp/test-gnunet-dht-peer-1/
22
23[nat]
24DISABLEV6 = YES
25ENABLE_UPNP = NO
26BEHIND_NAT = NO
27ALLOW_NAT = NO
28INTERNAL_ADDRESS = 127.0.0.1
29EXTERNAL_ADDRESS = 127.0.0.1
30USE_LOCALADDR = NO
31
32[dht]
33AUTOSTART = YES
34FORCESTART = YES
35
36[nse]
37AUTOSTART = YES
38WORKBITS = 1
39# Configuration to disable autostarting of
40# all services above the 'core' level.
41# (including resolver)
42
43[dns]
44AUTOSTART = NO
45
46[cadet]
47AUTOSTART = NO
48
49[datastore]
50AUTOSTART = NO
51
52[fs]
53AUTOSTART = NO
54
55[dv]
56AUTOSTART = NO
57
58[vpn]
59AUTOSTART = NO
60
61[consensus]
62AUTOSTART = NO
63
64[resolver]
65AUTOSTART = NO
66
67[namestore]
68AUTOSTART = NO
69
70[namecache]
71AUTOSTART = NO
72
73[identity]
74AUTOSTART = NO
75
76[revocation]
77AUTOSTART = NO
78
79[conversation]
80AUTOSTART = NO
81
82[peerstore]
83AUTOSTART = NO
84
85[psycstore]
86AUTOSTART = NO
87
88[gns]
89AUTOSTART = NO
90
91[regex]
92AUTOSTART = NO
93
94[set]
95AUTOSTART = NO
96
97[scalarproduct-bob]
98AUTOSTART = NO
99
100[scalarproduct-alice]
101AUTOSTART = NO
102
103[social]
104AUTOSTART = NO
105
106[psyc]
107AUTOSTART = NO
108
109[rps]
110AUTOSTART = NO
111
112[multicast]
113AUTOSTART = NO
114
115[sensordashboard]
116AUTOSTART = NO
117
118[sensor]
119AUTOSTART = NO
120# Configuration file that can be included to prevent ANY of the usual
121# FORCESTART = YES to be set. Also disables NSE POW calculation.
122#
123# This configuration is included from various configuration test files.
124# Whenever a new service is added that has FORCESTART = YES for
125# production should be disabled for (most) test suites, the option should
126# be added here instead of all over the place ;-).
127
128[core]
129FORCESTART = NO
130
131[fs]
132FORCESTART = NO
133
134[dht]
135FORCESTART = NO
136
137[cadet]
138FORCESTART = NO
139
140[nse]
141FORCESTART = NO
142WORKBITS = 0
143
144[revocation]
145FORCESTART = NO
146
147[topology]
148FORCESTART = NO
149
150[hostlist]
151FORCESTART = NO
152
153[gns]
154FORCESTART = NO
155
156[zonemaster]
157FORCESTART = 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 @@
1#!/bin/sh 1#!/bin/sh
2# This file is in the public domain.
2 3
3out=`mktemp /tmp/test-gnunet-dht-logXXXXXXXX` 4out=`mktemp /tmp/test-gnunet-dht-logXXXXXXXX`
4tempcfg=`mktemp /tmp/test_dht_api_peer1.XXXXXXXX` 5tempcfg=`mktemp /tmp/test-dht-tools.XXXXXXXX`
5checkout="check.out" 6checkout="check.out"
6armexe="gnunet-arm -c $tempcfg " 7armexe="gnunet-arm -c $tempcfg "
7putexe="gnunet-dht-put -c $tempcfg " 8putexe="gnunet-dht-put -c $tempcfg "
@@ -19,16 +20,7 @@ stop_arm()
19 rm -f $out $tempcfg 20 rm -f $out $tempcfg
20} 21}
21 22
22cp test_dht_api_peer1.conf $tempcfg 23cp test_dht_tools.conf $tempcfg
23
24echo -n "TEST: Generating hostkey..."
25if ! $peerinfo > $out ; then
26 echo "FAIL: error running $peerinfo"
27 echo "Command output was:"
28 cat $out
29 exit 1
30fi
31echo "PASS"
32 24
33echo -n "TEST: Starting ARM..." 25echo -n "TEST: Starting ARM..."
34if ! $armexe $DEBUG -s > $out ; then 26if ! $armexe $DEBUG -s > $out ; then
@@ -39,7 +31,6 @@ if ! $armexe $DEBUG -s > $out ; then
39 exit 1 31 exit 1
40fi 32fi
41echo "PASS" 33echo "PASS"
42sleep 1
43 34
44echo -n "TEST: Testing put..." 35echo -n "TEST: Testing put..."
45if ! $putexe -k testkey -d testdata -t 8 > $out ; then 36if ! $putexe -k testkey -d testdata -t 8 > $out ; then
@@ -50,13 +41,12 @@ if ! $putexe -k testkey -d testdata -t 8 > $out ; then
50 exit 1 41 exit 1
51fi 42fi
52echo "PASS" 43echo "PASS"
53sleep 1
54 44
55echo -n "TEST: Testing get..." 45echo -n "TEST: Testing get..."
56echo "Result 0, type 8:" > $checkout 46echo "Result 0, type 8:" > $checkout
57echo "testdata" >> $checkout 47echo "testdata" >> $checkout
58 48
59if ! $getexe -k testkey -T 5 -t 8 > $out ; then 49if ! $getexe -k testkey -T 100ms -t 8 > $out ; then
60 echo "FAIL: error running $putexe" 50 echo "FAIL: error running $putexe"
61 echo "Command output was:" 51 echo "Command output was:"
62 cat $out 52 cat $out
@@ -65,7 +55,8 @@ if ! $getexe -k testkey -T 5 -t 8 > $out ; then
65fi 55fi
66 56
67if ! diff --strip-trailing-cr -q $out $checkout ; then 57if ! diff --strip-trailing-cr -q $out $checkout ; then
68 echo "FAIL: $out and $checkout differ" 58 echo "FAIL: $out and $checkout differ:"
59 diff --strip-trailing-cr $out $checkout
69 stop_arm 60 stop_arm
70 exit 1 61 exit 1
71fi 62fi