-using new testing api to determine plugin name
authorChristian Grothoff <christian@grothoff.org>
Sun, 10 Jun 2012 11:43:20 +0000 (11:43 +0000)
committerChristian Grothoff <christian@grothoff.org>
Sun, 10 Jun 2012 11:43:20 +0000 (11:43 +0000)
src/datacache/Makefile.am
src/datacache/perf_datacache.c
src/datacache/test_datacache.c
src/datacache/test_datacache_quota.c
src/datastore/Makefile.am
src/datastore/perf_datastore_api.c
src/datastore/perf_plugin_datastore.c
src/datastore/test_datastore_api.c
src/datastore/test_datastore_api_management.c
src/datastore/test_plugin_datastore.c

index e1cd8fd799c7263b11afb2a40cfe0ccda7aa550c..0f10e6c1b0f0ed20660289823aa772e1e5a1845b 100644 (file)
@@ -134,54 +134,63 @@ endif
 test_datacache_sqlite_SOURCES = \
  test_datacache.c
 test_datacache_sqlite_LDADD = \
+ $(top_builddir)/src/testing/libgnunettesting.la \
  $(top_builddir)/src/datacache/libgnunetdatacache.la \
  $(top_builddir)/src/util/libgnunetutil.la  
 
 test_datacache_quota_sqlite_SOURCES = \
  test_datacache_quota.c
 test_datacache_quota_sqlite_LDADD = \
+ $(top_builddir)/src/testing/libgnunettesting.la \
  $(top_builddir)/src/datacache/libgnunetdatacache.la \
  $(top_builddir)/src/util/libgnunetutil.la  
 
 perf_datacache_sqlite_SOURCES = \
  perf_datacache.c
 perf_datacache_sqlite_LDADD = \
+ $(top_builddir)/src/testing/libgnunettesting.la \
  $(top_builddir)/src/datacache/libgnunetdatacache.la \
  $(top_builddir)/src/util/libgnunetutil.la  
 
 test_datacache_mysql_SOURCES = \
  test_datacache.c
 test_datacache_mysql_LDADD = \
+ $(top_builddir)/src/testing/libgnunettesting.la \
  $(top_builddir)/src/datacache/libgnunetdatacache.la \
  $(top_builddir)/src/util/libgnunetutil.la  
 
 test_datacache_quota_mysql_SOURCES = \
  test_datacache_quota.c
 test_datacache_quota_mysql_LDADD = \
+ $(top_builddir)/src/testing/libgnunettesting.la \
  $(top_builddir)/src/datacache/libgnunetdatacache.la \
  $(top_builddir)/src/util/libgnunetutil.la  
 
 perf_datacache_mysql_SOURCES = \
  perf_datacache.c
 perf_datacache_mysql_LDADD = \
+ $(top_builddir)/src/testing/libgnunettesting.la \
  $(top_builddir)/src/datacache/libgnunetdatacache.la \
  $(top_builddir)/src/util/libgnunetutil.la  
 
 test_datacache_postgres_SOURCES = \
  test_datacache.c
 test_datacache_postgres_LDADD = \
+ $(top_builddir)/src/testing/libgnunettesting.la \
  $(top_builddir)/src/datacache/libgnunetdatacache.la \
  $(top_builddir)/src/util/libgnunetutil.la  
 
 test_datacache_quota_postgres_SOURCES = \
  test_datacache_quota.c
 test_datacache_quota_postgres_LDADD = \
+ $(top_builddir)/src/testing/libgnunettesting.la \
  $(top_builddir)/src/datacache/libgnunetdatacache.la \
  $(top_builddir)/src/util/libgnunetutil.la  
 
 perf_datacache_postgres_SOURCES = \
  perf_datacache.c
 perf_datacache_postgres_LDADD = \
+ $(top_builddir)/src/testing/libgnunettesting.la \
  $(top_builddir)/src/datacache/libgnunetdatacache.la \
  $(top_builddir)/src/util/libgnunetutil.la  
 
index 77edbf92552c52fb0b0288fc04ca9ab3f7a45ba6..94cd7a58e61181fd779afd1e62565b9df2d3bb6f 100644 (file)
@@ -25,9 +25,9 @@
 #include "platform.h"
 #include "gnunet_util_lib.h"
 #include "gnunet_datacache_lib.h"
+#include "gnunet_testing_lib-new.h"
 #include <gauger.h>
 
-#define VERBOSE GNUNET_NO
 
 #define ASSERT(x) do { if (! (x)) { printf("Error at %s:%d\n", __FILE__, __LINE__); goto FAILURE;} } while (0)
 
