Host test plugins: added return values to setup() and execute() interface methods

pull/597/head
Przemek Wirkus 2014-10-22 16:59:07 +01:00
parent 3f00c59030
commit 7591cf5caf
6 changed files with 14 additions and 5 deletions

View File

@ -30,9 +30,16 @@ HOST_TEST_PLUGIN_REGISTRY.register_plugin(module_reset_mbed.load_plugin())
HOST_TEST_PLUGIN_REGISTRY.register_plugin(module_reset_mps2.load_plugin()) HOST_TEST_PLUGIN_REGISTRY.register_plugin(module_reset_mps2.load_plugin())
HOST_TEST_PLUGIN_REGISTRY.register_plugin(module_reset_silabs.load_plugin()) HOST_TEST_PLUGIN_REGISTRY.register_plugin(module_reset_silabs.load_plugin())
###############################################################################
# Functional interface for host test plugin registry
###############################################################################
def call_plugin(type, capability, *args, **kwargs): def call_plugin(type, capability, *args, **kwargs):
""" Interface to call plugin registry functional way """ Interface to call plugin registry functional way
""" """
HOST_TEST_PLUGIN_REGISTRY.call_plugin(type, capability, *args, **kwargs) HOST_TEST_PLUGIN_REGISTRY.call_plugin(type, capability, *args, **kwargs)
#print HOST_TEST_PLUGIN_REGISTRY def print_plugin_info():
""" Prints plugins' information in user friendly way
"""
print HOST_TEST_PLUGIN_REGISTRY

View File

@ -35,7 +35,7 @@ class HostTestPluginBase:
def setup(self, *args, **kwargs): def setup(self, *args, **kwargs):
""" Configure plugin, this function should be called before plugin execute() method is used. """ Configure plugin, this function should be called before plugin execute() method is used.
""" """
pass return False
def execute(self, capabilitity, *args, **kwargs): def execute(self, capabilitity, *args, **kwargs):
""" Executes capability by name. """ Executes capability by name.

View File

@ -20,7 +20,7 @@ class HostTestRegistry:
host test plugins for further usage host test plugins for further usage
""" """
# Here we actually store all the plugins # Here we actually store all the plugins
PLUGINS = {} PLUGINS = {} # 'Plugin Name' : Plugin Object
def print_error(self, text): def print_error(self, text):
print "Plugin load failed. Reason: %s"% text print "Plugin load failed. Reason: %s"% text

View File

@ -51,7 +51,7 @@ class HostTestPluginResetMethod_Mbed(HostTestPluginBase):
def setup(self, *args, **kwargs): def setup(self, *args, **kwargs):
""" Configure plugin, this function should be called before plugin execute() method is used. """ Configure plugin, this function should be called before plugin execute() method is used.
""" """
pass return True
def execute(self, capabilitity, *args, **kwargs): def execute(self, capabilitity, *args, **kwargs):
""" Executes capability by name. """ Executes capability by name.

View File

@ -44,7 +44,7 @@ class HostTestPluginResetMethod_MPS2(HostTestPluginBase):
This method can receive plugin specific parameters by kwargs and This method can receive plugin specific parameters by kwargs and
ignore other parameters which may affect other plugins. ignore other parameters which may affect other plugins.
""" """
pass return True
def execute(self, capabilitity, *args, **kwargs): def execute(self, capabilitity, *args, **kwargs):
""" Executes capability by name. """ Executes capability by name.

View File

@ -20,6 +20,7 @@ from host_test_plugins import HostTestPluginBase
class HostTestPluginResetMethod_SiLabs(HostTestPluginBase): class HostTestPluginResetMethod_SiLabs(HostTestPluginBase):
# Plugin interface # Plugin interface
name = 'HostTestPluginResetMethod_SiLabs' name = 'HostTestPluginResetMethod_SiLabs'
type = 'ResetMethod' type = 'ResetMethod'
@ -30,6 +31,7 @@ class HostTestPluginResetMethod_SiLabs(HostTestPluginBase):
""" Configure plugin, this function should be called before plugin execute() method is used. """ Configure plugin, this function should be called before plugin execute() method is used.
""" """
self.EACOMMANDER_CMD = 'c:/SiliconLabs/SimplicityStudio/v2/commander/eACommander.exe' self.EACOMMANDER_CMD = 'c:/SiliconLabs/SimplicityStudio/v2/commander/eACommander.exe'
return True
def execute(self, capabilitity, *args, **kwargs): def execute(self, capabilitity, *args, **kwargs):
""" Executes capability by name. """ Executes capability by name.