add wirewatch command to testcase (not yet active), for #5077

This commit is contained in:
Christian Grothoff 2017-12-10 14:25:15 +01:00
parent ff452e6033
commit d36de3bdd6
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC

View File

@ -141,6 +141,11 @@ enum OpCode
*/ */
OC_RUN_AGGREGATOR, OC_RUN_AGGREGATOR,
/**
* Run the wirewatcher to check for incoming transactions.
*/
OC_RUN_WIREWATCH,
/** /**
* Check that the fakebank has received a certain transaction. * Check that the fakebank has received a certain transaction.
*/ */
@ -608,6 +613,20 @@ struct Command
} run_aggregator; } run_aggregator;
struct {
/**
* Process for the wirewatcher.
*/
struct GNUNET_OS_Process *wirewatch_proc;
/**
* ID of task called whenever we get a SIGCHILD.
*/
struct GNUNET_SCHEDULER_Task *child_death_task;
} run_wirewatch;
struct { struct {
/** /**
@ -677,7 +696,7 @@ struct Command
const char *ref; const char *ref;
/** /**
* Process for the aggregator. * Process for the revocation process.
*/ */
struct GNUNET_OS_Process *revoke_proc; struct GNUNET_OS_Process *revoke_proc;
@ -1406,6 +1425,14 @@ maint_child_death (void *cls)
GNUNET_OS_process_destroy (cmd->details.run_aggregator.aggregator_proc); GNUNET_OS_process_destroy (cmd->details.run_aggregator.aggregator_proc);
cmd->details.run_aggregator.aggregator_proc = NULL; cmd->details.run_aggregator.aggregator_proc = NULL;
break; break;
case OC_RUN_WIREWATCH:
cmd->details.run_wirewatch.child_death_task = NULL;
pr = GNUNET_DISK_pipe_handle (sigpipe, GNUNET_DISK_PIPE_END_READ);
GNUNET_break (0 < GNUNET_DISK_file_read (pr, &c, sizeof (c)));
GNUNET_OS_process_wait (cmd->details.run_wirewatch.wirewatch_proc);
GNUNET_OS_process_destroy (cmd->details.run_wirewatch.wirewatch_proc);
cmd->details.run_wirewatch.wirewatch_proc = NULL;
break;
case OC_REVOKE: case OC_REVOKE:
cmd->details.revoke.child_death_task = NULL; cmd->details.revoke.child_death_task = NULL;
pr = GNUNET_DISK_pipe_handle (sigpipe, GNUNET_DISK_PIPE_END_READ); pr = GNUNET_DISK_pipe_handle (sigpipe, GNUNET_DISK_PIPE_END_READ);
@ -2574,13 +2601,42 @@ interpreter_run (void *cls)
fail (is); fail (is);
return; return;
} }
pr = GNUNET_DISK_pipe_handle (sigpipe, GNUNET_DISK_PIPE_END_READ); pr = GNUNET_DISK_pipe_handle (sigpipe,
GNUNET_DISK_PIPE_END_READ);
cmd->details.run_aggregator.child_death_task cmd->details.run_aggregator.child_death_task
= GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL, = GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL,
pr, pr,
&maint_child_death, is); &maint_child_death, is);
return; return;
} }
case OC_RUN_WIREWATCH:
{
const struct GNUNET_DISK_FileHandle *pr;
cmd->details.run_wirewatch.wirewatch_proc
= GNUNET_OS_start_process (GNUNET_NO,
GNUNET_OS_INHERIT_STD_ALL,
NULL, NULL, NULL,
"taler-exchange-wirewatch",
"taler-exchange-wirewatch",
"-c", "test_exchange_api.conf",
"-t", "test", /* use Taler's bank/fakebank */
"-T", /* exit when done */
NULL);
if (NULL == cmd->details.run_wirewatch.wirewatch_proc)
{
GNUNET_break (0);
fail (is);
return;
}
pr = GNUNET_DISK_pipe_handle (sigpipe,
GNUNET_DISK_PIPE_END_READ);
cmd->details.run_wirewatch.child_death_task
= GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL,
pr,
&maint_child_death, is);
return;
}
case OC_CHECK_BANK_TRANSFER: case OC_CHECK_BANK_TRANSFER:
{ {
if (GNUNET_OK != if (GNUNET_OK !=