aboutsummaryrefslogtreecommitdiff
path: root/src/namestore/test_namestore_api_store.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_store.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_store.c')
-rw-r--r--src/namestore/test_namestore_api_store.c33
1 files changed, 12 insertions, 21 deletions
diff --git a/src/namestore/test_namestore_api_store.c b/src/namestore/test_namestore_api_store.c
index 4e51678a1..4abcfa4d3 100644
--- a/src/namestore/test_namestore_api_store.c
+++ b/src/namestore/test_namestore_api_store.c
@@ -46,7 +46,6 @@ static int res;
46 46
47static struct GNUNET_NAMESTORE_QueueEntry *nsqe; 47static struct GNUNET_NAMESTORE_QueueEntry *nsqe;
48 48
49static char *directory;
50 49
51static void 50static void
52cleanup () 51cleanup ()
@@ -114,23 +113,11 @@ run (void *cls,
114 struct GNUNET_TESTING_Peer *peer) 113 struct GNUNET_TESTING_Peer *peer)
115{ 114{
116 struct GNUNET_GNSRECORD_Data rd; 115 struct GNUNET_GNSRECORD_Data rd;
117 char *hostkey_file;
118 const char * name = "dummy.dummy.gnunet"; 116 const char * name = "dummy.dummy.gnunet";
119 117
120 directory = NULL;
121 GNUNET_assert (GNUNET_OK ==
122 GNUNET_CONFIGURATION_get_value_string(cfg, "PATHS", "GNUNET_TEST_HOME", &directory));
123 GNUNET_DISK_directory_remove (directory);
124
125 endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, 118 endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT,
126 &endbadly, NULL); 119 &endbadly, NULL);
127 GNUNET_asprintf (&hostkey_file, 120 privkey = GNUNET_CRYPTO_ecdsa_key_create ();
128 "zonefiles%s%s",
129 DIR_SEPARATOR_STR,
130 "N0UJMP015AFUNR2BTNM3FKPBLG38913BL8IDMCO2H0A1LIB81960.zkey");
131 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Using zonekey file `%s' \n", hostkey_file);
132 privkey = GNUNET_CRYPTO_ecdsa_key_create_from_file (hostkey_file);
133 GNUNET_free (hostkey_file);
134 GNUNET_assert (privkey != NULL); 121 GNUNET_assert (privkey != NULL);
135 GNUNET_CRYPTO_ecdsa_key_get_public (privkey, &pubkey); 122 GNUNET_CRYPTO_ecdsa_key_get_public (privkey, &pubkey);
136 123
@@ -144,8 +131,13 @@ run (void *cls,
144 131
145 nsh = GNUNET_NAMESTORE_connect (cfg); 132 nsh = GNUNET_NAMESTORE_connect (cfg);
146 GNUNET_break (NULL != nsh); 133 GNUNET_break (NULL != nsh);
147 nsqe = GNUNET_NAMESTORE_records_store (nsh, privkey, name, 134 nsqe = GNUNET_NAMESTORE_records_store (nsh,
148 1, &rd, &put_cont, (void *) name); 135 privkey,
136 name,
137 1,
138 &rd,
139 &put_cont,
140 (void *) name);
149 if (NULL == nsqe) 141 if (NULL == nsqe)
150 { 142 {
151 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 143 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
@@ -167,6 +159,8 @@ main (int argc, char *argv[])
167 "test_namestore_api_%s.conf", 159 "test_namestore_api_%s.conf",
168 plugin_name); 160 plugin_name);
169 res = 1; 161 res = 1;
162 GNUNET_DISK_purge_cfg_dir (cfg_name,
163 "GNUNET_TEST_HOME");
170 if (0 != 164 if (0 !=
171 GNUNET_TESTING_peer_run ("test-namestore-api", 165 GNUNET_TESTING_peer_run ("test-namestore-api",
172 cfg_name, 166 cfg_name,
@@ -175,12 +169,9 @@ main (int argc, char *argv[])
175 { 169 {
176 res = 1; 170 res = 1;
177 } 171 }
172 GNUNET_DISK_purge_cfg_dir (cfg_name,
173 "GNUNET_TEST_HOME");
178 GNUNET_free (cfg_name); 174 GNUNET_free (cfg_name);
179 if (NULL != directory)
180 {
181 GNUNET_DISK_directory_remove (directory);
182 GNUNET_free (directory);
183 }
184 return res; 175 return res;
185} 176}
186 177