File tree Expand file tree Collapse file tree 3 files changed +32
-0
lines changed
dist/pythonlibs/riotctrl_ctrl Expand file tree Collapse file tree 3 files changed +32
-0
lines changed Original file line number Diff line number Diff line change 1+ # Copyright (C) 2021 Freie Universität Berlin
2+ #
3+ # This file is subject to the terms and conditions of the GNU Lesser
4+ # General Public License v2.1. See the file LICENSE in the top level
5+ # directory for more details.
6+
7+ import riotctrl .ctrl
8+
9+ import psutil
10+
11+
12+ class NativeRIOTCtrl (riotctrl .ctrl .RIOTCtrl ):
13+ """RIOTCtrl abstraction for a native node
14+
15+ This works exactly as a normal RIOTCtrl, with the exception that
16+ `DEBUG_ADAPTER_ID` is set in the environment to the PID of the `native`
17+ process, whenever a terminal is started. This allows for `reset()` to also
18+ work for a the `native` instance.
19+ """
20+ def _set_debug_adapter_id (self , child ):
21+ if child .name ().endswith ('.elf' ):
22+ self .env ['DEBUG_ADAPTER_ID' ] = str (child .pid )
23+ return True
24+ return False
25+
26+ def start_term (self , * args , ** kwargs ):
27+ super ().start_term (* args , ** kwargs )
28+ for child in psutil .Process (pid = self ._term_pid ()).children ():
29+ if self ._set_debug_adapter_id (child ):
30+ break
Original file line number Diff line number Diff line change 1+ psutil
2+ riotctrl
You can’t perform that action at this time.
0 commit comments