From 1b1f9688084ef21c8e715f717b790d292371bda9 Mon Sep 17 00:00:00 2001 From: HendrikVE Date: Fri, 7 Feb 2020 13:07:13 +0100 Subject: [PATCH] tests/shell: add test case for exceeding lines Co-authored-by: Juan Carrano --- tests/shell/tests/01-run.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/tests/shell/tests/01-run.py b/tests/shell/tests/01-run.py index 42293546be04..dcf4b5681530 100755 --- a/tests/shell/tests/01-run.py +++ b/tests/shell/tests/01-run.py @@ -60,6 +60,13 @@ BOARD = os.environ['BOARD'] + +def print_error(message): + FAIL = '\033[91m' + ENDC = '\033[0m' + print(FAIL + message + ENDC) + + def check_cmd(child, cmd, expected): child.expect(PROMPT) child.sendline(cmd) @@ -79,6 +86,20 @@ def check_and_get_bufsize(child): return bufsize +def check_line_exceeded(child, bufsize): + + if BOARD == 'nrf52dk': + # looks like the nrf52dk runs in to undefined behaviour when sending more + # than 64 bytes over UART + print_error('test case "check_line_exceeded" broken for nrf52dk. SKIP') + return + + longline = "_"*bufsize + "verylong" + + child.sendline(longline) + child.expect('shell: maximum line length exceeded') + + def check_line_canceling(child): child.expect(PROMPT) child.sendline('garbage1234' + CONTROL_C) @@ -97,6 +118,8 @@ def testfunc(child): bufsize = check_and_get_bufsize(child) + check_line_exceeded(child, bufsize) + check_line_canceling(child) # loop other defined commands and expected output