aboutsummaryrefslogtreecommitdiff
path: root/src/benchmark/taler-exchange-benchmark.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2018-08-10 13:09:12 +0200
committerChristian Grothoff <christian@grothoff.org>2018-08-10 18:48:45 +0200
commit9887077ea254163a873add1059b25144a7ddc32b (patch)
treef38f52ba0aa1cd8f23686dddc80b32cb250828ea /src/benchmark/taler-exchange-benchmark.c
parente17121fd1c8a08aeedafd0be365ba06e0820c691 (diff)
launch wirewatch in the background for benchmarking
Diffstat (limited to 'src/benchmark/taler-exchange-benchmark.c')
-rw-r--r--src/benchmark/taler-exchange-benchmark.c90
1 files changed, 62 insertions, 28 deletions
diff --git a/src/benchmark/taler-exchange-benchmark.c b/src/benchmark/taler-exchange-benchmark.c
index ac40ea748..3440b3b4e 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;
}