1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

Merge pull request #18891 from maribu/tests/shell

tests/shell: fix failure on samr21-xpro
This commit is contained in:
benpicco 2022-11-15 00:46:42 +01:00 committed by GitHub
commit 29128759ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 8 deletions

View File

@ -16,5 +16,7 @@ TEST_ON_CI_BLACKLIST += microbit
include $(RIOTBASE)/Makefile.include
CFLAGS += '-DTHREAD_STACKSIZE_MAIN=(THREAD_STACKSIZE_SMALL+THREAD_EXTRA_STACKSIZE_PRINTF)'
# the test script skips tests if socat is not used
$(call target-export-variables,$(RIOT_TERMINAL),RIOT_TERMINAL)

View File

@ -27,6 +27,12 @@
#include "xtimer.h"
#endif
/* define buffer to be used by the shell. Note: This is intentionally
* smaller than 64 bytes, as the EDBG integrated UART bridge of the samr21-xpro
* (and likely all other EDBG boards) drops chars when sending more than 64
* bytes at a time. This results in the buffer overflow test failing. */
static char line_buf[60];
#if MODULE_SHELL_HOOKS
void shell_post_readline_hook(void)
{
@ -81,7 +87,7 @@ static int print_shell_bufsize(int argc, char **argv)
{
(void)argc;
(void)argv;
printf("%d\n", SHELL_DEFAULT_BUFSIZE);
printf("%d\n", sizeof(line_buf));
return 0;
}
@ -130,20 +136,17 @@ int main(void)
{
printf("test_shell.\n");
/* define buffer to be used by the shell */
char line_buf[SHELL_DEFAULT_BUFSIZE];
/* define own shell commands */
shell_run_once(shell_commands, line_buf, SHELL_DEFAULT_BUFSIZE);
shell_run_once(shell_commands, line_buf, sizeof(line_buf));
puts("shell exited");
/* Restart the shell after the previous one exits, so that we can test
* Ctrl-D exit */
shell_run(shell_commands, line_buf, SHELL_DEFAULT_BUFSIZE);
shell_run(shell_commands, line_buf, sizeof(line_buf));
/* or use only system shell commands */
/* shell_run(NULL, line_buf, SHELL_DEFAULT_BUFSIZE); */
/* shell_run(NULL, line_buf, sizeof(line_buf)); */
return 0;
}

View File

@ -211,7 +211,7 @@ def testfunc(child):
child.crlf = '\n'
bufsize = check_and_get_bufsize(child)
longline = "_"*bufsize + "verylong"
longline = "_" * (bufsize - len("verylong")) + "verylong"
check_line_exceeded(child, longline)