diff options
Diffstat (limited to 'src/datacache/perf_datacache.c')
-rw-r--r-- | src/datacache/perf_datacache.c | 52 |
1 files changed, 29 insertions, 23 deletions
diff --git a/src/datacache/perf_datacache.c b/src/datacache/perf_datacache.c index a577927d0..e2eb474d4 100644 --- a/src/datacache/perf_datacache.c +++ b/src/datacache/perf_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 |
@@ -36,6 +36,12 @@ static int ok; | |||
36 | 36 | ||
37 | static unsigned int found; | 37 | static unsigned int found; |
38 | 38 | ||
39 | /** | ||
40 | * Name of plugin under test. | ||
41 | */ | ||
42 | static const char *plugin_name; | ||
43 | |||
44 | |||
39 | static int | 45 | static int |
40 | checkIt (void *cls, | 46 | checkIt (void *cls, |
41 | struct GNUNET_TIME_Absolute exp, | 47 | struct GNUNET_TIME_Absolute exp, |
@@ -119,12 +125,15 @@ FAILURE: | |||
119 | } | 125 | } |
120 | 126 | ||
121 | 127 | ||
122 | static int | 128 | int |
123 | check () | 129 | main (int argc, char *argv[]) |
124 | { | 130 | { |
125 | char *const argv[] = { "perf-datacache-api", | 131 | const char *pos; |
132 | char cfg_name[128]; | ||
133 | char *const xargv[] = { | ||
134 | "perf-datacache", | ||
126 | "-c", | 135 | "-c", |
127 | "perf_datacache_data.conf", | 136 | cfg_name, |
128 | #if VERBOSE | 137 | #if VERBOSE |
129 | "-L", "DEBUG", | 138 | "-L", "DEBUG", |
130 | #endif | 139 | #endif |
@@ -133,31 +142,28 @@ check () | |||
133 | struct GNUNET_GETOPT_CommandLineOption options[] = { | 142 | struct GNUNET_GETOPT_CommandLineOption options[] = { |
134 | GNUNET_GETOPT_OPTION_END | 143 | GNUNET_GETOPT_OPTION_END |
135 | }; | 144 | }; |
136 | GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, | ||
137 | argv, "perf-datacache-api", "nohelp", | ||
138 | options, &run, NULL); | ||
139 | if (ok != 0) | ||
140 | fprintf (stderr, "Missed some perfcases: %d\n", ok); | ||
141 | return ok; | ||
142 | } | ||
143 | |||
144 | |||
145 | int | ||
146 | main (int argc, char *argv[]) | ||
147 | { | ||
148 | int ret; | ||
149 | 145 | ||
150 | GNUNET_DISK_directory_remove ("/tmp/perf-gnunetd-datacache"); | 146 | GNUNET_log_setup ("perf-datacache", |
151 | GNUNET_log_setup ("perf-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 | "perf_datacache_data_%s.conf", | ||
160 | plugin_name); | ||
161 | GNUNET_PROGRAM_run ((sizeof (xargv) / sizeof (char *)) - 1, | ||
162 | xargv, "perf-datacache", "nohelp", | ||
163 | options, &run, NULL); | ||
164 | if (ok != 0) | ||
165 | fprintf (stderr, "Missed some perfcases: %d\n", ok); | ||
166 | return ok; | ||
161 | } | 167 | } |
162 | 168 | ||
163 | /* end of perf_datacache.c */ | 169 | /* end of perf_datacache.c */ |