fix
[oweals/gnunet.git] / src / datastore / perf_plugin_datastore.c
index a23569875c04b555975f3e0530fe62f14f6145eb..660f256f9b327f7fe084116c12ace0675e951655 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
@@ -51,6 +51,8 @@ static unsigned long long stored_entries;
 
 static unsigned long long stored_ops;
 
+static const char *plugin_name;
+
 static int ok;
 
 enum RunPhase
@@ -140,7 +142,7 @@ iterateDummy (void *cls,
              const GNUNET_HashCode * key,
              uint32_t size,
              const void *data,
-             uint32_t type,
+             enum GNUNET_BLOCK_Type type,
              uint32_t priority,
              uint32_t anonymity,
              struct GNUNET_TIME_Absolute
@@ -365,10 +367,11 @@ run (void *cls,
 static int
 check ()
 {
+  char cfg_name[128];
   char *const argv[] = { 
     "perf-plugin-datastore",
     "-c",
-    "perf_plugin_datastore_data.conf",
+    cfg_name,
 #if VERBOSE
     "-L", "DEBUG",
 #endif
@@ -377,6 +380,11 @@ check ()
   struct GNUNET_GETOPT_CommandLineOption options[] = {
     GNUNET_GETOPT_OPTION_END
   };
+
+  GNUNET_snprintf (cfg_name,
+                  sizeof (cfg_name),
+                  "perf_plugin_datastore_data_%s.conf",
+                  plugin_name);
   GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1,
                       argv, "perf-plugin-datastore", "nohelp",
                       options, &run, NULL);
@@ -390,8 +398,19 @@ int
 main (int argc, char *argv[])
 {
   int ret;
-
-  GNUNET_DISK_directory_remove ("/tmp/perf-gnunet-datastore");
+  const char *pos;
+  char dir_name[128];
+
+  /* determine name of plugin to use */
+  plugin_name = argv[0];
+  while (NULL != (pos = strstr(plugin_name, "_")))
+    plugin_name = pos+1;
+
+  GNUNET_snprintf (dir_name,
+                  sizeof (dir_name),
+                  "/tmp/perf-gnunet-datastore-%s",
+                  plugin_name);
+  GNUNET_DISK_directory_remove (dir_name);
   GNUNET_log_setup ("perf-plugin-datastore",
 #if VERBOSE
                     "DEBUG",
@@ -400,12 +419,11 @@ main (int argc, char *argv[])
 #endif
                     NULL);
   ret = check ();
-  GNUNET_DISK_directory_remove ("/tmp/perf-gnunet-datastore");
+  GNUNET_DISK_directory_remove (dir_name);
 
   return ret;
 }
 
-
 /* end of perf_plugin_datastore.c */