aboutsummaryrefslogtreecommitdiff
path: root/src/namestore/test_namestore_api_lookup_shadow_filter.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2018-05-09 17:33:04 +0200
committerChristian Grothoff <christian@grothoff.org>2018-05-09 17:33:04 +0200
commit8bb475af99260f1d107dbc8908268ae93960aa83 (patch)
tree1a7a1fc03424df841a6f977b137482439b09bc9f /src/namestore/test_namestore_api_lookup_shadow_filter.c
parent1f80a11e90ee982bffaae4685e281f75ee1c225d (diff)
downloadgnunet-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_lookup_shadow_filter.c')
-rw-r--r--src/namestore/test_namestore_api_lookup_shadow_filter.c34
1 files changed, 11 insertions, 23 deletions
diff --git a/src/namestore/test_namestore_api_lookup_shadow_filter.c b/src/namestore/test_namestore_api_lookup_shadow_filter.c
index 5b8811a23..09fd8ce07 100644
--- a/src/namestore/test_namestore_api_lookup_shadow_filter.c
+++ b/src/namestore/test_namestore_api_lookup_shadow_filter.c
@@ -66,7 +66,6 @@ static struct GNUNET_HashCode derived_hash;
66 66
67static struct GNUNET_CRYPTO_EcdsaPublicKey pubkey; 67static struct GNUNET_CRYPTO_EcdsaPublicKey pubkey;
68 68
69static char *directory;
70 69
71static void 70static void
72cleanup () 71cleanup ()
@@ -291,26 +290,16 @@ run (void *cls,
291 const struct GNUNET_CONFIGURATION_Handle *cfg, 290 const struct GNUNET_CONFIGURATION_Handle *cfg,
292 struct GNUNET_TESTING_Peer *peer) 291 struct GNUNET_TESTING_Peer *peer)
293{ 292{
294 char *hostkey_file;
295
296 directory = NULL;
297 GNUNET_assert (GNUNET_OK ==
298 GNUNET_CONFIGURATION_get_value_string(cfg, "PATHS", "GNUNET_TEST_HOME", &directory));
299 GNUNET_DISK_directory_remove (directory);
300
301 endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, 293 endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT,
302 &endbadly, NULL); 294 &endbadly,
303 GNUNET_asprintf (&hostkey_file, 295 NULL);
304 "zonefiles%s%s", 296 privkey = GNUNET_CRYPTO_ecdsa_key_create ();
305 DIR_SEPARATOR_STR,
306 "N0UJMP015AFUNR2BTNM3FKPBLG38913BL8IDMCO2H0A1LIB81960.zkey");
307 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Using zonekey file `%s' \n", hostkey_file);
308 privkey = GNUNET_CRYPTO_ecdsa_key_create_from_file (hostkey_file);
309 GNUNET_free (hostkey_file);
310 GNUNET_assert (privkey != NULL); 297 GNUNET_assert (privkey != NULL);
311 GNUNET_CRYPTO_ecdsa_key_get_public (privkey, &pubkey); 298 GNUNET_CRYPTO_ecdsa_key_get_public (privkey,
299 &pubkey);
312 300
313 record_expiration = GNUNET_TIME_absolute_add(GNUNET_TIME_absolute_get(), EXPIRATION); 301 record_expiration = GNUNET_TIME_absolute_add (GNUNET_TIME_absolute_get(),
302 EXPIRATION);
314 records[0].expiration_time = record_expiration.abs_value_us; 303 records[0].expiration_time = record_expiration.abs_value_us;
315 records[0].record_type = TEST_RECORD_TYPE; 304 records[0].record_type = TEST_RECORD_TYPE;
316 records[0].data_size = TEST_RECORD_DATALEN; 305 records[0].data_size = TEST_RECORD_DATALEN;
@@ -352,6 +341,8 @@ main (int argc, char *argv[])
352 GNUNET_asprintf (&cfg_name, 341 GNUNET_asprintf (&cfg_name,
353 "test_namestore_api_%s.conf", 342 "test_namestore_api_%s.conf",
354 plugin_name); 343 plugin_name);
344 GNUNET_DISK_purge_cfg_dir (cfg_name,
345 "GNUNET_TEST_HOME");
355 res = 1; 346 res = 1;
356 if (0 != 347 if (0 !=
357 GNUNET_TESTING_peer_run ("test-namestore-api-lookup-shadow-filter", 348 GNUNET_TESTING_peer_run ("test-namestore-api-lookup-shadow-filter",
@@ -362,11 +353,8 @@ main (int argc, char *argv[])
362 res = 1; 353 res = 1;
363 } 354 }
364 GNUNET_free (cfg_name); 355 GNUNET_free (cfg_name);
365 if (NULL != directory) 356 GNUNET_DISK_purge_cfg_dir (cfg_name,
366 { 357 "GNUNET_TEST_HOME");
367 GNUNET_DISK_directory_remove (directory);
368 GNUNET_free (directory);
369 }
370 return res; 358 return res;
371} 359}
372 360