Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests/shell: fix failure on samr21-xpro #18891

Merged
merged 1 commit into from
Nov 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions tests/shell/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)
17 changes: 10 additions & 7 deletions tests/shell/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}
2 changes: 1 addition & 1 deletion tests/shell/tests/01-run.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down