diff options
Diffstat (limited to 'src/mesh/test_mesh_2dtorus.c')
-rw-r--r-- | src/mesh/test_mesh_2dtorus.c | 58 |
1 files changed, 20 insertions, 38 deletions
diff --git a/src/mesh/test_mesh_2dtorus.c b/src/mesh/test_mesh_2dtorus.c index 718ab0864..6d91185cc 100644 --- a/src/mesh/test_mesh_2dtorus.c +++ b/src/mesh/test_mesh_2dtorus.c | |||
@@ -104,8 +104,7 @@ shutdown_callback (void *cls, const char *emsg) | |||
104 | if (emsg != NULL) | 104 | if (emsg != NULL) |
105 | { | 105 | { |
106 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 106 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
107 | "test: Shutdown of peers failed! (%s)\n", | 107 | "test: Shutdown of peers failed! (%s)\n", emsg); |
108 | emsg); | ||
109 | ok--; | 108 | ok--; |
110 | } | 109 | } |
111 | #if VERBOSE | 110 | #if VERBOSE |
@@ -122,8 +121,7 @@ static void | |||
122 | shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 121 | shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) |
123 | { | 122 | { |
124 | #if VERBOSE | 123 | #if VERBOSE |
125 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 124 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: Ending test.\n"); |
126 | "test: Ending test.\n"); | ||
127 | #endif | 125 | #endif |
128 | 126 | ||
129 | GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL); | 127 | GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL); |
@@ -134,8 +132,7 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
134 | static void | 132 | static void |
135 | disconnect_peers (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 133 | disconnect_peers (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) |
136 | { | 134 | { |
137 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 135 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: disconnecting peers\n"); |
138 | "test: disconnecting peers\n"); | ||
139 | 136 | ||
140 | if (GNUNET_SCHEDULER_NO_TASK != shutdown_handle) | 137 | if (GNUNET_SCHEDULER_NO_TASK != shutdown_handle) |
141 | { | 138 | { |
@@ -162,33 +159,26 @@ topo_cb (void *cls, const struct GNUNET_PeerIdentity *first, | |||
162 | topo_connections++; | 159 | topo_connections++; |
163 | if (NULL != emsg) | 160 | if (NULL != emsg) |
164 | { | 161 | { |
165 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 162 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "test: Error by topo %u: %s\n", |
166 | "test: Error by topo %u: %s\n", | ||
167 | topo_connections, emsg); | 163 | topo_connections, emsg); |
168 | } | 164 | } |
169 | else | 165 | else |
170 | { | 166 | { |
171 | if (first == NULL || second == NULL) | 167 | if (first == NULL || second == NULL) |
172 | { | 168 | { |
173 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 169 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: Connection %u NULL\n", |
174 | "test: Connection %u NULL\n", | ||
175 | topo_connections); | 170 | topo_connections); |
176 | if (disconnect_task != GNUNET_SCHEDULER_NO_TASK) | 171 | if (disconnect_task != GNUNET_SCHEDULER_NO_TASK) |
177 | { | 172 | { |
178 | GNUNET_SCHEDULER_cancel (disconnect_task); | 173 | GNUNET_SCHEDULER_cancel (disconnect_task); |
179 | GNUNET_SCHEDULER_add_now(&disconnect_peers, NULL); | 174 | GNUNET_SCHEDULER_add_now (&disconnect_peers, NULL); |
180 | } | 175 | } |
181 | return; | 176 | return; |
182 | } | 177 | } |
183 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 178 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: Connection %u ok\n", |
184 | "test: Connection %u ok\n", | ||
185 | topo_connections); | 179 | topo_connections); |
186 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 180 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: %s\n", GNUNET_i2s (first)); |
187 | "test: %s\n", | 181 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: %s\n", GNUNET_i2s (second)); |
188 | GNUNET_i2s (first)); | ||
189 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
190 | "test: %s\n", | ||
191 | GNUNET_i2s (second)); | ||
192 | } | 182 | } |
193 | } | 183 | } |
194 | 184 | ||
@@ -205,8 +195,8 @@ peergroup_ready (void *cls, const char *emsg) | |||
205 | { | 195 | { |
206 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 196 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
207 | "test: Peergroup callback called with error, aborting test!\n"); | 197 | "test: Peergroup callback called with error, aborting test!\n"); |
208 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 198 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: Error from testing: `%s'\n", |
209 | "test: Error from testing: `%s'\n", emsg); | 199 | emsg); |
210 | ok--; | 200 | ok--; |
211 | GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL); | 201 | GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL); |
212 | return; | 202 | return; |
@@ -216,8 +206,7 @@ peergroup_ready (void *cls, const char *emsg) | |||
216 | "************************************************************\n"); | 206 | "************************************************************\n"); |
217 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 207 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
218 | "test: Peer Group started successfully!\n"); | 208 | "test: Peer Group started successfully!\n"); |
219 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 209 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: Have %u connections\n", |
220 | "test: Have %u connections\n", | ||
221 | total_connections); | 210 | total_connections); |
222 | #endif | 211 | #endif |
223 | 212 | ||
@@ -225,8 +214,7 @@ peergroup_ready (void *cls, const char *emsg) | |||
225 | if (0 < failed_connections) | 214 | if (0 < failed_connections) |
226 | { | 215 | { |
227 | ok = GNUNET_SYSERR; | 216 | ok = GNUNET_SYSERR; |
228 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 217 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "test: %u connections have FAILED!\n", |
229 | "test: %u connections have FAILED!\n", | ||
230 | failed_connections); | 218 | failed_connections); |
231 | disconnect_task = GNUNET_SCHEDULER_add_now (&disconnect_peers, NULL); | 219 | disconnect_task = GNUNET_SCHEDULER_add_now (&disconnect_peers, NULL); |
232 | 220 | ||
@@ -272,12 +260,9 @@ connect_cb (void *cls, const struct GNUNET_PeerIdentity *first, | |||
272 | { | 260 | { |
273 | failed_connections++; | 261 | failed_connections++; |
274 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 262 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
275 | "test: Problem with new connection (%s)\n", | 263 | "test: Problem with new connection (%s)\n", emsg); |
276 | emsg); | 264 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: (%s)\n", GNUNET_i2s (first)); |
277 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: (%s)\n", | 265 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: (%s)\n", GNUNET_i2s (second)); |
278 | GNUNET_i2s (first)); | ||
279 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: (%s)\n", | ||
280 | GNUNET_i2s (second)); | ||
281 | } | 266 | } |
282 | 267 | ||
283 | } | 268 | } |
@@ -310,8 +295,7 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
310 | NULL); | 295 | NULL); |
311 | 296 | ||
312 | #if VERBOSE | 297 | #if VERBOSE |
313 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 298 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: Starting daemons.\n"); |
314 | "test: Starting daemons.\n"); | ||
315 | GNUNET_CONFIGURATION_set_value_string (testing_cfg, "testing", | 299 | GNUNET_CONFIGURATION_set_value_string (testing_cfg, "testing", |
316 | "use_progressbars", "YES"); | 300 | "use_progressbars", "YES"); |
317 | #endif | 301 | #endif |
@@ -369,16 +353,14 @@ main (int argc, char *argv[]) | |||
369 | 353 | ||
370 | 354 | ||
371 | GNUNET_PROGRAM_run ((sizeof (argv2) / sizeof (char *)) - 1, argv2, | 355 | GNUNET_PROGRAM_run ((sizeof (argv2) / sizeof (char *)) - 1, argv2, |
372 | "test_mesh_2dtorus", | 356 | "test_mesh_2dtorus", gettext_noop ("Test mesh 2d torus."), |
373 | gettext_noop ("Test mesh 2d torus."), options, | 357 | options, &run, NULL); |
374 | &run, NULL); | ||
375 | #if REMOVE_DIR | 358 | #if REMOVE_DIR |
376 | GNUNET_DISK_directory_remove ("/tmp/test_mesh_2dtorus"); | 359 | GNUNET_DISK_directory_remove ("/tmp/test_mesh_2dtorus"); |
377 | #endif | 360 | #endif |
378 | if (GNUNET_OK != ok) | 361 | if (GNUNET_OK != ok) |
379 | { | 362 | { |
380 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 363 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "test: FAILED!\n"); |
381 | "test: FAILED!\n"); | ||
382 | return 1; | 364 | return 1; |
383 | } | 365 | } |
384 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: success\n"); | 366 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: success\n"); |