- add underlay api implementation
[oweals/gnunet.git] / src / testing / testing.c
index 4e60ae0f771a4db5c9e6e774cbdc93726ad65591..f414032a0749f898c05665a3ea1fc050491152ca 100644 (file)
@@ -388,7 +388,7 @@ GNUNET_TESTING_system_create_with_portrange (const char *testdir,
 
   GNUNET_assert (NULL != testdir);
   system = GNUNET_malloc (sizeof (struct GNUNET_TESTING_System));
-  if (NULL == (system->tmppath = getenv ("GNUNET_TESTING_PREFIX")))
+  if (NULL == (system->tmppath = getenv (GNUNET_TESTING_PREFIX)))
     system->tmppath = GNUNET_DISK_mkdtemp (testdir);
   else
     system->tmppath = GNUNET_strdup (system->tmppath);
@@ -508,7 +508,7 @@ static void
 stop_shared_service_instance (struct SharedServiceInstance *i)
 {
   GNUNET_break (0 == i->n_refs);
-  if (0 != GNUNET_OS_process_kill (i->proc, SIGTERM))
+  if (0 != GNUNET_OS_process_kill (i->proc, GNUNET_TERM_SIG))
     LOG (GNUNET_ERROR_TYPE_WARNING,
          "Killing shared service instance (%s) failed\n", i->ss->sname);
   (void) GNUNET_OS_process_wait (i->proc);
@@ -701,12 +701,12 @@ GNUNET_TESTING_release_port (struct GNUNET_TESTING_System *system,
  *        key; if NULL, GNUNET_SYSERR is returned immediately
  * @return NULL on error (not enough keys)
  */
-struct GNUNET_CRYPTO_EccPrivateKey *
+struct GNUNET_CRYPTO_EddsaPrivateKey *
 GNUNET_TESTING_hostkey_get (const struct GNUNET_TESTING_System *system,
                            uint32_t key_number,
                            struct GNUNET_PeerIdentity *id)
 {
-  struct GNUNET_CRYPTO_EccPrivateKey *private_key;
+  struct GNUNET_CRYPTO_EddsaPrivateKey *private_key;
 
   if ((NULL == id) || (NULL == system->hostkeys_data))
     return NULL;
@@ -716,12 +716,12 @@ GNUNET_TESTING_hostkey_get (const struct GNUNET_TESTING_System *system,
          _("Key number %u does not exist\n"), key_number);
     return NULL;
   }
-  private_key = GNUNET_new (struct GNUNET_CRYPTO_EccPrivateKey);
+  private_key = GNUNET_new (struct GNUNET_CRYPTO_EddsaPrivateKey);
   memcpy (private_key,
          system->hostkeys_data +
          (key_number * GNUNET_TESTING_HOSTKEYFILESIZE),
          GNUNET_TESTING_HOSTKEYFILESIZE);
-  GNUNET_CRYPTO_ecc_key_get_public_for_signature (private_key,
+  GNUNET_CRYPTO_eddsa_key_get_public (private_key,
                                                   &id->public_key);
   return private_key;
 }
@@ -1137,7 +1137,7 @@ GNUNET_TESTING_peer_configure (struct GNUNET_TESTING_System *system,
   char *config_filename;
   char *libexec_binary;
   char *emsg_;
-  struct GNUNET_CRYPTO_EccPrivateKey *pk;
+  struct GNUNET_CRYPTO_EddsaPrivateKey *pk;
   uint16_t *ports;
   struct SharedService *ss;
   struct SharedServiceInstance **ss_instances;
@@ -1224,10 +1224,13 @@ 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_string
+                 GNUNET_CONFIGURATION_get_value_filename
                  (cfg, "PATHS", "DEFAULTCONFIG", &config_filename));
   if (GNUNET_OK != GNUNET_CONFIGURATION_write (cfg, config_filename))
   {
@@ -1251,7 +1254,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);
@@ -1320,15 +1325,15 @@ GNUNET_TESTING_peer_start (struct GNUNET_TESTING_Peer *peer)
       return GNUNET_SYSERR;
     i->n_refs++;
   }
-  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,
@@ -1418,7 +1423,7 @@ GNUNET_TESTING_peer_kill (struct GNUNET_TESTING_Peer *peer)
     GNUNET_break (0);
     return GNUNET_SYSERR;
   }
-  if (0 != GNUNET_OS_process_kill (peer->main_process, SIGTERM))
+  if (0 != GNUNET_OS_process_kill (peer->main_process, GNUNET_TERM_SIG))
     return GNUNET_SYSERR;
   for (cnt = 0; cnt < peer->system->n_shared_services; cnt++)
   {