diff options
author | Christian Grothoff <christian@grothoff.org> | 2018-05-09 17:33:04 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2018-05-09 17:33:04 +0200 |
commit | 8bb475af99260f1d107dbc8908268ae93960aa83 (patch) | |
tree | 1a7a1fc03424df841a6f977b137482439b09bc9f /src/namestore/test_namestore_api_zone_iteration_specific_zone.c | |
parent | 1f80a11e90ee982bffaae4685e281f75ee1c225d (diff) | |
download | gnunet-8bb475af99260f1d107dbc8908268ae93960aa83.tar.gz gnunet-8bb475af99260f1d107dbc8908268ae93960aa83.zip |
implement new functions in libgnunetsq, clean up sqlite namestore plugin, implement flow control in namestore API and tests
Diffstat (limited to 'src/namestore/test_namestore_api_zone_iteration_specific_zone.c')
-rw-r--r-- | src/namestore/test_namestore_api_zone_iteration_specific_zone.c | 54 |
1 files changed, 14 insertions, 40 deletions
diff --git a/src/namestore/test_namestore_api_zone_iteration_specific_zone.c b/src/namestore/test_namestore_api_zone_iteration_specific_zone.c index a4fb320e9..54cbe5472 100644 --- a/src/namestore/test_namestore_api_zone_iteration_specific_zone.c +++ b/src/namestore/test_namestore_api_zone_iteration_specific_zone.c | |||
@@ -57,7 +57,6 @@ static char * s_name_3; | |||
57 | 57 | ||
58 | static struct GNUNET_GNSRECORD_Data *s_rd_3; | 58 | static struct GNUNET_GNSRECORD_Data *s_rd_3; |
59 | 59 | ||
60 | static char *directory; | ||
61 | 60 | ||
62 | /** | 61 | /** |
63 | * Re-establish the connection to the service. | 62 | * Re-establish the connection to the service. |
@@ -379,35 +378,16 @@ empty_zone_proc (void *cls, | |||
379 | static void | 378 | static void |
380 | empty_zone_proc_end (void *cls) | 379 | empty_zone_proc_end (void *cls) |
381 | { | 380 | { |
382 | char *hostkey_file; | ||
383 | |||
384 | zi = NULL; | 381 | zi = NULL; |
385 | GNUNET_asprintf (&hostkey_file, | 382 | privkey = GNUNET_CRYPTO_ecdsa_key_create (); |
386 | "zonefiles%s%s", | ||
387 | DIR_SEPARATOR_STR, | ||
388 | "N0UJMP015AFUNR2BTNM3FKPBLG38913BL8IDMCO2H0A1LIB81960.zkey"); | ||
389 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
390 | "Using zonekey file `%s'\n", | ||
391 | hostkey_file); | ||
392 | privkey = GNUNET_CRYPTO_ecdsa_key_create_from_file (hostkey_file); | ||
393 | GNUNET_free (hostkey_file); | ||
394 | GNUNET_assert (privkey != NULL); | 383 | GNUNET_assert (privkey != NULL); |
395 | 384 | privkey2 = GNUNET_CRYPTO_ecdsa_key_create (); | |
396 | GNUNET_asprintf(&hostkey_file, | ||
397 | "zonefiles%s%s", | ||
398 | DIR_SEPARATOR_STR, | ||
399 | "HGU0A0VCU334DN7F2I9UIUMVQMM7JMSD142LIMNUGTTV9R0CF4EG.zkey"); | ||
400 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
401 | "Using zonekey file `%s' \n", | ||
402 | hostkey_file); | ||
403 | privkey2 = GNUNET_CRYPTO_ecdsa_key_create_from_file(hostkey_file); | ||
404 | GNUNET_free (hostkey_file); | ||
405 | GNUNET_assert (privkey2 != NULL); | 385 | GNUNET_assert (privkey2 != NULL); |
406 | 386 | ||
407 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 387 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
408 | "Created record 1\n"); | 388 | "Created record 1\n"); |
409 | 389 | GNUNET_asprintf (&s_name_1, | |
410 | GNUNET_asprintf(&s_name_1, "dummy1"); | 390 | "dummy1"); |
411 | s_rd_1 = create_record (1); | 391 | s_rd_1 = create_record (1); |
412 | GNUNET_NAMESTORE_records_store (nsh, | 392 | GNUNET_NAMESTORE_records_store (nsh, |
413 | privkey, | 393 | privkey, |
@@ -419,7 +399,8 @@ empty_zone_proc_end (void *cls) | |||
419 | 399 | ||
420 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 400 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
421 | "Created record 2 \n"); | 401 | "Created record 2 \n"); |
422 | GNUNET_asprintf(&s_name_2, "dummy2"); | 402 | GNUNET_asprintf (&s_name_2, |
403 | "dummy2"); | ||
423 | s_rd_2 = create_record (1); | 404 | s_rd_2 = create_record (1); |
424 | GNUNET_NAMESTORE_records_store (nsh, | 405 | GNUNET_NAMESTORE_records_store (nsh, |
425 | privkey, | 406 | privkey, |
@@ -433,7 +414,8 @@ empty_zone_proc_end (void *cls) | |||
433 | "Created record 3\n"); | 414 | "Created record 3\n"); |
434 | 415 | ||
435 | /* name in different zone */ | 416 | /* name in different zone */ |
436 | GNUNET_asprintf(&s_name_3, "dummy3"); | 417 | GNUNET_asprintf (&s_name_3, |
418 | "dummy3"); | ||
437 | s_rd_3 = create_record (1); | 419 | s_rd_3 = create_record (1); |
438 | GNUNET_NAMESTORE_records_store (nsh, | 420 | GNUNET_NAMESTORE_records_store (nsh, |
439 | privkey2, | 421 | privkey2, |
@@ -449,14 +431,6 @@ run (void *cls, | |||
449 | const struct GNUNET_CONFIGURATION_Handle *cfg, | 431 | const struct GNUNET_CONFIGURATION_Handle *cfg, |
450 | struct GNUNET_TESTING_Peer *peer) | 432 | struct GNUNET_TESTING_Peer *peer) |
451 | { | 433 | { |
452 | directory = NULL; | ||
453 | GNUNET_assert (GNUNET_OK == | ||
454 | GNUNET_CONFIGURATION_get_value_string (cfg, | ||
455 | "PATHS", | ||
456 | "GNUNET_TEST_HOME", | ||
457 | &directory)); | ||
458 | GNUNET_DISK_directory_remove (directory); | ||
459 | |||
460 | endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, | 434 | endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, |
461 | &endbadly, | 435 | &endbadly, |
462 | NULL); | 436 | NULL); |
@@ -477,7 +451,8 @@ run (void *cls, | |||
477 | "Failed to create zone iterator\n"); | 451 | "Failed to create zone iterator\n"); |
478 | GNUNET_break (0); | 452 | GNUNET_break (0); |
479 | GNUNET_SCHEDULER_cancel (endbadly_task); | 453 | GNUNET_SCHEDULER_cancel (endbadly_task); |
480 | endbadly_task = GNUNET_SCHEDULER_add_now (&endbadly, NULL); | 454 | endbadly_task = GNUNET_SCHEDULER_add_now (&endbadly, |
455 | NULL); | ||
481 | } | 456 | } |
482 | } | 457 | } |
483 | 458 | ||
@@ -493,6 +468,8 @@ main (int argc, char *argv[]) | |||
493 | "test_namestore_api_%s.conf", | 468 | "test_namestore_api_%s.conf", |
494 | plugin_name); | 469 | plugin_name); |
495 | res = 1; | 470 | res = 1; |
471 | GNUNET_DISK_purge_cfg_dir (cfg_name, | ||
472 | "GNUNET_TEST_HOME"); | ||
496 | if (0 != | 473 | if (0 != |
497 | GNUNET_TESTING_peer_run ("test-namestore-api-zone-iteration-specific-zone", | 474 | GNUNET_TESTING_peer_run ("test-namestore-api-zone-iteration-specific-zone", |
498 | cfg_name, | 475 | cfg_name, |
@@ -501,12 +478,9 @@ main (int argc, char *argv[]) | |||
501 | { | 478 | { |
502 | res = 1; | 479 | res = 1; |
503 | } | 480 | } |
481 | GNUNET_DISK_purge_cfg_dir (cfg_name, | ||
482 | "GNUNET_TEST_HOME"); | ||
504 | GNUNET_free (cfg_name); | 483 | GNUNET_free (cfg_name); |
505 | if (NULL != directory) | ||
506 | { | ||
507 | GNUNET_DISK_directory_remove (directory); | ||
508 | GNUNET_free (directory); | ||
509 | } | ||
510 | return res; | 484 | return res; |
511 | } | 485 | } |
512 | 486 | ||