- system = GNUNET_malloc (sizeof (struct GNUNET_TESTING_System));
- if (NULL != (system->tmppath = getenv ("GNUNET_TESTING_PREFIX")))
+ system = GNUNET_new (struct GNUNET_TESTING_System);
+ if (NULL == (system->tmppath = getenv (GNUNET_TESTING_PREFIX)))
ss->sname = GNUNET_strdup (tss.service);
ss->cfg = GNUNET_CONFIGURATION_create ();
GNUNET_CONFIGURATION_iterate_section_values (tss.cfg, ss->sname,
&cfg_copy_iterator, ss->cfg);
GNUNET_CONFIGURATION_iterate_section_values (tss.cfg, "TESTING",
&cfg_copy_iterator, ss->cfg);
ss->sname = GNUNET_strdup (tss.service);
ss->cfg = GNUNET_CONFIGURATION_create ();
GNUNET_CONFIGURATION_iterate_section_values (tss.cfg, ss->sname,
&cfg_copy_iterator, ss->cfg);
GNUNET_CONFIGURATION_iterate_section_values (tss.cfg, "TESTING",
&cfg_copy_iterator, ss->cfg);
*
* @param testdir only the directory name without any path. This is used for all
* service homes; the directory will be created in a temporary location
*
* @param testdir only the directory name without any path. This is used for all
* service homes; the directory will be created in a temporary location
- * depending on the underlying OS
+ * depending on the underlying OS. This variable will be
+ * overridden with the value of the environmental variable
+ * GNUNET_TESTING_PREFIX, if it exists.
* @param trusted_ip the ip address which will be set as TRUSTED HOST in all
* service configurations generated to allow control connections from
* this ip. This can either be a single ip address or a network address
* @param trusted_ip the ip address which will be set as TRUSTED HOST in all
* service configurations generated to allow control connections from
* this ip. This can either be a single ip address or a network address
GNUNET_free (binary);
i->proc = GNUNET_OS_start_process (PIPE_CONTROL,
GNUNET_OS_INHERIT_STD_OUT_AND_ERR,
GNUNET_free (binary);
i->proc = GNUNET_OS_start_process (PIPE_CONTROL,
GNUNET_OS_INHERIT_STD_OUT_AND_ERR,
LOG (GNUNET_ERROR_TYPE_WARNING,
"Killing shared service instance (%s) failed\n", i->ss->sname);
(void) GNUNET_OS_process_wait (i->proc);
LOG (GNUNET_ERROR_TYPE_WARNING,
"Killing shared service instance (%s) failed\n", i->ss->sname);
(void) GNUNET_OS_process_wait (i->proc);
* key; if NULL, GNUNET_SYSERR is returned immediately
* @return NULL on error (not enough keys)
*/
* key; if NULL, GNUNET_SYSERR is returned immediately
* @return NULL on error (not enough keys)
*/
GNUNET_TESTING_hostkey_get (const struct GNUNET_TESTING_System *system,
uint32_t key_number,
struct GNUNET_PeerIdentity *id)
{
GNUNET_TESTING_hostkey_get (const struct GNUNET_TESTING_System *system,
uint32_t key_number,
struct GNUNET_PeerIdentity *id)
{
memcpy (private_key,
system->hostkeys_data +
(key_number * GNUNET_TESTING_HOSTKEYFILESIZE),
GNUNET_TESTING_HOSTKEYFILESIZE);
memcpy (private_key,
system->hostkeys_data +
(key_number * GNUNET_TESTING_HOSTKEYFILESIZE),
GNUNET_TESTING_HOSTKEYFILESIZE);
single_variable))
{
GNUNET_snprintf (uval, sizeof (uval), "%s/%s.sock",
single_variable))
{
GNUNET_snprintf (uval, sizeof (uval), "%s/%s.sock",
cleanup_shared_service_instance (i);
return NULL;
}
GNUNET_array_append (ss->instances, ss->n_instances, i);
temp = GNUNET_CONFIGURATION_dup (ss->cfg);
(void) GNUNET_asprintf (&i->port_str, "%u", port);
cleanup_shared_service_instance (i);
return NULL;
}
GNUNET_array_append (ss->instances, ss->n_instances, i);
temp = GNUNET_CONFIGURATION_dup (ss->cfg);
(void) GNUNET_asprintf (&i->port_str, "%u", port);
- (void) GNUNET_asprintf (&i->cfg_fn, "%s/config", service_home);
- GNUNET_CONFIGURATION_set_value_string (temp, "PATHS", "SERVICEHOME",
- service_home);
- GNUNET_free (service_home);
+ (void) GNUNET_asprintf (&i->cfg_fn, "%s/config", gnunet_home);
+ GNUNET_CONFIGURATION_set_value_string (temp, "PATHS", "GNUNET_HOME",
+ gnunet_home);
+ GNUNET_free (gnunet_home);
GNUNET_CONFIGURATION_set_value_string (temp, ss->sname, "UNIXPATH",
i->unix_sock);
GNUNET_CONFIGURATION_set_value_string (temp, ss->sname, "PORT",
GNUNET_CONFIGURATION_set_value_string (temp, ss->sname, "UNIXPATH",
i->unix_sock);
GNUNET_CONFIGURATION_set_value_string (temp, ss->sname, "PORT",
* Create a new configuration using the given configuration as a template;
* ports and paths will be modified to select available ports on the local
* system. The default configuration will be available in PATHS section under
* Create a new configuration using the given configuration as a template;
* ports and paths will be modified to select available ports on the local
* system. The default configuration will be available in PATHS section under
* @param ports array with port numbers used in the created configuration.
* Will be updated upon successful return. Can be NULL
* @param nports the size of the `ports' array. Will be updated.
* @param ports array with port numbers used in the created configuration.
* Will be updated upon successful return. Can be NULL
* @param nports the size of the `ports' array. Will be updated.
- GNUNET_asprintf (&uc.service_home, "%s/%u", system->tmppath,
+ GNUNET_asprintf (&uc.gnunet_home, "%s/%u", system->tmppath,
GNUNET_CONFIGURATION_set_value_string (cfg, "PATHS", "DEFAULTCONFIG",
default_config);
GNUNET_CONFIGURATION_set_value_string (cfg, "arm", "CONFIG",
default_config);
GNUNET_free (default_config);
GNUNET_CONFIGURATION_set_value_string (cfg, "PATHS", "DEFAULTCONFIG",
default_config);
GNUNET_CONFIGURATION_set_value_string (cfg, "arm", "CONFIG",
default_config);
GNUNET_free (default_config);
- GNUNET_CONFIGURATION_set_value_string (cfg, "PATHS", "SERVICEHOME",
- uc.service_home);
+ GNUNET_CONFIGURATION_set_value_string (cfg, "PATHS", "GNUNET_HOME",
+ uc.gnunet_home);
/* make PORTs and UNIXPATHs unique */
GNUNET_CONFIGURATION_iterate (cfg, &update_config, &uc);
/* allow connections to services from system trusted_ip host */
/* make PORTs and UNIXPATHs unique */
GNUNET_CONFIGURATION_iterate (cfg, &update_config, &uc);
/* allow connections to services from system trusted_ip host */
* Create a new configuration using the given configuration as a template;
* ports and paths will be modified to select available ports on the local
* system. The default configuration will be available in PATHS section under
* Create a new configuration using the given configuration as a template;
* ports and paths will be modified to select available ports on the local
* system. The default configuration will be available in PATHS section under
* section to the temporary directory specific to this configuration. If we run
* out of "*port" numbers, return SYSERR.
*
* section to the temporary directory specific to this configuration. If we run
* out of "*port" numbers, return SYSERR.
*
ss = system->shared_services[cnt];
ss_instances[cnt] = associate_shared_service (system, ss, cfg);
if (NULL == ss_instances[cnt])
ss = system->shared_services[cnt];
ss_instances[cnt] = associate_shared_service (system, ss, cfg);
if (NULL == ss_instances[cnt])
(cfg, "PATHS", "DEFAULTCONFIG", &config_filename));
if (GNUNET_OK != GNUNET_CONFIGURATION_write (cfg, config_filename))
{
(cfg, "PATHS", "DEFAULTCONFIG", &config_filename));
if (GNUNET_OK != GNUNET_CONFIGURATION_write (cfg, config_filename))
{
peer->ss_instances = ss_instances;
peer->cfgfile = config_filename; /* Free in peer_destroy */
peer->cfg = GNUNET_CONFIGURATION_dup (cfg);
peer->ss_instances = ss_instances;
peer->cfgfile = config_filename; /* Free in peer_destroy */
peer->cfg = GNUNET_CONFIGURATION_dup (cfg);
- peer->main_process = GNUNET_OS_start_process (PIPE_CONTROL,
- GNUNET_OS_INHERIT_STD_OUT_AND_ERR,
- NULL, NULL,
- peer->main_binary,
- peer->main_binary,
- peer->args,
- "-c",
- peer->cfgfile,
- NULL);
+ peer->main_binary = GNUNET_CONFIGURATION_expand_dollar (peer->cfg, peer->main_binary);
+ peer->main_process = GNUNET_OS_start_process_s (PIPE_CONTROL,
+ GNUNET_OS_INHERIT_STD_OUT_AND_ERR,
+ NULL,
+ peer->main_binary,
+ peer->args,
+ "-c",
+ peer->cfgfile,
+ NULL);
if (NULL == peer->main_process)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
if (NULL == peer->main_process)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,