fix
[oweals/gnunet.git] / src / datastore / test_datastore_api.c
index af2f15da84a268ea579a4e344da8944df7fa9b8f..2ae6dbe4ab87ae72b9cca994f396cbe3d16d1ea4 100644 (file)
@@ -33,6 +33,8 @@
 
 #define VERBOSE GNUNET_NO
 
+#define START_DATASTORE GNUNET_YES
+
 /**
  * How long until we give up on transmitting the message?
  */
@@ -297,6 +299,9 @@ check_multiple (void *cls,
     {
       if (crc->phase != RP_GET_MULTIPLE_DONE)
        {
+         fprintf (stderr, 
+                  "Wrong phase: %d\n",
+                  crc->phase);
          GNUNET_break (0);
          crc->phase = RP_ERROR;
        }
@@ -350,8 +355,15 @@ check_update (void *cls,
 
   if (key == NULL)
     {
-      GNUNET_assert (crc->phase == RP_UPDATE_DONE);
-      crc->phase = RP_DONE;
+      if (crc->phase != RP_UPDATE_DONE)
+       {
+         GNUNET_break (0);
+         crc->phase = RP_ERROR;
+       }
+      else
+       {
+         crc->phase = RP_DONE;
+       }
       GNUNET_SCHEDULER_add_continuation (crc->sched,
                                         &run_continuation,
                                         crc,
@@ -598,10 +610,13 @@ static int
 check ()
 {
   char cfg_name[128];
+#if START_DATASTORE
   pid_t pid;
-  char *const argv[] = { "test-datastore-api",
+#endif
+  char *const argv[] = {
+    "test-datastore-api",
     "-c",
-    "test_datastore_api_data.conf",
+    cfg_name,
 #if VERBOSE
     "-L", "DEBUG",
 #endif
@@ -614,21 +629,25 @@ check ()
                   sizeof (cfg_name),
                   "test_datastore_api_data_%s.conf",
                   plugin_name);
+#if START_DATASTORE
   pid = GNUNET_OS_start_process (NULL, NULL, "gnunet-service-arm",
                                  "gnunet-service-arm",
 #if VERBOSE
                                  "-L", "DEBUG",
 #endif
                                  "-c", cfg_name, NULL);
+#endif
   GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1,
                       argv, "test-datastore-api", "nohelp",
                       options, &run, NULL);
+#if START_DATASTORE
   if (0 != PLIBC_KILL (pid, SIGTERM))
     {
       GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill");
       ok = 1;
     }
   GNUNET_OS_process_wait(pid);
+#endif
   if (ok != 0)
     fprintf (stderr, "Missed some testcases: %u\n", ok);
   return ok;