-more datacache integration work
[oweals/gnunet.git] / src / testbed / test_testbed_logger_api.c
index bbc9e33d23e2b5c58c27e17a0ba6bdbdc2a6f295..030bb9e33dc1968b1beb736bf347f7fd1255544a 100644 (file)
@@ -1,6 +1,6 @@
 /*
       This file is part of GNUnet
-      (C) 2008--2013 Christian Grothoff (and other contributing authors)
+      Copyright (C) 2008--2013 Christian Grothoff (and other contributing authors)
 
       GNUnet is free software; you can redistribute it and/or modify
       it under the terms of the GNU General Public License as published
@@ -53,16 +53,16 @@ static char *search_dir;
 /**
  * Abort task identifier
  */
-static GNUNET_SCHEDULER_TaskIdentifier abort_task;
-static GNUNET_SCHEDULER_TaskIdentifier write_task;
+static struct GNUNET_SCHEDULER_Task * abort_task;
+static struct GNUNET_SCHEDULER_Task * write_task;
 
 static int result;
 
 #define CANCEL_TASK(task) do {                  \
-    if (GNUNET_SCHEDULER_NO_TASK != task) \
+    if (NULL != task) \
     {                                           \
       GNUNET_SCHEDULER_cancel (task);     \
-      task = GNUNET_SCHEDULER_NO_TASK;    \
+      task = NULL;    \
     }                                           \
   } while (0)
 
@@ -90,6 +90,8 @@ shutdown_now ()
   CANCEL_TASK (abort_task);
   CANCEL_TASK (write_task);
   GNUNET_free_non_null (search_dir);
+  if (NULL != h)
+    GNUNET_TESTBED_LOGGER_disconnect (h);
   GNUNET_SCHEDULER_shutdown ();
 }
 
@@ -98,7 +100,7 @@ static void
 do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
   LOG (GNUNET_ERROR_TYPE_WARNING, "Aborting\n");
-  abort_task = GNUNET_SCHEDULER_NO_TASK;
+  abort_task = NULL;
   shutdown_now ();
 }
 
@@ -140,12 +142,12 @@ iterator_cb (void *cls, struct GNUNET_DISK_DirectoryIterator *di,
   if ((BSIZE * 2) != fs)        /* The file size should be equal to what we
                                    have written */
     goto iteration_cont;
-  
+
   cancel = GNUNET_YES;
   result = GNUNET_OK;
-    
+
  iteration_cont:
-  if ( (NULL != di) && 
+  if ( (NULL != di) &&
        (GNUNET_YES == GNUNET_DISK_directory_iterator_next (di, cancel)) )
     return;
   shutdown_now ();
@@ -176,7 +178,7 @@ do_write (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
   static int i;
   char buf[BSIZE];
 
-  write_task = GNUNET_SCHEDULER_NO_TASK;
+  write_task = NULL;
   if (0 == i)
     write_task = GNUNET_SCHEDULER_add_delayed (TIME_REL_SECS(1), &do_write, NULL);
   (void) memset (buf, i, BSIZE);
@@ -191,7 +193,7 @@ do_write (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
 /**
  * Signature of the 'main' function for a (single-peer) testcase that
  * is run using 'GNUNET_TESTING_peer_run'.
- * 
+ *
  * @param cls closure
  * @param cfg configuration of the peer that was started
  * @param peer identity of the peer that was created
@@ -201,9 +203,8 @@ test_main (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg,
            struct GNUNET_TESTING_Peer *p)
 {
   FAIL_TEST (NULL != (h = GNUNET_TESTBED_LOGGER_connect (cfg)), return);
-  FAIL_TEST (GNUNET_OK == GNUNET_CONFIGURATION_get_value_string
+  FAIL_TEST (GNUNET_OK == GNUNET_CONFIGURATION_get_value_filename
              (cfg, "testbed-logger", "dir", &search_dir), return);
-  search_dir = GNUNET_CONFIGURATION_expand_dollar (cfg, search_dir);
   peer = p;
   write_task = GNUNET_SCHEDULER_add_now (&do_write, NULL);
   abort_task = GNUNET_SCHEDULER_add_delayed (TIME_REL_SECS (10),