M testbed/testbed.h
[oweals/gnunet.git] / src / chat / test_chat_private.c
index 0aebd8f8bb74f851cd62aae474bd3d1787bd4d66..b911d091fbef7ccedaccb7dcfcd0d4ee2d453cb7 100644 (file)
@@ -32,8 +32,6 @@
 
 #define VERBOSE GNUNET_NO
 
-#define START_ARM GNUNET_YES
-
 /**
  * How long until we give up on passing the test?
  */
@@ -47,9 +45,7 @@
 struct PeerContext
 {
   struct GNUNET_CONFIGURATION_Handle *cfg;
-#if START_ARM
   struct GNUNET_OS_Process *arm_proc;
-#endif
 };
 
 struct Wanted
@@ -124,30 +120,28 @@ static int bob_ready;
 
 static int is_p2p;
 
-struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *bob_public_key = NULL;
+static struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *bob_public_key;
 
 
 static void
 setup_peer (struct PeerContext *p, const char *cfgname)
 {
+  char *binary;
+
+  binary = GNUNET_OS_get_libexec_binary_path ("gnunet-service-arm");
   p->cfg = GNUNET_CONFIGURATION_create ();
-#if START_ARM
   p->arm_proc =
-      GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-service-arm",
+    GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, binary,
                                "gnunet-service-arm",
-#if VERBOSE
-                               "-L", "DEBUG",
-#endif
                                "-c", cfgname, NULL);
-#endif
   GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname));
+  GNUNET_free (binary);
 }
 
 
 static void
 stop_arm (struct PeerContext *p)
 {
-#if START_ARM
   if (0 != GNUNET_OS_process_kill (p->arm_proc, SIGTERM))
     GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill");
   if (GNUNET_OS_process_wait (p->arm_proc) != GNUNET_OK)
@@ -156,7 +150,6 @@ stop_arm (struct PeerContext *p)
               GNUNET_OS_process_get_pid (p->arm_proc));
   GNUNET_OS_process_destroy (p->arm_proc);
   p->arm_proc = NULL;
-#endif
   GNUNET_CONFIGURATION_destroy (p->cfg);
 }
 
@@ -614,9 +607,6 @@ main (int argc, char *argv[])
     "test-chat",
     "-c",
     "test_chat_data.conf",
-#if VERBOSE
-    "-L", "DEBUG",
-#endif
     NULL
   };
   struct GNUNET_GETOPT_CommandLineOption options[] = {
@@ -624,11 +614,7 @@ main (int argc, char *argv[])
   };
 
   GNUNET_log_setup ("test_chat",
-#if VERBOSE
-                    "DEBUG",
-#else
                     "WARNING",
-#endif
                     NULL);
   if (strstr (argv[0], "p2p") != NULL)
   {