Put lookup logic for meta-commands.
This commit is contained in:
parent
6a8c5209c3
commit
61fecfcd6f
@ -57,11 +57,33 @@ TALER_TESTING_interpreter_lookup_command
|
|||||||
"Attempt to lookup command for empty label\n");
|
"Attempt to lookup command for empty label\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
for (unsigned int i=0;NULL != (cmd = &is->commands[i])->label;i++)
|
for (unsigned int i=0;
|
||||||
|
NULL != (cmd = &is->commands[i])->label;
|
||||||
|
i++)
|
||||||
|
{
|
||||||
|
/* Give precedence to top-level commands. */
|
||||||
if ( (NULL != cmd->label) &&
|
if ( (NULL != cmd->label) &&
|
||||||
(0 == strcmp (cmd->label,
|
(0 == strcmp (cmd->label,
|
||||||
label)) )
|
label)) )
|
||||||
return cmd;
|
return cmd;
|
||||||
|
|
||||||
|
if (GNUNET_YES == cmd->meta)
|
||||||
|
{
|
||||||
|
struct TALER_TESTING_Command *batch = cmd->cls;
|
||||||
|
|
||||||
|
/* NOTE: the batch does need a "end" CMD in the
|
||||||
|
* last place. */
|
||||||
|
for (unsigned int i=0;
|
||||||
|
NULL != (cmd = &batch[i])->label;
|
||||||
|
i++)
|
||||||
|
{
|
||||||
|
if ( (NULL != cmd->label) &&
|
||||||
|
(0 == strcmp (cmd->label,
|
||||||
|
label)) )
|
||||||
|
return cmd;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
|
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
|
||||||
"Command not found: %s\n",
|
"Command not found: %s\n",
|
||||||
label);
|
label);
|
||||||
|
@ -300,6 +300,15 @@ struct TALER_TESTING_Command
|
|||||||
const char *trait,
|
const char *trait,
|
||||||
unsigned int index);
|
unsigned int index);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Has GNUNET_YES if the command is a "meta" one. Meta
|
||||||
|
* commands are those that takes arrays of commands and
|
||||||
|
* execute them. Are used to group testing commands in
|
||||||
|
* order to improve readability of test cases.
|
||||||
|
*/
|
||||||
|
unsigned int meta;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user