From 2946f4b192dbf7e34687703cf8c8a96021c78e9f Mon Sep 17 00:00:00 2001 From: Juan Carrano Date: Wed, 16 Jan 2019 17:45:25 +0100 Subject: [PATCH] tests/shell: Test cancelling a line with ctrl-C. Send garbage, cancel it and issue a valid command. No errors should ocurr. --- tests/shell/tests/01-run.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/shell/tests/01-run.py b/tests/shell/tests/01-run.py index fe6dddcf8e..be99c9bbab 100755 --- a/tests/shell/tests/01-run.py +++ b/tests/shell/tests/01-run.py @@ -27,6 +27,18 @@ EXPECTED_PS = ( '\t 2 | running Q | 7' ) +# In native we are directly executing the binary (no terminal program). We must +# therefore use Ctrl-V (DLE or "data link escape") before Ctrl-C to send a +# literal ETX instead of SIGINT. +# When using a board it is also a problem because we are using a "user friendly" +# terminal that interprets Ctrl-C. So until we have rawterm we must also use +# ctrl-v in boards. + +DLE = '\x16' + +CONTROL_C = DLE+'\x03' +CONTROL_D = DLE+'\x04' + CMDS = ( ('start_test', ('[TEST_START]')), ('end_test', ('[TEST_END]')), @@ -38,6 +50,8 @@ CMDS = ( ('help', EXPECTED_HELP), ('echo a string', ('\"echo\"\"a\"\"string\"')), ('ps', EXPECTED_PS), + ('garbage1234'+CONTROL_C, ('>')), # test cancelling a line + ('help', EXPECTED_HELP), ('reboot', ('test_shell.')) )