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_not_existing_record.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_not_existing_record.c')
-rw-r--r-- | src/namestore/test_namestore_api_remove_not_existing_record.c | 37 |
1 files changed, 12 insertions, 25 deletions
diff --git a/src/namestore/test_namestore_api_remove_not_existing_record.c b/src/namestore/test_namestore_api_remove_not_existing_record.c index 2f20c3636..d0438a7e1 100644 --- a/src/namestore/test_namestore_api_remove_not_existing_record.c +++ b/src/namestore/test_namestore_api_remove_not_existing_record.c | |||
@@ -46,7 +46,6 @@ static int res; | |||
46 | 46 | ||
47 | static struct GNUNET_NAMESTORE_QueueEntry *nsqe; | 47 | static struct GNUNET_NAMESTORE_QueueEntry *nsqe; |
48 | 48 | ||
49 | static char *directory; | ||
50 | 49 | ||
51 | static void | 50 | static void |
52 | cleanup () | 51 | cleanup () |
@@ -92,7 +91,9 @@ end (void *cls) | |||
92 | 91 | ||
93 | 92 | ||
94 | static void | 93 | static void |
95 | put_cont (void *cls, int32_t success, const char *emsg) | 94 | put_cont (void *cls, |
95 | int32_t success, | ||
96 | const char *emsg) | ||
96 | { | 97 | { |
97 | GNUNET_assert (NULL != cls); | 98 | GNUNET_assert (NULL != cls); |
98 | nsqe = NULL; | 99 | nsqe = NULL; |
@@ -101,8 +102,8 @@ put_cont (void *cls, int32_t success, const char *emsg) | |||
101 | GNUNET_SCHEDULER_cancel (endbadly_task); | 102 | GNUNET_SCHEDULER_cancel (endbadly_task); |
102 | endbadly_task = NULL; | 103 | endbadly_task = NULL; |
103 | } | 104 | } |
104 | 105 | switch (success) | |
105 | switch (success) { | 106 | { |
106 | case GNUNET_NO: | 107 | case GNUNET_NO: |
107 | /* We expected GNUNET_NO, since record was not found */ | 108 | /* We expected GNUNET_NO, since record was not found */ |
108 | GNUNET_SCHEDULER_add_now (&end, NULL); | 109 | GNUNET_SCHEDULER_add_now (&end, NULL); |
@@ -129,25 +130,12 @@ run (void *cls, | |||
129 | const struct GNUNET_CONFIGURATION_Handle *cfg, | 130 | const struct GNUNET_CONFIGURATION_Handle *cfg, |
130 | struct GNUNET_TESTING_Peer *peer) | 131 | struct GNUNET_TESTING_Peer *peer) |
131 | { | 132 | { |
132 | char *hostkey_file; | ||
133 | const char * name = "dummy.dummy.gnunet"; | 133 | const char * name = "dummy.dummy.gnunet"; |
134 | 134 | ||
135 | directory = NULL; | ||
136 | GNUNET_assert (GNUNET_OK == | ||
137 | GNUNET_CONFIGURATION_get_value_string(cfg, "PATHS", "GNUNET_TEST_HOME", &directory)); | ||
138 | GNUNET_DISK_directory_remove (directory); | ||
139 | |||
140 | endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, | 135 | endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, |
141 | &endbadly, NULL); | 136 | &endbadly, |
142 | GNUNET_asprintf (&hostkey_file, | 137 | NULL); |
143 | "zonefiles%s%s", | 138 | privkey = GNUNET_CRYPTO_ecdsa_key_create (); |
144 | DIR_SEPARATOR_STR, | ||
145 | "N0UJMP015AFUNR2BTNM3FKPBLG38913BL8IDMCO2H0A1LIB81960.zkey"); | ||
146 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
147 | "Using zonekey file `%s' \n", | ||
148 | hostkey_file); | ||
149 | privkey = GNUNET_CRYPTO_ecdsa_key_create_from_file (hostkey_file); | ||
150 | GNUNET_free (hostkey_file); | ||
151 | GNUNET_assert (privkey != NULL); | 139 | GNUNET_assert (privkey != NULL); |
152 | GNUNET_CRYPTO_ecdsa_key_get_public (privkey, &pubkey); | 140 | GNUNET_CRYPTO_ecdsa_key_get_public (privkey, &pubkey); |
153 | 141 | ||
@@ -174,6 +162,8 @@ main (int argc, char *argv[]) | |||
174 | GNUNET_asprintf (&cfg_name, | 162 | GNUNET_asprintf (&cfg_name, |
175 | "test_namestore_api_%s.conf", | 163 | "test_namestore_api_%s.conf", |
176 | plugin_name); | 164 | plugin_name); |
165 | GNUNET_DISK_purge_cfg_dir (cfg_name, | ||
166 | "GNUNET_TEST_HOME"); | ||
177 | res = 1; | 167 | res = 1; |
178 | if (0 != | 168 | if (0 != |
179 | GNUNET_TESTING_peer_run ("test-namestore-api-remove-non-existing-record", | 169 | GNUNET_TESTING_peer_run ("test-namestore-api-remove-non-existing-record", |
@@ -183,12 +173,9 @@ main (int argc, char *argv[]) | |||
183 | { | 173 | { |
184 | res = 1; | 174 | res = 1; |
185 | } | 175 | } |
176 | GNUNET_DISK_purge_cfg_dir (cfg_name, | ||
177 | "GNUNET_TEST_HOME"); | ||
186 | GNUNET_free (cfg_name); | 178 | GNUNET_free (cfg_name); |
187 | if (NULL != directory) | ||
188 | { | ||
189 | GNUNET_DISK_directory_remove (directory); | ||
190 | GNUNET_free (directory); | ||
191 | } | ||
192 | return res; | 179 | return res; |
193 | } | 180 | } |
194 | 181 | ||