Use more-or-equal (some machines are fast enough)
[oweals/gnunet.git] / src / testbed / test_testbed_logger_api.c
index d35d6671fa58007656f4823ac55b82c3154368f7..11ba7270b515eb4856daf1fef62e8c2dc5e32d43 100644 (file)
@@ -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 ();
 }
 
@@ -140,13 +142,13 @@ 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) && 
-       (GNUNET_YES != GNUNET_DISK_directory_iterator_next (di, cancel)) )
+  if ( (NULL != di) &&
+       (GNUNET_YES == GNUNET_DISK_directory_iterator_next (di, cancel)) )
     return;
   shutdown_now ();
 }
@@ -167,8 +169,6 @@ flush_comp (void *cls, size_t size)
   FAIL_TEST (GNUNET_YES == GNUNET_DISK_directory_iterator_start
              (GNUNET_SCHEDULER_PRIORITY_DEFAULT, search_dir,
               &iterator_cb, NULL), return);
-  result = GNUNET_OK;
-  shutdown_now ();
 }
 
 
@@ -185,14 +185,15 @@ do_write (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
   GNUNET_TESTBED_LOGGER_write (h, buf, BSIZE);
   if (0 == i++)
     return;
-  GNUNET_TESTBED_LOGGER_flush (h, &flush_comp, &write_task);
+  GNUNET_TESTBED_LOGGER_flush (h, GNUNET_TIME_UNIT_FOREVER_REL,
+                               &flush_comp, &write_task);
 }
 
 
 /**
  * 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
@@ -202,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),