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 <[email protected]>
  • Loading branch information
2 people authored and fjmolinas committed Mar 30, 2020
1 parent 8a8416a commit 68a35f5
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 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 @@ -80,6 +87,22 @@ def check_and_get_bufsize(child):
return bufsize


def check_line_exceeded(child, bufsize):

if BOARD == 'nrf52dk':
# There is an issue with nrf52dk when the Virtual COM port is connected
# and sending more than 64 bytes over UART. If no terminal is connected
# to the Virtual COM and interfacing directly to the nrf52832 UART pins
# the issue is not present. See issue #10639 on GitHub.
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 @@ -98,6 +121,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 68a35f5

Please sign in to comment.