gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [taler-exchange] 02/02: launch wirewatch in the background


From: gnunet
Subject: [GNUnet-SVN] [taler-exchange] 02/02: launch wirewatch in the background for benchmarking
Date: Fri, 10 Aug 2018 18:48:50 +0200

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository exchange.

commit 9887077ea254163a873add1059b25144a7ddc32b
Author: Christian Grothoff <address@hidden>
AuthorDate: Fri Aug 10 13:09:12 2018 +0200

    launch wirewatch in the background for benchmarking
---
 src/benchmark/taler-exchange-benchmark.c | 90 ++++++++++++++++++++++----------
 1 file changed, 62 insertions(+), 28 deletions(-)

diff --git a/src/benchmark/taler-exchange-benchmark.c 
b/src/benchmark/taler-exchange-benchmark.c
index ac40ea7..3440b3b 100644
--- a/src/benchmark/taler-exchange-benchmark.c
+++ b/src/benchmark/taler-exchange-benchmark.c
@@ -351,10 +351,6 @@ run (void *cls,
     CMD_TRANSFER_TO_EXCHANGE
       ("create-reserve",
        TALER_amount_to_string (&total_reserve_amount)),
-    /* FIXME: remove wirewatch here! */
-    TALER_TESTING_cmd_exec_wirewatch
-      ("wirewatch",
-       cfg_filename),
     TALER_TESTING_cmd_end ()
   };
 
@@ -506,6 +502,22 @@ parallel_benchmark (TALER_TESTING_Main main_cb,
   pid_t fakebank;
   int wstatus;
   struct GNUNET_OS_Process *exchanged;
+  struct GNUNET_OS_Process *wirewatch;
+
+  /* start fakebank */
+  fakebank = fork ();
+  if (0 == fakebank)
+  {
+    GNUNET_SCHEDULER_run (&launch_fakebank,
+                          exchange_bank_account.bank_base_url);
+    exit (0);
+  }
+  if (-1 == fakebank)
+  {
+    GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR,
+                         "fork");
+    return GNUNET_SYSERR;
+  }
 
   /* start exchange */
   exchanged = GNUNET_OS_start_process (GNUNET_NO,
@@ -517,34 +529,50 @@ parallel_benchmark (TALER_TESTING_Main main_cb,
                                        "-i",
                                        NULL);
   if (NULL == exchanged)
-    return GNUNET_SYSERR;
-  if (0 != TALER_TESTING_wait_exchange_ready (exchange_url))
+  {
+    kill (fakebank,
+         SIGTERM);
+    waitpid (fakebank,
+            &wstatus,
+            0);
+    return 77;
+  }
+  /* start exchange */
+  wirewatch = GNUNET_OS_start_process (GNUNET_NO,
+                                       GNUNET_OS_INHERIT_STD_ALL,
+                                       NULL, NULL, NULL,
+                                       "taler-exchange-wirewatch",
+                                       "taler-exchange-wirewatch",
+                                       "-c", config_file,
+                                       NULL);
+  if (NULL == wirewatch)
   {
     GNUNET_OS_process_kill (exchanged,
                             SIGTERM);
+    kill (fakebank,
+         SIGTERM);
     GNUNET_OS_process_wait (exchanged);
     GNUNET_OS_process_destroy (exchanged);
+    waitpid (fakebank,
+            &wstatus,
+            0);
     return 77;
   }
-  /* start fakebank */
-  fakebank = fork ();
-  if (0 == fakebank)
-  {
-    GNUNET_SCHEDULER_run (&launch_fakebank,
-                          exchange_bank_account.bank_base_url);
-    exit (0);
-  }
-  if (-1 == fakebank)
+  if (0 != TALER_TESTING_wait_exchange_ready (exchange_url))
   {
-    GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR,
-                         "fork");
-    result = GNUNET_SYSERR;
+    GNUNET_OS_process_kill (exchanged,
+                            SIGTERM);
+    kill (fakebank,
+         SIGTERM);
+    GNUNET_OS_process_wait (exchanged);
+    GNUNET_OS_process_destroy (exchanged);
+    waitpid (fakebank,
+            &wstatus,
+            0);
     return 77;
   }
   sleep (1); /* make sure fakebank process is ready before continuing */
 
-  /* FIXME: start wirewatch */
-
   start_time = GNUNET_TIME_absolute_get ();
   result = GNUNET_OK;
   for (unsigned int i=0;i<howmany_clients;i++)
@@ -585,8 +613,21 @@ parallel_benchmark (TALER_TESTING_Main main_cb,
       result = GNUNET_SYSERR;
     }
   }
-  /* FIXME: stop wirewatch */
 
+  /* stop wirewatch */
+  GNUNET_break (0 ==
+                GNUNET_OS_process_kill (wirewatch,
+                                        SIGTERM));
+  GNUNET_break (GNUNET_OK ==
+                GNUNET_OS_process_wait (wirewatch));
+  GNUNET_OS_process_destroy (wirewatch);
+  /* stop exchange */
+  GNUNET_break (0 ==
+                GNUNET_OS_process_kill (exchanged,
+                                        SIGTERM));
+  GNUNET_break (GNUNET_OK ==
+                GNUNET_OS_process_wait (exchanged));
+  GNUNET_OS_process_destroy (exchanged);
   /* stop fakebank */
   if (0 != kill (fakebank,
                  SIGTERM))
@@ -601,13 +642,6 @@ parallel_benchmark (TALER_TESTING_Main main_cb,
     GNUNET_break (0);
     result = GNUNET_SYSERR;
   }
-  /* stop exchange */
-  GNUNET_break (0 ==
-                GNUNET_OS_process_kill (exchanged,
-                                        SIGTERM));
-  GNUNET_break (GNUNET_OK ==
-                GNUNET_OS_process_wait (exchanged));
-  GNUNET_OS_process_destroy (exchanged);
   return result;
 }
 

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

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