aboutsummaryrefslogtreecommitdiff
path: root/src/datacache/test_datacache.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2010-08-13 19:43:17 +0000
committerChristian Grothoff <christian@grothoff.org>2010-08-13 19:43:17 +0000
commit54edcbe9ce37e934a0d045fdde27e9caa3ac145a (patch)
tree1f87dffbbb93f09bb4d0b606022ad9595d11bad8 /src/datacache/test_datacache.c
parent2151b951b91971bd9c906b12ab940b0ee0038001 (diff)
mysql hackery
Diffstat (limited to 'src/datacache/test_datacache.c')
-rw-r--r--src/datacache/test_datacache.c50
1 files changed, 28 insertions, 22 deletions
diff --git a/src/datacache/test_datacache.c b/src/datacache/test_datacache.c
index 8e09a7692a..c5acf365aa 100644
--- a/src/datacache/test_datacache.c
+++ b/src/datacache/test_datacache.c
@@ -1,6 +1,6 @@
/*
This file is part of GNUnet.
- (C) 2006, 2009 Christian Grothoff (and other contributing authors)
+ (C) 2006, 2009, 2010 Christian Grothoff (and other contributing authors)
GNUnet is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
@@ -32,6 +32,11 @@
static int ok;
+/**
+ * Name of plugin under test.
+ */
+static const char *plugin_name;
+
static int
checkIt (void *cls,
@@ -120,12 +125,15 @@ FAILURE:
}
-static int
-check ()
+int
+main (int argc, char *argv[])
{
- char *const argv[] = { "test-datacache-api",
+ const char *pos;
+ char cfg_name[128];
+ char *const xargv[] = {
+ "test-datacache",
"-c",
- "test_datacache_data.conf",
+ cfg_name,
#if VERBOSE
"-L", "DEBUG",
#endif
@@ -134,30 +142,28 @@ check ()
struct GNUNET_GETOPT_CommandLineOption options[] = {
GNUNET_GETOPT_OPTION_END
};
- GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1,
- argv, "test-datacache-api", "nohelp",
- options, &run, NULL);
- if (ok != 0)
- fprintf (stderr, "Missed some testcases: %d\n", ok);
- return ok;
-}
-
-int
-main (int argc, char *argv[])
-{
- int ret;
-
- GNUNET_log_setup ("test-datacache-api",
+ GNUNET_log_setup ("test-datacache",
#if VERBOSE
"DEBUG",
#else
"WARNING",
#endif
NULL);
- ret = check ();
-
- return ret;
+ /* determine name of plugin to use */
+ plugin_name = argv[0];
+ while (NULL != (pos = strstr(plugin_name, "_")))
+ plugin_name = pos+1;
+ GNUNET_snprintf (cfg_name,
+ sizeof (cfg_name),
+ "test_datacache_data_%s.conf",
+ plugin_name);
+ GNUNET_PROGRAM_run ((sizeof (xargv) / sizeof (char *)) - 1,
+ xargv, "test-datacache", "nohelp",
+ options, &run, NULL);
+ if (ok != 0)
+ fprintf (stderr, "Missed some testcases: %d\n", ok);
+ return ok;
}
/* end of test_datacache.c */