-
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
[BUG] testrunner matching local echo #10952
[BUG] testrunner matching local echo #10952
Conversation
Include fix for RIOT-OS#10952 Disable local echo otherwise pexpect matches sent characters.
examples/hello-world/tests/01-run.py
Outdated
|
||
child.sendline("the test should not match this") | ||
try: | ||
child.expect_exact("the test should not match this") |
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.
I think the correct way to do this pexpect
style would be
child.expect_exact("the test should not match this") | |
res child.expect([pexpect.TIMEOUT, "the test should not match this"]) | |
if res == 0: | |
raise RuntimeError("There should have been a timeout on the match," | |
" and not match on stdin") |
See e.g. this of pexpect's own examples
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.
It is just a throwaway commit anyway but I take the suggestion for other uses.
I think it would still require expect_exact
here to have the same behavior.
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.
I implemented the test with expect_exact([pexpect.TIMEOUT, msg])
for #10949 in commit cladmi@f386f39
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.
Now that my computer finished testing samr21-xpro
I updated the first commit and force-pushed to do this.
1786c11
to
2558efd
Compare
This did not introduce regression in our testsuite according to running Unrelated: I somehow noticed that |
The codacy error can be ignored as it is the goal to have an assert here and also, it is in a throwaway commit anyway. |
Test results on native
Test results on nucleo-f103rb
I suppose seeing the message on native is expected? |
I think that the test should not be removed. It is an important sanity check for the test runner. |
I think so as well. Also, it finally starts introducing test-scripts for the examples, which I dearly miss ;-). |
@MrKevinWeiss We see the message on both boards, it is displayed before on A test for this is important, but I would not put it in I found about it while testing the Would that be enough or do you prefer to also have a board test for this too ? One issue I see for tests with a real board is that it may require multiple firmwares for testing everything. But it could make sense to have a few directories in With all this, should I add dedicated test to this PR instead of the throwaway commit ? |
The abstraction is a basic class to replicate behavior that was in `testrunner. Implementation was sometime directly taken from `testrunner` without being technically justified to keep backward compatibility. This is described in `TODO.rst` and dedicated implementation. This also adds a test `node` implementation with a Makefile. It is currently an easy to use node as no output is lost and reset correctly resets. TODO maybe put this as a comment in the file!! When pexpect 'close' a 'ptyprocess' it starts by 'SIGHUP'. It is not handled by default to call 'atexit'. To not do a specific handling for 'SIGHUP' just forward all signals to the child. This wrapper should not do any specific things anyway. TODO Split the 'safe_term_close' to utils with a test not using Make term and so directly only wanting 'sigkill' This should allow merging it before and using it in testrunner TODO settle the `env` handling. Get feedback on what to do here. Disable local echo otherwise pexpect matches sent characters. REMOVE ME: Include fix for RIOT-OS#10952
I just tested with
So having a dedicated test could be good. |
I think a test should be in the |
For multiple firmwares I was thinking about testing both a non echo case, a shell, a case where the nodes starts and flood and everything that could be needed for testing. But this would be more high level tests than the issue here. I will write a simple one at least for this. Running with different terminals can come in a second step. |
Ahh, got it! Thanks! |
3e85734
to
b992353
Compare
414a315
to
d17b130
Compare
364574d
to
c43c7a0
Compare
As there is issue currently with |
When local echo is enabled, pexpect will also match on send lines to the node. So could think a node is echoing when it is only seeing the sent message. The sent messages are still written to `logfile` but now only once. This may show issues with our current tests implementation that expected this behavior.
c43c7a0
to
731dcfc
Compare
The test has been split out to #11094 until the main issue is fixed. It includes this pull request fix. |
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.
If nobody has anything more to say I'll merge this.
I can still re-add the test on |
The abstraction is a basic class to replicate behavior that was in `testrunner. Implementation was sometime directly taken from `testrunner` without being technically justified to keep backward compatibility. This is described in `TODO.rst` and dedicated implementation. This also adds a test `node` implementation with a Makefile. It is currently an easy to use node as no output is lost and reset correctly resets. TODO maybe put this as a comment in the file!! When pexpect 'close' a 'ptyprocess' it starts by 'SIGHUP'. It is not handled by default to call 'atexit'. To not do a specific handling for 'SIGHUP' just forward all signals to the child. This wrapper should not do any specific things anyway. TODO Split the 'safe_term_close' to utils with a test not using Make term and so directly only wanting 'sigkill' This should allow merging it before and using it in testrunner TODO settle the `env` handling. Get feedback on what to do here. Disable local echo otherwise pexpect matches sent characters. REMOVE ME: Include fix for RIOT-OS#10952
The abstraction is a basic class to replicate behavior that was in `testrunner. Implementation was sometime directly taken from `testrunner` without being technically justified to keep backward compatibility. This is described in `TODO.rst` and dedicated implementation. This also adds a test `node` implementation with a Makefile. It is currently an easy to use node as no output is lost and reset correctly resets. TODO maybe put this as a comment in the file!! When pexpect 'close' a 'ptyprocess' it starts by 'SIGHUP'. It is not handled by default to call 'atexit'. To not do a specific handling for 'SIGHUP' just forward all signals to the child. This wrapper should not do any specific things anyway. TODO Split the 'safe_term_close' to utils with a test not using Make term and so directly only wanting 'sigkill' This should allow merging it before and using it in testrunner TODO settle the `env` handling. Get feedback on what to do here. Disable local echo otherwise pexpect matches sent characters. REMOVE ME: Include fix for RIOT-OS#10952
The abstraction is a basic class to replicate behavior that was in `testrunner. Implementation was sometime directly taken from `testrunner` without being technically justified to keep backward compatibility. This is described in `TODO.rst` and dedicated implementation. This also adds a test `node` implementation with a Makefile. It is currently an easy to use node as no output is lost and reset correctly resets. TODO maybe put this as a comment in the file!! When pexpect 'close' a 'ptyprocess' it starts by 'SIGHUP'. It is not handled by default to call 'atexit'. To not do a specific handling for 'SIGHUP' just forward all signals to the child. This wrapper should not do any specific things anyway. TODO Split the 'safe_term_close' to utils with a test not using Make term and so directly only wanting 'sigkill' This should allow merging it before and using it in testrunner TODO settle the `env` handling. Get feedback on what to do here. Disable local echo otherwise pexpect matches sent characters. REMOVE ME: Include fix for RIOT-OS#10952
The abstraction is a basic class to replicate behavior that was in `testrunner. Implementation was sometime directly taken from `testrunner` without being technically justified to keep backward compatibility. This is described in `TODO.rst` and dedicated implementation. This also adds a test `node` implementation with a Makefile. It is currently an easy to use node as no output is lost and reset correctly resets. TODO maybe put this as a comment in the file!! When pexpect 'close' a 'ptyprocess' it starts by 'SIGHUP'. It is not handled by default to call 'atexit'. To not do a specific handling for 'SIGHUP' just forward all signals to the child. This wrapper should not do any specific things anyway. TODO Split the 'safe_term_close' to utils with a test not using Make term and so directly only wanting 'sigkill' This should allow merging it before and using it in testrunner TODO settle the `env` handling. Get feedback on what to do here. Disable local echo otherwise pexpect matches sent characters. REMOVE ME: Include fix for RIOT-OS#10952
The abstraction is a basic class to replicate behavior that was in `testrunner. Implementation was sometime directly taken from `testrunner` without being technically justified to keep backward compatibility. This is described in `TODO.rst` and dedicated implementation. This also adds a test `node` implementation with a Makefile. It is currently an easy to use node as no output is lost and reset correctly resets. TODO maybe put this as a comment in the file!! When pexpect 'close' a 'ptyprocess' it starts by 'SIGHUP'. It is not handled by default to call 'atexit'. To not do a specific handling for 'SIGHUP' just forward all signals to the child. This wrapper should not do any specific things anyway. TODO Split the 'safe_term_close' to utils with a test not using Make term and so directly only wanting 'sigkill' This should allow merging it before and using it in testrunner TODO settle the `env` handling. Get feedback on what to do here. Disable local echo otherwise pexpect matches sent characters. REMOVE ME: Include fix for RIOT-OS#10952
The abstraction is a basic class to replicate behavior that was in `testrunner. Implementation was sometime directly taken from `testrunner` without being technically justified to keep backward compatibility. This is described in `TODO.rst` and dedicated implementation. This also adds a test `node` implementation with a Makefile. It is currently an easy to use node as no output is lost and reset correctly resets. TODO maybe put this as a comment in the file!! When pexpect 'close' a 'ptyprocess' it starts by 'SIGHUP'. It is not handled by default to call 'atexit'. To not do a specific handling for 'SIGHUP' just forward all signals to the child. This wrapper should not do any specific things anyway. TODO Split the 'safe_term_close' to utils with a test not using Make term and so directly only wanting 'sigkill' This should allow merging it before and using it in testrunner TODO settle the `env` handling. Get feedback on what to do here. Disable local echo otherwise pexpect matches sent characters. REMOVE ME: Include fix for RIOT-OS#10952
The abstraction is a basic class to replicate behavior that was in `testrunner. Implementation was sometime directly taken from `testrunner` without being technically justified to keep backward compatibility. This is described in `TODO.rst` and dedicated implementation. This also adds a test `node` implementation with a Makefile. It is currently an easy to use node as no output is lost and reset correctly resets. TODO maybe put this as a comment in the file!! When pexpect 'close' a 'ptyprocess' it starts by 'SIGHUP'. It is not handled by default to call 'atexit'. To not do a specific handling for 'SIGHUP' just forward all signals to the child. This wrapper should not do any specific things anyway. TODO Split the 'safe_term_close' to utils with a test not using Make term and so directly only wanting 'sigkill' This should allow merging it before and using it in testrunner TODO settle the `env` handling. Get feedback on what to do here. Disable local echo otherwise pexpect matches sent characters. REMOVE ME: Include fix for RIOT-OS#10952
Contribution description
When local echo is enabled, pexpect will also match on send lines to the
node. So could think a node is echoing when it is only seeing the sent
message.
The sent messages are still written to
logfile
but now only once.This may show issues with our current tests implementation that expected
this behavior.
Testing procedure
I included a test commit to show the fixed issue.
Sending a string to
hello-world
and matching on the same string works in master even if the nodes does not echo anything.When running the test commit alone, it will fail with a
RuntimeError
to show the erroneous behavior.With the
disable local echo
fix, the test passes.EDIT: it can now be tested with #11094 alone.
I will retry all our test suite on this:
native
after runningdist/tools/tapsetup/tapsetup
samr21-xpro
Issues/PRs references
Found while implementing #10949 based on
testrunner
handling.Depends on
#11064Depends on #11086 Silencing codacy for assert
Handling
make term
without local echo.