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_quota.c | |
parent | 2151b951b91971bd9c906b12ab940b0ee0038001 (diff) | |
download | gnunet-54edcbe9ce37e934a0d045fdde27e9caa3ac145a.tar.gz gnunet-54edcbe9ce37e934a0d045fdde27e9caa3ac145a.zip |
mysql hackery
Diffstat (limited to 'src/datacache/test_datacache_quota.c')
-rw-r--r-- | src/datacache/test_datacache_quota.c | 50 |
1 files changed, 28 insertions, 22 deletions
diff --git a/src/datacache/test_datacache_quota.c b/src/datacache/test_datacache_quota.c index f4686b6a3..9028196bd 100644 --- a/src/datacache/test_datacache_quota.c +++ b/src/datacache/test_datacache_quota.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 |
@@ -33,6 +33,11 @@ | |||
33 | static int ok; | 33 | static int ok; |
34 | 34 | ||
35 | /** | 35 | /** |
36 | * Name of plugin under test. | ||
37 | */ | ||
38 | static const char *plugin_name; | ||
39 | |||
40 | /** | ||
36 | * Quota is 1 MB. Each iteration of the test puts in about 1 MB of | 41 | * Quota is 1 MB. Each iteration of the test puts in about 1 MB of |
37 | * data. We do 10 iterations. Afterwards we check that the data from | 42 | * data. We do 10 iterations. Afterwards we check that the data from |
38 | * the first 5 iterations has all been discarded and that at least | 43 | * the first 5 iterations has all been discarded and that at least |
@@ -110,12 +115,15 @@ FAILURE: | |||
110 | } | 115 | } |
111 | 116 | ||
112 | 117 | ||
113 | static int | 118 | int |
114 | check () | 119 | main (int argc, char *argv[]) |
115 | { | 120 | { |
116 | char *const argv[] = { "test-datacache-quota", | 121 | const char *pos; |
122 | char cfg_name[128]; | ||
123 | char *const xargv[] = { | ||
124 | "test-datacache-quota", | ||
117 | "-c", | 125 | "-c", |
118 | "test_datacache_data.conf", | 126 | cfg_name, |
119 | #if VERBOSE | 127 | #if VERBOSE |
120 | "-L", "DEBUG", | 128 | "-L", "DEBUG", |
121 | #endif | 129 | #endif |
@@ -124,20 +132,7 @@ check () | |||
124 | struct GNUNET_GETOPT_CommandLineOption options[] = { | 132 | struct GNUNET_GETOPT_CommandLineOption options[] = { |
125 | GNUNET_GETOPT_OPTION_END | 133 | GNUNET_GETOPT_OPTION_END |
126 | }; | 134 | }; |
127 | GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, | 135 | |
128 | argv, "test-datacache-quota", "nohelp", | ||
129 | options, &run, NULL); | ||
130 | if (ok != 0) | ||
131 | fprintf (stderr, "Missed some testcases: %d\n", ok); | ||
132 | return ok; | ||
133 | } | ||
134 | |||
135 | |||
136 | int | ||
137 | main (int argc, char *argv[]) | ||
138 | { | ||
139 | int ret; | ||
140 | |||
141 | GNUNET_log_setup ("test-datacache-quota", | 136 | GNUNET_log_setup ("test-datacache-quota", |
142 | #if VERBOSE | 137 | #if VERBOSE |
143 | "DEBUG", | 138 | "DEBUG", |
@@ -145,9 +140,20 @@ main (int argc, char *argv[]) | |||
145 | "WARNING", | 140 | "WARNING", |
146 | #endif | 141 | #endif |
147 | NULL); | 142 | NULL); |
148 | ret = check (); | 143 | /* determine name of plugin to use */ |
149 | 144 | plugin_name = argv[0]; | |
150 | return ret; | 145 | while (NULL != (pos = strstr(plugin_name, "_"))) |
146 | plugin_name = pos+1; | ||
147 | GNUNET_snprintf (cfg_name, | ||
148 | sizeof (cfg_name), | ||
149 | "test_datacache_data_%s.conf", | ||
150 | plugin_name); | ||
151 | GNUNET_PROGRAM_run ((sizeof (xargv) / sizeof (char *)) - 1, | ||
152 | xargv, "test-datacache-quota", "nohelp", | ||
153 | options, &run, NULL); | ||
154 | if (ok != 0) | ||
155 | fprintf (stderr, "Missed some testcases: %d\n", ok); | ||
156 | return ok; | ||
151 | } | 157 | } |
152 | 158 | ||
153 | /* end of test_datacache_quota.c */ | 159 | /* end of test_datacache_quota.c */ |