tests/shell: add test case for shell's buffer size

Co-authored-by: Juan Carrano <j.carrano@fu-berlin.de>
This commit is contained in:
Hendrik van Essen 2020-02-07 12:56:16 +01:00 committed by Francisco Molina
parent 3860355380
commit c8daf596c9
No known key found for this signature in database
GPG Key ID: 3E94EAC3DBDEEDA8
2 changed files with 20 additions and 0 deletions

View File

@ -56,7 +56,17 @@ static int print_echo(int argc, char **argv)
return 0;
}
static int print_shell_bufsize(int argc, char **argv)
{
(void) argc;
(void) argv;
printf("%d\n", SHELL_DEFAULT_BUFSIZE);
return 0;
}
static const shell_command_t shell_commands[] = {
{ "bufsize", "Get the shell's buffer size", print_shell_bufsize },
{ "start_test", "starts a test", print_teststart },
{ "end_test", "ends a test", print_testend },
{ "echo", "prints the input command", print_echo },

View File

@ -63,7 +63,17 @@ def check_cmd(child, cmd, expected):
child.expect_exact(line)
def check_and_get_bufsize(child):
child.sendline('bufsize')
child.expect('([0-9]+)\r\n')
bufsize = int(child.match.group(1))
return bufsize
def testfunc(child):
bufsize = check_and_get_bufsize(child)
# loop other defined commands and expected output
for cmd, expected in CMDS:
check_cmd(child, cmd, expected)