diff options
-rw-r--r-- | src/dht/gnunet-dht-get.c | 39 | ||||
-rw-r--r-- | src/dht/test_dht_tools.conf | 157 | ||||
-rwxr-xr-x | src/dht/test_dht_tools.sh | 21 |
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] | ||
2 | QUOTA = 1 MB | ||
3 | DATABASE = heap | ||
4 | |||
5 | [transport] | ||
6 | PLUGINS = tcp | ||
7 | ACCEPT_FROM6 = ::1; | ||
8 | ACCEPT_FROM = 127.0.0.1; | ||
9 | NEIGHBOUR_LIMIT = 50 | ||
10 | PORT = 12365 | ||
11 | |||
12 | [ats] | ||
13 | WAN_QUOTA_IN = 1 GB | ||
14 | WAN_QUOTA_OUT = 1 GB | ||
15 | |||
16 | [transport-tcp] | ||
17 | TIMEOUT = 300 s | ||
18 | BINDTO = 127.0.0.1 | ||
19 | |||
20 | [PATHS] | ||
21 | GNUNET_TEST_HOME = /tmp/test-gnunet-dht-peer-1/ | ||
22 | |||
23 | [nat] | ||
24 | DISABLEV6 = YES | ||
25 | ENABLE_UPNP = NO | ||
26 | BEHIND_NAT = NO | ||
27 | ALLOW_NAT = NO | ||
28 | INTERNAL_ADDRESS = 127.0.0.1 | ||
29 | EXTERNAL_ADDRESS = 127.0.0.1 | ||
30 | USE_LOCALADDR = NO | ||
31 | |||
32 | [dht] | ||
33 | AUTOSTART = YES | ||
34 | FORCESTART = YES | ||
35 | |||
36 | [nse] | ||
37 | AUTOSTART = YES | ||
38 | WORKBITS = 1 | ||
39 | # Configuration to disable autostarting of | ||
40 | # all services above the 'core' level. | ||
41 | # (including resolver) | ||
42 | |||
43 | [dns] | ||
44 | AUTOSTART = NO | ||
45 | |||
46 | [cadet] | ||
47 | AUTOSTART = NO | ||
48 | |||
49 | [datastore] | ||
50 | AUTOSTART = NO | ||
51 | |||
52 | [fs] | ||
53 | AUTOSTART = NO | ||
54 | |||
55 | [dv] | ||
56 | AUTOSTART = NO | ||
57 | |||
58 | [vpn] | ||
59 | AUTOSTART = NO | ||
60 | |||
61 | [consensus] | ||
62 | AUTOSTART = NO | ||
63 | |||
64 | [resolver] | ||
65 | AUTOSTART = NO | ||
66 | |||
67 | [namestore] | ||
68 | AUTOSTART = NO | ||
69 | |||
70 | [namecache] | ||
71 | AUTOSTART = NO | ||
72 | |||
73 | [identity] | ||
74 | AUTOSTART = NO | ||
75 | |||
76 | [revocation] | ||
77 | AUTOSTART = NO | ||
78 | |||
79 | [conversation] | ||
80 | AUTOSTART = NO | ||
81 | |||
82 | [peerstore] | ||
83 | AUTOSTART = NO | ||
84 | |||
85 | [psycstore] | ||
86 | AUTOSTART = NO | ||
87 | |||
88 | [gns] | ||
89 | AUTOSTART = NO | ||
90 | |||
91 | [regex] | ||
92 | AUTOSTART = NO | ||
93 | |||
94 | [set] | ||
95 | AUTOSTART = NO | ||
96 | |||
97 | [scalarproduct-bob] | ||
98 | AUTOSTART = NO | ||
99 | |||
100 | [scalarproduct-alice] | ||
101 | AUTOSTART = NO | ||
102 | |||
103 | [social] | ||
104 | AUTOSTART = NO | ||
105 | |||
106 | [psyc] | ||
107 | AUTOSTART = NO | ||
108 | |||
109 | [rps] | ||
110 | AUTOSTART = NO | ||
111 | |||
112 | [multicast] | ||
113 | AUTOSTART = NO | ||
114 | |||
115 | [sensordashboard] | ||
116 | AUTOSTART = NO | ||
117 | |||
118 | [sensor] | ||
119 | AUTOSTART = 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] | ||
129 | FORCESTART = NO | ||
130 | |||
131 | [fs] | ||
132 | FORCESTART = NO | ||
133 | |||
134 | [dht] | ||
135 | FORCESTART = NO | ||
136 | |||
137 | [cadet] | ||
138 | FORCESTART = NO | ||
139 | |||
140 | [nse] | ||
141 | FORCESTART = NO | ||
142 | WORKBITS = 0 | ||
143 | |||
144 | [revocation] | ||
145 | FORCESTART = NO | ||
146 | |||
147 | [topology] | ||
148 | FORCESTART = NO | ||
149 | |||
150 | [hostlist] | ||
151 | FORCESTART = NO | ||
152 | |||
153 | [gns] | ||
154 | FORCESTART = NO | ||
155 | |||
156 | [zonemaster] | ||
157 | 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 @@ | |||
1 | #!/bin/sh | 1 | #!/bin/sh |
2 | # This file is in the public domain. | ||
2 | 3 | ||
3 | out=`mktemp /tmp/test-gnunet-dht-logXXXXXXXX` | 4 | out=`mktemp /tmp/test-gnunet-dht-logXXXXXXXX` |
4 | tempcfg=`mktemp /tmp/test_dht_api_peer1.XXXXXXXX` | 5 | tempcfg=`mktemp /tmp/test-dht-tools.XXXXXXXX` |
5 | checkout="check.out" | 6 | checkout="check.out" |
6 | armexe="gnunet-arm -c $tempcfg " | 7 | armexe="gnunet-arm -c $tempcfg " |
7 | putexe="gnunet-dht-put -c $tempcfg " | 8 | putexe="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 | ||
22 | cp test_dht_api_peer1.conf $tempcfg | 23 | cp test_dht_tools.conf $tempcfg |
23 | |||
24 | echo -n "TEST: Generating hostkey..." | ||
25 | if ! $peerinfo > $out ; then | ||
26 | echo "FAIL: error running $peerinfo" | ||
27 | echo "Command output was:" | ||
28 | cat $out | ||
29 | exit 1 | ||
30 | fi | ||
31 | echo "PASS" | ||
32 | 24 | ||
33 | echo -n "TEST: Starting ARM..." | 25 | echo -n "TEST: Starting ARM..." |
34 | if ! $armexe $DEBUG -s > $out ; then | 26 | if ! $armexe $DEBUG -s > $out ; then |
@@ -39,7 +31,6 @@ if ! $armexe $DEBUG -s > $out ; then | |||
39 | exit 1 | 31 | exit 1 |
40 | fi | 32 | fi |
41 | echo "PASS" | 33 | echo "PASS" |
42 | sleep 1 | ||
43 | 34 | ||
44 | echo -n "TEST: Testing put..." | 35 | echo -n "TEST: Testing put..." |
45 | if ! $putexe -k testkey -d testdata -t 8 > $out ; then | 36 | if ! $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 |
51 | fi | 42 | fi |
52 | echo "PASS" | 43 | echo "PASS" |
53 | sleep 1 | ||
54 | 44 | ||
55 | echo -n "TEST: Testing get..." | 45 | echo -n "TEST: Testing get..." |
56 | echo "Result 0, type 8:" > $checkout | 46 | echo "Result 0, type 8:" > $checkout |
57 | echo "testdata" >> $checkout | 47 | echo "testdata" >> $checkout |
58 | 48 | ||
59 | if ! $getexe -k testkey -T 5 -t 8 > $out ; then | 49 | if ! $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 | |||
65 | fi | 55 | fi |
66 | 56 | ||
67 | if ! diff --strip-trailing-cr -q $out $checkout ; then | 57 | if ! 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 |
71 | fi | 62 | fi |