gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r21313 - gnunet/src/testing


From: gnunet
Subject: [GNUnet-SVN] r21313 - gnunet/src/testing
Date: Mon, 7 May 2012 09:38:43 +0200

Author: grothoff
Date: 2012-05-07 09:38:43 +0200 (Mon, 07 May 2012)
New Revision: 21313

Modified:
   gnunet/src/testing/test_testing_topology.c
Log:
-improving error messages of failing test

Modified: gnunet/src/testing/test_testing_topology.c
===================================================================
--- gnunet/src/testing/test_testing_topology.c  2012-05-07 07:24:38 UTC (rev 
21312)
+++ gnunet/src/testing/test_testing_topology.c  2012-05-07 07:38:43 UTC (rev 
21313)
@@ -166,12 +166,13 @@
 /**
  * Check whether peers successfully shut down.
  */
-void
+static void
 shutdown_callback (void *cls, const char *emsg)
 {
   if (emsg != NULL)
   {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Shutdown of peers failed!\n");
+    GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Shutdown of peers failed: %s!\n",
+               emsg);
     if (ok == 0)
       ok = 666;
   }
@@ -181,6 +182,7 @@
   }
 }
 
+
 #if DELAY_FOR_LOGGING
 static void
 gather_log_data ()
@@ -198,9 +200,9 @@
   GNUNET_OS_process_close (mem_process);
   mem_process = NULL;
 }
-
 #endif
 
+
 static void
 finish_testing ()
 {
@@ -243,7 +245,6 @@
     FPRINTF (dotOutFile, "%s",  "}");
     FCLOSE (dotOutFile);
   }
-
   ok = 0;
 }
 
@@ -257,14 +258,17 @@
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Disconnecting from peer 1 `%4s'\n",
               GNUNET_i2s (&pos->peer1->id));
   if (pos->peer1handle != NULL)
+  {
     GNUNET_CORE_disconnect (pos->peer1handle);
+    pos->peer1handle = NULL;
+  }
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Disconnecting from peer 2 `%4s'\n",
               GNUNET_i2s (&pos->peer2->id));
   if (pos->peer2handle != NULL)
+  {
     GNUNET_CORE_disconnect (pos->peer2handle);
-  /* Set handles to NULL so test case can be ended properly */
-  pos->peer1handle = NULL;
-  pos->peer2handle = NULL;
+    pos->peer2handle = NULL;
+  }
   pos->disconnect_task = GNUNET_SCHEDULER_NO_TASK;
   /* Decrement total connections so new can be established */
   total_server_connections -= 2;
@@ -299,6 +303,7 @@
 }
 #endif
 
+
 static void
 topology_cb (void *cls, const struct GNUNET_PeerIdentity *first,
              const struct GNUNET_PeerIdentity *second, const char *emsg)
@@ -331,6 +336,7 @@
   }
 }
 
+
 static int
 process_mtype (void *cls, const struct GNUNET_PeerIdentity *peer,
                const struct GNUNET_MessageHeader *message,
@@ -397,13 +403,14 @@
   return GNUNET_OK;
 }
 
+
 static void
 end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
   char *msg = cls;
 
-  GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
-              "End badly was called (%s)... stopping daemons.\n", msg);
+  GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+              "Ending with error: %s\n", msg);
   struct TestMessageContext *pos;
   struct TestMessageContext *free_pos;
 
@@ -448,6 +455,7 @@
   }
 }
 
+
 static size_t
 transmit_ready (void *cls, size_t size, void *buf)
 {
@@ -472,11 +480,13 @@
   {NULL, 0, 0}
 };
 
+
 static struct GNUNET_CORE_MessageHandler handlers[] = {
   {&process_mtype, MTYPE, sizeof (struct GNUNET_TestMessage)},
   {NULL, 0, 0}
 };
 
+
 static void
 init_notify_peer2 (void *cls, struct GNUNET_CORE_Handle *server,
                    const struct GNUNET_PeerIdentity *my_identity)
@@ -510,6 +520,7 @@
   }
 }
 
+
 /**
  * Method called whenever a given peer connects.
  *
@@ -559,6 +570,7 @@
   }
 }
 
+
 static void
 init_notify_peer1 (void *cls, struct GNUNET_CORE_Handle *server,
                    const struct GNUNET_PeerIdentity *my_identity)
@@ -566,7 +578,6 @@
   struct TestMessageContext *pos = cls;
 
   total_server_connections++;
-
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Core connection to `%4s' established, setting up handles\n",
               GNUNET_i2s (my_identity));
@@ -631,7 +642,7 @@
 }
 
 
-void
+static void
 topology_callback (void *cls, const struct GNUNET_PeerIdentity *first,
                    const struct GNUNET_PeerIdentity *second, uint32_t distance,
                    const struct GNUNET_CONFIGURATION_Handle *first_cfg,
@@ -680,7 +691,7 @@
   else
   {
     failed_connections++;
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
                 "Failed to connect peer %s to peer %s with error :\n%s\n",
                 first_daemon->shortname, second_daemon->shortname, emsg);
   }
@@ -747,6 +758,7 @@
   }
 }
 
+
 static void
 topology_creation_finished (void *cls, const char *emsg)
 {
@@ -755,6 +767,7 @@
                 "All topology connections created successfully!\n");
 }
 
+
 static void
 connect_topology ()
 {
@@ -768,7 +781,7 @@
                                          connect_timeout, connect_attempts,
                                          &topology_creation_finished, NULL);
 #if PROGRESS_BARS
-    GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Have %d expected connections\n",
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Have %d expected connections\n",
                 expected_connections);
 #endif
   }
@@ -944,6 +957,7 @@
   }
 }
 
+
 static void
 run (void *cls, char *const *args, const char *cfgfile,
      const struct GNUNET_CONFIGURATION_Handle *cfg)
@@ -1126,6 +1140,7 @@
 
 }
 
+
 static int
 check ()
 {
@@ -1159,6 +1174,7 @@
   return ok;
 }
 
+
 int
 main (int argc, char *argv[])
 {




reply via email to

[Prev in Thread] Current Thread [Next in Thread]