doxygen documentation
[oweals/gnunet.git] / src / testing / test_testing_topology_blacklist.c
index 9788fa87cb1aff567d29df11be81254c88e8f8e1..5e35205101875a91d6ce2633e7d4e06b99868014 100644 (file)
@@ -4,7 +4,7 @@
 
      GNUnet is free software; you can redistribute it and/or modify
      it under the terms of the GNU General Public License as published
-     by the Free Software Foundation; either version 2, or (at your
+     by the Free Software Foundation; either version 3, or (at your
      option) any later version.
 
      GNUnet is distributed in the hope that it will be useful, but
@@ -96,6 +96,31 @@ struct GNUNET_TestMessage
   uint32_t uid;
 };
 
+
+/**
+ * Check whether peers successfully shut down.
+ */
+void shutdown_callback (void *cls,
+                        const char *emsg)
+{
+  if (emsg != NULL)
+    {
+#if VERBOSE
+      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                  "Shutdown of peers failed!\n");
+#endif
+      if (ok == 0)
+        ok = 666;
+    }
+  else
+    {
+#if VERBOSE
+      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                  "All peers successfully shut down!\n");
+#endif
+    }
+}
+
 static void
 finish_testing ()
 {
@@ -110,7 +135,7 @@ finish_testing ()
           GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                       "Calling daemons_stop\n");
 #endif
-  GNUNET_TESTING_daemons_stop (pg, TIMEOUT);
+  GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL);
 #if VERBOSE
           GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                       "daemons_stop finished\n");
@@ -133,7 +158,7 @@ end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext * tc)
 
   if (pg != NULL)
     {
-      GNUNET_TESTING_daemons_stop (pg, TIMEOUT);
+      GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL);
       ok = 7331;                /* Opposite of leet */
     }
   else
@@ -445,6 +470,7 @@ run (void *cls,
 
   main_cfg = cfg;
 
+  GNUNET_assert(num_peers > 0 && num_peers < (unsigned int)-1);
   peers_left = num_peers;
 
   /* For this specific test we only really want a CLIQUE topology as the