diff options
author | Christian Grothoff <christian@grothoff.org> | 2012-06-10 11:43:20 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2012-06-10 11:43:20 +0000 |
commit | dadbf4c950bf4cd459c95ac4ab61a02af7b3668b (patch) | |
tree | ddaf0644dcd97fbef7f67a68eff2a5cf204b0bb7 /src/datacache | |
parent | 8efaae301b29ec7cbdb921ac5e6b30ae2c143568 (diff) |
-using new testing api to determine plugin name
Diffstat (limited to 'src/datacache')
-rw-r--r-- | src/datacache/Makefile.am | 9 | ||||
-rw-r--r-- | src/datacache/perf_datacache.c | 23 | ||||
-rw-r--r-- | src/datacache/test_datacache.c | 17 | ||||
-rw-r--r-- | src/datacache/test_datacache_quota.c | 26 |
4 files changed, 17 insertions, 58 deletions
diff --git a/src/datacache/Makefile.am b/src/datacache/Makefile.am index e1cd8fd799..0f10e6c1b0 100644 --- a/src/datacache/Makefile.am +++ b/src/datacache/Makefile.am @@ -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 diff --git a/src/datacache/perf_datacache.c b/src/datacache/perf_datacache.c index 77edbf9255..94cd7a58e6 100644 --- a/src/datacache/perf_datacache.c +++ b/src/datacache/perf_datacache.c @@ -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) diff --git a/src/datacache/test_datacache.c b/src/datacache/test_datacache.c index 97e2cda308..c818daaa83 100644 --- a/src/datacache/test_datacache.c +++ b/src/datacache/test_datacache.c @@ -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; } diff --git a/src/datacache/test_datacache_quota.c b/src/datacache/test_datacache_quota.c index cc47bdb8fb..5325b398f9 100644 --- a/src/datacache/test_datacache_quota.c +++ b/src/datacache/test_datacache_quota.c @@ -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; } |