continue to fix extract result
[oweals/gnunet.git] / src / datastore / test_plugin_datastore.c
index b367b1a7fb8c61d5231b478bc7b299313b1aba80..9ec0c53a22033a90cc59c5b409d53c376fe0a1e0 100644 (file)
@@ -1,6 +1,6 @@
 /*
      This file is part of GNUnet.
-     Copyright (C) 2011 Christian Grothoff (and other contributing authors)
+     Copyright (C) 2011 GNUnet e.V.
 
      GNUnet is free software; you can redistribute it and/or modify
      it under the terms of the GNU General Public License as published
@@ -84,12 +84,24 @@ disk_utilization_change_cb (void *cls, int delta)
 
 
 static void
-test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc);
+test (void *cls);
 
 
+/**
+ * Put continuation.
+ *
+ * @param cls closure
+ * @param key key for the item stored
+ * @param size size of the item stored
+ * @param status #GNUNET_OK or #GNUNET_SYSERROR
+ * @param msg error message on error
+ */
 static void
-put_continuation (void *cls, const struct GNUNET_HashCode *key,
-                  uint32_t size, int status, char *msg)
+put_continuation (void *cls,
+                 const struct GNUNET_HashCode *key,
+                  uint32_t size,
+                 int status,
+                 const char *msg)
 {
   struct CpsRunContext *crc = cls;
   static unsigned long long os;
@@ -228,7 +240,7 @@ unload_plugin (struct GNUNET_DATASTORE_PluginFunctions *api,
  * the transport and core.
  */
 static void
-cleaning_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+cleaning_task (void *cls)
 {
   struct CpsRunContext *crc = cls;
 
@@ -238,7 +250,9 @@ cleaning_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
 
 
 static void
-update_continuation (void *cls, int status, char *msg)
+update_continuation (void *cls,
+                    int status,
+                    const char *msg)
 {
   struct CpsRunContext *crc = cls;
 
@@ -249,16 +263,11 @@ update_continuation (void *cls, int status, char *msg)
 
 
 static void
-test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+test (void *cls)
 {
   struct CpsRunContext *crc = cls;
   struct GNUNET_HashCode key;
 
-  if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Test aborted.\n");
-    crc->phase = RP_ERROR;
-  }
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
              "In phase %d, iteration %u\n", crc->phase, crc->cnt);
   switch (crc->phase)
@@ -285,8 +294,12 @@ test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
                        GNUNET_BLOCK_TYPE_ANY, &iterate_one_shot, crc);
     break;
   case RP_UPDATE:
-    crc->api->update (crc->api->cls, guid, 1, GNUNET_TIME_UNIT_ZERO_ABS,
-                      update_continuation, crc);
+    crc->api->update (crc->api->cls,
+                     guid,
+                     1,
+                     GNUNET_TIME_UNIT_ZERO_ABS,
+                      &update_continuation,
+                     crc);
     break;
 
   case RP_ITER_ZERO:
@@ -325,11 +338,14 @@ load_plugin (const struct GNUNET_CONFIGURATION_Handle *cfg)
   char *libname;
 
   if (GNUNET_OK !=
-      GNUNET_CONFIGURATION_get_value_string (cfg, "DATASTORE", "DATABASE",
+      GNUNET_CONFIGURATION_get_value_string (cfg,
+                                            "DATASTORE",
+                                            "DATABASE",
                                              &name))
   {
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                _("No `%s' specified for `%s' in configuration!\n"), "DATABASE",
+                _("No `%s' specified for `%s' in configuration!\n"),
+               "DATABASE",
                 "DATASTORE");
     return NULL;
   }
@@ -344,6 +360,7 @@ load_plugin (const struct GNUNET_CONFIGURATION_Handle *cfg)
     FPRINTF (stderr, "Failed to load plugin `%s'!\n", name);
     GNUNET_free (libname);
     GNUNET_free (name);
+    ok = 77; /* mark test as skipped */
     return NULL;
   }
   GNUNET_free (libname);
@@ -401,7 +418,7 @@ main (int argc, char *argv[])
                    "test_plugin_datastore_data_%s.conf", plugin_name);
   GNUNET_PROGRAM_run ((sizeof (xargv) / sizeof (char *)) - 1, xargv,
                       "test-plugin-datastore", "nohelp", options, &run, NULL);
-  if (0 != ok)
+  if ( (0 != ok) && (77 != ok) )
     FPRINTF (stderr, "Missed some testcases: %u\n", ok);
   GNUNET_DISK_directory_remove (dir_name);
   return ok;