-
Notifications
You must be signed in to change notification settings - Fork 2k
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
pyterm: use clean output by default #12094
Conversation
@MrKevinWeiss you may be interested by this |
Hmm, the |
Funny thing, this PR could pass |
I will split the changes that do not change the behavior. Split the first commits in #12095 |
tests/shell/Makefile
Outdated
@@ -6,9 +6,6 @@ USEMODULE += shell | |||
USEMODULE += shell_commands | |||
USEMODULE += ps | |||
|
|||
# Use a terminal that does not introduce extra characters into the stream. | |||
RIOT_TERMINAL ?= socat |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will cause problems when testing long lines, see https:/RIOT-OS/RIOT/pull/10635/files#diff-16e3498e34b06780aaf14222a95484a5R91
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like a bad bug…
Currently the other issue with pyterm
is that it exits when ctrl+c
is sent.
I'm all in favor dropping the loglevel, but the timestamp is quite valuable to have. |
@benpicco the timestamp causes problems in test scripts with pexpect, when one needs to match a number and ends up matching the timestamp instead. |
Wouldn't it be better then to change the output with an optional parameter just for the test scripts instead of changing the behavior for all users? |
I did it the other way around and added support to configure it from command line. By default, |
So it should now be easy to remove the timestamp from the test using PYTERMFLAGS. I would do this instead of changing the behaviour just because this doesn't fit in your tests. |
I will change the PRs to keep the current behavior and open issues that |
Do not prepend the output with the timestamp and the loglevel (always INFO) by default. This gives a different behavior with the other RIOT_TERMINAL. Also, CI uses `picocom` by default so does not have timestamp which can make a test fail locally when it works in CI. Or work in native and fail on a board as native does not have this decoration. Also it will help with test when you need to get the output of the node and not from your terminal program. The previous behavior can be achieved by using the environment variable PYTERMFLAGS='--format "%(asctime)s - %(levelname)s # %(message)s" So for example PYTERMFLAGS='-f "%(asctime)s - %(levelname)s # %(message)s"' \ RIOT_TERMINAL=pyterm BOARD=samr21-xpro make -C tests/shell/ flash term
Get the output of a one line command without other garbage messages.
All supported shells do now not add output when testing. So the test can also run with `pyterm` or `jlink.sh term_rtt` for boards that cannot use another terminal.
This reverts commit 3da8e83. Sending ctrl+c is not supported by pyterm.
This reverts commit 12a4de6.
3f6ddd3
to
d9793c5
Compare
It is similar to 'term' but with removing possible additional behaviors from pyterm. It currently only removes the logging decorators.
Use a clean terminal without added decoration on the output for testing.
It's easier to re-open a new one. |
And the issue #12108 |
Wrong link copy #12107 |
Contribution description
Do not prepend the output with the timestamp and the loglevel (always
INFO) by default.
This gives a different behavior with the other RIOT_TERMINAL. Also, CI
uses
picocom
by default so does not have timestamp which can make atest fail locally when it works in CI. Or work in native and fail on a
board as native does not have this decoration.
Also it will help with test when you need to get the output of the node
and not from your terminal program.
The previous behavior can be achieved by using the environment variable
So for example
Implementation details
I first introduce
PYTERMFLAGS
to allow havingpyterm
specific options.I then use it for boards that have
pyterm
specific options.I then disabled using the timestamp in the output by default. It can be restored by configuring
PYTERMFLAGS
from the environment.I then added a test that indeed the output is now clean.
Fix the issue that theshell
was requiring to useRIOT_TERMINAL ?= socat
that was incompatible with some boards.pyterm
does not handle sendingctrl+c
, so it cannot be replaced.Testing procedure
Run
BOARD=your_board make -C tests/test_tools/ flash test
with different RIOT_TERMINAL, currently supported (not on all boards)pyterm
,socat
,picocom
. If possible one withterm_rtt
. But as it is internally usingpyterm
it will benefit from the changes automatically.RIOT_TERMINAL=pyterm samr21-xpro
RIOT_TERMINAL=picocom samr21-xpro
RIOT_TERMINAL=socat samr21-xpro
native
On IoT-LAB it works too
term
works correctly withmsba2
`tests/bloom_bytes` on `msba2`
The `term` command is still the same for `lobaro-lorabox` as in `master`
Which gives this execution
Issues/PRs references
This fixes the issues with different behavior between the different test tools #9726 (comment)
This is a shortcut for #11099
This replaces [WIP] tests/test_tools: add a test for the testing tools environment #11094
Required for #10949