Skip to content

Commit

Permalink
tests/shell: add test case for exceeding lines
Browse files Browse the repository at this point in the history
Co-authored-by: Juan Carrano <j.carrano@fu-berlin.de>
  • Loading branch information
HendrikVE and jcarrano committed Feb 7, 2020
1 parent da58f54 commit 1b1f968
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions tests/shell/tests/01-run.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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
Expand Down

0 comments on commit 1b1f968

Please sign in to comment.