From d59021ff6800c43405cff5987d09848a2aa2a62d Mon Sep 17 00:00:00 2001 From: Matthias Wachs Date: Thu, 14 Jul 2011 15:33:20 +0000 Subject: [PATCH] --- .../test_transport_api_unreliability.c | 30 ++++++++++++------- 1 file 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; static int p1_hello_canceled; static int p2_hello_canceled; +static int test_failed; + /** * Sets a bit active in the bitmap. * @@ -257,23 +259,25 @@ stop_arm (struct PeerContext *p) static void end_badly (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) + const struct GNUNET_SCHEDULER_TaskContext *tc) { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Reliability failed: Last message sent %u Next message scheduled %u Last message received %u Message expected %u\n", - msg_sent, - msg_scheduled, - msg_recv, - msg_recv_expected); - GNUNET_break (0); - + if (test_failed == GNUNET_NO) + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "Testcase timeout\n"); + else + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "Reliability failed: Last message sent %u, Next message scheduled %u, Last message received %u, Message expected %u\n", + msg_sent, + msg_scheduled, + msg_recv, + msg_recv_expected); if (th_p2 != NULL) GNUNET_TRANSPORT_notify_transmit_ready_cancel(th_p2); th_p2 = NULL; + GNUNET_break (0); GNUNET_TRANSPORT_disconnect (p1.th); GNUNET_TRANSPORT_disconnect (p2.th); - if (GNUNET_SCHEDULER_NO_TASK != tct) { GNUNET_SCHEDULER_cancel (tct); @@ -283,6 +287,7 @@ end_badly (void *cls, } + struct TestMessage { struct GNUNET_MessageHeader header; @@ -331,6 +336,7 @@ notify_receive (void *cls, ntohl (hdr->num)); if (GNUNET_SCHEDULER_NO_TASK != die_task) GNUNET_SCHEDULER_cancel (die_task); + test_failed = GNUNET_YES; die_task = GNUNET_SCHEDULER_add_now (&end_badly, NULL); return; } @@ -345,6 +351,7 @@ notify_receive (void *cls, ntohl(hdr->num), (unsigned char) n); if (GNUNET_SCHEDULER_NO_TASK != die_task) GNUNET_SCHEDULER_cancel (die_task); + test_failed = GNUNET_YES; die_task = GNUNET_SCHEDULER_add_now (&end_badly, NULL); return; } @@ -364,6 +371,7 @@ notify_receive (void *cls, fprintf (stderr, "."); if (GNUNET_SCHEDULER_NO_TASK != die_task) GNUNET_SCHEDULER_cancel (die_task); + test_failed = GNUNET_YES; die_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_badly, NULL); @@ -868,6 +876,8 @@ main (int argc, char *argv[]) return GNUNET_SYSERR; #endif + test_failed = GNUNET_NO; + GNUNET_DISK_directory_remove ("/tmp/test-gnunetd-transport-peer-1"); GNUNET_DISK_directory_remove ("/tmp/test-gnunetd-transport-peer-2"); -- 2.25.1