diff options
| author | Jeremy Spewock <[email protected]> | 2023-07-19 16:16:54 -0400 |
|---|---|---|
| committer | Thomas Monjalon <[email protected]> | 2023-07-22 16:40:48 +0200 |
| commit | 88489c0501af7ecf09be9665107e47509a219453 (patch) | |
| tree | 5cf79c3ad029f31c18158483ef8c11864de05edf /dts/framework/testbed_model/node.py | |
| parent | e26b20c6a9894b2840e4321fa058ad4b60aa8641 (diff) | |
dts: add smoke tests
Adds a new test suite for running smoke tests that verify general
configuration aspects of the system under test. If any of these tests
fail, the DTS execution terminates as part of a "fail-fast" model.
Signed-off-by: Jeremy Spewock <[email protected]>
Reviewed-by: Juraj Linkeš <[email protected]>
Diffstat (limited to 'dts/framework/testbed_model/node.py')
| -rw-r--r-- | dts/framework/testbed_model/node.py | 43 |
1 files changed, 41 insertions, 2 deletions
diff --git a/dts/framework/testbed_model/node.py b/dts/framework/testbed_model/node.py index d48fafe65d..d237b3f75b 100644 --- a/dts/framework/testbed_model/node.py +++ b/dts/framework/testbed_model/node.py @@ -7,7 +7,7 @@ A node is a generic host that DTS connects to and manages. """ -from typing import Any, Callable +from typing import Any, Callable, Type from framework.config import ( BuildTargetConfiguration, @@ -15,7 +15,7 @@ from framework.config import ( NodeConfiguration, ) from framework.logger import DTSLOG, getLogger -from framework.remote_session import OSSession, create_session +from framework.remote_session import InteractiveShellType, OSSession, create_session from framework.settings import SETTINGS from .hw import ( @@ -23,6 +23,7 @@ from .hw import ( LogicalCoreCount, LogicalCoreList, LogicalCoreListFilter, + VirtualDevice, lcore_filter, ) @@ -40,6 +41,8 @@ class Node(object): lcores: list[LogicalCore] _logger: DTSLOG _other_sessions: list[OSSession] + _execution_config: ExecutionConfiguration + virtual_devices: list[VirtualDevice] def __init__(self, node_config: NodeConfiguration): self.config = node_config @@ -54,6 +57,7 @@ class Node(object): ).filter() self._other_sessions = [] + self.virtual_devices = [] self._logger.info(f"Created node: {self.name}") @@ -64,6 +68,9 @@ class Node(object): """ self._setup_hugepages() self._set_up_execution(execution_config) + self._execution_config = execution_config + for vdev in execution_config.vdevs: + self.virtual_devices.append(VirtualDevice(vdev)) def _set_up_execution(self, execution_config: ExecutionConfiguration) -> None: """ @@ -76,6 +83,7 @@ class Node(object): Perform the execution teardown that will be done after each execution this node is part of concludes. """ + self.virtual_devices = [] self._tear_down_execution() def _tear_down_execution(self) -> None: @@ -127,6 +135,37 @@ class Node(object): self._other_sessions.append(connection) return connection + def create_interactive_shell( + self, + shell_cls: Type[InteractiveShellType], + timeout: float = SETTINGS.timeout, + privileged: bool = False, + app_args: str = "", + ) -> InteractiveShellType: + """Create a handler for an interactive session. + + Instantiate shell_cls according to the remote OS specifics. + + Args: + shell_cls: The class of the shell. + timeout: Timeout for reading output from the SSH channel. If you are + reading from the buffer and don't receive any data within the timeout + it will throw an error. + privileged: Whether to run the shell with administrative privileges. + app_args: The arguments to be passed to the application. + Returns: + Instance of the desired interactive application. + """ + if not shell_cls.dpdk_app: + shell_cls.path = self.main_session.join_remote_path(shell_cls.path) + + return self.main_session.create_interactive_shell( + shell_cls, + app_args, + timeout, + privileged, + ) + def filter_lcores( self, filter_specifier: LogicalCoreCount | LogicalCoreList, |
