line
[oweals/gnunet.git] / src / statistics / test_statistics_api_loop.c
index b70e92bdc98dc016f40e891fff897a4fd3446c6f..d969e65ce565b8eeee3e0e59e14114da265c0593 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
@@ -60,7 +60,6 @@ next (void *cls, int success)
 
 static void
 run (void *cls,
-     struct GNUNET_SCHEDULER_Handle *sched,
      char *const *args,
      const char *cfgfile,
      const struct GNUNET_CONFIGURATION_Handle *cfg)
@@ -68,7 +67,7 @@ run (void *cls,
   int i;
   char name[128];
 
-  h = GNUNET_STATISTICS_create (sched, "test-statistics-api-loop", cfg);
+  h = GNUNET_STATISTICS_create ("test-statistics-api-loop", cfg);
   for (i=0;i<ROUNDS;i++)
     {
       GNUNET_snprintf (name, sizeof (name), "test-%d", i % 256);
@@ -79,7 +78,7 @@ run (void *cls,
   i = 0;
   GNUNET_break (NULL != 
                GNUNET_STATISTICS_get (h, NULL, "test-0",
-                                      GNUNET_TIME_UNIT_SECONDS, &next, &check_1, cls));
+                                      GNUNET_TIME_UNIT_MINUTES, &next, &check_1, cls));
 }
 
 
@@ -96,23 +95,26 @@ check ()
     GNUNET_GETOPT_OPTION_END
   };
 #if START_SERVICE
-  pid_t pid;
-  pid = GNUNET_OS_start_process (NULL, NULL, "gnunet-service-statistics",
+  struct GNUNET_OS_Process *proc;
+  proc = GNUNET_OS_start_process (NULL, NULL, "gnunet-service-statistics",
                                  "gnunet-service-statistics",
 #if DEBUG_STATISTICS
                                  "-L", "DEBUG",
 #endif
                                  "-c", "test_statistics_api_data.conf", NULL);
 #endif
+  GNUNET_assert (NULL != proc);
   GNUNET_PROGRAM_run (3, argv, "test-statistics-api", "nohelp",
                       options, &run, &ok);
 #if START_SERVICE
-  if (0 != PLIBC_KILL (pid, SIGTERM))
+  if (0 != GNUNET_OS_process_kill (proc, SIGTERM))
     {
       GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill");
       ok = 1;
     }
-  GNUNET_OS_process_wait(pid);
+  GNUNET_OS_process_wait (proc);
+  GNUNET_OS_process_close (proc);
+  proc = NULL;
 #endif
   return ok;
 }