Mbed Host Tests
mbed_host_tests.host_tests_plugins.host_test_plugins.HostTestPluginBase Class Reference

Base class for all plugins used with host tests. More...

Inheritance diagram for mbed_host_tests.host_tests_plugins.host_test_plugins.HostTestPluginBase:
mbed_host_tests.host_tests_plugins.module_copy_jn51xx.HostTestPluginCopyMethod_JN51xx mbed_host_tests.host_tests_plugins.module_copy_mbed.HostTestPluginCopyMethod_Mbed mbed_host_tests.host_tests_plugins.module_copy_mps2.HostTestPluginCopyMethod_MPS2 mbed_host_tests.host_tests_plugins.module_copy_pyocd.HostTestPluginCopyMethod_pyOCD mbed_host_tests.host_tests_plugins.module_copy_shell.HostTestPluginCopyMethod_Shell mbed_host_tests.host_tests_plugins.module_copy_silabs.HostTestPluginCopyMethod_Silabs mbed_host_tests.host_tests_plugins.module_copy_stlink.HostTestPluginCopyMethod_Stlink mbed_host_tests.host_tests_plugins.module_copy_ublox.HostTestPluginCopyMethod_ublox mbed_host_tests.host_tests_plugins.module_power_cycle_mbed.HostTestPluginPowerCycleResetMethod mbed_host_tests.host_tests_plugins.module_reset_jn51xx.HostTestPluginResetMethod_JN51xx mbed_host_tests.host_tests_plugins.module_reset_mbed.HostTestPluginResetMethod_Mbed mbed_host_tests.host_tests_plugins.module_reset_mps2.HostTestPluginResetMethod_MPS2 mbed_host_tests.host_tests_plugins.module_reset_pyocd.HostTestPluginResetMethod_pyOCD mbed_host_tests.host_tests_plugins.module_reset_silabs.HostTestPluginResetMethod_SiLabs mbed_host_tests.host_tests_plugins.module_reset_stlink.HostTestPluginResetMethod_Stlink mbed_host_tests.host_tests_plugins.module_reset_ublox.HostTestPluginResetMethod_ublox

Public Member Functions

def __init__ (self)
 
def setup (self, *args, **kwargs)
 Interface methods. More...
 
def execute (self, capability, *args, **kwargs)
 Executes capability by name. More...
 
def is_os_supported (self, os_name=None)
 
def print_plugin_error (self, text)
 Interface helper methods - overload only if you need to have custom behaviour. More...
 
def print_plugin_info (self, text, NL=True)
 Function prints notification in console and exits always with True. More...
 
def print_plugin_char (self, char)
 
def check_mount_point_ready (self, destination_disk, init_delay=0.2, loop_delay=0.25, target_id=None, timeout=60)
 Waits until destination_disk is ready and can be accessed by e.g. More...
 
def check_serial_port_ready (self, serial_port, target_id=None, timeout=60)
 Function checks (using mbed-ls) and updates serial port name information for DUT with specified target_id. More...
 
def check_parameters (self, capability, *args, **kwargs)
 This function should be ran each time we call execute() to check if none of the required parameters is missing. More...
 
def run_command (self, cmd, shell=True)
 Runs command from command line. More...
 
def mbed_os_info (self)
 Returns information about host OS. More...
 
def mbed_os_support (self)
 Function used to determine host OS. More...
 

Public Attributes

 plugin_logger
 

Static Public Attributes

string name = "HostTestPluginBase"
 Interface: More...
 
string type = "BasePlugin"
 
list capabilities = []
 
list required_parameters = []
 
bool stable = False
 

Detailed Description

Base class for all plugins used with host tests.

Definition at line 32 of file host_test_plugins.py.

Constructor & Destructor Documentation

◆ __init__()

Member Function Documentation

◆ check_mount_point_ready()

def mbed_host_tests.host_tests_plugins.host_test_plugins.HostTestPluginBase.check_mount_point_ready (   self,
  destination_disk,
  init_delay = 0.2,
  loop_delay = 0.25,
  target_id = None,
  timeout = 60 
)

Waits until destination_disk is ready and can be accessed by e.g.

copy commands

Returns
True if mount point was ready in given time, False otherwise
Parameters
destination_diskMount point (disk) which will be checked for readiness
init_delay- Initial delay time before first access check
loop_delay- polling delay for access check
timeoutMount point pooling timeout in seconds

Definition at line 116 of file host_test_plugins.py.

◆ check_parameters()

def mbed_host_tests.host_tests_plugins.host_test_plugins.HostTestPluginBase.check_parameters (   self,
  capability,
args,
**  kwargs 
)

This function should be ran each time we call execute() to check if none of the required parameters is missing.

Parameters
capabilityCapability name
argsAdditional parameters
kwargsAdditional parameters
Returns
Returns True if all parameters are passed to plugin, else return False

