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:

## Public Member Functions

| __init__ (self)
| setup (self, *args, **kwargs)
| Interface methods.
| execute (self, capability, *args, **kwargs)
| Executes capability by name.
| is_os_supported (self, os_name=None)
| print_plugin_error (self, text)
| Interface helper methods - overload only if you need to have custom behaviour.
| print_plugin_info (self, text, NL=True)
| Function prints notification in console and exits always with True.
| print_plugin_char (self, char)
| 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.
| 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.
| 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.
| run_command (self, cmd, shell=True)
| Runs command from command line.
| mbed_os_info (self)
| Returns information about host OS.
| mbed_os_support (self)
| Function used to determine host OS.

## Public Attributes

| plugin_logger

## Static Public Attributes

str | name = "HostTestPluginBase"
| Interface:
str | 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__()

mbed_host_tests.host_tests_plugins.host_test_plugins.HostTestPluginBase.__init__ | ( |  | self | ) |

     ctor

Reimplemented in 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_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, and mbed_host_tests.host_tests_plugins.module_reset_stlink.HostTestPluginResetMethod_Stlink.

Definition at line 49 of file host_test_plugins.py.

## Member Function Documentation

## check_mount_point_ready()

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_disk | Mount point (disk) which will be checked for readiness
  init_delay | - Initial delay time before first access check
  loop_delay | - polling delay for access check
  timeout | Mount point pooling timeout in seconds

Definition at line 116 of file host_test_plugins.py.

## check_parameters()

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

  capability | Capability name
  args | Additional parameters
  kwargs | Additional 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()

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_port | Current serial port name
  target_id | Target ID of a device under test which serial port will be checked and updated if needed
  timeout | Serial 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()

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

Executes capability by name.

Parameters

  capability | Capability name
  args | Additional arguments
  kwargs | Additional 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_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, and mbed_host_tests.host_tests_plugins.module_reset_ublox.HostTestPluginResetMethod_ublox.

Definition at line 69 of file host_test_plugins.py.

## is_os_supported()

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_copy_jn51xx.HostTestPluginCopyMethod_JN51xx, 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_reset_jn51xx.HostTestPluginResetMethod_JN51xx, mbed_host_tests.host_tests_plugins.module_reset_stlink.HostTestPluginResetMethod_Stlink, and mbed_host_tests.host_tests_plugins.module_reset_ublox.HostTestPluginResetMethod_ublox.

Definition at line 79 of file host_test_plugins.py.

## mbed_os_info()

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()

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()

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()

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

  text | Text to print

Definition at line 93 of file host_test_plugins.py.

## print_plugin_info()

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

  text | Text to print
  NL | Deprecated! Newline will be added behind text if this flag is True

Definition at line 100 of file host_test_plugins.py.

## run_command()

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

Runs command from command line.

Parameters

  cmd | Command to execute
  shell | True 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()

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_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, and mbed_host_tests.host_tests_plugins.module_reset_ublox.HostTestPluginResetMethod_ublox.

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

str 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

str 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:

- mbed_host_tests/host_tests_plugins/host_test_plugins.py