X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=src%2Ftesting%2Ftesting.c;h=a4fdd38cabcf55eaef7107777a97f7672c3ba834;hb=cea95af17bb3bfaf65224d0ecd2db2308e333764;hp=dd680539695e93cc36cb781a522ea91387ae166a;hpb=e82e35960347d2cd4368144d167a0077673264f5;p=oweals%2Fgnunet.git diff --git a/src/testing/testing.c b/src/testing/testing.c index dd6805396..a4fdd38ca 100644 --- a/src/testing/testing.c +++ b/src/testing/testing.c @@ -34,8 +34,6 @@ #include "gnunet_arm_service.h" #include "gnunet_testing_lib.h" -#include "../arm/do_start_process.c" - #define LOG(kind,...) \ GNUNET_log_from (kind, "testing-api", __VA_ARGS__) @@ -389,7 +387,7 @@ GNUNET_TESTING_system_create_with_portrange (const char *testdir, unsigned int cnt; GNUNET_assert (NULL != testdir); - system = GNUNET_malloc (sizeof (struct GNUNET_TESTING_System)); + system = GNUNET_new (struct GNUNET_TESTING_System); if (NULL == (system->tmppath = getenv (GNUNET_TESTING_PREFIX))) system->tmppath = GNUNET_DISK_mkdtemp (testdir); else @@ -415,13 +413,15 @@ GNUNET_TESTING_system_create_with_portrange (const char *testdir, for (cnt = 0; NULL != shared_services[cnt].service; cnt++) { tss = shared_services[cnt]; - ss = GNUNET_malloc (sizeof (struct SharedService)); + ss = GNUNET_new (struct SharedService); 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); + GNUNET_CONFIGURATION_iterate_section_values (tss.cfg, "PATHS", + &cfg_copy_iterator, ss->cfg); ss->share = tss.share; GNUNET_array_append (system->shared_services, system->n_shared_services, ss); @@ -493,7 +493,7 @@ start_shared_service_instance (struct SharedServiceInstance *i) GNUNET_free (binary); i->proc = GNUNET_OS_start_process (PIPE_CONTROL, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, - NULL, NULL, + NULL, NULL, NULL, libexec_binary, libexec_binary, "-c", @@ -1226,7 +1226,10 @@ GNUNET_TESTING_peer_configure (struct GNUNET_TESTING_System *system, ss = system->shared_services[cnt]; ss_instances[cnt] = associate_shared_service (system, ss, cfg); if (NULL == ss_instances[cnt]) + { + emsg_ = GNUNET_strdup ("FIXME"); goto err_ret; + } } GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_get_value_filename @@ -1241,7 +1244,7 @@ GNUNET_TESTING_peer_configure (struct GNUNET_TESTING_System *system, GNUNET_free (config_filename); goto err_ret; } - peer = GNUNET_malloc (sizeof (struct GNUNET_TESTING_Peer)); + peer = GNUNET_new (struct GNUNET_TESTING_Peer); peer->ss_instances = ss_instances; peer->cfgfile = config_filename; /* Free in peer_destroy */ peer->cfg = GNUNET_CONFIGURATION_dup (cfg); @@ -1253,7 +1256,9 @@ GNUNET_TESTING_peer_configure (struct GNUNET_TESTING_System *system, peer->args = strdup (""); } else + { peer->args = strdup (libexec_binary); + } peer->system = system; peer->key_number = key_number; GNUNET_free (libexec_binary); @@ -1288,7 +1293,7 @@ GNUNET_TESTING_peer_get_identity (struct GNUNET_TESTING_Peer *peer, memcpy (id, peer->id, sizeof (struct GNUNET_PeerIdentity)); return; } - peer->id = GNUNET_malloc (sizeof (struct GNUNET_PeerIdentity)); + peer->id = GNUNET_new (struct GNUNET_PeerIdentity); GNUNET_free (GNUNET_TESTING_hostkey_get (peer->system, peer->key_number, peer->id)); @@ -1322,14 +1327,15 @@ GNUNET_TESTING_peer_start (struct GNUNET_TESTING_Peer *peer) return GNUNET_SYSERR; i->n_refs++; } - peer->main_process = do_start_process (PIPE_CONTROL, - GNUNET_OS_INHERIT_STD_OUT_AND_ERR, - NULL, - 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,