Definition at line 211 of file host_test_plugins.py.

◆ check_serial_port_ready()

def mbed_host_tests.host_tests_plugins.host_test_plugins.HostTestPluginBase.check_serial_port_ready (   self,
  serial_port,
  target_id = None,
  timeout = 60 
)

Function checks (using mbed-ls) and updates serial port name information for DUT with specified target_id.

If no target_id is specified function returns old serial port name.

Parameters
serial_portCurrent serial port name
target_idTarget ID of a device under test which serial port will be checked and updated if needed
timeoutSerial port pooling timeout in seconds
Returns
Tuple with result (always True) and serial port read from mbed-ls

Definition at line 173 of file host_test_plugins.py.

◆ execute()

def mbed_host_tests.host_tests_plugins.host_test_plugins.HostTestPluginBase.execute (   self,
  capability,
args,
**  kwargs 
)

Executes capability by name.

Parameters
capabilityCapability name
argsAdditional arguments
kwargsAdditional arguments

Each capability e.g. may directly just call some command line program or execute building pythonic function

Returns
Capability call return value

Reimplemented in mbed_host_tests.host_tests_plugins.module_reset_ublox.HostTestPluginResetMethod_ublox, mbed_host_tests.host_tests_plugins.module_reset_stlink.HostTestPluginResetMethod_Stlink, mbed_host_tests.host_tests_plugins.module_reset_silabs.HostTestPluginResetMethod_SiLabs, mbed_host_tests.host_tests_plugins.module_reset_pyocd.HostTestPluginResetMethod_pyOCD, mbed_host_tests.host_tests_plugins.module_reset_mps2.HostTestPluginResetMethod_MPS2, mbed_host_tests.host_tests_plugins.module_reset_mbed.HostTestPluginResetMethod_Mbed, mbed_host_tests.host_tests_plugins.module_reset_jn51xx.HostTestPluginResetMethod_JN51xx, mbed_host_tests.host_tests_plugins.module_power_cycle_mbed.HostTestPluginPowerCycleResetMethod, mbed_host_tests.host_tests_plugins.module_copy_ublox.HostTestPluginCopyMethod_ublox, mbed_host_tests.host_tests_plugins.module_copy_stlink.HostTestPluginCopyMethod_Stlink, mbed_host_tests.host_tests_plugins.module_copy_silabs.HostTestPluginCopyMethod_Silabs, mbed_host_tests.host_tests_plugins.module_copy_shell.HostTestPluginCopyMethod_Shell, mbed_host_tests.host_tests_plugins.module_copy_pyocd.HostTestPluginCopyMethod_pyOCD, mbed_host_tests.host_tests_plugins.module_copy_mps2.HostTestPluginCopyMethod_MPS2, mbed_host_tests.host_tests_plugins.module_copy_mbed.HostTestPluginCopyMethod_Mbed, and mbed_host_tests.host_tests_plugins.module_copy_jn51xx.HostTestPluginCopyMethod_JN51xx.

Definition at line 69 of file host_test_plugins.py.

◆ is_os_supported()

def mbed_host_tests.host_tests_plugins.host_test_plugins.HostTestPluginBase.is_os_supported (   self,
  os_name = None 
)
Returns
Returns true if plugin works (supportes) under certain OS @os_name String describing OS. See self.mbed_os_support() and self.mbed_os_info()

In some cases a plugin will not work under particular OS mainly because command / software used to implement plugin functionality is not available e.g. on MacOS or Linux.

Reimplemented in mbed_host_tests.host_tests_plugins.module_reset_ublox.HostTestPluginResetMethod_ublox, mbed_host_tests.host_tests_plugins.module_reset_stlink.HostTestPluginResetMethod_Stlink, mbed_host_tests.host_tests_plugins.module_reset_jn51xx.HostTestPluginResetMethod_JN51xx, mbed_host_tests.host_tests_plugins.module_copy_ublox.HostTestPluginCopyMethod_ublox, mbed_host_tests.host_tests_plugins.module_copy_stlink.HostTestPluginCopyMethod_Stlink, and mbed_host_tests.host_tests_plugins.module_copy_jn51xx.HostTestPluginCopyMethod_JN51xx.

Definition at line 79 of file host_test_plugins.py.

◆ mbed_os_info()

def mbed_host_tests.host_tests_plugins.host_test_plugins.HostTestPluginBase.mbed_os_info (   self)

Returns information about host OS.

Returns
Returns tuple with information about OS and host platform

Definition at line 246 of file host_test_plugins.py.

◆ mbed_os_support()

def mbed_host_tests.host_tests_plugins.host_test_plugins.HostTestPluginBase.mbed_os_support (   self)

Function used to determine host OS.

Returns
Returns None if host OS is unknown, else string with name

This function should be ported for new OS support

Definition at line 257 of file host_test_plugins.py.