@@ -129,16 +129,11 @@ FAILURE:
 int
 main (int argc, char *argv[])
 {
-  char *pos;
   char cfg_name[128];
-
   char *const xargv[] = {
     "perf-datacache",
     "-c",
     cfg_name,
-#if VERBOSE
-    "-L", "DEBUG",
-#endif
     NULL
   };
   struct GNUNET_GETOPT_CommandLineOption options[] = {
@@ -146,25 +141,11 @@ main (int argc, char *argv[])
   };
 
   GNUNET_log_setup ("perf-datacache",
-#if VERBOSE
-                    "DEBUG",
-#else
                     "WARNING",
-#endif
                     NULL);
-  /* determine name of plugin to use */
-  plugin_name = argv[0];
-  while (NULL != (pos = strstr (plugin_name, "_")))
-    plugin_name = pos + 1;
-  if (NULL != (pos = strstr (plugin_name, ".")))
-    pos[0] = 0;
-  else
-    pos = (char *) plugin_name;
-
+  plugin_name = GNUNET_TESTING_get_testname_from_underscore (argv[0]);
   GNUNET_snprintf (cfg_name, sizeof (cfg_name), "perf_datacache_data_%s.conf",
                    plugin_name);
-  if (pos != plugin_name)
-    pos[0] = '.';
   GNUNET_PROGRAM_run ((sizeof (xargv) / sizeof (char *)) - 1, xargv,
                       "perf-datacache", "nohelp", options, &run, NULL);
   if (ok != 0)
index 97e2cda308ffe53bef3ad4dc6041d37d95f95adc..c818daaa83b79629b8b12d32a906735e652568b5 100644 (file)
@@ -25,6 +25,7 @@
 #include "platform.h"
 #include "gnunet_util_lib.h"
 #include "gnunet_datacache_lib.h"
+#include "gnunet_testing_lib-new.h"
 
 #define ASSERT(x) do { if (! (x)) { printf("Error at %s:%d\n", __FILE__, __LINE__); goto FAILURE;} } while (0)
 
@@ -114,9 +115,7 @@ FAILURE:
 int
 main (int argc, char *argv[])
 {
-  char *pos;
   char cfg_name[128];
-
   char *const xargv[] = {
     "test-datacache",
     "-c",
@@ -130,22 +129,12 @@ main (int argc, char *argv[])
   GNUNET_log_setup ("test-datacache",
                     "WARNING",
                     NULL);
-  /* determine name of plugin to use */
-  plugin_name = argv[0];
-  while (NULL != (pos = strstr (plugin_name, "_")))
-    plugin_name = pos + 1;
-  if (NULL != (pos = strstr (plugin_name, ".")))
-    pos[0] = 0;
-  else
-    pos = (char *) plugin_name;
-
+  plugin_name = GNUNET_TESTING_get_testname_from_underscore (argv[0]);
   GNUNET_snprintf (cfg_name, sizeof (cfg_name), "test_datacache_data_%s.conf",
                    plugin_name);
-  if (pos != plugin_name)
-    pos[0] = '.';
   GNUNET_PROGRAM_run ((sizeof (xargv) / sizeof (char *)) - 1, xargv,
                       "test-datacache", "nohelp", options, &run, NULL);
-  if (ok != 0)
+  if (0 != ok)
     FPRINTF (stderr, "Missed some testcases: %d\n", ok);
   return ok;
 }
index cc47bdb8fb512f13e5db59f2a3f16d140479273b..5325b398f9f1f692a77905d65da51db27c1b13ee 100644 (file)
@@ -25,8 +25,7 @@
 #include "platform.h"
 #include "gnunet_util_lib.h"
 #include "gnunet_datacache_lib.h"
-
-#define VERBOSE GNUNET_NO
+#include "gnunet_testing_lib-new.h"
 
 #define ASSERT(x) do { if (! (x)) { printf("Error at %s:%d\n", __FILE__, __LINE__); goto FAILURE;} } while (0)
 
@@ -104,16 +103,11 @@ FAILURE:
 int
 main (int argc, char *argv[])
 {
-  char *pos;
   char cfg_name[128];
-
   char *const xargv[] = {
     "test-datacache-quota",
     "-c",
     cfg_name,
-#if VERBOSE
-    "-L", "DEBUG",
-#endif
     NULL
   };
   struct GNUNET_GETOPT_CommandLineOption options[] = {
@@ -121,29 +115,15 @@ main (int argc, char *argv[])
   };
 
   GNUNET_log_setup ("test-datacache-quota",
-#if VERBOSE
-                    "DEBUG",
-#else
                     "WARNING",
-#endif
                     NULL);
 
-  /* determine name of plugin to use */
-  plugin_name = argv[0];
-  while (NULL != (pos = strstr (plugin_name, "_")))
-    plugin_name = pos + 1;
-  if (NULL != (pos = strstr (plugin_name, ".")))
-    pos[0] = 0;
-  else
-    pos = (char *) plugin_name;
-
+  plugin_name = GNUNET_TESTING_get_testname_from_underscore (argv[0]);
   GNUNET_snprintf (cfg_name, sizeof (cfg_name), "test_datacache_data_%s.conf",
                    plugin_name);
-  if (pos != plugin_name)
-    pos[0] = '.';
   GNUNET_PROGRAM_run ((sizeof (xargv) / sizeof (char *)) - 1, xargv,
                       "test-datacache-quota", "nohelp", options, &run, NULL);
-  if (ok != 0)
+  if (0 != ok)
     FPRINTF (stderr, "Missed some testcases: %d\n", ok);
   return ok;
 }
index cd5b0d481a059cad789afb1d7c3367d5f84f9e9b..4000e998183fbcc587abd8fdd73be8eb997cfe3f 100644 (file)
@@ -162,11 +162,13 @@ perf_datastore_api_sqlite_LDADD = \
 perf_plugin_datastore_sqlite_SOURCES = \
  perf_plugin_datastore.c
 perf_plugin_datastore_sqlite_LDADD = \
+ $(top_builddir)/src/testing/libgnunettesting.la \
  $(top_builddir)/src/util/libgnunetutil.la  
 
 test_plugin_datastore_sqlite_SOURCES = \
  test_plugin_datastore.c
 test_plugin_datastore_sqlite_LDADD = \
+ $(top_builddir)/src/testing/libgnunettesting.la \
  $(top_builddir)/src/util/libgnunetutil.la  
 
 
@@ -194,11 +196,13 @@ perf_datastore_api_mysql_LDADD = \
 test_plugin_datastore_mysql_SOURCES = \
  test_plugin_datastore.c
 test_plugin_datastore_mysql_LDADD = \
+ $(top_builddir)/src/testing/libgnunettesting.la \
  $(top_builddir)/src/util/libgnunetutil.la  
 
 perf_plugin_datastore_mysql_SOURCES = \
  perf_plugin_datastore.c
 perf_plugin_datastore_mysql_LDADD = \
+ $(top_builddir)/src/testing/libgnunettesting.la \
  $(top_builddir)/src/util/libgnunetutil.la  
 
 
@@ -226,11 +230,13 @@ perf_datastore_api_postgres_LDADD = \
 test_plugin_datastore_postgres_SOURCES = \
  test_plugin_datastore.c
 test_plugin_datastore_postgres_LDADD = \
+ $(top_builddir)/src/testing/libgnunettesting.la \
  $(top_builddir)/src/util/libgnunetutil.la  
 
 perf_plugin_datastore_postgres_SOURCES = \
  perf_plugin_datastore.c
 perf_plugin_datastore_postgres_LDADD = \
+ $(top_builddir)/src/testing/libgnunettesting.la \
  $(top_builddir)/src/util/libgnunetutil.la  
 
 
index e236b6235ae1f8cfb2772c0aff987dbd51781ff3..fa2ee52dc95e3df2c9453721b8d39af9234fda53 100644 (file)
@@ -322,17 +322,9 @@ run (void *cls,
 int
 main (int argc, char *argv[])
 {
-  char *pos;
   char cfg_name[128];
 
-  /* determine name of plugin to use */
-  plugin_name = argv[0];
-  while (NULL != (pos = strstr (plugin_name, "_")))
-    plugin_name = pos + 1;
-  if (NULL != (pos = strstr (plugin_name, ".")))
-    pos[0] = '\0';
-  else
-    pos = (char *) plugin_name;
+  plugin_name = GNUNET_TESTING_get_testname_from_underscoare (argv[0]);
   GNUNET_snprintf (cfg_name, sizeof (cfg_name),
                    "test_datastore_api_data_%s.conf", plugin_name);
   if (0 !=
index daea8d7961c15dc0514604735e7facc2725faef8..763b387662903ecbca3b8a1d7243a990623838ea 100644 (file)
@@ -27,6 +27,7 @@
 #include "gnunet_util_lib.h"
 #include "gnunet_protocols.h"
 #include "gnunet_datastore_plugin.h"
+#include "gnunet_testing_lib-new.h"
 #include <gauger.h>
 
 /**
@@ -453,7 +454,6 @@ run (void *cls, char *const *args, const char *cfgfile,
 int
 main (int argc, char *argv[])
 {
-  char *pos;
   char dir_name[128];
   char cfg_name[128];
   char *const argv[] = {
@@ -466,14 +466,7 @@ main (int argc, char *argv[])
     GNUNET_GETOPT_OPTION_END
   };
 
-  /* determine name of plugin to use */
-  plugin_name = argv[0];
-  while (NULL != (pos = strstr (plugin_name, "_")))
-    plugin_name = pos + 1;
-  if (NULL != (pos = strstr (plugin_name, ".")))
-    pos[0] = 0;
-  else
-    pos = (char *) plugin_name;
+  plugin_name = GNUNET_TESTING_get_testname_from_underscore (argv[0]);
   GNUNET_snprintf (dir_name, sizeof (dir_name), "/tmp/perf-gnunet-datastore-%s",
                    plugin_name);
   GNUNET_DISK_directory_remove (dir_name);
@@ -487,8 +480,6 @@ main (int argc, char *argv[])
                       "perf-plugin-datastore", "nohelp", options, &run, NULL);
   if (ok != 0)
     FPRINTF (stderr, "Missed some testcases: %u\n", ok);
-  if (pos != plugin_name)
-    pos[0] = '.';
   GNUNET_DISK_directory_remove (dir_name);
 
   return ok;
index cfeac86db11994dc67710582198724d2679c8cc5..374067ca011af54cc2beebf80d3f017c653269a6 100644 (file)
@@ -491,17 +491,9 @@ run (void *cls,
 int
 main (int argc, char *argv[])
 {
-  char *pos;
   char cfg_name[128];
 
-  /* determine name of plugin to use */
-  plugin_name = argv[0];
-  while (NULL != (pos = strstr (plugin_name, "_")))
-    plugin_name = pos + 1;
-  if (NULL != (pos = strstr (plugin_name, ".")))
-    pos[0] = '\0';
-  else
-    pos = (char *) plugin_name;
+  plugin_name = GNUNET_TESTING_get_testname_from_underscore (argv[0]);
   GNUNET_snprintf (cfg_name, sizeof (cfg_name),
                    "test_datastore_api_data_%s.conf", plugin_name);
   if (0 !=
index 9b5fb4e6f2563374e7ad2d54a56a579dcf91d2df..bbb9543044e5450289f2ea380d4e057d542a9dcc 100644 (file)
@@ -286,17 +286,9 @@ run (void *cls,
 int
 main (int argc, char *argv[])
 {
-  char *pos;
   char cfg_name[128];
 
-  /* determine name of plugin to use */
-  plugin_name = argv[0];
-  while (NULL != (pos = strstr (plugin_name, "_")))
-    plugin_name = pos + 1;
-  if (NULL != (pos = strstr (plugin_name, ".")))
-    pos[0] = 0;
-  else
-    pos = (char *) plugin_name;
+  plugin_name = GNUNET_TESTING_get_testname_from_underscore (argv[0]);
   GNUNET_snprintf (cfg_name, sizeof (cfg_name),
                    "test_datastore_api_data_%s.conf", plugin_name);
   if (0 !=
index de9e7c2ab6d6fcf2d62bc88d21e247db9b2a6906..a228e1004bfebf97749811aae4f2073a758739c4 100644 (file)
@@ -27,6 +27,7 @@
 #include "gnunet_util_lib.h"
 #include "gnunet_protocols.h"
 #include "gnunet_datastore_plugin.h"
+#include "gnunet_testing_lib-new.h"
 
 /**
  * Number of put operations to perform.
@@ -349,11 +350,9 @@ run (void *cls, char *const *args, const char *cfgfile,
 }
 
 
-
 int
 main (int argc, char *argv[])
 {
-  char *pos;
   char dir_name[128];
   char cfg_name[128];
   char *const xargv[] = {
@@ -367,14 +366,7 @@ main (int argc, char *argv[])
   };
 
   /* determine name of plugin to use */
-  plugin_name = argv[0];
-  while (NULL != (pos = strstr (plugin_name, "_")))
-    plugin_name = pos + 1;
-  if (NULL != (pos = strstr (plugin_name, ".")))
-    pos[0] = 0;
-  else
-    pos = (char *) plugin_name;
-
+  plugin_name = GNUNET_TESTING_get_testname_from_underscore (argv[0]);
   GNUNET_snprintf (dir_name, sizeof (dir_name),
                    "/tmp/test-gnunet-datastore-plugin-%s", plugin_name);
   GNUNET_DISK_directory_remove (dir_name);
@@ -385,10 +377,8 @@ 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 (ok != 0)
+  if (0 != ok)
     FPRINTF (stderr, "Missed some testcases: %u\n", ok);
-  if (pos != plugin_name)
-    pos[0] = '.';
   GNUNET_DISK_directory_remove (dir_name);
   return ok;
 }