-fixing
[oweals/gnunet.git] / src / util / test_configuration.c
index 3780b36490dee6282f264272814bb734736d3275..62ad5fa92fc3a4a267b834b719d9307675fad1bc 100644 (file)
@@ -28,7 +28,6 @@
 #include "gnunet_configuration_lib.h"
 #include "gnunet_disk_lib.h"
 
-#define DEBUG GNUNET_EXTRA_LOGGING
 
 /* Test Configuration Diffs Options */
 enum
@@ -40,10 +39,8 @@ enum
   ADD_NEW_ENTRY,
   REMOVE_SECTION,
   REMOVE_ENTRY,
-  COMPARE
-#if DEBUG
-      , PRINT
-#endif
+  COMPARE, 
+  PRINT
 };
 
 static struct GNUNET_CONFIGURATION_Handle *cfg;
@@ -234,20 +231,21 @@ checkDiffs (struct GNUNET_CONFIGURATION_Handle *cfgDefault, int option)
   /* Compare the dumped configuration with modifications done */
   cfg = GNUNET_CONFIGURATION_create ();
   GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_parse (cfg, diffsFileName));
-  remove (diffsFileName);
+  if (0 != remove (diffsFileName))
+    GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING, "remove", diffsFileName);
   cbData.callBackOption = COMPARE;
   cbData.cfgDiffs = cfgDiffs;
   GNUNET_CONFIGURATION_iterate (cfg, diffsCallBack, &cbData);
   if (1 == (ret = cbData.status))
   {
-    fprintf (stderr,
+    FPRINTF (stderr, "%s", 
              "Incorrect Configuration Diffs: Diffs may contain data not actually edited\n");
     goto housekeeping;
   }
   cbData.cfgDiffs = cfg;
   GNUNET_CONFIGURATION_iterate (cfgDiffs, diffsCallBack, &cbData);
   if ((ret = cbData.status) == 1)
-    fprintf (stderr,
+    FPRINTF (stderr, "%s", 
              "Incorrect Configuration Diffs: Data may be missing in diffs\n");
 
 housekeeping:
@@ -277,7 +275,7 @@ testConfig ()
     return 1;
   if (0 != strcmp ("b", c))
   {
-    fprintf (stderr, "Got `%s'\n", c);
+    FPRINTF (stderr, "Got `%s'\n", c);
     GNUNET_free (c);
     return 2;
   }
@@ -470,7 +468,7 @@ main (int argc, char *argv[])
   if (GNUNET_OK !=
       GNUNET_CONFIGURATION_parse (cfg, "test_configuration_data.conf"))
   {
-    fprintf (stderr, "Failed to parse configuration file\n");
+    FPRINTF (stderr, "%s",  "Failed to parse configuration file\n");
     GNUNET_CONFIGURATION_destroy (cfg);
     return 1;
   }
@@ -484,7 +482,7 @@ main (int argc, char *argv[])
 
   if (GNUNET_OK != GNUNET_CONFIGURATION_write (cfg, "/tmp/gnunet-test.conf"))
   {
-    fprintf (stderr, "Failed to write configuration file\n");
+    FPRINTF (stderr, "%s",  "Failed to write configuration file\n");
     GNUNET_CONFIGURATION_destroy (cfg);
     return 1;
   }
@@ -546,7 +544,7 @@ main (int argc, char *argv[])
 error:
   if (failureCount != 0)
   {
-    fprintf (stderr, "Test failed: %u\n", failureCount);
+    FPRINTF (stderr, "Test failed: %u\n", failureCount);
     return 1;
   }
   return 0;