diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2012-03-02 10:21:58 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2012-03-02 10:21:58 +0000 |
commit | e892ec3a25fc315d58ae7aafbd138b79aff2ca34 (patch) | |
tree | 618d778ee297a080cc4aa17b1013ef03dc99fb9c /src | |
parent | e2f8c8f83b67abb62b8858beb684b0b7f43c3ed7 (diff) | |
download | gnunet-e892ec3a25fc315d58ae7aafbd138b79aff2ca34.tar.gz gnunet-e892ec3a25fc315d58ae7aafbd138b79aff2ca34.zip |
- reset db before test
Diffstat (limited to 'src')
-rw-r--r-- | src/namestore/test_namestore_api.c | 19 | ||||
-rw-r--r-- | src/namestore/test_namestore_api_lookup.c | 19 | ||||
-rw-r--r-- | src/namestore/test_namestore_api_put.c | 18 | ||||
-rw-r--r-- | src/namestore/test_namestore_api_remove.c | 19 | ||||
-rw-r--r-- | src/namestore/test_namestore_api_remove_not_existing_record.c | 19 | ||||
-rw-r--r-- | src/namestore/test_namestore_api_zone_iteration.c | 19 |
6 files changed, 113 insertions, 0 deletions
diff --git a/src/namestore/test_namestore_api.c b/src/namestore/test_namestore_api.c index ebd8be3f6..a69f27665 100644 --- a/src/namestore/test_namestore_api.c +++ b/src/namestore/test_namestore_api.c | |||
@@ -142,10 +142,29 @@ void put_cont (void *cls, int32_t success, const char *emsg) | |||
142 | GNUNET_NAMESTORE_lookup_record (nsh, &zone, name, 0, &name_lookup_proc, NULL); | 142 | GNUNET_NAMESTORE_lookup_record (nsh, &zone, name, 0, &name_lookup_proc, NULL); |
143 | } | 143 | } |
144 | 144 | ||
145 | void | ||
146 | delete_existing_db (const struct GNUNET_CONFIGURATION_Handle *cfg) | ||
147 | { | ||
148 | char *afsdir; | ||
149 | |||
150 | if (GNUNET_OK == | ||
151 | GNUNET_CONFIGURATION_get_value_filename (cfg, "namestore-sqlite", | ||
152 | "FILENAME", &afsdir)) | ||
153 | { | ||
154 | if (GNUNET_OK == GNUNET_DISK_file_test (afsdir)) | ||
155 | if (GNUNET_OK == GNUNET_DISK_file_test (afsdir)) | ||
156 | if (GNUNET_OK == GNUNET_DISK_directory_remove(afsdir)) | ||
157 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Deleted existing database `%s' \n", afsdir); | ||
158 | GNUNET_free (afsdir); | ||
159 | } | ||
160 | |||
161 | } | ||
162 | |||
145 | static void | 163 | static void |
146 | run (void *cls, char *const *args, const char *cfgfile, | 164 | run (void *cls, char *const *args, const char *cfgfile, |
147 | const struct GNUNET_CONFIGURATION_Handle *cfg) | 165 | const struct GNUNET_CONFIGURATION_Handle *cfg) |
148 | { | 166 | { |
167 | delete_existing_db(cfg); | ||
149 | endbadly_task = GNUNET_SCHEDULER_add_delayed(TIMEOUT,endbadly, NULL); | 168 | endbadly_task = GNUNET_SCHEDULER_add_delayed(TIMEOUT,endbadly, NULL); |
150 | 169 | ||
151 | privkey = GNUNET_CRYPTO_rsa_key_create_from_file("hostkey"); | 170 | privkey = GNUNET_CRYPTO_rsa_key_create_from_file("hostkey"); |
diff --git a/src/namestore/test_namestore_api_lookup.c b/src/namestore/test_namestore_api_lookup.c index 3943d9db2..daca07b14 100644 --- a/src/namestore/test_namestore_api_lookup.c +++ b/src/namestore/test_namestore_api_lookup.c | |||
@@ -227,10 +227,29 @@ create_record (int count) | |||
227 | return rd; | 227 | return rd; |
228 | } | 228 | } |
229 | 229 | ||
230 | void | ||
231 | delete_existing_db (const struct GNUNET_CONFIGURATION_Handle *cfg) | ||
232 | { | ||
233 | char *afsdir; | ||
234 | |||
235 | if (GNUNET_OK == | ||
236 | GNUNET_CONFIGURATION_get_value_filename (cfg, "namestore-sqlite", | ||
237 | "FILENAME", &afsdir)) | ||
238 | { | ||
239 | if (GNUNET_OK == GNUNET_DISK_file_test (afsdir)) | ||
240 | if (GNUNET_OK == GNUNET_DISK_file_test (afsdir)) | ||
241 | if (GNUNET_OK == GNUNET_DISK_directory_remove(afsdir)) | ||
242 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Deleted existing database `%s' \n", afsdir); | ||
243 | GNUNET_free (afsdir); | ||
244 | } | ||
245 | |||
246 | } | ||
247 | |||
230 | static void | 248 | static void |
231 | run (void *cls, char *const *args, const char *cfgfile, | 249 | run (void *cls, char *const *args, const char *cfgfile, |
232 | const struct GNUNET_CONFIGURATION_Handle *cfg) | 250 | const struct GNUNET_CONFIGURATION_Handle *cfg) |
233 | { | 251 | { |
252 | delete_existing_db(cfg); | ||
234 | endbadly_task = GNUNET_SCHEDULER_add_delayed(TIMEOUT,endbadly, NULL); | 253 | endbadly_task = GNUNET_SCHEDULER_add_delayed(TIMEOUT,endbadly, NULL); |
235 | 254 | ||
236 | size_t rd_ser_len; | 255 | size_t rd_ser_len; |
diff --git a/src/namestore/test_namestore_api_put.c b/src/namestore/test_namestore_api_put.c index 211c19696..f65b533b3 100644 --- a/src/namestore/test_namestore_api_put.c +++ b/src/namestore/test_namestore_api_put.c | |||
@@ -151,10 +151,28 @@ create_record (int count) | |||
151 | return rd; | 151 | return rd; |
152 | } | 152 | } |
153 | 153 | ||
154 | void | ||
155 | delete_existing_db (const struct GNUNET_CONFIGURATION_Handle *cfg) | ||
156 | { | ||
157 | char *afsdir; | ||
158 | |||
159 | if (GNUNET_OK == | ||
160 | GNUNET_CONFIGURATION_get_value_filename (cfg, "namestore-sqlite", | ||
161 | "FILENAME", &afsdir)) | ||
162 | { | ||
163 | if (GNUNET_OK == GNUNET_DISK_file_test (afsdir)) | ||
164 | if (GNUNET_OK == GNUNET_DISK_file_test (afsdir)) | ||
165 | if (GNUNET_OK == GNUNET_DISK_directory_remove(afsdir)) | ||
166 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Deleted existing database `%s' \n", afsdir); | ||
167 | GNUNET_free (afsdir); | ||
168 | } | ||
169 | } | ||
170 | |||
154 | static void | 171 | static void |
155 | run (void *cls, char *const *args, const char *cfgfile, | 172 | run (void *cls, char *const *args, const char *cfgfile, |
156 | const struct GNUNET_CONFIGURATION_Handle *cfg) | 173 | const struct GNUNET_CONFIGURATION_Handle *cfg) |
157 | { | 174 | { |
175 | delete_existing_db(cfg); | ||
158 | endbadly_task = GNUNET_SCHEDULER_add_delayed(TIMEOUT,endbadly, NULL); | 176 | endbadly_task = GNUNET_SCHEDULER_add_delayed(TIMEOUT,endbadly, NULL); |
159 | 177 | ||
160 | /* load privat key */ | 178 | /* load privat key */ |
diff --git a/src/namestore/test_namestore_api_remove.c b/src/namestore/test_namestore_api_remove.c index 6b0943f3d..9bd25b3a2 100644 --- a/src/namestore/test_namestore_api_remove.c +++ b/src/namestore/test_namestore_api_remove.c | |||
@@ -261,10 +261,29 @@ create_record (int count) | |||
261 | return rd; | 261 | return rd; |
262 | } | 262 | } |
263 | 263 | ||
264 | void | ||
265 | delete_existing_db (const struct GNUNET_CONFIGURATION_Handle *cfg) | ||
266 | { | ||
267 | char *afsdir; | ||
268 | |||
269 | if (GNUNET_OK == | ||
270 | GNUNET_CONFIGURATION_get_value_filename (cfg, "namestore-sqlite", | ||
271 | "FILENAME", &afsdir)) | ||
272 | { | ||
273 | if (GNUNET_OK == GNUNET_DISK_file_test (afsdir)) | ||
274 | if (GNUNET_OK == GNUNET_DISK_file_test (afsdir)) | ||
275 | if (GNUNET_OK == GNUNET_DISK_directory_remove(afsdir)) | ||
276 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Deleted existing database `%s' \n", afsdir); | ||
277 | GNUNET_free (afsdir); | ||
278 | } | ||
279 | |||
280 | } | ||
281 | |||
264 | static void | 282 | static void |
265 | run (void *cls, char *const *args, const char *cfgfile, | 283 | run (void *cls, char *const *args, const char *cfgfile, |
266 | const struct GNUNET_CONFIGURATION_Handle *cfg) | 284 | const struct GNUNET_CONFIGURATION_Handle *cfg) |
267 | { | 285 | { |
286 | delete_existing_db(cfg); | ||
268 | endbadly_task = GNUNET_SCHEDULER_add_delayed(TIMEOUT,endbadly, NULL); | 287 | endbadly_task = GNUNET_SCHEDULER_add_delayed(TIMEOUT,endbadly, NULL); |
269 | size_t rd_ser_len; | 288 | size_t rd_ser_len; |
270 | 289 | ||
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 85652874c..4ee633598 100644 --- a/src/namestore/test_namestore_api_remove_not_existing_record.c +++ b/src/namestore/test_namestore_api_remove_not_existing_record.c | |||
@@ -195,10 +195,29 @@ create_record (int count) | |||
195 | return rd; | 195 | return rd; |
196 | } | 196 | } |
197 | 197 | ||
198 | void | ||
199 | delete_existing_db (const struct GNUNET_CONFIGURATION_Handle *cfg) | ||
200 | { | ||
201 | char *afsdir; | ||
202 | |||
203 | if (GNUNET_OK == | ||
204 | GNUNET_CONFIGURATION_get_value_filename (cfg, "namestore-sqlite", | ||
205 | "FILENAME", &afsdir)) | ||
206 | { | ||
207 | if (GNUNET_OK == GNUNET_DISK_file_test (afsdir)) | ||
208 | if (GNUNET_OK == GNUNET_DISK_file_test (afsdir)) | ||
209 | if (GNUNET_OK == GNUNET_DISK_directory_remove(afsdir)) | ||
210 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Deleted existing database `%s' \n", afsdir); | ||
211 | GNUNET_free (afsdir); | ||
212 | } | ||
213 | |||
214 | } | ||
215 | |||
198 | static void | 216 | static void |
199 | run (void *cls, char *const *args, const char *cfgfile, | 217 | run (void *cls, char *const *args, const char *cfgfile, |
200 | const struct GNUNET_CONFIGURATION_Handle *cfg) | 218 | const struct GNUNET_CONFIGURATION_Handle *cfg) |
201 | { | 219 | { |
220 | delete_existing_db(cfg); | ||
202 | endbadly_task = GNUNET_SCHEDULER_add_delayed(TIMEOUT,endbadly, NULL); | 221 | endbadly_task = GNUNET_SCHEDULER_add_delayed(TIMEOUT,endbadly, NULL); |
203 | size_t rd_ser_len; | 222 | size_t rd_ser_len; |
204 | 223 | ||
diff --git a/src/namestore/test_namestore_api_zone_iteration.c b/src/namestore/test_namestore_api_zone_iteration.c index c0ef8c809..95755ceee 100644 --- a/src/namestore/test_namestore_api_zone_iteration.c +++ b/src/namestore/test_namestore_api_zone_iteration.c | |||
@@ -153,10 +153,29 @@ void zone_proc (void *cls, | |||
153 | stopiteration_task = GNUNET_SCHEDULER_add_now (&stop_iteration, NULL); | 153 | stopiteration_task = GNUNET_SCHEDULER_add_now (&stop_iteration, NULL); |
154 | } | 154 | } |
155 | 155 | ||
156 | void | ||
157 | delete_existing_db (const struct GNUNET_CONFIGURATION_Handle *cfg) | ||
158 | { | ||
159 | char *afsdir; | ||
160 | |||
161 | if (GNUNET_OK == | ||
162 | GNUNET_CONFIGURATION_get_value_filename (cfg, "namestore-sqlite", | ||
163 | "FILENAME", &afsdir)) | ||
164 | { | ||
165 | if (GNUNET_OK == GNUNET_DISK_file_test (afsdir)) | ||
166 | if (GNUNET_OK == GNUNET_DISK_file_test (afsdir)) | ||
167 | if (GNUNET_OK == GNUNET_DISK_directory_remove(afsdir)) | ||
168 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Deleted existing database `%s' \n", afsdir); | ||
169 | GNUNET_free (afsdir); | ||
170 | } | ||
171 | |||
172 | } | ||
173 | |||
156 | static void | 174 | static void |
157 | run (void *cls, char *const *args, const char *cfgfile, | 175 | run (void *cls, char *const *args, const char *cfgfile, |
158 | const struct GNUNET_CONFIGURATION_Handle *cfg) | 176 | const struct GNUNET_CONFIGURATION_Handle *cfg) |
159 | { | 177 | { |
178 | delete_existing_db(cfg); | ||
160 | endbadly_task = GNUNET_SCHEDULER_add_delayed(TIMEOUT,&endbadly, NULL); | 179 | endbadly_task = GNUNET_SCHEDULER_add_delayed(TIMEOUT,&endbadly, NULL); |
161 | 180 | ||
162 | privkey = GNUNET_CRYPTO_rsa_key_create_from_file("hostkey"); | 181 | privkey = GNUNET_CRYPTO_rsa_key_create_from_file("hostkey"); |