From: Sree Harsha Totakura Date: Sun, 3 Jun 2012 09:04:50 +0000 (+0000) Subject: -arm now starts childs with custom config X-Git-Tag: initial-import-from-subversion-38251~13267 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=2f0d0091c69569d8eb2d4b294679f97084950325;p=oweals%2Fgnunet.git -arm now starts childs with custom config --- diff --git a/src/testing/test_testing_new_peerstartup.c b/src/testing/test_testing_new_peerstartup.c index 203df2f1e..8021a763c 100644 --- a/src/testing/test_testing_new_peerstartup.c +++ b/src/testing/test_testing_new_peerstartup.c @@ -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); diff --git a/src/testing/test_testing_new_servicestartup.c b/src/testing/test_testing_new_servicestartup.c index 3b9868869..0d3c6ca13 100644 --- a/src/testing/test_testing_new_servicestartup.c +++ b/src/testing/test_testing_new_servicestartup.c @@ -25,6 +25,7 @@ */ #include "platform.h" +#include "gnunet_scheduler_lib.h" #include "gnunet_testing_lib-new.h" diff --git a/src/testing/testing_new.c b/src/testing/testing_new.c index c45b89e29..da1d76363 100644 --- a/src/testing/testing_new.c +++ b/src/testing/testing_new.c @@ -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);