aboutsummaryrefslogtreecommitdiff
path: root/src/namestore/test_plugin_namestore.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-06-10 13:08:08 +0000
committerChristian Grothoff <christian@grothoff.org>2012-06-10 13:08:08 +0000
commitdbde4bf3121a02a8d2694fcccb0f293dc05eb767 (patch)
tree9319e4ba09b6807f4cc0177b8cfdcac7cf816ea1 /src/namestore/test_plugin_namestore.c
parent7891046af9e1f85a6ee1aa2dc3b0135ff8852d13 (diff)
downloadgnunet-dbde4bf3121a02a8d2694fcccb0f293dc05eb767.tar.gz
gnunet-dbde4bf3121a02a8d2694fcccb0f293dc05eb767.zip
-starting with namestore test cleanup
Diffstat (limited to 'src/namestore/test_plugin_namestore.c')
-rw-r--r--src/namestore/test_plugin_namestore.c22
1 files changed, 2 insertions, 20 deletions
diff --git a/src/namestore/test_plugin_namestore.c b/src/namestore/test_plugin_namestore.c
index 3e93d73b2..5b8a8aa8e 100644
--- a/src/namestore/test_plugin_namestore.c
+++ b/src/namestore/test_plugin_namestore.c
@@ -25,8 +25,8 @@
25#include "platform.h" 25#include "platform.h"
26#include "gnunet_util_lib.h" 26#include "gnunet_util_lib.h"
27#include "gnunet_namestore_plugin.h" 27#include "gnunet_namestore_plugin.h"
28#include "gnunet_testing_lib.h"
28 29
29#define VERBOSE GNUNET_NO
30 30
31#define ASSERT(x) do { if (! (x)) { printf("Error at %s:%d\n", __FILE__, __LINE__); goto FAILURE;} } while (0) 31#define ASSERT(x) do { if (! (x)) { printf("Error at %s:%d\n", __FILE__, __LINE__); goto FAILURE;} } while (0)
32 32
@@ -196,23 +196,17 @@ run (void *cls, char *const *args, const char *cfgfile,
196 GNUNET_CRYPTO_short_hash (&zone_key, sizeof (zone_key), &zone); 196 GNUNET_CRYPTO_short_hash (&zone_key, sizeof (zone_key), &zone);
197 nsp->delete_zone (nsp->cls, &zone); 197 nsp->delete_zone (nsp->cls, &zone);
198 unload_plugin (nsp); 198 unload_plugin (nsp);
199
200} 199}
201 200
202 201
203int 202int
204main (int argc, char *argv[]) 203main (int argc, char *argv[])
205{ 204{
206 char *pos;
207 char cfg_name[128]; 205 char cfg_name[128];
208
209 char *const xargv[] = { 206 char *const xargv[] = {
210 "test-plugin-namestore", 207 "test-plugin-namestore",
211 "-c", 208 "-c",
212 cfg_name, 209 cfg_name,
213#if VERBOSE
214 "-L", "DEBUG",
215#endif
216 NULL 210 NULL
217 }; 211 };
218 struct GNUNET_GETOPT_CommandLineOption options[] = { 212 struct GNUNET_GETOPT_CommandLineOption options[] = {
@@ -221,21 +215,9 @@ main (int argc, char *argv[])
221 215
222 GNUNET_DISK_directory_remove ("/tmp/gnunet-test-plugin-namestore-sqlite"); 216 GNUNET_DISK_directory_remove ("/tmp/gnunet-test-plugin-namestore-sqlite");
223 GNUNET_log_setup ("test-plugin-namestore", 217 GNUNET_log_setup ("test-plugin-namestore",
224#if VERBOSE
225 "DEBUG",
226#else
227 "WARNING", 218 "WARNING",
228#endif
229 NULL); 219 NULL);
230 /* determine name of plugin to use */ 220 plugin_name = GNUNET_TESTING_get_testname_from_underscore (argv[0]);
231 plugin_name = argv[0];
232 while (NULL != (pos = strstr (plugin_name, "_")))
233 plugin_name = pos + 1;
234 if (NULL != (pos = strstr (plugin_name, ".")))
235 pos[0] = 0;
236 else
237 pos = (char *) plugin_name;
238
239 GNUNET_snprintf (cfg_name, sizeof (cfg_name), "test_plugin_namestore_%s.conf", 221 GNUNET_snprintf (cfg_name, sizeof (cfg_name), "test_plugin_namestore_%s.conf",
240 plugin_name); 222 plugin_name);
241 GNUNET_PROGRAM_run ((sizeof (xargv) / sizeof (char *)) - 1, xargv, 223 GNUNET_PROGRAM_run ((sizeof (xargv) / sizeof (char *)) - 1, xargv,