Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tools/serial.inc.mk: Support miniterm.py. #11003

Closed
wants to merge 2 commits into from

Conversation

jcarrano
Copy link
Contributor

@jcarrano jcarrano commented Feb 12, 2019

Contribution description

miniterm.py is a simple terminal program that is included with pyserial. This means that it is available wherever pyterm can work. It allows raw access, does line translation and passes through special characters.

For test scripts, a terminal that does not modify the input and output streams, configured without local echo, is preferred as it ensures the test setup is introducing as few noise as possible.

Testing procedure

With this change, tests/shell uses miniterm.py. Just run the tests. Use a real board, native has no real TTY.

$ cd tests/shell
$ BOARD=samr21-xpro make all
$ BOARD=samr21-xpro make flash
$ BOARD=samr21-xpro make test

Issues/PRs references

This PR is part of #10994 and it's purpose is to ease shell automation.
Split from #10788 .

@jcarrano jcarrano added Type: new feature The issue requests / The PR implemements a new feature for RIOT Area: tools Area: Supplementary tools labels Feb 12, 2019
@jcarrano jcarrano added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Feb 12, 2019
Copy link
Contributor

@aabadie aabadie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's indeed useful to provide support for miniterm even if it's not the default.
I haven't tried this PR but I think local echo should also be enabled by default. There are also a couple minor issues.

@@ -1,4 +1,5 @@
DEVELHELP=0

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unrelated

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, that slipped through when I splitted the change.

@@ -12,4 +13,8 @@ BOARD_BLACKLIST += chronos

TEST_ON_CI_WHITELIST += all

ifneq ($(BOARD), native)
RIOT_TERMINAL=miniterm.py
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like there's tab here. The indent should be 2 spaces.

@@ -19,4 +19,7 @@ ifeq ($(RIOT_TERMINAL),pyterm)
else ifeq ($(RIOT_TERMINAL),picocom)
export TERMPROG ?= picocom
export TERMFLAGS ?= --nolock --imap lfcrlf --echo --baud "$(BAUD)" "$(PORT)"
else ifeq ($(RIOT_TERMINAL),miniterm.py)
export TERMPROG ?= miniterm.py
export TERMFLAGS ?= --eol CRLF "$(PORT)" "$(BAUD)"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe also enable --echo ? It's the kind of useful things when using the shell.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With local echo you end up having double echo, as the shell echoes too, and miniterm does not do line buffering, eg.:

> hheellpp

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having local echo messes with the tests also as the sent string is matched by pexpect.

Copy link
Contributor

@aabadie aabadie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested tests/shell with miniterm and confirm that it also works.

I have other comments.

@@ -19,4 +19,9 @@ ifeq ($(RIOT_TERMINAL),pyterm)
else ifeq ($(RIOT_TERMINAL),picocom)
export TERMPROG ?= picocom
export TERMFLAGS ?= --nolock --imap lfcrlf --echo --baud "$(BAUD)" "$(PORT)"
else ifeq ($(RIOT_TERMINAL),miniterm.py)
export TERMPROG ?= miniterm.py
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
export TERMPROG ?= miniterm.py
export TERMPROG ?= $(RIOT_TERMINAL)

Not blocking for this

# In order to properly test and debug the shell it is better to use a terminal
# program that does not modify the input and output streams and has no buffering.
ifneq ($(BOARD), native)
RIOT_TERMINAL?=miniterm.py
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tab is still there. I would put space around ?= like it's done in other places.

@@ -12,4 +12,10 @@ BOARD_BLACKLIST += chronos

TEST_ON_CI_WHITELIST += all

# In order to properly test and debug the shell it is better to use a terminal
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why just set this in tests/shell only ? I would prefer to have this set globally in Makefile.tests_common.

@jcarrano jcarrano force-pushed the support-miniterm.py branch from 7478f60 to 0c27453 Compare February 20, 2019 10:38
@jcarrano
Copy link
Contributor Author

@aabadie I rebased this on top of your indentation fix.

miniterm.py is a simple terminal program that is included with pyserial.
This means that it is available wherever pyterm can work. It allows raw
access, does line translation and passes through special characters.

For test scripts, a terminal that does not modify the input and output
streams, configured without local echo, is preferred as it ensures the
test setup is introducing as few noise as possible.
@cladmi
Copy link
Contributor

cladmi commented Feb 20, 2019

When testing #10952 I found that having local echo may even be hurting for testing as it introduces more text in the tested text.

@cladmi
Copy link
Contributor

cladmi commented Feb 20, 2019

I would prefer to move changing the test configuration in a different PR as it relates to the main tracking issue and not to adding the support.

Adding support should be done alone and it does not hurt anything.
Changing the test configuration is a different thing that may have consequences.

tests/shell/Makefile Outdated Show resolved Hide resolved
@jcarrano
Copy link
Contributor Author

#11034 makes this PR irrelevant. Socat is a better tool. I'm closing this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: tools Area: Supplementary tools CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Type: new feature The issue requests / The PR implemements a new feature for RIOT
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants