gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r24984 - gnunet/src/testing


From: gnunet
Subject: [GNUnet-SVN] r24984 - gnunet/src/testing
Date: Thu, 15 Nov 2012 14:59:23 +0100

Author: wachs
Date: 2012-11-15 14:59:23 +0100 (Thu, 15 Nov 2012)
New Revision: 24984

Modified:
   gnunet/src/testing/testing.c
Log:
prefix support for testing

Modified: gnunet/src/testing/testing.c
===================================================================
--- gnunet/src/testing/testing.c        2012-11-15 13:55:33 UTC (rev 24983)
+++ gnunet/src/testing/testing.c        2012-11-15 13:59:23 UTC (rev 24984)
@@ -159,6 +159,7 @@
    * necessary).
    */ 
   char *main_binary;
+  char *args;
   
   /**
    * Handle to the running binary of the service, NULL if the
@@ -837,6 +838,7 @@
   char *service_home;  
   char hostkey_filename[128];
   char *config_filename;
+  char *libexec_binary;
   char *emsg_;
   struct GNUNET_CRYPTO_RsaPrivateKey *pk;
 
@@ -935,9 +937,21 @@
   }
   peer = GNUNET_malloc (sizeof (struct GNUNET_TESTING_Peer));
   peer->cfgfile = config_filename; /* Free in peer_destroy */
-  peer->main_binary = GNUNET_OS_get_libexec_binary_path ("gnunet-service-arm");
+
+  libexec_binary = GNUNET_OS_get_libexec_binary_path ("gnunet-service-arm");
+  if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_string(cfg, "arm", 
"PREFIX", &peer->main_binary))
+  {
+    /* No prefix */
+    GNUNET_asprintf(&peer->main_binary, "%s", libexec_binary);
+    peer->args = strdup ("");
+  }
+  else
+    peer->args = strdup (libexec_binary);
+
   peer->system = system;
   peer->key_number = key_number;
+
+  GNUNET_free (libexec_binary);
   return peer;
 }
 
@@ -976,6 +990,7 @@
   peer->main_process = GNUNET_OS_start_process (GNUNET_YES, 
GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL,
                                                 peer->main_binary,
                                                 peer->main_binary,
+                                                peer->args,
                                                 "-c",
                                                 peer->cfgfile,
                                                 NULL);
@@ -1069,6 +1084,7 @@
   }
   GNUNET_free (peer->cfgfile);
   GNUNET_free (peer->main_binary);
+  GNUNET_free (peer->args);
   GNUNET_free (peer);
 }
 
@@ -1176,6 +1192,7 @@
   struct GNUNET_TESTING_Peer *peer;
   struct GNUNET_CONFIGURATION_Handle *cfg;
   char *binary;
+  char *libexec_binary;
 
   GNUNET_log_setup (testdir, "WARNING", NULL);
   system = GNUNET_TESTING_system_create (testdir, "127.0.0.1", NULL);
@@ -1199,8 +1216,19 @@
     return 1;
   }
   GNUNET_free (peer->main_binary);
+
   GNUNET_asprintf (&binary, "gnunet-service-%s", service_name);
-  peer->main_binary = GNUNET_OS_get_libexec_binary_path (binary);
+  libexec_binary = GNUNET_OS_get_libexec_binary_path (binary);
+  if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_string(cfg, 
service_name, "PREFIX", &peer->main_binary))
+  {
+    /* No prefix */
+    GNUNET_asprintf(&peer->main_binary, "%s", libexec_binary);
+    peer->args = strdup ("");
+  }
+  else
+    peer->args = strdup (libexec_binary);
+
+  GNUNET_free (libexec_binary);
   GNUNET_free (binary);
   if (GNUNET_OK != GNUNET_TESTING_peer_start (peer))
   {    




reply via email to

[Prev in Thread] Current Thread [Next in Thread]