-fixes
[oweals/gnunet.git] / src / testing / testing_group.c
index ae08136e352d4275f7fd932f2dcc771b6cae3645..e8db98a91add24e7312017a5ec0dce62c4a3b839 100644 (file)
@@ -30,9 +30,9 @@
 #include "gnunet_testing_lib.h"
 #include "gnunet_core_service.h"
 
-#define VERBOSE_TESTING GNUNET_EXTRA_LOGGING
+#define VERBOSE_TESTING GNUNET_NO
 
-#define VERBOSE_TOPOLOGY GNUNET_EXTRA_LOGGING
+#define VERBOSE_TOPOLOGY GNUNET_NO
 
 #define DEBUG_CHURN GNUNET_EXTRA_LOGGING
 
@@ -1357,7 +1357,7 @@ update_config (void *cls, const char *section, const char *option,
   GNUNET_asprintf (&single_variable, "single_%s_per_host", section);
   GNUNET_asprintf (&per_host_variable, "num_%s_per_host", section);
 
-  if ((0 == strcmp (option, "PORT")) && (1 == sscanf (value, "%u", &ival)))
+  if ((0 == strcmp (option, "PORT")) && (1 == SSCANF (value, "%u", &ival)))
   {
     if ((ival != 0) &&
         (GNUNET_YES !=
@@ -1904,7 +1904,7 @@ create_small_world_ring (struct GNUNET_TESTING_PeerGroup *pg,
       GNUNET_CONFIGURATION_get_value_string (pg->cfg, "TESTING", "PERCENTAGE",
                                              &p_string))
   {
-    if (sscanf (p_string, "%lf", &logNModifier) != 1)
+    if (SSCANF (p_string, "%lf", &logNModifier) != 1)
       GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
                   _
                   ("Invalid value `%s' for option `%s' in section `%s': expected float\n"),
@@ -1916,7 +1916,7 @@ create_small_world_ring (struct GNUNET_TESTING_PeerGroup *pg,
       GNUNET_CONFIGURATION_get_value_string (pg->cfg, "TESTING", "PROBABILITY",
                                              &p_string))
   {
-    if (sscanf (p_string, "%lf", &probability) != 1)
+    if (SSCANF (p_string, "%lf", &probability) != 1)
       GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
                   _
                   ("Invalid value `%s' for option `%s' in section `%s': expected float\n"),
@@ -2017,7 +2017,7 @@ create_nated_internet (struct GNUNET_TESTING_PeerGroup *pg,
       GNUNET_CONFIGURATION_get_value_string (pg->cfg, "TESTING", "PERCENTAGE",
                                              &p_string))
   {
-    if (sscanf (p_string, "%lf", &nat_percentage) != 1)
+    if (SSCANF (p_string, "%lf", &nat_percentage) != 1)
       GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
                   _
                   ("Invalid value `%s' for option `%s' in section `%s': expected float\n"),
@@ -2076,7 +2076,7 @@ create_nated_internet_copy (struct GNUNET_TESTING_PeerGroup *pg,
       GNUNET_CONFIGURATION_get_value_string (pg->cfg, "TESTING", "PERCENTAGE",
                                              &p_string))
   {
-    if (sscanf (p_string, "%lf", &nat_percentage) != 1)
+    if (SSCANF (p_string, "%lf", &nat_percentage) != 1)
       GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
                   _
                   ("Invalid value `%s' for option `%s' in section `%s': expected float\n"),
@@ -2165,7 +2165,7 @@ create_small_world (struct GNUNET_TESTING_PeerGroup *pg,
       GNUNET_CONFIGURATION_get_value_string (pg->cfg, "TESTING", "PERCENTAGE",
                                              &p_string))
   {
-    if (sscanf (p_string, "%lf", &percentage) != 1)
+    if (SSCANF (p_string, "%lf", &percentage) != 1)
       GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
                   _
                   ("Invalid value `%s' for option `%s' in section `%s': expected float\n"),
@@ -2185,7 +2185,7 @@ create_small_world (struct GNUNET_TESTING_PeerGroup *pg,
       GNUNET_CONFIGURATION_get_value_string (pg->cfg, "TESTING", "PROBABILITY",
                                              &p_string))
   {
-    if (sscanf (p_string, "%lf", &probability) != 1)
+    if (SSCANF (p_string, "%lf", &probability) != 1)
       GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
                   _
                   ("Invalid value `%s' for option `%s' in section `%s': expected float\n"),
@@ -2322,7 +2322,7 @@ create_erdos_renyi (struct GNUNET_TESTING_PeerGroup *pg,
       GNUNET_CONFIGURATION_get_value_string (pg->cfg, "TESTING", "PROBABILITY",
                                              &p_string))
   {
-    if (sscanf (p_string, "%lf", &probability) != 1)
+    if (SSCANF (p_string, "%lf", &probability) != 1)
       GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
                   _
                   ("Invalid value `%s' for option `%s' in section `%s': expected float\n"),
@@ -2927,15 +2927,12 @@ create_and_copy_friend_files (struct GNUNET_TESTING_PeerGroup *pg)
     if (pg->peers[pg_iter].daemon->hostname == NULL)    /* Local, just copy the file */
     {
       GNUNET_asprintf (&arg, "%s/friends", temp_service_path);
-      procarr[pg_iter] =
-          GNUNET_OS_start_process (NULL, NULL, "mv", "mv", mytemp, arg, NULL);
-      GNUNET_assert (procarr[pg_iter] != NULL);
 #if VERBOSE_TESTING
       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                  "Copying file with command cp %s %s\n", mytemp, arg);
+                  "Copying file with RENAME(%s,%s)\n", mytemp, arg);
 #endif
-      ret = GNUNET_OS_process_wait (procarr[pg_iter]);  /* FIXME: schedule this, throttle! */
-      GNUNET_OS_process_close (procarr[pg_iter]);
+      RENAME (mytemp, arg);
+      procarr[pg_iter] = NULL;
       GNUNET_free (arg);
     }
     else                        /* Remote, scp the file to the correct place */
@@ -2950,7 +2947,7 @@ create_and_copy_friend_files (struct GNUNET_TESTING_PeerGroup *pg)
                          pg->peers[pg_iter].daemon->hostname,
                          temp_service_path);
       procarr[pg_iter] =
-          GNUNET_OS_start_process (NULL, NULL, "scp", "scp", mytemp, arg, NULL);
+       GNUNET_OS_start_process (GNUNET_NO, NULL, NULL, "scp", "scp", mytemp, arg, NULL);
       GNUNET_assert (procarr[pg_iter] != NULL);
       ret = GNUNET_OS_process_wait (procarr[pg_iter]);  /* FIXME: schedule this, throttle! */
       GNUNET_OS_process_close (procarr[pg_iter]);
@@ -3126,11 +3123,11 @@ create_and_copy_blacklist_files (struct GNUNET_TESTING_PeerGroup *pg,
     if (pg->peers[pg_iter].daemon->hostname == NULL)    /* Local, just copy the file */
     {
       GNUNET_asprintf (&arg, "%s/blacklist", temp_service_path);
-      procarr[pg_iter] =
-          GNUNET_OS_start_process (NULL, NULL, "mv", "mv", mytemp, arg, NULL);
+      RENAME (mytemp, arg);
+      procarr[pg_iter] = NULL;
 #if VERBOSE_TESTING
       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                  _("Copying file with command cp %s %s\n"), mytemp, arg);
+                  _("Copying file with RENAME (%s,%s)\n"), mytemp, arg);
 #endif
 
       GNUNET_free (arg);
@@ -3147,7 +3144,7 @@ create_and_copy_blacklist_files (struct GNUNET_TESTING_PeerGroup *pg,
                          pg->peers[pg_iter].daemon->hostname,
                          temp_service_path);
       procarr[pg_iter] =
-          GNUNET_OS_start_process (NULL, NULL, "scp", "scp", mytemp, arg, NULL);
+       GNUNET_OS_start_process (GNUNET_NO, NULL, NULL, "scp", "scp", mytemp, arg, NULL);
       GNUNET_assert (procarr[pg_iter] != NULL);
       GNUNET_OS_process_wait (procarr[pg_iter]);        /* FIXME: add scheduled blacklist file copy that parallelizes file copying! */
 
@@ -5806,7 +5803,7 @@ start_peer_helper (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
 
   /* FIXME: Doesn't support ssh_port option! */
   helper->proc =
-      GNUNET_OS_start_process (NULL, NULL, "ssh", "ssh", arg,
+    GNUNET_OS_start_process (GNUNET_NO, NULL, NULL, "ssh", "ssh", arg,
                                "peerStartHelper.pl", tempdir, NULL);
   GNUNET_assert (helper->proc != NULL);
 #if DEBUG_TESTING
@@ -6031,7 +6028,7 @@ GNUNET_TESTING_daemons_start (const struct GNUNET_CONFIGURATION_Handle *cfg,
     {
       GNUNET_asprintf (&ssh_port_str, "%d", pg->hosts[i].sshport);
       proc =
-          GNUNET_OS_start_process (NULL, NULL, "ssh", "ssh", "-P", ssh_port_str,
+       GNUNET_OS_start_process (GNUNET_NO, NULL, NULL, "ssh", "ssh", "-P", ssh_port_str,
 #if !DEBUG_TESTING
                                    "-q",
 #endif
@@ -6039,7 +6036,7 @@ GNUNET_TESTING_daemons_start (const struct GNUNET_CONFIGURATION_Handle *cfg,
     }
     else
       proc =
-          GNUNET_OS_start_process (NULL, NULL, "ssh", "ssh", arg, "mkdir -p",
+       GNUNET_OS_start_process (GNUNET_NO, NULL, NULL, "ssh", "ssh", arg, "mkdir -p",
                                    tmpdir, NULL);
     GNUNET_assert (proc != NULL);
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -6262,7 +6259,7 @@ GNUNET_TESTING_daemons_start (const struct GNUNET_CONFIGURATION_Handle *cfg,
 
       /* FIXME: Doesn't support ssh_port option! */
       proc =
-          GNUNET_OS_start_process (NULL, NULL, "rsync", "rsync", "-r",
+       GNUNET_OS_start_process (GNUNET_NO, NULL, NULL, "rsync", "rsync", "-r",
                                    newservicehome, arg, NULL);
 #if DEBUG_TESTING
       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -7034,7 +7031,7 @@ GNUNET_TESTING_hosts_load (const struct GNUNET_CONFIGURATION_Handle *cfg)
         data[count] = '\0';
         temphost = GNUNET_malloc (sizeof (struct GNUNET_TESTING_Host));
         ret =
-            sscanf (buf, "%a[a-zA-Z0-9_]@%a[a-zA-Z0-9.]:%hd",
+            SSCANF (buf, "%a[a-zA-Z0-9_]@%a[a-zA-Z0-9.]:%hd",
                     &temphost->username, &temphost->hostname, &temphost->port);
         if (3 == ret)
         {