write control_host information to testing configs (for remote starting), hasn't been...
authorNathan S. Evans <evans@in.tum.de>
Tue, 30 Mar 2010 14:55:27 +0000 (14:55 +0000)
committerNathan S. Evans <evans@in.tum.de>
Tue, 30 Mar 2010 14:55:27 +0000 (14:55 +0000)
src/testing/testing.c
src/testing/testing_group.c

index a1bbb4f70a6714d1b25d7949503c6c1f40e97a2f..6c670e8d4079d677e9fdee5de8ced861122953b6 100644 (file)
@@ -40,7 +40,7 @@
 #include "gnunet_testing_lib.h"
 #include "gnunet_transport_service.h"
 
-#define DEBUG_TESTING GNUNET_NO
+#define DEBUG_TESTING GNUNET_YES
 
 /**
  * How long do we wait after starting gnunet-service-arm
@@ -168,6 +168,13 @@ start_fsm (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
       /* start GNUnet on remote host */
       if (NULL == d->hostname)
         {
+#if DEBUG_TESTING
+          GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                      "Starting `%s', with command `%s %s %s %s %s %s'.\n",
+                      "gnunet-arm", "gnunet-arm", "-c", d->cfgfile,
+                      "-L", "DEBUG",
+                      "-s");
+#endif
           d->pid = GNUNET_OS_start_process (NULL, NULL, "gnunet-arm",
                                             "gnunet-arm",
                                             "-c", d->cfgfile,
@@ -182,6 +189,13 @@ start_fsm (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
             GNUNET_asprintf (&dst, "%s@%s", d->username, d->hostname);
           else
             dst = GNUNET_strdup (d->hostname);
+
+#if DEBUG_TESTING
+          GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                      "Starting `%s', with command `%s %s %s %s %s %s %s %s'.\n",
+                      "gnunet-arm", "ssh", dst, "gnunet-arm", "-c", d->cfgfile,
+                      "-L", "DEBUG", "-s");
+#endif
           d->pid = GNUNET_OS_start_process (NULL, NULL, "ssh",
                                             "ssh",
                                             dst,
@@ -534,7 +548,7 @@ GNUNET_TESTING_daemon_stop (struct GNUNET_TESTING_Daemon *d,
 #if DEBUG_TESTING
                                               "-L", "DEBUG",
 #endif
-                                              "-c", d->cfgfile, "-e", "-d", NULL);
+                                              "-c", d->cfgfile, "-e", NULL);
       /* Use -e to end arm, and -d to remove temp files */
 
       GNUNET_free (arg);
index 96d2831d7b8450f318745e9d091fdbec2884ea64..7281109f91a175e82712bdfb49074adadc519603 100644 (file)
@@ -27,7 +27,7 @@
 #include "gnunet_arm_service.h"
 #include "gnunet_testing_lib.h"
 
-#define VERBOSE_TESTING GNUNET_NO
+#define VERBOSE_TESTING GNUNET_YES
 
 /**
  * Lowest port used for GNUnet testing.  Should be high enough to not
@@ -44,7 +44,7 @@
  */
 #define HIGH_PORT 32000
 
-#define MAX_OUTSTANDING_CONNECTIONS 30
+#define MAX_OUTSTANDING_CONNECTIONS 50
 
 #define CONNECT_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 180)
 
@@ -225,10 +225,13 @@ make_config (const struct GNUNET_CONFIGURATION_Handle *cfg, uint16_t * port)
 {
   struct UpdateContext uc;
   uint16_t orig;
+  char *control_host;
+  char *allowed_hosts;
 
   orig = *port;
   uc.nport = *port;
   uc.ret = GNUNET_CONFIGURATION_create ();
+
   GNUNET_CONFIGURATION_iterate (cfg, &update_config, &uc);
   if (uc.nport >= HIGH_PORT)
     {
@@ -236,6 +239,15 @@ make_config (const struct GNUNET_CONFIGURATION_Handle *cfg, uint16_t * port)
       GNUNET_CONFIGURATION_destroy (uc.ret);
       return NULL;
     }
+
+  if (GNUNET_CONFIGURATION_get_value_string(cfg, "testing", "control_host", &control_host) == GNUNET_OK)
+    {
+      GNUNET_asprintf(&allowed_hosts, "%s; 127.0.0.1;", control_host);
+      fprintf(stderr, "FOUND CONTROL_HOST OPTION %s, setting to %s\n", control_host, allowed_hosts);
+      GNUNET_CONFIGURATION_set_value_string(uc.ret, "core", "ACCEPT_FROM", allowed_hosts);
+      GNUNET_free(allowed_hosts);
+    }
+
   *port = (uint16_t) uc.nport;
   return uc.ret;
 }
@@ -1173,6 +1185,7 @@ GNUNET_TESTING_daemons_start (struct GNUNET_SCHEDULER_Handle *sched,
       GNUNET_break (0);
       return NULL;
     }
+
   pg = GNUNET_malloc (sizeof (struct GNUNET_TESTING_PeerGroup));
   pg->sched = sched;
   pg->cfg = cfg;