-
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
[take over] riotnode: node abstraction package #13612
[take over] riotnode: node abstraction package #13612
Conversation
It is a python directory to start developing the package. I include all files around for testing and integrating in RIOT. Test dependencies in tox are already ready for testing with pytest. * sitecustomize.py: allow implementing 'riotnode' in a subdirectory * setup.py implement a releasable package * requirements.txt: uses 'setup.py' could then be used by our standard way of installing * tox.ini: run the test suite with 'tox' * setup.cfg/.coveragerc: test suites configuration
The abstraction is a basic class to replicate behavior that was in `testrunner. Implementation was sometimes 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.
This allows finer analysis of exception as sometimes the calling line is only `expect(variable)` without knowing the value.
This allows having a nicely printed output on `pytest`. This could be moved outside of here too.
Add functions that handle killing all child processes using psutil. This allows killing child processes that may not have been correctly terminated by its parent. It should not be necessary in an ideal world, but it would allow detecting errors in the tests.
This shows the current handling that could correctly terminate a subprocess that is not always killed. It is here as a regression test when removing the process group sigkill.
In case all children are not correctly cleaned by '_safe_term_close', sigkill them anyway. This prepares for replacing the global kill with SIGKILL with a less violent method. Also, adds a test where the terminal program tries to do a cleanup. It is important that a terminal can clean itself correctly to close files, or remove created interfaces.
The process should be closed alone with 'self.term.close'. Closing child processes must be done by the `make term` program.
Remove now unused _kill_term.
I started to have a look at this PR and have several general comments/questions:
|
👍 |
True, this is following the proposal in the original PR, introducing the package as is with no changes on testrunner, and integrate it later.
Sure, I will address this!
Discussion about naming is seems to be ongoing since the original PR. IMHO as the package provides an abstraction on the node (or whatever we would like to call it) which runs a certain firmware, the current name reflects more what the package is, as opposed to That being said, I'm not 100% convinced by
Regarding this the main concern seemed to be keeping the package in sync with RIOT's shell interfaces. What I see is that a big part of this package (and code) will be in the mixins we write to interact with commands (and those are the ones which need to be kept in sync with RIOT's shell, mostly). Would we have some on RIOT and some on Release-Specs? Will it come the time when we need to group them to reduce duplication? I can see how keeping the package out of the codebase could be a good thing. Let's discuss further how this would look like. |
The framework could go into its own repository, while the mixins for the shell commands could remain in RIOT-OS/RIOT. Regarding the ReleaseSpecs: we need the RIOT repo for testing those anyways (its what we are testing after all), so we would then also pull in the latest version of the mixins ;-). |
I'm fine with having the package on a separate repo if the mixins can be kept in RIOT-OS/RIOT and stay in sync with shell commands. @aabadie how should we proceed in this direction? |
+1 for this |
I'm not in favor of using the mixins but rather follow @cladmi's suggestion in #10949 and in #11406 (comment). Otherwise I'm also OK for moving riotnode (or whatever better name it takes) to a separate repo. |
Regardless if we do it as mixins or associations, this is something we can decide once this framework is in place. I want this (and the shell command wrappers, however they look like) in for 2020.07, so we should do the first step ASAP :-). |
Without re-reading my comments, what I was "against" was to have the implementation in the mixins. Defining mixins allows simple instantiation for the price of an enforced usage convention. I had in mind (and played with) a layer on top with mixins that would create a composed class:
And even the next abstraction being |
The For a first version, you can remove the exception handling from there I think. The shorter exception is a nice thing but may better be done after using it and seeing what is wanted. The "ensuring all process stopped" is an horrible thing that should be removed Only go for the first two commits. It was developed with separate steps to demo what could be done at what price, not take everything as is. |
|
+1 |
As I see this is missing:
With that we can move it to the organization. |
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.
small nitpick
command = ['make'] | ||
command.extend(self.MAKE_ARGS) | ||
if self._application_directory != '.': | ||
dir_cmd = '--no-print-directory', '-C', self.application_directory |
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.
dir_cmd = '--no-print-directory', '-C', self.application_directory | |
dir_cmd = '--no-print-directory', '-C', self._application_directory |
self.logger = logging.getLogger(__name__) | ||
|
||
@property | ||
def application_directory(self): |
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.
Should we add a setter function for 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.
Discussing it offline with @cladmi, it makes sense to not be able to set it since some application have different requirements for the terminal baudrate
use of ethos
, etc.. so it makes sense to not be able to change the application directory.
Are we ok with |
If the |
What is a node ? If we talk about networking, it's a node in a mesh network. But otherwise ? I think there's an abuse of the term here. |
Then maybe (though maybe confusing with the |
Or |
If we look back at @leandrolanzieri proposals it could also be |
So options would be:
|
No, as far as I understood the conversation, the package's name stays |
Remember, that it is also important what the URL will look like / the name on the
|
|
but riotnode would only be a small wheel in the whole RIOT testing infrastructure? |
True, but |
Now I think that riottest is too specific and the actual project can be used in other contexts. The actual README says that already: https://github.com/RIOT-OS/RIOT/pull/13612/files#diff-1134727da204f7baca0c000c630766daR4-R9 |
As I mentioned here testing is one of the possible use cases for this package. Some people commented that Any strong opinions against |
That has the same problem IMHO. As a new contributor I would ask myself: Do I need this to run my device with RIOT? |
This is being moved to its own repo now. |
Contribution description
As discussed offline with @fjmolinas, this PR is taking over @cladmi's work in #10949. I added some missing tests that he proposed as TODOs, and cleaned up a bit git history.
There seems to be an agreement on #10949 on merging the package with the current features (and without the changes to 'testrunner'), and improve it in follow-up PRs. It would be nice to have this soonish, in order to start working on release tests before the freezes.
Testing procedure
Running the test suite can be done with
tox
(pip install --user tox).Issues/PRs references
For a full description see #10949