From 0904d77dff1b19a2b09d9fad24d1c945fd23beac Mon Sep 17 00:00:00 2001 From: Kaspar Schleiser Date: Thu, 30 Jul 2020 13:22:26 +0200 Subject: [PATCH] tests/shell: allow not using socat, do so on z1 --- tests/shell/Makefile | 10 ++++++++-- tests/shell/tests/01-run.py | 21 +++++++++++++++++---- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/tests/shell/Makefile b/tests/shell/Makefile index 110f1f28ac..dc77be4a6f 100644 --- a/tests/shell/Makefile +++ b/tests/shell/Makefile @@ -6,14 +6,20 @@ USEMODULE += shell USEMODULE += shell_commands USEMODULE += ps +# for z1, socat doesn't work (unknown reason) +ifeq (z1, $(BOARD)) + RIOT_TERMINAL ?= pyterm +endif + # Use a terminal that does not introduce extra characters into the stream. RIOT_TERMINAL ?= socat -DISABLE_MODULE += test_utils_interactive_sync - # chronos is missing a getchar implementation BOARD_BLACKLIST += chronos APP_SHELL_FMT ?= NONE include $(RIOTBASE)/Makefile.include + +# the test script skips tests if socat is not used +$(call target-export-variables,$(RIOT_TERMINAL),RIOT_TERMINAL) diff --git a/tests/shell/tests/01-run.py b/tests/shell/tests/01-run.py index 4f0a8f682c..e74e7dfa0d 100755 --- a/tests/shell/tests/01-run.py +++ b/tests/shell/tests/01-run.py @@ -27,6 +27,9 @@ EXPECTED_PS = ( '\t \d | running Q | 7' ) +RIOT_TERMINAL = os.environ.get('RIOT_TERMINAL') +CLEANTERMS = {"socat"} + # 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. @@ -44,7 +47,6 @@ PROMPT = '> ' CMDS = ( # test start ('start_test', '[TEST_START]'), - (CONTROL_C, PROMPT), ('\n', PROMPT), # test simple word separation @@ -101,6 +103,10 @@ CMDS = ( ('end_test', '[TEST_END]'), ) +CMDS_CLEANTERM = { + (CONTROL_C, PROMPT), +} + CMDS_REGEX = {'ps'} BOARD = os.environ['BOARD'] @@ -181,14 +187,15 @@ def testfunc(child): if BOARD == 'native': child.crlf = '\n' - check_startup(child) - bufsize = check_and_get_bufsize(child) longline = "_"*bufsize + "verylong" check_line_exceeded(child, longline) - check_line_canceling(child) + if RIOT_TERMINAL in CLEANTERMS: + check_line_canceling(child) + else: + print("skipping check_line_canceling()") check_erase_long_line(child, longline) @@ -196,6 +203,12 @@ def testfunc(child): for cmd, expected in CMDS: check_cmd(child, cmd, expected) + if RIOT_TERMINAL in CLEANTERMS: + for cmd, expected in CMDS_CLEANTERM: + check_cmd(child, cmd, expected) + else: + print("skipping cleanterm tests") + if __name__ == "__main__": sys.exit(run(testfunc))