aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSree Harsha Totakura <totakura@in.tum.de>2012-06-03 09:04:50 +0000
committerSree Harsha Totakura <totakura@in.tum.de>2012-06-03 09:04:50 +0000
commit2f0d0091c69569d8eb2d4b294679f97084950325 (patch)
tree23036187dd943913460148e84aaaa4fe6d852c43 /src
parent07329b80900096e1617f1e58df01f9bec945c6bd (diff)
downloadgnunet-2f0d0091c69569d8eb2d4b294679f97084950325.tar.gz
gnunet-2f0d0091c69569d8eb2d4b294679f97084950325.zip
-arm now starts childs with custom config
Diffstat (limited to 'src')
-rw-r--r--src/testing/test_testing_new_peerstartup.c2
-rw-r--r--src/testing/test_testing_new_servicestartup.c1
-rw-r--r--src/testing/testing_new.c20
3 files changed, 17 insertions, 6 deletions
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,
120 /* LOG (GNUNET_ERROR_TYPE_ERROR, */ 120 /* LOG (GNUNET_ERROR_TYPE_ERROR, */
121 /* "Temporary directory: %s\n", tmpdir); */ 121 /* "Temporary directory: %s\n", tmpdir); */
122 system = GNUNET_TESTING_system_create (tmpdir, 122 system = GNUNET_TESTING_system_create (tmpdir,
123 "localhost"); 123 "127.0.0.1");
124 GNUNET_assert (NULL != system); 124 GNUNET_assert (NULL != system);
125 GNUNET_free (tmpdir); 125 GNUNET_free (tmpdir);
126 data_dir = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_DATADIR); 126 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 @@
25 */ 25 */
26 26
27#include "platform.h" 27#include "platform.h"
28#include "gnunet_scheduler_lib.h"
28#include "gnunet_testing_lib-new.h" 29#include "gnunet_testing_lib-new.h"
29 30
30 31
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,
597 if (NULL == uc->system->controller) 597 if (NULL == uc->system->controller)
598 allowed_hosts = GNUNET_strdup (orig_allowed_hosts); 598 allowed_hosts = GNUNET_strdup (orig_allowed_hosts);
599 else 599 else
600 GNUNET_asprintf (&allowed_hosts, "%s %s;", orig_allowed_hosts, 600 GNUNET_asprintf (&allowed_hosts, "%s%s;", orig_allowed_hosts,
601 uc->system->controller); 601 uc->system->controller);
602 GNUNET_free (orig_allowed_hosts); 602 GNUNET_free (orig_allowed_hosts);
603 GNUNET_CONFIGURATION_set_value_string (uc->cfg, section, "ACCEPT_FROM", 603 GNUNET_CONFIGURATION_set_value_string (uc->cfg, section, "ACCEPT_FROM",
@@ -625,12 +625,17 @@ GNUNET_TESTING_configuration_create (struct GNUNET_TESTING_System *system,
625 struct GNUNET_CONFIGURATION_Handle *cfg) 625 struct GNUNET_CONFIGURATION_Handle *cfg)
626{ 626{
627 struct UpdateContext uc; 627 struct UpdateContext uc;
628 char *default_config;
628 629
629 uc.system = system; 630 uc.system = system;
630 uc.cfg = cfg; 631 uc.cfg = cfg;
631 uc.status = GNUNET_OK; 632 uc.status = GNUNET_OK;
632 GNUNET_asprintf (&uc.service_home, "%s/%u", system->tmppath, 633 GNUNET_asprintf (&uc.service_home, "%s/%u", system->tmppath,
633 system->path_counter++); 634 system->path_counter++);
635 GNUNET_asprintf (&default_config, "%s/config", uc.service_home);
636 GNUNET_CONFIGURATION_set_value_string (cfg, "PATHS", "DEFAULTCONFIG",
637 default_config);
638 GNUNET_free (default_config);
634 GNUNET_CONFIGURATION_set_value_string (cfg, "PATHS", "SERVICEHOME", 639 GNUNET_CONFIGURATION_set_value_string (cfg, "PATHS", "SERVICEHOME",
635 uc.service_home); 640 uc.service_home);
636 /* make PORTs and UNIXPATHs unique */ 641 /* make PORTs and UNIXPATHs unique */
@@ -716,6 +721,7 @@ GNUNET_TESTING_peer_configure (struct GNUNET_TESTING_System *system,
716 &service_home)); 721 &service_home));
717 GNUNET_snprintf (hostkey_filename, sizeof (hostkey_filename), "%s/.hostkey", 722 GNUNET_snprintf (hostkey_filename, sizeof (hostkey_filename), "%s/.hostkey",
718 service_home); 723 service_home);
724 GNUNET_free (service_home);
719 fd = GNUNET_DISK_file_open (hostkey_filename, 725 fd = GNUNET_DISK_file_open (hostkey_filename,
720 GNUNET_DISK_OPEN_CREATE | GNUNET_DISK_OPEN_WRITE, 726 GNUNET_DISK_OPEN_CREATE | GNUNET_DISK_OPEN_WRITE,
721 GNUNET_DISK_PERM_USER_READ 727 GNUNET_DISK_PERM_USER_READ
@@ -743,8 +749,9 @@ GNUNET_TESTING_peer_configure (struct GNUNET_TESTING_System *system,
743 return NULL; 749 return NULL;
744 } 750 }
745 GNUNET_DISK_file_close (fd); 751 GNUNET_DISK_file_close (fd);
746 GNUNET_asprintf (&config_filename, "%s/config", service_home); 752 GNUNET_assert (GNUNET_OK ==
747 GNUNET_free (service_home); 753 GNUNET_CONFIGURATION_get_value_string
754 (cfg, "PATHS", "DEFAULTCONFIG", &config_filename));
748 if (GNUNET_OK != GNUNET_CONFIGURATION_write (cfg, config_filename)) 755 if (GNUNET_OK != GNUNET_CONFIGURATION_write (cfg, config_filename))
749 { 756 {
750 GNUNET_asprintf (&emsg_, 757 GNUNET_asprintf (&emsg_,
@@ -757,6 +764,7 @@ GNUNET_TESTING_peer_configure (struct GNUNET_TESTING_System *system,
757 *emsg = emsg_; 764 *emsg = emsg_;
758 else 765 else
759 GNUNET_free (emsg_); 766 GNUNET_free (emsg_);
767 GNUNET_free (config_filename);
760 return NULL; 768 return NULL;
761 } 769 }
762 peer = GNUNET_malloc (sizeof (struct GNUNET_TESTING_Peer)); 770 peer = GNUNET_malloc (sizeof (struct GNUNET_TESTING_Peer));
@@ -782,7 +790,9 @@ GNUNET_TESTING_peer_start (struct GNUNET_TESTING_Peer *peer)
782 } 790 }
783 GNUNET_assert (NULL != peer->cfgfile); 791 GNUNET_assert (NULL != peer->cfgfile);
784 peer->main_process = GNUNET_OS_start_process (GNUNET_NO, NULL, NULL, 792 peer->main_process = GNUNET_OS_start_process (GNUNET_NO, NULL, NULL,
785 peer->main_binary, "-c", 793 peer->main_binary,
794 peer->main_binary,
795 "-c",
786 peer->cfgfile, 796 peer->cfgfile,
787 NULL); 797 NULL);
788 if (NULL == peer->main_process) 798 if (NULL == peer->main_process)
@@ -939,7 +949,7 @@ GNUNET_TESTING_service_run (const char *tmppath,
939 data_dir = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_DATADIR); 949 data_dir = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_DATADIR);
940 GNUNET_asprintf (&hostkeys_file, "%s/testing_hostkeys.dat", data_dir); 950 GNUNET_asprintf (&hostkeys_file, "%s/testing_hostkeys.dat", data_dir);
941 GNUNET_free (data_dir); 951 GNUNET_free (data_dir);
942 system = GNUNET_TESTING_system_create (tmppath, "localhost"); 952 system = GNUNET_TESTING_system_create (tmppath, "127.0.0.1");
943 if (NULL == system) 953 if (NULL == system)
944 { 954 {
945 GNUNET_free (hostkeys_file); 955 GNUNET_free (hostkeys_file);