diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2011-07-14 15:33:20 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2011-07-14 15:33:20 +0000 |
commit | d59021ff6800c43405cff5987d09848a2aa2a62d (patch) | |
tree | d4cf90fcd48afec8aa0efad7e8bf778d06f0075f /src/transport/test_transport_api_unreliability.c | |
parent | e053b5cd2bf4c8fa6ec2b6b0afca3da1cd7d6170 (diff) | |
download | gnunet-d59021ff6800c43405cff5987d09848a2aa2a62d.tar.gz gnunet-d59021ff6800c43405cff5987d09848a2aa2a62d.zip |
Diffstat (limited to 'src/transport/test_transport_api_unreliability.c')
-rw-r--r-- | src/transport/test_transport_api_unreliability.c | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/src/transport/test_transport_api_unreliability.c b/src/transport/test_transport_api_unreliability.c index 1c6e9061c..0bc85b174 100644 --- a/src/transport/test_transport_api_unreliability.c +++ b/src/transport/test_transport_api_unreliability.c | |||
@@ -111,6 +111,8 @@ static int msg_recv; | |||
111 | static int p1_hello_canceled; | 111 | static int p1_hello_canceled; |
112 | static int p2_hello_canceled; | 112 | static int p2_hello_canceled; |
113 | 113 | ||
114 | static int test_failed; | ||
115 | |||
114 | /** | 116 | /** |
115 | * Sets a bit active in the bitmap. | 117 | * Sets a bit active in the bitmap. |
116 | * | 118 | * |
@@ -257,23 +259,25 @@ stop_arm (struct PeerContext *p) | |||
257 | 259 | ||
258 | static void | 260 | static void |
259 | end_badly (void *cls, | 261 | end_badly (void *cls, |
260 | const struct GNUNET_SCHEDULER_TaskContext *tc) | 262 | const struct GNUNET_SCHEDULER_TaskContext *tc) |
261 | { | 263 | { |
262 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 264 | if (test_failed == GNUNET_NO) |
263 | "Reliability failed: Last message sent %u Next message scheduled %u Last message received %u Message expected %u\n", | 265 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
264 | msg_sent, | 266 | "Testcase timeout\n"); |
265 | msg_scheduled, | 267 | else |
266 | msg_recv, | 268 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
267 | msg_recv_expected); | 269 | "Reliability failed: Last message sent %u, Next message scheduled %u, Last message received %u, Message expected %u\n", |
268 | GNUNET_break (0); | 270 | msg_sent, |
269 | 271 | msg_scheduled, | |
272 | msg_recv, | ||
273 | msg_recv_expected); | ||
270 | if (th_p2 != NULL) | 274 | if (th_p2 != NULL) |
271 | GNUNET_TRANSPORT_notify_transmit_ready_cancel(th_p2); | 275 | GNUNET_TRANSPORT_notify_transmit_ready_cancel(th_p2); |
272 | th_p2 = NULL; | 276 | th_p2 = NULL; |
273 | 277 | ||
278 | GNUNET_break (0); | ||
274 | GNUNET_TRANSPORT_disconnect (p1.th); | 279 | GNUNET_TRANSPORT_disconnect (p1.th); |
275 | GNUNET_TRANSPORT_disconnect (p2.th); | 280 | GNUNET_TRANSPORT_disconnect (p2.th); |
276 | |||
277 | if (GNUNET_SCHEDULER_NO_TASK != tct) | 281 | if (GNUNET_SCHEDULER_NO_TASK != tct) |
278 | { | 282 | { |
279 | GNUNET_SCHEDULER_cancel (tct); | 283 | GNUNET_SCHEDULER_cancel (tct); |
@@ -283,6 +287,7 @@ end_badly (void *cls, | |||
283 | } | 287 | } |
284 | 288 | ||
285 | 289 | ||
290 | |||
286 | struct TestMessage | 291 | struct TestMessage |
287 | { | 292 | { |
288 | struct GNUNET_MessageHeader header; | 293 | struct GNUNET_MessageHeader header; |
@@ -331,6 +336,7 @@ notify_receive (void *cls, | |||
331 | ntohl (hdr->num)); | 336 | ntohl (hdr->num)); |
332 | if (GNUNET_SCHEDULER_NO_TASK != die_task) | 337 | if (GNUNET_SCHEDULER_NO_TASK != die_task) |
333 | GNUNET_SCHEDULER_cancel (die_task); | 338 | GNUNET_SCHEDULER_cancel (die_task); |
339 | test_failed = GNUNET_YES; | ||
334 | die_task = GNUNET_SCHEDULER_add_now (&end_badly, NULL); | 340 | die_task = GNUNET_SCHEDULER_add_now (&end_badly, NULL); |
335 | return; | 341 | return; |
336 | } | 342 | } |
@@ -345,6 +351,7 @@ notify_receive (void *cls, | |||
345 | ntohl(hdr->num), (unsigned char) n); | 351 | ntohl(hdr->num), (unsigned char) n); |
346 | if (GNUNET_SCHEDULER_NO_TASK != die_task) | 352 | if (GNUNET_SCHEDULER_NO_TASK != die_task) |
347 | GNUNET_SCHEDULER_cancel (die_task); | 353 | GNUNET_SCHEDULER_cancel (die_task); |
354 | test_failed = GNUNET_YES; | ||
348 | die_task = GNUNET_SCHEDULER_add_now (&end_badly, NULL); | 355 | die_task = GNUNET_SCHEDULER_add_now (&end_badly, NULL); |
349 | return; | 356 | return; |
350 | } | 357 | } |
@@ -364,6 +371,7 @@ notify_receive (void *cls, | |||
364 | fprintf (stderr, "."); | 371 | fprintf (stderr, "."); |
365 | if (GNUNET_SCHEDULER_NO_TASK != die_task) | 372 | if (GNUNET_SCHEDULER_NO_TASK != die_task) |
366 | GNUNET_SCHEDULER_cancel (die_task); | 373 | GNUNET_SCHEDULER_cancel (die_task); |
374 | test_failed = GNUNET_YES; | ||
367 | die_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, | 375 | die_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, |
368 | &end_badly, | 376 | &end_badly, |
369 | NULL); | 377 | NULL); |
@@ -868,6 +876,8 @@ main (int argc, char *argv[]) | |||
868 | return GNUNET_SYSERR; | 876 | return GNUNET_SYSERR; |
869 | #endif | 877 | #endif |
870 | 878 | ||
879 | test_failed = GNUNET_NO; | ||
880 | |||
871 | GNUNET_DISK_directory_remove ("/tmp/test-gnunetd-transport-peer-1"); | 881 | GNUNET_DISK_directory_remove ("/tmp/test-gnunetd-transport-peer-1"); |
872 | GNUNET_DISK_directory_remove ("/tmp/test-gnunetd-transport-peer-2"); | 882 | GNUNET_DISK_directory_remove ("/tmp/test-gnunetd-transport-peer-2"); |
873 | 883 | ||