3 Copyright (c) 2016-2016,2018 ARM Limited 5 Licensed under the Apache License, Version 2.0 (the "License"); 6 you may not use this file except in compliance with the License. 7 You may obtain a copy of the License at 9 http://www.apache.org/licenses/LICENSE-2.0 11 Unless required by applicable law or agreed to in writing, software 12 distributed under the License is distributed on an "AS IS" BASIS, 13 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 See the License for the specific language governing permissions and 15 limitations under the License. 17 Author: Russ Butler <russ.butler@arm.com> 20 from .host_test_plugins
import HostTestPluginBase
21 from pyocd.core.helpers
import ConnectHelper
27 name =
'HostTestPluginResetMethod_pyOCD' 30 capabilities = [
'pyocd']
31 required_parameters = [
'target_id']
35 @details We can check module version by referring to version attribute 37 print pkg_resources.require("mbed-host-tests")[0].version 40 HostTestPluginBase.__init__(self)
42 def setup(self, *args, **kwargs):
43 """! Configure plugin, this function should be called before plugin execute() method is used. 47 def execute(self, capability, *args, **kwargs):
48 """! Executes capability by name 50 @param capability Capability name 51 @param args Additional arguments 52 @param kwargs Additional arguments 53 @details Each capability e.g. may directly just call some command line program or execute building pythonic function 54 @return Capability call return value 56 if not kwargs[
'target_id']:
62 if kwargs[
'target_id']:
63 if capability ==
'pyocd':
64 target_id = kwargs[
'target_id']
65 with ConnectHelper.session_with_chosen_probe(unique_id=target_id,
66 resume_on_disconnect=
False)
as session:
67 session.target.reset()
68 session.target.resume()
74 """! Returns plugin available in this module Base class for all plugins used with host tests.
def load_plugin()
Returns plugin available in this module.
def setup(self, args, kwargs)
Configure plugin, this function should be called before plugin execute() method is used...
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 i...
def print_plugin_error(self, text)
Interface helper methods - overload only if you need to have custom behaviour.
def execute(self, capability, args, kwargs)
Executes capability by name.