- Tests did not clean up: TEST_HOME with namestore db was not removed after test
[oweals/gnunet.git] / src / namestore / test_namestore_api_store.c
index 424c826b7920170da4d5f7717c8941a1e803e973..c44d248090fde8f9147050f82ff33802e46476b0 100644 (file)
@@ -46,6 +46,7 @@ static int res;
 
 static struct GNUNET_NAMESTORE_QueueEntry *nsqe;
 
+static char *directory;
 
 static void
 cleanup ()
@@ -60,6 +61,11 @@ cleanup ()
     GNUNET_free (privkey);
     privkey = NULL;
   }
+  if (NULL != directory)
+  {
+      GNUNET_DISK_directory_remove (directory);
+      GNUNET_free (directory);
+  }
   GNUNET_SCHEDULER_shutdown ();
 }
 
@@ -117,6 +123,9 @@ run (void *cls,
   char *hostkey_file;
   const char * name = "dummy.dummy.gnunet";
 
+  directory = NULL;
+  GNUNET_CONFIGURATION_get_value_string(cfg, "PATHS", "GNUNET_TEST_HOME", &directory);
+
   endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT,
                                                &endbadly, NULL);
   GNUNET_asprintf (&hostkey_file,
@@ -134,6 +143,7 @@ run (void *cls,
   rd.record_type = TEST_RECORD_TYPE;
   rd.data_size = TEST_RECORD_DATALEN;
   rd.data = GNUNET_malloc (TEST_RECORD_DATALEN);
+  rd.flags = 0;
   memset ((char *) rd.data, 'a', TEST_RECORD_DATALEN);
 
   nsh = GNUNET_NAMESTORE_connect (cfg);