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_remove.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_remove.c')
-rw-r--r-- | src/namestore/test_namestore_api_remove.c | 42 |
1 files changed, 15 insertions, 27 deletions
diff --git a/src/namestore/test_namestore_api_remove.c b/src/namestore/test_namestore_api_remove.c index 532a751da..c9e2802bd 100644 --- a/src/namestore/test_namestore_api_remove.c +++ b/src/namestore/test_namestore_api_remove.c | |||
@@ -48,7 +48,6 @@ static int removed; | |||
48 | 48 | ||
49 | static struct GNUNET_NAMESTORE_QueueEntry *nsqe; | 49 | static struct GNUNET_NAMESTORE_QueueEntry *nsqe; |
50 | 50 | ||
51 | static char *directory; | ||
52 | 51 | ||
53 | static void | 52 | static void |
54 | cleanup () | 53 | cleanup () |
@@ -157,29 +156,12 @@ run (void *cls, | |||
157 | struct GNUNET_TESTING_Peer *peer) | 156 | struct GNUNET_TESTING_Peer *peer) |
158 | { | 157 | { |
159 | struct GNUNET_GNSRECORD_Data rd; | 158 | struct GNUNET_GNSRECORD_Data rd; |
160 | char *hostkey_file; | ||
161 | const char * name = "dummy.dummy.gnunet"; | 159 | const char * name = "dummy.dummy.gnunet"; |
162 | 160 | ||
163 | directory = NULL; | ||
164 | GNUNET_assert (GNUNET_OK == | ||
165 | GNUNET_CONFIGURATION_get_value_string(cfg, | ||
166 | "PATHS", | ||
167 | "GNUNET_TEST_HOME", | ||
168 | &directory)); | ||
169 | GNUNET_DISK_directory_remove (directory); | ||
170 | |||
171 | endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, | 161 | endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, |
172 | &endbadly, | 162 | &endbadly, |
173 | NULL); | 163 | NULL); |
174 | GNUNET_asprintf (&hostkey_file, | 164 | privkey = GNUNET_CRYPTO_ecdsa_key_create (); |
175 | "zonefiles%s%s", | ||
176 | DIR_SEPARATOR_STR, | ||
177 | "N0UJMP015AFUNR2BTNM3FKPBLG38913BL8IDMCO2H0A1LIB81960.zkey"); | ||
178 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
179 | "Using zonekey file `%s' \n", | ||
180 | hostkey_file); | ||
181 | privkey = GNUNET_CRYPTO_ecdsa_key_create_from_file (hostkey_file); | ||
182 | GNUNET_free (hostkey_file); | ||
183 | GNUNET_assert (privkey != NULL); | 165 | GNUNET_assert (privkey != NULL); |
184 | GNUNET_CRYPTO_ecdsa_key_get_public (privkey, | 166 | GNUNET_CRYPTO_ecdsa_key_get_public (privkey, |
185 | &pubkey); | 167 | &pubkey); |
@@ -191,12 +173,19 @@ run (void *cls, | |||
191 | rd.data_size = TEST_RECORD_DATALEN; | 173 | rd.data_size = TEST_RECORD_DATALEN; |
192 | rd.data = GNUNET_malloc (TEST_RECORD_DATALEN); | 174 | rd.data = GNUNET_malloc (TEST_RECORD_DATALEN); |
193 | rd.flags = 0; | 175 | rd.flags = 0; |
194 | memset ((char *) rd.data, 'a', TEST_RECORD_DATALEN); | 176 | memset ((char *) rd.data, |
177 | 'a', | ||
178 | TEST_RECORD_DATALEN); | ||
195 | 179 | ||
196 | nsh = GNUNET_NAMESTORE_connect (cfg); | 180 | nsh = GNUNET_NAMESTORE_connect (cfg); |
197 | GNUNET_break (NULL != nsh); | 181 | GNUNET_break (NULL != nsh); |
198 | nsqe = GNUNET_NAMESTORE_records_store (nsh, privkey, name, | 182 | nsqe = GNUNET_NAMESTORE_records_store (nsh, |
199 | 1, &rd, &put_cont, (void *) name); | 183 | privkey, |
184 | name, | ||
185 | 1, | ||
186 | &rd, | ||
187 | &put_cont, | ||
188 | (void *) name); | ||
200 | if (NULL == nsqe) | 189 | if (NULL == nsqe) |
201 | { | 190 | { |
202 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 191 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
@@ -216,6 +205,8 @@ main (int argc, char *argv[]) | |||
216 | GNUNET_asprintf (&cfg_name, | 205 | GNUNET_asprintf (&cfg_name, |
217 | "test_namestore_api_%s.conf", | 206 | "test_namestore_api_%s.conf", |
218 | plugin_name); | 207 | plugin_name); |
208 | GNUNET_DISK_purge_cfg_dir (cfg_name, | ||
209 | "GNUNET_TEST_HOME"); | ||
219 | res = 1; | 210 | res = 1; |
220 | if (0 != | 211 | if (0 != |
221 | GNUNET_TESTING_peer_run ("test-namestore-api-remove", | 212 | GNUNET_TESTING_peer_run ("test-namestore-api-remove", |
@@ -225,12 +216,9 @@ main (int argc, char *argv[]) | |||
225 | { | 216 | { |
226 | res = 1; | 217 | res = 1; |
227 | } | 218 | } |
219 | GNUNET_DISK_purge_cfg_dir (cfg_name, | ||
220 | "GNUNET_TEST_HOME"); | ||
228 | GNUNET_free (cfg_name); | 221 | GNUNET_free (cfg_name); |
229 | if (NULL != directory) | ||
230 | { | ||
231 | GNUNET_DISK_directory_remove (directory); | ||
232 | GNUNET_free (directory); | ||
233 | } | ||
234 | return res; | 222 | return res; |
235 | } | 223 | } |
236 | 224 | ||