add --test option to taler-exchange-wirewatch

This commit is contained in:
Christian Grothoff 2017-06-11 11:57:05 +02:00
parent 0ef7116ecf
commit 1eb739c670
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
3 changed files with 20 additions and 0 deletions

View File

@ -19,6 +19,9 @@ Use the specified wire plugin and its configuration to talk to the bank.
.IP "\-h, \-\-help" .IP "\-h, \-\-help"
Print short help on options. Print short help on options.
.B .B
.IP "\-T, \-\-test"
Run in test mode and exit when idle.
.B
.IP "\-v, \-\-version" .IP "\-v, \-\-version"
Print version information. Print version information.
.B .B

View File

@ -94,6 +94,11 @@ static char *type;
*/ */
static int delay; static int delay;
/**
* Are we run in testing mode and should only do one pass?
*/
static int test_mode;
/** /**
* Next task to run, if any. * Next task to run, if any.
*/ */
@ -234,6 +239,12 @@ history_cb (void *cls,
start_off = last_row_off; start_off = last_row_off;
start_off_size = last_row_off_size; start_off_size = last_row_off_size;
} }
if ( (GNUNET_YES == delay) &&
(test_mode) )
{
GNUNET_SCHEDULER_shutdown ();
return GNUNET_OK;
}
if (GNUNET_YES == delay) if (GNUNET_YES == delay)
task = GNUNET_SCHEDULER_add_delayed (DELAY, task = GNUNET_SCHEDULER_add_delayed (DELAY,
&find_transfers, &find_transfers,
@ -289,6 +300,7 @@ find_transfers (void *cls)
struct TALER_EXCHANGEDB_Session *session; struct TALER_EXCHANGEDB_Session *session;
int ret; int ret;
task = NULL;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Checking for incoming wire transfers\n"); "Checking for incoming wire transfers\n");
@ -389,6 +401,10 @@ main (int argc,
"PLUGINNAME", "PLUGINNAME",
"which wire plugin to use", "which wire plugin to use",
&type), &type),
GNUNET_GETOPT_option_flag ('T',
"test",
"run in test mode and exit when idle",
&test_mode),
GNUNET_GETOPT_OPTION_END GNUNET_GETOPT_OPTION_END
}; };

View File

@ -486,6 +486,7 @@ interpreter (void *cls)
"taler-exchange-wirewatch", "taler-exchange-wirewatch",
"-c", config_filename, "-c", config_filename,
"-t", "test", "-t", "test",
"-T", /* run in test mode, exit instead of looping */
NULL); NULL);
if (NULL == cmd->details.wirewatch.wirewatch_proc) if (NULL == cmd->details.wirewatch.wirewatch_proc)
{ {