From e892ec3a25fc315d58ae7aafbd138b79aff2ca34 Mon Sep 17 00:00:00 2001 From: Matthias Wachs Date: Fri, 2 Mar 2012 10:21:58 +0000 Subject: - reset db before test --- .../test_namestore_api_remove_not_existing_record.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/namestore/test_namestore_api_remove_not_existing_record.c') 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) return rd; } +void +delete_existing_db (const struct GNUNET_CONFIGURATION_Handle *cfg) +{ + char *afsdir; + + if (GNUNET_OK == + GNUNET_CONFIGURATION_get_value_filename (cfg, "namestore-sqlite", + "FILENAME", &afsdir)) + { + if (GNUNET_OK == GNUNET_DISK_file_test (afsdir)) + if (GNUNET_OK == GNUNET_DISK_file_test (afsdir)) + if (GNUNET_OK == GNUNET_DISK_directory_remove(afsdir)) + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Deleted existing database `%s' \n", afsdir); + GNUNET_free (afsdir); + } + +} + static void run (void *cls, char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg) { + delete_existing_db(cfg); endbadly_task = GNUNET_SCHEDULER_add_delayed(TIMEOUT,endbadly, NULL); size_t rd_ser_len; -- cgit v1.2.3