- Tests did not clean up: TEST_HOME with namestore db was not removed after test
[oweals/gnunet.git] / src / namestore / test_namestore_api_zone_to_name.c
index c7cbe0ebe2a4f4a2bad4fbc946776dcac12c136f..26593547bc5f11d29c55f804f4be9b2dcf261443 100644 (file)
@@ -57,6 +57,7 @@ static struct GNUNET_CRYPTO_EcdsaSignature *s_signature;
 
 static int res;
 
+static char *directory;
 
 /**
  * Re-establish the connection to the service.
@@ -72,6 +73,11 @@ endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
   nsh = NULL;
   if (privkey != NULL)
     GNUNET_free (privkey);
+  if (NULL != directory)
+  {
+      GNUNET_DISK_directory_remove (directory);
+      GNUNET_free (directory);
+  }
   privkey = NULL;
   res = 1;
 }
@@ -90,6 +96,11 @@ end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
   privkey = NULL;
   if (nsh != NULL)
     GNUNET_NAMESTORE_disconnect (nsh);
+  if (NULL != directory)
+  {
+      GNUNET_DISK_directory_remove (directory);
+      GNUNET_free (directory);
+  }
   nsh = NULL;
 }
 
@@ -167,6 +178,9 @@ run (void *cls,
 {
   struct GNUNET_TIME_Absolute et;
 
+  directory = NULL;
+  GNUNET_CONFIGURATION_get_value_string(cfg, "PATHS", "GNUNET_TEST_HOME", &directory);
+
   endbadly_task = GNUNET_SCHEDULER_add_delayed(TIMEOUT,endbadly, NULL);
   GNUNET_asprintf (&s_name, "dummy");
   /* load privat key */