diff options
author | Christian Grothoff <christian@grothoff.org> | 2014-12-11 14:03:52 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2014-12-11 14:03:52 +0000 |
commit | 0b385d20dad7898fbc0d07aba0587e86648a733a (patch) | |
tree | 2f739566bf1b9324d287b5667857e92c765863db /src/datastore | |
parent | 0a1098b10093d1344be7455c901e938806753fd0 (diff) | |
download | gnunet-0b385d20dad7898fbc0d07aba0587e86648a733a.tar.gz gnunet-0b385d20dad7898fbc0d07aba0587e86648a733a.zip |
adding single location for no_forcestart configuration list
Diffstat (limited to 'src/datastore')
-rw-r--r-- | src/datastore/test_datastore_api.c | 98 |
1 files changed, 71 insertions, 27 deletions
diff --git a/src/datastore/test_datastore_api.c b/src/datastore/test_datastore_api.c index 26d0f1343..2bc29b9fe 100644 --- a/src/datastore/test_datastore_api.c +++ b/src/datastore/test_datastore_api.c | |||
@@ -137,7 +137,10 @@ run_continuation (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc); | |||
137 | 137 | ||
138 | 138 | ||
139 | static void | 139 | static void |
140 | check_success (void *cls, int success, struct GNUNET_TIME_Absolute min_expiration, const char *msg) | 140 | check_success (void *cls, |
141 | int success, | ||
142 | struct GNUNET_TIME_Absolute min_expiration, | ||
143 | const char *msg) | ||
141 | { | 144 | { |
142 | struct CpsRunContext *crc = cls; | 145 | struct CpsRunContext *crc = cls; |
143 | 146 | ||
@@ -156,12 +159,16 @@ check_success (void *cls, int success, struct GNUNET_TIME_Absolute min_expiratio | |||
156 | 159 | ||
157 | 160 | ||
158 | static void | 161 | static void |
159 | get_reserved (void *cls, int success, struct GNUNET_TIME_Absolute min_expiration, const char *msg) | 162 | get_reserved (void *cls, |
163 | int success, | ||
164 | struct GNUNET_TIME_Absolute min_expiration, | ||
165 | const char *msg) | ||
160 | { | 166 | { |
161 | struct CpsRunContext *crc = cls; | 167 | struct CpsRunContext *crc = cls; |
162 | 168 | ||
163 | if (0 >= success) | 169 | if (0 >= success) |
164 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Error obtaining reservation: `%s'\n", | 170 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
171 | "Error obtaining reservation: `%s'\n", | ||
165 | msg); | 172 | msg); |
166 | GNUNET_assert (0 < success); | 173 | GNUNET_assert (0 < success); |
167 | crc->rid = success; | 174 | crc->rid = success; |
@@ -171,9 +178,14 @@ get_reserved (void *cls, int success, struct GNUNET_TIME_Absolute min_expiration | |||
171 | 178 | ||
172 | 179 | ||
173 | static void | 180 | static void |
174 | check_value (void *cls, const struct GNUNET_HashCode * key, size_t size, | 181 | check_value (void *cls, |
175 | const void *data, enum GNUNET_BLOCK_Type type, uint32_t priority, | 182 | const struct GNUNET_HashCode *key, |
176 | uint32_t anonymity, struct GNUNET_TIME_Absolute expiration, | 183 | size_t size, |
184 | const void *data, | ||
185 | enum GNUNET_BLOCK_Type type, | ||
186 | uint32_t priority, | ||
187 | uint32_t anonymity, | ||
188 | struct GNUNET_TIME_Absolute expiration, | ||
177 | uint64_t uid) | 189 | uint64_t uid) |
178 | { | 190 | { |
179 | struct CpsRunContext *crc = cls; | 191 | struct CpsRunContext *crc = cls; |
@@ -183,7 +195,8 @@ check_value (void *cls, const struct GNUNET_HashCode * key, size_t size, | |||
183 | if (NULL == key) | 195 | if (NULL == key) |
184 | { | 196 | { |
185 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 197 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
186 | "Value check failed (got NULL key) in %d/%d\n", crc->phase, | 198 | "Value check failed (got NULL key) in %d/%d\n", |
199 | crc->phase, | ||
187 | crc->i); | 200 | crc->i); |
188 | crc->phase = RP_ERROR; | 201 | crc->phase = RP_ERROR; |
189 | GNUNET_SCHEDULER_add_continuation (&run_continuation, crc, | 202 | GNUNET_SCHEDULER_add_continuation (&run_continuation, crc, |
@@ -218,14 +231,19 @@ check_value (void *cls, const struct GNUNET_HashCode * key, size_t size, | |||
218 | 231 | ||
219 | 232 | ||
220 | static void | 233 | static void |
221 | delete_value (void *cls, const struct GNUNET_HashCode * key, size_t size, | 234 | delete_value (void *cls, |
222 | const void *data, enum GNUNET_BLOCK_Type type, uint32_t priority, | 235 | const struct GNUNET_HashCode *key, |
223 | uint32_t anonymity, struct GNUNET_TIME_Absolute expiration, | 236 | size_t size, |
237 | const void *data, | ||
238 | enum GNUNET_BLOCK_Type type, | ||
239 | uint32_t priority, | ||
240 | uint32_t anonymity, | ||
241 | struct GNUNET_TIME_Absolute expiration, | ||
224 | uint64_t uid) | 242 | uint64_t uid) |
225 | { | 243 | { |
226 | struct CpsRunContext *crc = cls; | 244 | struct CpsRunContext *crc = cls; |
227 | 245 | ||
228 | GNUNET_assert (crc->data == NULL); | 246 | GNUNET_assert (NULL == crc->data); |
229 | GNUNET_assert (NULL != key); | 247 | GNUNET_assert (NULL != key); |
230 | crc->size = size; | 248 | crc->size = size; |
231 | crc->key = *key; | 249 | crc->key = *key; |
@@ -254,10 +272,15 @@ check_nothing (void *cls, const struct GNUNET_HashCode * key, size_t size, | |||
254 | 272 | ||
255 | 273 | ||
256 | static void | 274 | static void |
257 | check_multiple (void *cls, const struct GNUNET_HashCode * key, size_t size, | 275 | check_multiple (void *cls, |
258 | const void *data, enum GNUNET_BLOCK_Type type, | 276 | const struct GNUNET_HashCode *key, |
259 | uint32_t priority, uint32_t anonymity, | 277 | size_t size, |
260 | struct GNUNET_TIME_Absolute expiration, uint64_t uid) | 278 | const void *data, |
279 | enum GNUNET_BLOCK_Type type, | ||
280 | uint32_t priority, | ||
281 | uint32_t anonymity, | ||
282 | struct GNUNET_TIME_Absolute expiration, | ||
283 | uint64_t uid) | ||
261 | { | 284 | { |
262 | struct CpsRunContext *crc = cls; | 285 | struct CpsRunContext *crc = cls; |
263 | 286 | ||
@@ -286,9 +309,14 @@ check_multiple (void *cls, const struct GNUNET_HashCode * key, size_t size, | |||
286 | 309 | ||
287 | 310 | ||
288 | static void | 311 | static void |
289 | check_update (void *cls, const struct GNUNET_HashCode * key, size_t size, | 312 | check_update (void *cls, |
290 | const void *data, enum GNUNET_BLOCK_Type type, uint32_t priority, | 313 | const struct GNUNET_HashCode *key, |
291 | uint32_t anonymity, struct GNUNET_TIME_Absolute expiration, | 314 | size_t size, |
315 | const void *data, | ||
316 | enum GNUNET_BLOCK_Type type, | ||
317 | uint32_t priority, | ||
318 | uint32_t anonymity, | ||
319 | struct GNUNET_TIME_Absolute expiration, | ||
292 | uint64_t uid) | 320 | uint64_t uid) |
293 | { | 321 | { |
294 | struct CpsRunContext *crc = cls; | 322 | struct CpsRunContext *crc = cls; |
@@ -308,16 +336,21 @@ check_update (void *cls, const struct GNUNET_HashCode * key, size_t size, | |||
308 | 336 | ||
309 | 337 | ||
310 | static void | 338 | static void |
311 | run_continuation (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 339 | run_continuation (void *cls, |
340 | const struct GNUNET_SCHEDULER_TaskContext *tc) | ||
312 | { | 341 | { |
313 | struct CpsRunContext *crc = cls; | 342 | struct CpsRunContext *crc = cls; |
314 | 343 | ||
315 | ok = (int) crc->phase; | 344 | ok = (int) crc->phase; |
316 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Test in phase %u\n", crc->phase); | 345 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
346 | "Test in phase %u\n", | ||
347 | crc->phase); | ||
317 | switch (crc->phase) | 348 | switch (crc->phase) |
318 | { | 349 | { |
319 | case RP_PUT: | 350 | case RP_PUT: |
320 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Executing `%s' number %u\n", "PUT", | 351 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
352 | "Executing `%s' number %u\n", | ||
353 | "PUT", | ||
321 | crc->i); | 354 | crc->i); |
322 | GNUNET_CRYPTO_hash (&crc->i, sizeof (int), &crc->key); | 355 | GNUNET_CRYPTO_hash (&crc->i, sizeof (int), &crc->key); |
323 | GNUNET_DATASTORE_put (datastore, 0, &crc->key, get_size (crc->i), | 356 | GNUNET_DATASTORE_put (datastore, 0, &crc->key, get_size (crc->i), |
@@ -331,7 +364,9 @@ run_continuation (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
331 | break; | 364 | break; |
332 | case RP_GET: | 365 | case RP_GET: |
333 | crc->i--; | 366 | crc->i--; |
334 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Executing `%s' number %u\n", "GET", | 367 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
368 | "Executing `%s' number %u\n", | ||
369 | "GET", | ||
335 | crc->i); | 370 | crc->i); |
336 | GNUNET_CRYPTO_hash (&crc->i, sizeof (int), &crc->key); | 371 | GNUNET_CRYPTO_hash (&crc->i, sizeof (int), &crc->key); |
337 | GNUNET_DATASTORE_get_key (datastore, crc->offset, &crc->key, | 372 | GNUNET_DATASTORE_get_key (datastore, crc->offset, &crc->key, |
@@ -340,7 +375,9 @@ run_continuation (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
340 | break; | 375 | break; |
341 | case RP_DEL: | 376 | case RP_DEL: |
342 | crc->i--; | 377 | crc->i--; |
343 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Executing `%s' number %u\n", "DEL", | 378 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
379 | "Executing `%s' number %u\n", | ||
380 | "DEL", | ||
344 | crc->i); | 381 | crc->i); |
345 | crc->data = NULL; | 382 | crc->data = NULL; |
346 | GNUNET_CRYPTO_hash (&crc->i, sizeof (int), &crc->key); | 383 | GNUNET_CRYPTO_hash (&crc->i, sizeof (int), &crc->key); |
@@ -350,7 +387,9 @@ run_continuation (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
350 | &delete_value, crc)); | 387 | &delete_value, crc)); |
351 | break; | 388 | break; |
352 | case RP_DO_DEL: | 389 | case RP_DO_DEL: |
353 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Executing `%s' number %u\n", "DO_DEL", | 390 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
391 | "Executing `%s' number %u\n", | ||
392 | "DO_DEL", | ||
354 | crc->i); | 393 | crc->i); |
355 | if (crc->i == 0) | 394 | if (crc->i == 0) |
356 | { | 395 | { |
@@ -368,7 +407,8 @@ run_continuation (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
368 | break; | 407 | break; |
369 | case RP_DELVALIDATE: | 408 | case RP_DELVALIDATE: |
370 | crc->i--; | 409 | crc->i--; |
371 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Executing `%s' number %u\n", | 410 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
411 | "Executing `%s' number %u\n", | ||
372 | "DEL-VALIDATE", crc->i); | 412 | "DEL-VALIDATE", crc->i); |
373 | GNUNET_CRYPTO_hash (&crc->i, sizeof (int), &crc->key); | 413 | GNUNET_CRYPTO_hash (&crc->i, sizeof (int), &crc->key); |
374 | GNUNET_assert (NULL != | 414 | GNUNET_assert (NULL != |
@@ -435,7 +475,10 @@ run_continuation (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
435 | 475 | ||
436 | 476 | ||
437 | static void | 477 | static void |
438 | run_tests (void *cls, int32_t success, struct GNUNET_TIME_Absolute min_expiration, const char *msg) | 478 | run_tests (void *cls, |
479 | int32_t success, | ||
480 | struct GNUNET_TIME_Absolute min_expiration, | ||
481 | const char *msg) | ||
439 | { | 482 | { |
440 | struct CpsRunContext *crc = cls; | 483 | struct CpsRunContext *crc = cls; |
441 | 484 | ||
@@ -446,7 +489,8 @@ run_tests (void *cls, int32_t success, struct GNUNET_TIME_Absolute min_expiratio | |||
446 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); | 489 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); |
447 | return; | 490 | return; |
448 | case GNUNET_NO: | 491 | case GNUNET_NO: |
449 | FPRINTF (stderr, "%s", "Test 'put' operation failed, key already exists (!?)\n"); | 492 | FPRINTF (stderr, |
493 | "%s", "Test 'put' operation failed, key already exists (!?)\n"); | ||
450 | GNUNET_DATASTORE_disconnect (datastore, GNUNET_YES); | 494 | GNUNET_DATASTORE_disconnect (datastore, GNUNET_YES); |
451 | GNUNET_free (crc); | 495 | GNUNET_free (crc); |
452 | return; | 496 | return; |