mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
tests/shell: add test case for line editing
Test erasing characters using backspace. The test is not really testing a lot right now, because the host is still line buffering. Co-authored-by: Juan Carrano <j.carrano@fu-berlin.de>
This commit is contained in:
parent
a0a3e6c3a1
commit
013af64a80
@ -50,6 +50,8 @@ CMDS = (
|
||||
'shell: command not found: '
|
||||
'123456789012345678901234567890123456789012345678901234567890'),
|
||||
('unknown_command', 'shell: command not found: unknown_command'),
|
||||
('hello-willy\b\b\b\borld', 'shell: command not found: hello-world'),
|
||||
('\b\b\b\becho', '\"echo\"'),
|
||||
('help', EXPECTED_HELP),
|
||||
('echo a string', '\"echo\"\"a\"\"string\"'),
|
||||
('ps', EXPECTED_PS),
|
||||
@ -87,7 +89,7 @@ def check_and_get_bufsize(child):
|
||||
return bufsize
|
||||
|
||||
|
||||
def check_line_exceeded(child, bufsize):
|
||||
def check_line_exceeded(child, longline):
|
||||
|
||||
if BOARD == 'nrf52dk':
|
||||
# There is an issue with nrf52dk when the Virtual COM port is connected
|
||||
@ -97,8 +99,6 @@ def check_line_exceeded(child, bufsize):
|
||||
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')
|
||||
|
||||
@ -112,6 +112,16 @@ def check_line_canceling(child):
|
||||
assert garbage_expected == garbage_received
|
||||
|
||||
|
||||
def check_erase_long_line(child, longline):
|
||||
# FIXME: this only works on native, due to #10634 combined with socat
|
||||
# insisting in line-buffering the terminal.
|
||||
|
||||
if BOARD == 'native':
|
||||
longline_erased = longline + "\b"*len(longline) + "echo"
|
||||
child.sendline(longline_erased)
|
||||
child.expect_exact('"echo"')
|
||||
|
||||
|
||||
def testfunc(child):
|
||||
# avoid sending an extra empty line on native.
|
||||
if BOARD == 'native':
|
||||
@ -120,11 +130,14 @@ def testfunc(child):
|
||||
check_startup(child)
|
||||
|
||||
bufsize = check_and_get_bufsize(child)
|
||||
longline = "_"*bufsize + "verylong"
|
||||
|
||||
check_line_exceeded(child, bufsize)
|
||||
check_line_exceeded(child, longline)
|
||||
|
||||
check_line_canceling(child)
|
||||
|
||||
check_erase_long_line(child, longline)
|
||||
|
||||
# loop other defined commands and expected output
|
||||
for cmd, expected in CMDS:
|
||||
check_cmd(child, cmd, expected)
|
||||
|
Loading…
Reference in New Issue
Block a user