3 Copyright (c) 2011-2015 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: Przemyslaw Wirkus <Przemyslaw.Wirkus@arm.com>
23 from .host_test_plugins
import 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