add missing 'static', ensure no NPE, fail nicely even on bad test input
This commit is contained in:
parent
69c1ca4d23
commit
2cea0eb4d2
@ -243,6 +243,7 @@ deposit_wtid_cb
|
|||||||
TALER_TESTING_interpreter_next (tts->is);
|
TALER_TESTING_interpreter_next (tts->is);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Run the command.
|
* Run the command.
|
||||||
*
|
*
|
||||||
@ -340,6 +341,7 @@ track_transaction_run (void *cls,
|
|||||||
GNUNET_assert (NULL != tts->tth);
|
GNUNET_assert (NULL != tts->tth);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cleanup the state from a "track transaction" CMD, and possibly
|
* Cleanup the state from a "track transaction" CMD, and possibly
|
||||||
* cancel a operation thereof.
|
* cancel a operation thereof.
|
||||||
@ -347,7 +349,7 @@ track_transaction_run (void *cls,
|
|||||||
* @param cls closure.
|
* @param cls closure.
|
||||||
* @param cmd the command which is being cleaned up.
|
* @param cmd the command which is being cleaned up.
|
||||||
*/
|
*/
|
||||||
void
|
static void
|
||||||
track_transaction_cleanup
|
track_transaction_cleanup
|
||||||
(void *cls,
|
(void *cls,
|
||||||
const struct TALER_TESTING_Command *cmd)
|
const struct TALER_TESTING_Command *cmd)
|
||||||
@ -437,6 +439,7 @@ TALER_TESTING_cmd_track_transaction
|
|||||||
return cmd;
|
return cmd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cleanup the state for a "track transfer" CMD, and possibly
|
* Cleanup the state for a "track transfer" CMD, and possibly
|
||||||
* cancel a pending operation thereof.
|
* cancel a pending operation thereof.
|
||||||
@ -444,7 +447,7 @@ TALER_TESTING_cmd_track_transaction
|
|||||||
* @param cls closure.
|
* @param cls closure.
|
||||||
* @param cmd the command which is being cleaned up.
|
* @param cmd the command which is being cleaned up.
|
||||||
*/
|
*/
|
||||||
void
|
static void
|
||||||
track_transfer_cleanup (void *cls,
|
track_transfer_cleanup (void *cls,
|
||||||
const struct TALER_TESTING_Command *cmd)
|
const struct TALER_TESTING_Command *cmd)
|
||||||
{
|
{
|
||||||
@ -461,9 +464,9 @@ track_transfer_cleanup (void *cls,
|
|||||||
tts->tth = NULL;
|
tts->tth = NULL;
|
||||||
}
|
}
|
||||||
GNUNET_free (tts);
|
GNUNET_free (tts);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check whether the HTTP response code from a "track transfer"
|
* Check whether the HTTP response code from a "track transfer"
|
||||||
* operation is acceptable, and all other values like total amount,
|
* operation is acceptable, and all other values like total amount,
|
||||||
@ -505,11 +508,9 @@ track_transfer_cb
|
|||||||
struct TrackTransferState *tts = cls;
|
struct TrackTransferState *tts = cls;
|
||||||
struct TALER_TESTING_Interpreter *is = tts->is;
|
struct TALER_TESTING_Interpreter *is = tts->is;
|
||||||
struct TALER_TESTING_Command *cmd = &is->commands[is->ip];
|
struct TALER_TESTING_Command *cmd = &is->commands[is->ip];
|
||||||
|
|
||||||
struct TALER_Amount expected_amount;
|
struct TALER_Amount expected_amount;
|
||||||
|
|
||||||
tts->tth = NULL;
|
tts->tth = NULL;
|
||||||
|
|
||||||
if (tts->expected_response_code != http_status)
|
if (tts->expected_response_code != http_status)
|
||||||
{
|
{
|
||||||
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
|
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
|
||||||
@ -522,13 +523,18 @@ track_transfer_cb
|
|||||||
TALER_TESTING_interpreter_fail (is);
|
TALER_TESTING_interpreter_fail (is);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (NULL == tts->expected_total_amount)
|
||||||
if ( (NULL == tts->expected_total_amount) ||
|
{
|
||||||
(NULL == tts->expected_wire_fee) )
|
GNUNET_break (0);
|
||||||
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
|
TALER_TESTING_interpreter_fail (is);
|
||||||
"Expected amount and fee not specified, "
|
return;
|
||||||
"likely to segfault...\n");
|
}
|
||||||
|
if (NULL == tts->expected_wire_fee)
|
||||||
|
{
|
||||||
|
GNUNET_break (0);
|
||||||
|
TALER_TESTING_interpreter_fail (is);
|
||||||
|
return;
|
||||||
|
}
|
||||||
switch (http_status)
|
switch (http_status)
|
||||||
{
|
{
|
||||||
case MHD_HTTP_OK:
|
case MHD_HTTP_OK:
|
||||||
|
Loading…
Reference in New Issue
Block a user