3Copyright (c) 2011-2015 ARM Limited
5Licensed under the Apache License, Version 2.0 (the "License");
6you may not use this file except in compliance with the License.
7You may obtain a copy of the License at
9 http://www.apache.org/licenses/LICENSE-2.0
11Unless required by applicable law or agreed to
in writing, software
12distributed under the License
is distributed on an
"AS IS" BASIS,
13WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
or implied.
14See the License
for the specific language governing permissions
and
15limitations under the License.
17Author: Przemyslaw Wirkus <Przemyslaw.Wirkus
@arm.com>
23from .host_test_plugins import HostTestPluginBase
25# Note: This plugin is not fully functional, needs improvements
27class HostTestPluginResetMethod_MPS2(HostTestPluginBase):
28 """! Plugin used to reset ARM_MPS2 platform
31 reboot.txt - startup
from standby state, reboots when
in run mode.
35 name =
'HostTestPluginResetMethod_MPS2'
37 capabilities = [
'reboot.txt']
38 required_parameters = [
'disk']
43 HostTestPluginBase.__init__(self)
46 """ Touch file and set timestamp to items
51 def setup(self, *args, **kwargs):
52 """ Prepare / configure plugin to work.
53 This method can receive plugin specific parameters by kwargs and
54 ignore other parameters which may affect other plugins.
58 def execute(self, capability, *args, **kwargs):
59 """! Executes capability by name
61 @param capability Capability name
62 @param args Additional arguments
63 @param kwargs Additional arguments
65 @details Each capability e.g. may directly just call some command line program
or execute building pythonic function
67 @return Capability call
return value
70 if not kwargs[
'disk']:
74 destination_disk = kwargs.get(
'disk',
None)
77 target_id = kwargs.get(
'target_id',
None)
78 pooling_timeout = kwargs.get(
'polling_timeout', 60)
81 if capability ==
'reboot.txt':
82 reboot_file_path = os.path.join(destination_disk, capability)
83 reboot_fh = open(reboot_file_path,
"w")
86 if os.name ==
'posix':
87 self.
run_command(
'sync -f %s' % reboot_file_path, shell=
True)
89 result, destination_disk = self.
check_mount_point_ready(destination_disk, target_id=target_id, timeout=pooling_timeout)
93 """ Returns plugin available in this module
def run_command(self, cmd, shell=True)
Runs command from command line.
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.
def print_plugin_error(self, text)
Interface helper methods - overload only if you need to have custom behaviour.
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...
Plugin used to reset ARM_MPS2 platform.
def setup(self, *args, **kwargs)
def execute(self, capability, *args, **kwargs)
Executes capability by name.
def touch_file(self, path)