diff options
author | Christian Grothoff <christian@grothoff.org> | 2011-07-18 12:36:35 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2011-07-18 12:36:35 +0000 |
commit | 9e8168055316aa8d397efa1b9cafaab64f7302c1 (patch) | |
tree | 287ec784faac42903385596f46486e2ddaace0a3 /src/testing/testing_group.c | |
parent | 156ad5567cc3c489c5f2caf4504923dad9cca602 (diff) | |
download | gnunet-9e8168055316aa8d397efa1b9cafaab64f7302c1.tar.gz gnunet-9e8168055316aa8d397efa1b9cafaab64f7302c1.zip |
ugs
Diffstat (limited to 'src/testing/testing_group.c')
-rw-r--r-- | src/testing/testing_group.c | 79 |
1 files changed, 49 insertions, 30 deletions
diff --git a/src/testing/testing_group.c b/src/testing/testing_group.c index 81b39ddbc..8bda28564 100644 --- a/src/testing/testing_group.c +++ b/src/testing/testing_group.c | |||
@@ -5879,8 +5879,9 @@ GNUNET_TESTING_daemons_start(const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
5879 | } | 5879 | } |
5880 | 5880 | ||
5881 | /* Create the servicehome directory for each remote peer */ | 5881 | /* Create the servicehome directory for each remote peer */ |
5882 | GNUNET_assert(GNUNET_OK == GNUNET_CONFIGURATION_get_value_string (cfg, "PATHS", "SERVICEHOME", | 5882 | GNUNET_assert(GNUNET_OK == |
5883 | &baseservicehome)); | 5883 | GNUNET_CONFIGURATION_get_value_string (cfg, "PATHS", "SERVICEHOME", |
5884 | &baseservicehome)); | ||
5884 | for (i = 0; i < pg->num_hosts; i++) | 5885 | for (i = 0; i < pg->num_hosts; i++) |
5885 | { | 5886 | { |
5886 | ssh_entry = GNUNET_malloc(sizeof(struct OutstandingSSH)); | 5887 | ssh_entry = GNUNET_malloc(sizeof(struct OutstandingSSH)); |
@@ -5916,6 +5917,7 @@ GNUNET_TESTING_daemons_start(const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
5916 | GNUNET_OS_process_close(proc); | 5917 | GNUNET_OS_process_close(proc); |
5917 | } | 5918 | } |
5918 | GNUNET_free(baseservicehome); | 5919 | GNUNET_free(baseservicehome); |
5920 | baseservicehome = NULL; | ||
5919 | 5921 | ||
5920 | if (GNUNET_YES == GNUNET_CONFIGURATION_get_value_string (cfg, "TESTING", | 5922 | if (GNUNET_YES == GNUNET_CONFIGURATION_get_value_string (cfg, "TESTING", |
5921 | "HOSTKEYSFILE", | 5923 | "HOSTKEYSFILE", |
@@ -5995,9 +5997,10 @@ GNUNET_TESTING_daemons_start(const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
5995 | 5997 | ||
5996 | if (NULL == pcfg) | 5998 | if (NULL == pcfg) |
5997 | { | 5999 | { |
5998 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, _ | 6000 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
5999 | ("Could not create configuration for peer number %u on `%s'!\n"), | 6001 | _("Could not create configuration for peer number %u on `%s'!\n"), |
6000 | off, hostname == NULL ? "localhost" : hostname); | 6002 | off, |
6003 | hostname == NULL ? "localhost" : hostname); | ||
6001 | continue; | 6004 | continue; |
6002 | } | 6005 | } |
6003 | 6006 | ||
@@ -6010,9 +6013,8 @@ GNUNET_TESTING_daemons_start(const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
6010 | GNUNET_asprintf (&newservicehome, "%s/%s/%d/", baseservicehome, hostname, off); | 6013 | GNUNET_asprintf (&newservicehome, "%s/%s/%d/", baseservicehome, hostname, off); |
6011 | else | 6014 | else |
6012 | GNUNET_asprintf (&newservicehome, "%s/%d/", baseservicehome, off); | 6015 | GNUNET_asprintf (&newservicehome, "%s/%d/", baseservicehome, off); |
6013 | #if !USE_START_HELPER | ||
6014 | GNUNET_free (baseservicehome); | 6016 | GNUNET_free (baseservicehome); |
6015 | #endif | 6017 | baseservicehome = NULL; |
6016 | } | 6018 | } |
6017 | else | 6019 | else |
6018 | { | 6020 | { |
@@ -6048,17 +6050,18 @@ GNUNET_TESTING_daemons_start(const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
6048 | #else | 6050 | #else |
6049 | if ((pg->hostkey_data != NULL) && (hostcnt > 0)) | 6051 | if ((pg->hostkey_data != NULL) && (hostcnt > 0)) |
6050 | { | 6052 | { |
6051 | pg->peers[off].daemon = GNUNET_TESTING_daemon_start (pcfg, | 6053 | pg->peers[off].daemon |
6052 | timeout, | 6054 | = GNUNET_TESTING_daemon_start (pcfg, |
6053 | GNUNET_YES, | 6055 | timeout, |
6054 | hostname, | 6056 | GNUNET_YES, |
6055 | username, | 6057 | hostname, |
6056 | sshport, | 6058 | username, |
6057 | pg->peers[off].internal_context.hostkey, | 6059 | sshport, |
6058 | &internal_hostkey_callback, | 6060 | pg->peers[off].internal_context.hostkey, |
6059 | &pg->peers[off].internal_context, | 6061 | &internal_hostkey_callback, |
6060 | &internal_startup_callback, | 6062 | &pg->peers[off].internal_context, |
6061 | &pg->peers[off].internal_context); | 6063 | &internal_startup_callback, |
6064 | &pg->peers[off].internal_context); | ||
6062 | /** | 6065 | /** |
6063 | * At this point, given that we had a hostkeyfile, | 6066 | * At this point, given that we had a hostkeyfile, |
6064 | * we can call the hostkey callback! | 6067 | * we can call the hostkey callback! |
@@ -6083,25 +6086,42 @@ GNUNET_TESTING_daemons_start(const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
6083 | { | 6086 | { |
6084 | for (off = 0; off < hostcnt; off++) | 6087 | for (off = 0; off < hostcnt; off++) |
6085 | { | 6088 | { |
6086 | GNUNET_asprintf(&newservicehome, "%s/%s/", baseservicehome, pg->hosts[off].hostname); | 6089 | /* FIXME: grab baseservicehome! */ |
6090 | GNUNET_asprintf (&newservicehome, | ||
6091 | "%s/%s/", | ||
6092 | baseservicehome, | ||
6093 | pg->hosts[off].hostname); | ||
6087 | 6094 | ||
6088 | if (NULL != username) | 6095 | if (NULL != username) |
6089 | GNUNET_asprintf (&arg, "%s@%s:%s/%s", username, pg->hosts[off].hostname, baseservicehome, pg->hosts[off].hostname); | 6096 | GNUNET_asprintf (&arg, |
6097 | "%s@%s:%s/%s", | ||
6098 | username, | ||
6099 | pg->hosts[off].hostname, | ||
6100 | baseservicehome, | ||
6101 | pg->hosts[off].hostname); | ||
6090 | else | 6102 | else |
6091 | GNUNET_asprintf (&arg, "%s:%s/%s", pg->hosts[off].hostname, baseservicehome, pg->hosts[off].hostname); | 6103 | GNUNET_asprintf (&arg, |
6092 | 6104 | "%s:%s/%s", | |
6105 | pg->hosts[off].hostname, | ||
6106 | baseservicehome, | ||
6107 | pg->hosts[off].hostname); | ||
6108 | |||
6109 | // FIXME: free--- GNUNET_free (baseservicehome); | ||
6110 | |||
6093 | /* FIXME: Doesn't support ssh_port option! */ | 6111 | /* FIXME: Doesn't support ssh_port option! */ |
6094 | proc = GNUNET_OS_start_process (NULL, NULL, "rsync", "rsync", "-r", newservicehome, arg, NULL); | 6112 | proc = GNUNET_OS_start_process (NULL, NULL, |
6113 | "rsync", | ||
6114 | "rsync", "-r", newservicehome, arg, NULL); | ||
6095 | 6115 | ||
6096 | GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "copying directory with command rsync -r %s %s\n", newservicehome, arg); | 6116 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
6117 | "copying directory with command rsync -r %s %s\n", | ||
6118 | newservicehome, arg); | ||
6097 | 6119 | ||
6098 | GNUNET_free (arg); | 6120 | GNUNET_free (arg); |
6099 | if (NULL == proc) | 6121 | if (NULL == proc) |
6100 | { | 6122 | { |
6101 | GNUNET_log ( | 6123 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
6102 | GNUNET_ERROR_TYPE_ERROR, | 6124 | _("Could not start `%s' process to copy configuration directory.\n"), |
6103 | _ | ||
6104 | ("Could not start `%s' process to copy configuration directory.\n"), | ||
6105 | "scp"); | 6125 | "scp"); |
6106 | GNUNET_assert(0); | 6126 | GNUNET_assert(0); |
6107 | } | 6127 | } |
@@ -6109,9 +6129,8 @@ GNUNET_TESTING_daemons_start(const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
6109 | GNUNET_OS_process_close (proc); | 6129 | GNUNET_OS_process_close (proc); |
6110 | } | 6130 | } |
6111 | /* Now all the configuration files and hostkeys are copied to the remote host. Call the hostkey callback for each peer! */ | 6131 | /* Now all the configuration files and hostkeys are copied to the remote host. Call the hostkey callback for each peer! */ |
6112 | GNUNET_SCHEDULER_add_now(&call_hostkey_callbacks, pg); | 6132 | GNUNET_SCHEDULER_add_now (&call_hostkey_callbacks, pg); |
6113 | } | 6133 | } |
6114 | GNUNET_free (baseservicehome); | ||
6115 | #endif | 6134 | #endif |
6116 | return pg; | 6135 | return pg; |
6117 | } | 6136 | } |