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:
parent
3860355380
commit
c8daf596c9
@ -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 },
|
||||
|
||||
@ -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)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user