◆ print_plugin_char()

def mbed_host_tests.host_tests_plugins.host_test_plugins.HostTestPluginBase.print_plugin_char (   self,
  char 
)
 Function prints char on stdout

Definition at line 109 of file host_test_plugins.py.

◆ print_plugin_error()

def mbed_host_tests.host_tests_plugins.host_test_plugins.HostTestPluginBase.print_plugin_error (   self,
  text 
)

Interface helper methods - overload only if you need to have custom behaviour.

Function prints error in console and exits always with False

Parameters
textText to print

Definition at line 93 of file host_test_plugins.py.

◆ print_plugin_info()

def mbed_host_tests.host_tests_plugins.host_test_plugins.HostTestPluginBase.print_plugin_info (   self,
  text,
  NL = True 
)

Function prints notification in console and exits always with True.

Parameters
textText to print
NLDeprecated! Newline will be added behind text if this flag is True

Definition at line 100 of file host_test_plugins.py.

◆ run_command()

def mbed_host_tests.host_tests_plugins.host_test_plugins.HostTestPluginBase.run_command (   self,
  cmd,
  shell = True 
)

Runs command from command line.

Parameters
cmdCommand to execute
shellTrue if shell command should be executed (eg. ls, ps)

Function prints 'cmd' return code if execution failed

Returns
True if command successfully executed

Definition at line 227 of file host_test_plugins.py.

◆ setup()

def mbed_host_tests.host_tests_plugins.host_test_plugins.HostTestPluginBase.setup (   self,
args,
**  kwargs 
)

Interface methods.

 Configure plugin, this function should be called before plugin execute() method is used.

Reimplemented in mbed_host_tests.host_tests_plugins.module_reset_ublox.HostTestPluginResetMethod_ublox, mbed_host_tests.host_tests_plugins.module_reset_stlink.HostTestPluginResetMethod_Stlink, mbed_host_tests.host_tests_plugins.module_reset_silabs.HostTestPluginResetMethod_SiLabs, mbed_host_tests.host_tests_plugins.module_reset_pyocd.HostTestPluginResetMethod_pyOCD, mbed_host_tests.host_tests_plugins.module_reset_mps2.HostTestPluginResetMethod_MPS2, mbed_host_tests.host_tests_plugins.module_reset_mbed.HostTestPluginResetMethod_Mbed, mbed_host_tests.host_tests_plugins.module_reset_jn51xx.HostTestPluginResetMethod_JN51xx, mbed_host_tests.host_tests_plugins.module_power_cycle_mbed.HostTestPluginPowerCycleResetMethod, mbed_host_tests.host_tests_plugins.module_copy_ublox.HostTestPluginCopyMethod_ublox, mbed_host_tests.host_tests_plugins.module_copy_stlink.HostTestPluginCopyMethod_Stlink, mbed_host_tests.host_tests_plugins.module_copy_silabs.HostTestPluginCopyMethod_Silabs, mbed_host_tests.host_tests_plugins.module_copy_shell.HostTestPluginCopyMethod_Shell, mbed_host_tests.host_tests_plugins.module_copy_pyocd.HostTestPluginCopyMethod_pyOCD, mbed_host_tests.host_tests_plugins.module_copy_mps2.HostTestPluginCopyMethod_MPS2, mbed_host_tests.host_tests_plugins.module_copy_mbed.HostTestPluginCopyMethod_Mbed, and mbed_host_tests.host_tests_plugins.module_copy_jn51xx.HostTestPluginCopyMethod_JN51xx.

Definition at line 64 of file host_test_plugins.py.

Member Data Documentation

◆ capabilities

list mbed_host_tests.host_tests_plugins.host_test_plugins.HostTestPluginBase.capabilities = []
static

Definition at line 44 of file host_test_plugins.py.

◆ name

string mbed_host_tests.host_tests_plugins.host_test_plugins.HostTestPluginBase.name = "HostTestPluginBase"
static

Interface:

Interface attributes defining plugin name, type etc.

Definition at line 42 of file host_test_plugins.py.

◆ plugin_logger

mbed_host_tests.host_tests_plugins.host_test_plugins.HostTestPluginBase.plugin_logger

Definition at line 58 of file host_test_plugins.py.

◆ required_parameters

list mbed_host_tests.host_tests_plugins.host_test_plugins.HostTestPluginBase.required_parameters = []
static

Definition at line 46 of file host_test_plugins.py.

◆ stable

bool mbed_host_tests.host_tests_plugins.host_test_plugins.HostTestPluginBase.stable = False
static

Definition at line 47 of file host_test_plugins.py.

◆ type

string mbed_host_tests.host_tests_plugins.host_test_plugins.HostTestPluginBase.type = "BasePlugin"
static

Definition at line 43 of file host_test_plugins.py.


The documentation for this class was generated from the following file: