-
Notifications
You must be signed in to change notification settings - Fork 2.1k
riotctrl_ctrl: A reset helper class for native
#15978
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
Conversation
cfaa95c
to
84968f4
Compare
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 have a question about this approach, specifically on how these board_clss
s would evolve.
It seems the issue you fix for native is also an issue we would have for other BOARD
, just that we don't have it in the default case on iot-lab
, but we would have it in local setups as well if multiple similar BOARD
s are connected.
Might it make more sense to change generically start_term
with a special case for native
. because for all other BOARD
s it's going to be the same. Emulation might also inherit the same handling so it might more be a case of "physical" BOARD
vs emulated
ones. What do you think?
I'm not against the NativeRIOTCtrl
, it just seems like a bit of an overkill, and I just worry about how this will grow, having Samr21XproRiotrCtrl
, etc.. for +200 BOARD
s could end up in a nightmare.
if child.name().endswith('.elf'): | ||
self.env['DEBUG_ADAPTER_ID'] = str(child.pid) | ||
break |
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.
Why is this elf needed? Won't it always be like that for native?
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.
Because we need to find the actual executable of the native
instance. Those end in elf
. There might be other child processes of the make term
or the user might decide to use e.g. pyterm
via TCP to control the native
instance.
"""Abstract factory to create different RIOTCtrl types based on | ||
the environment variables. | ||
|
||
:param board_cls: A dict that maps a `BOARD` name to a RIOTCtrl class. | ||
""" | ||
DEFAULT_CLS = riotctrl.ctrl.RIOTCtrl | ||
BOARD_CLS = { | ||
'native': NativeRIOTCtrl | ||
} |
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.
How would this evolve? Are we going to start implementing BOARD_CLS
for all BOARD
. Here I see the wrapper is only for setting the DEBUG_ADAPTER_ID
. Do you foresee other functionalities for the native
class?
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.
No, because that is mostly how the native
board differs from other boards: We don't know the DEBUG_ADAPTER_ID
before the instance starts, while for other boards it is an intrinsic property of the physical board.
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.
No, because that is mostly how the
native
board differs from other boards: We don't know theDEBUG_ADAPTER_ID
before the instance starts, while for other boards it is an intrinsic property of the physical board.
I like that argument.
You mean in
My hope is that this will be more of an exception than the special case. There is nothing special about |
No not RIOTCtrl itself, do it in RIOT, I guess its the naming pattern |
So what about changing the mapping to an adapter point of view instead of |
I don't understand that statement or how you meant your original one then ^^. If we want to change the behavior of |
That is how my implementation is meant to be. It's just that the behavior I am adapting here is very intrinsic to (+ just to clarify the |
Sorry, it's just the naming I don't like because it makes me think of
Ok, let's keep the current name, we can change it later if needed to factor in common handling. |
Oh, yeah the reason I named the member |
Just gave me the idea to make this actually a proper method within the class, so that it is overrideable in the future :-) |
@@ -24,10 +24,13 @@ jobs: | |||
python -m pip install --upgrade pip | |||
python -m pip install tox | |||
python -m pip install kconfiglib | |||
sudo apt-get install gcc-multilib |
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.
Doesn't seem to be needed for testing the new classes (pure Python).
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.
The test is compiling examples/hello-world
to test if the feature really work. Sure I can mock that up, but that can get stale quickly and wouldn't test if everything is working right.
from .native import NativeRIOTCtrl | ||
|
||
|
||
class RIOTCtrlFactory: |
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 to be generic enough to go to riotctrl.
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 was thinking the same tbh. Also would be useful with RIOT-OS/riotctrl#13 when there is a iotlabcli
adaptor for that.
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.
Done. |
Adopted for riotctrl v0.4.0. |
native
If this is still needed please squash @miri64 |
2013732
to
9f8b4a1
Compare
|
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.
ACK
Contribution description
This provides two helper classes for tests with
riotctrl
:NativeRIOTCtrl
for native specifically, so the nodes can be resetable with the workflow provided in native: allow for native to be resetable via SIGUSR1 #12517.A factory class(migrated toRIOTCtrlFactory
that allows for automatic generation of a RIOTCtrl object. In a first step, theNativeRIOTCtrl
is selected, whenBOARD
is set tonative
in the environment variables (or a providedenv
dictionary)riotctrl
)Testing procedure
Tests are provided and hooked into the
test-tools
Github Action. For manual testing callIssues/PRs references
None