tests/shell: add tests for XFA shell commands

This commit is contained in:
Kaspar Schleiser 2021-02-22 12:37:04 +01:00
parent 3eaa1beb56
commit 5975fabd9f
2 changed files with 31 additions and 1 deletions

View File

@ -103,6 +103,30 @@ static const shell_command_t shell_commands[] = {
{ NULL, NULL, NULL } { NULL, NULL, NULL }
}; };
static int _xfa_test1(int argc, char **argv)
{
(void) argc;
(void) argv;
printf("[XFA TEST 1 OK]\n");
return 0;
}
static int _xfa_test2(int argc, char **argv)
{
(void) argc;
(void) argv;
printf("[XFA TEST 2 OK]\n");
return 0;
}
/* Add above commands to the shell commands XFA using helper macro.
* Intentionally reversed order to test linker script based alphanumeric
* ordering. */
SHELL_COMMAND(xfa_test2, "xfa test command 2",_xfa_test2);
SHELL_COMMAND(xfa_test1, "xfa test command 1",_xfa_test1);
int main(void) int main(void)
{ {
printf("test_shell.\n"); printf("test_shell.\n");

View File

@ -19,7 +19,9 @@ EXPECTED_HELP = (
'echo prints the input command', 'echo prints the input command',
'reboot Reboot the node', 'reboot Reboot the node',
'ps Prints information about running threads.', 'ps Prints information about running threads.',
'app_metadata Returns application metadata' 'app_metadata Returns application metadata',
'xfa_test1 xfa test command 1',
'xfa_test2 xfa test command 2'
) )
EXPECTED_PS = ( EXPECTED_PS = (
@ -96,6 +98,10 @@ CMDS = (
('ps', EXPECTED_PS), ('ps', EXPECTED_PS),
('help', EXPECTED_HELP), ('help', EXPECTED_HELP),
# test commands added to shell_commands_xfa
('xfa_test1', '[XFA TEST 1 OK]'),
('xfa_test2', '[XFA TEST 2 OK]'),
# test reboot # test reboot
('reboot', 'test_shell.'), ('reboot', 'test_shell.'),