diff options
author | Christian Grothoff <christian@grothoff.org> | 2010-08-13 19:43:17 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2010-08-13 19:43:17 +0000 |
commit | 54edcbe9ce37e934a0d045fdde27e9caa3ac145a (patch) | |
tree | 1f87dffbbb93f09bb4d0b606022ad9595d11bad8 /src/datacache/test_datacache.c | |
parent | 2151b951b91971bd9c906b12ab940b0ee0038001 (diff) | |
download | gnunet-54edcbe9ce37e934a0d045fdde27e9caa3ac145a.tar.gz gnunet-54edcbe9ce37e934a0d045fdde27e9caa3ac145a.zip |
mysql hackery
Diffstat (limited to 'src/datacache/test_datacache.c')
-rw-r--r-- | src/datacache/test_datacache.c | 50 |
1 files changed, 28 insertions, 22 deletions
diff --git a/src/datacache/test_datacache.c b/src/datacache/test_datacache.c index 8e09a7692..c5acf365a 100644 --- a/src/datacache/test_datacache.c +++ b/src/datacache/test_datacache.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | (C) 2006, 2009 Christian Grothoff (and other contributing authors) | 3 | (C) 2006, 2009, 2010 Christian Grothoff (and other contributing authors) |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published | 6 | it under the terms of the GNU General Public License as published |
@@ -32,6 +32,11 @@ | |||
32 | 32 | ||
33 | static int ok; | 33 | static int ok; |
34 | 34 | ||
35 | /** | ||
36 | * Name of plugin under test. | ||
37 | */ | ||
38 | static const char *plugin_name; | ||
39 | |||
35 | 40 | ||
36 | static int | 41 | static int |
37 | checkIt (void *cls, | 42 | checkIt (void *cls, |
@@ -120,12 +125,15 @@ FAILURE: | |||
120 | } | 125 | } |
121 | 126 | ||
122 | 127 | ||
123 | static int | 128 | int |
124 | check () | 129 | main (int argc, char *argv[]) |
125 | { | 130 | { |
126 | char *const argv[] = { "test-datacache-api", | 131 | const char *pos; |
132 | char cfg_name[128]; | ||
133 | char *const xargv[] = { | ||
134 | "test-datacache", | ||
127 | "-c", | 135 | "-c", |
128 | "test_datacache_data.conf", | 136 | cfg_name, |
129 | #if VERBOSE | 137 | #if VERBOSE |
130 | "-L", "DEBUG", | 138 | "-L", "DEBUG", |
131 | #endif | 139 | #endif |
@@ -134,30 +142,28 @@ check () | |||
134 | struct GNUNET_GETOPT_CommandLineOption options[] = { | 142 | struct GNUNET_GETOPT_CommandLineOption options[] = { |
135 | GNUNET_GETOPT_OPTION_END | 143 | GNUNET_GETOPT_OPTION_END |
136 | }; | 144 | }; |
137 | GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, | ||
138 | argv, "test-datacache-api", "nohelp", | ||
139 | options, &run, NULL); | ||
140 | if (ok != 0) | ||
141 | fprintf (stderr, "Missed some testcases: %d\n", ok); | ||
142 | return ok; | ||
143 | } | ||
144 | 145 | ||
145 | 146 | GNUNET_log_setup ("test-datacache", | |
146 | int | ||
147 | main (int argc, char *argv[]) | ||
148 | { | ||
149 | int ret; | ||
150 | |||
151 | GNUNET_log_setup ("test-datacache-api", | ||
152 | #if VERBOSE | 147 | #if VERBOSE |
153 | "DEBUG", | 148 | "DEBUG", |
154 | #else | 149 | #else |
155 | "WARNING", | 150 | "WARNING", |
156 | #endif | 151 | #endif |
157 | NULL); | 152 | NULL); |
158 | ret = check (); | 153 | /* determine name of plugin to use */ |
159 | 154 | plugin_name = argv[0]; | |
160 | return ret; | 155 | while (NULL != (pos = strstr(plugin_name, "_"))) |
156 | plugin_name = pos+1; | ||
157 | GNUNET_snprintf (cfg_name, | ||
158 | sizeof (cfg_name), | ||
159 | "test_datacache_data_%s.conf", | ||
160 | plugin_name); | ||
161 | GNUNET_PROGRAM_run ((sizeof (xargv) / sizeof (char *)) - 1, | ||
162 | xargv, "test-datacache", "nohelp", | ||
163 | options, &run, NULL); | ||
164 | if (ok != 0) | ||
165 | fprintf (stderr, "Missed some testcases: %d\n", ok); | ||
166 | return ok; | ||
161 | } | 167 | } |
162 | 168 | ||
163 | /* end of test_datacache.c */ | 169 | /* end of test_datacache.c */ |