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