aboutsummaryrefslogtreecommitdiff
path: root/src/namestore/test_plugin_namestore.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-02-22 22:52:06 +0000
committerChristian Grothoff <christian@grothoff.org>2012-02-22 22:52:06 +0000
commit97636ddef6d81caf222ff34076b157d3cafb8042 (patch)
tree2e039cd8aa5c7f82bc7917edd066b1feb0a16ad4 /src/namestore/test_plugin_namestore.c
parentf6884a301a25d5038b0eeebaa4678eb164dc395b (diff)
downloadgnunet-97636ddef6d81caf222ff34076b157d3cafb8042.tar.gz
gnunet-97636ddef6d81caf222ff34076b157d3cafb8042.zip
-more bugfixes, more testing
Diffstat (limited to 'src/namestore/test_plugin_namestore.c')
-rw-r--r--src/namestore/test_plugin_namestore.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/namestore/test_plugin_namestore.c b/src/namestore/test_plugin_namestore.c
index 6b606e62b..d3d94684d 100644
--- a/src/namestore/test_plugin_namestore.c
+++ b/src/namestore/test_plugin_namestore.c
@@ -243,7 +243,7 @@ test_signature (void *cls,
243 243
244 memset (&tzone_key, 13, sizeof (tzone_key)); 244 memset (&tzone_key, 13, sizeof (tzone_key));
245 tloc.depth = (id % 10); 245 tloc.depth = (id % 10);
246 tloc.offset = (id % 3); 246 tloc.offset = 0;
247 tloc.revision = id % 1024; 247 tloc.revision = id % 1024;
248 memset (&ttop_sig, 24, sizeof (ttop_sig)); 248 memset (&ttop_sig, 24, sizeof (ttop_sig));
249 memset (&troot_hash, 42, sizeof (troot_hash)); 249 memset (&troot_hash, 42, sizeof (troot_hash));
@@ -258,12 +258,14 @@ test_signature (void *cls,
258static void 258static void
259get_signature (struct GNUNET_NAMESTORE_PluginFunctions *nsp, int id) 259get_signature (struct GNUNET_NAMESTORE_PluginFunctions *nsp, int id)
260{ 260{
261 GNUNET_HashCode root_hash; 261 struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded zone_key;
262 GNUNET_HashCode zone;
262 263
263 memset (&root_hash, 42, sizeof (root_hash)); 264 memset (&zone_key, 13, sizeof (zone_key));
265 GNUNET_CRYPTO_hash (&zone_key, sizeof (zone_key), &zone);
264 GNUNET_assert (GNUNET_OK == 266 GNUNET_assert (GNUNET_OK ==
265 nsp->get_signature (nsp->cls, 267 nsp->get_signature (nsp->cls,
266 &root_hash, 268 &zone,
267 test_signature, 269 test_signature,
268 &id)); 270 &id));
269} 271}
@@ -347,7 +349,7 @@ put_signature (struct GNUNET_NAMESTORE_PluginFunctions *nsp,
347 349
348 memset (&zone_key, 13, sizeof (zone_key)); 350 memset (&zone_key, 13, sizeof (zone_key));
349 loc.depth = (id % 10); 351 loc.depth = (id % 10);
350 loc.offset = (id % 3); 352 loc.offset = 0;
351 loc.revision = id % 1024; 353 loc.revision = id % 1024;
352 memset (&top_sig, 24, sizeof (top_sig)); 354 memset (&top_sig, 24, sizeof (top_sig));
353 memset (&root_hash, 42, sizeof (root_hash)); 355 memset (&root_hash, 42, sizeof (root_hash));
@@ -368,6 +370,7 @@ run (void *cls, char *const *args, const char *cfgfile,
368 const struct GNUNET_CONFIGURATION_Handle *cfg) 370 const struct GNUNET_CONFIGURATION_Handle *cfg)
369{ 371{
370 struct GNUNET_NAMESTORE_PluginFunctions *nsp; 372 struct GNUNET_NAMESTORE_PluginFunctions *nsp;
373 GNUNET_HashCode zone;
371 374
372 ok = 0; 375 ok = 0;
373 nsp = load_plugin (cfg); 376 nsp = load_plugin (cfg);
@@ -384,7 +387,9 @@ run (void *cls, char *const *args, const char *cfgfile,
384 get_node (nsp, 1); 387 get_node (nsp, 1);
385 put_signature (nsp, 1); 388 put_signature (nsp, 1);
386 get_signature (nsp, 1); 389 get_signature (nsp, 1);
387 390
391 memset (&zone, 42, sizeof (zone));
392 nsp->delete_zone (nsp->cls, &zone);
388 unload_plugin (nsp); 393 unload_plugin (nsp);
389} 394}
390 395
@@ -408,6 +413,7 @@ main (int argc, char *argv[])
408 GNUNET_GETOPT_OPTION_END 413 GNUNET_GETOPT_OPTION_END
409 }; 414 };
410 415
416 GNUNET_DISK_directory_remove ("/tmp/gnunet-test-plugin-namestore-sqlite");
411 GNUNET_log_setup ("test-plugin-namestore", 417 GNUNET_log_setup ("test-plugin-namestore",
412#if VERBOSE 418#if VERBOSE
413 "DEBUG", 419 "DEBUG",
@@ -432,6 +438,7 @@ main (int argc, char *argv[])
432 "test-plugin-namestore", "nohelp", options, &run, NULL); 438 "test-plugin-namestore", "nohelp", options, &run, NULL);
433 if (ok != 0) 439 if (ok != 0)
434 FPRINTF (stderr, "Missed some testcases: %d\n", ok); 440 FPRINTF (stderr, "Missed some testcases: %d\n", ok);
441 GNUNET_DISK_directory_remove ("/tmp/gnunet-test-plugin-namestore-sqlite");
435 return ok; 442 return ok;
436} 443}
437 444