-arm now starts childs with custom config
authorSree Harsha Totakura <totakura@in.tum.de>
Sun, 3 Jun 2012 09:04:50 +0000 (09:04 +0000)
committerSree Harsha Totakura <totakura@in.tum.de>
Sun, 3 Jun 2012 09:04:50 +0000 (09:04 +0000)
src/testing/test_testing_new_peerstartup.c
src/testing/test_testing_new_servicestartup.c
src/testing/testing_new.c

index 203df2f1e19fcd1131d880da517b11745273f2cf..8021a763ca45ebc96296938eb4cb432142add51b 100644 (file)
@@ -120,7 +120,7 @@ run (void *cls, char *const *args, const char *cfgfile,
   /* LOG (GNUNET_ERROR_TYPE_ERROR, */
   /*      "Temporary directory: %s\n", tmpdir); */
   system = GNUNET_TESTING_system_create (tmpdir,
-                                         "localhost");
+                                         "127.0.0.1");
   GNUNET_assert (NULL != system);
   GNUNET_free (tmpdir);
   data_dir = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_DATADIR);
index 3b9868869941103bba8df0ddae984644ded43288..0d3c6ca13b85ab25e671f56928f75a37b491d7a3 100644 (file)
@@ -25,6 +25,7 @@
  */
 
 #include "platform.h"
+#include "gnunet_scheduler_lib.h"
 #include "gnunet_testing_lib-new.h"
 
 
index c45b89e29b5ae0cd6a128515c9056b4b5b40d28e..da1d763639ee9fc3f18f3727f42ab3a6d70f22ef 100644 (file)
@@ -597,7 +597,7 @@ update_config_sections (void *cls,
   if (NULL == uc->system->controller)
     allowed_hosts = GNUNET_strdup (orig_allowed_hosts);
   else
-    GNUNET_asprintf (&allowed_hosts, "%s %s;", orig_allowed_hosts,
+    GNUNET_asprintf (&allowed_hosts, "%s%s;", orig_allowed_hosts,
                      uc->system->controller);
   GNUNET_free (orig_allowed_hosts);
   GNUNET_CONFIGURATION_set_value_string (uc->cfg, section, "ACCEPT_FROM",
@@ -625,12 +625,17 @@ GNUNET_TESTING_configuration_create (struct GNUNET_TESTING_System *system,
                                     struct GNUNET_CONFIGURATION_Handle *cfg)
 {
   struct UpdateContext uc;
+  char *default_config;
   
   uc.system = system;
   uc.cfg = cfg;
   uc.status = GNUNET_OK;
   GNUNET_asprintf (&uc.service_home, "%s/%u", system->tmppath,
                    system->path_counter++);
+  GNUNET_asprintf (&default_config, "%s/config", uc.service_home);
+  GNUNET_CONFIGURATION_set_value_string (cfg, "PATHS", "DEFAULTCONFIG",
+                                         default_config);
+  GNUNET_free (default_config);
   GNUNET_CONFIGURATION_set_value_string (cfg, "PATHS", "SERVICEHOME",
                                          uc.service_home);
   /* make PORTs and UNIXPATHs unique */
@@ -716,6 +721,7 @@ GNUNET_TESTING_peer_configure (struct GNUNET_TESTING_System *system,
                                                         &service_home));
   GNUNET_snprintf (hostkey_filename, sizeof (hostkey_filename), "%s/.hostkey",
                    service_home);
+  GNUNET_free (service_home);
   fd = GNUNET_DISK_file_open (hostkey_filename,
                               GNUNET_DISK_OPEN_CREATE | GNUNET_DISK_OPEN_WRITE,
                               GNUNET_DISK_PERM_USER_READ 
@@ -743,8 +749,9 @@ GNUNET_TESTING_peer_configure (struct GNUNET_TESTING_System *system,
     return NULL;
   }
   GNUNET_DISK_file_close (fd);
-  GNUNET_asprintf (&config_filename, "%s/config", service_home);
-  GNUNET_free (service_home);
+  GNUNET_assert (GNUNET_OK ==
+                 GNUNET_CONFIGURATION_get_value_string 
+                 (cfg, "PATHS", "DEFAULTCONFIG", &config_filename));  
   if (GNUNET_OK != GNUNET_CONFIGURATION_write (cfg, config_filename))
   {
     GNUNET_asprintf (&emsg_,
@@ -757,6 +764,7 @@ GNUNET_TESTING_peer_configure (struct GNUNET_TESTING_System *system,
       *emsg = emsg_;
     else
       GNUNET_free (emsg_);
+    GNUNET_free (config_filename);
     return NULL;
   }
   peer = GNUNET_malloc (sizeof (struct GNUNET_TESTING_Peer));
@@ -782,7 +790,9 @@ GNUNET_TESTING_peer_start (struct GNUNET_TESTING_Peer *peer)
   }
   GNUNET_assert (NULL != peer->cfgfile);
   peer->main_process = GNUNET_OS_start_process (GNUNET_NO, NULL, NULL,
-                                                peer->main_binary, "-c",
+                                                peer->main_binary,
+                                                peer->main_binary,
+                                                "-c",
                                                 peer->cfgfile,
                                                 NULL);
   if (NULL == peer->main_process)
@@ -939,7 +949,7 @@ GNUNET_TESTING_service_run (const char *tmppath,
   data_dir = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_DATADIR);
   GNUNET_asprintf (&hostkeys_file, "%s/testing_hostkeys.dat", data_dir);
   GNUNET_free (data_dir);  
-  system = GNUNET_TESTING_system_create (tmppath, "localhost");
+  system = GNUNET_TESTING_system_create (tmppath, "127.0.0.1");
   if (NULL == system)
   {
     GNUNET_free (hostkeys_file);