diff options
author | Christian Grothoff <christian@grothoff.org> | 2010-08-07 16:55:16 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2010-08-07 16:55:16 +0000 |
commit | b9de10a83f130b2c0a4513a1f713d778fbb4ecc1 (patch) | |
tree | 0dcfa912e2eea217d494ba56f1373e2c0cbb7e26 /src/datastore/test_datastore_api_management.c | |
parent | d4115af6385dcab2433b27796e777819e297dae7 (diff) | |
download | gnunet-b9de10a83f130b2c0a4513a1f713d778fbb4ecc1.tar.gz gnunet-b9de10a83f130b2c0a4513a1f713d778fbb4ecc1.zip |
do not fail if datastore unavailable
Diffstat (limited to 'src/datastore/test_datastore_api_management.c')
-rw-r--r-- | src/datastore/test_datastore_api_management.c | 41 |
1 files changed, 36 insertions, 5 deletions
diff --git a/src/datastore/test_datastore_api_management.c b/src/datastore/test_datastore_api_management.c index d0278094f..3de1544f3 100644 --- a/src/datastore/test_datastore_api_management.c +++ b/src/datastore/test_datastore_api_management.c | |||
@@ -293,6 +293,28 @@ run_continuation (void *cls, | |||
293 | 293 | ||
294 | 294 | ||
295 | static void | 295 | static void |
296 | run_tests (void *cls, | ||
297 | int success, | ||
298 | const char *msg) | ||
299 | { | ||
300 | struct CpsRunContext *crc = cls; | ||
301 | |||
302 | if (success != GNUNET_YES) | ||
303 | { | ||
304 | fprintf (stderr, | ||
305 | "Test 'put' operation failed with error `%s' database likely not setup, skipping test.", | ||
306 | msg); | ||
307 | GNUNET_free (crc); | ||
308 | return; | ||
309 | } | ||
310 | GNUNET_SCHEDULER_add_continuation (crc->sched, | ||
311 | &run_continuation, | ||
312 | crc, | ||
313 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); | ||
314 | } | ||
315 | |||
316 | |||
317 | static void | ||
296 | run (void *cls, | 318 | run (void *cls, |
297 | struct GNUNET_SCHEDULER_Handle *sched, | 319 | struct GNUNET_SCHEDULER_Handle *sched, |
298 | char *const *args, | 320 | char *const *args, |
@@ -300,6 +322,7 @@ run (void *cls, | |||
300 | const struct GNUNET_CONFIGURATION_Handle *cfg) | 322 | const struct GNUNET_CONFIGURATION_Handle *cfg) |
301 | { | 323 | { |
302 | struct CpsRunContext *crc; | 324 | struct CpsRunContext *crc; |
325 | static GNUNET_HashCode zkey; | ||
303 | 326 | ||
304 | crc = GNUNET_malloc(sizeof(struct CpsRunContext)); | 327 | crc = GNUNET_malloc(sizeof(struct CpsRunContext)); |
305 | crc->sched = sched; | 328 | crc->sched = sched; |
@@ -307,11 +330,19 @@ run (void *cls, | |||
307 | crc->phase = RP_PUT; | 330 | crc->phase = RP_PUT; |
308 | now = GNUNET_TIME_absolute_get (); | 331 | now = GNUNET_TIME_absolute_get (); |
309 | datastore = GNUNET_DATASTORE_connect (cfg, sched); | 332 | datastore = GNUNET_DATASTORE_connect (cfg, sched); |
310 | GNUNET_SCHEDULER_add_continuation (crc->sched, | 333 | if (NULL == |
311 | &run_continuation, | 334 | GNUNET_DATASTORE_put (datastore, 0, |
312 | crc, | 335 | &zkey, 4, "TEST", |
313 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); | 336 | GNUNET_BLOCK_TYPE_TEST, |
314 | 337 | 0, 0, GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_SECONDS), | |
338 | 0, 1, GNUNET_TIME_UNIT_MINUTES, | ||
339 | &run_tests, crc)) | ||
340 | { | ||
341 | fprintf (stderr, | ||
342 | "Test 'put' operation failed.\n"); | ||
343 | GNUNET_free (crc); | ||
344 | ok = 1; | ||
345 | } | ||
315 | } | 346 | } |
316 | 347 | ||
317 | 348 | ||