Home | History | Annotate | Download | only in firmware_DevModeStress
      1 # Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
      2 # Use of this source code is governed by a BSD-style license that can be
      3 # found in the LICENSE file.
      4 
      5 #from threading import Timer
      6 import logging
      7 import time
      8 
      9 from autotest_lib.client.common_lib import utils
     10 from autotest_lib.server.cros.faft.firmware_test import FirmwareTest
     11 
     12 
     13 class firmware_DevModeStress(FirmwareTest):
     14     """
     15     Servo based, iterative developer firmware boot test. One iteration
     16     of this test performs 2 reboots and 3 checks.
     17     """
     18     version = 1
     19 
     20     def initialize(self, host, cmdline_args):
     21         # Parse arguments from command line
     22         dict_args = utils.args_to_dict(cmdline_args)
     23         self.faft_iterations = int(dict_args.get('faft_iterations', 1))
     24         super(firmware_DevModeStress, self).initialize(host, cmdline_args)
     25         self.switcher.setup_mode('dev')
     26         self.setup_usbkey(usbkey=False)
     27 
     28     def run_once(self):
     29         for i in xrange(self.faft_iterations):
     30             logging.info('======== Running FAFT ITERATION %d/%s ========',
     31                          i + 1, self.faft_iterations)
     32             logging.info("Verify dev mode.")
     33             self.check_state((self.checkers.crossystem_checker, {
     34                                 'devsw_boot': '1',
     35                                 'mainfw_type': 'developer',
     36                                 }))
     37             self.switcher.mode_aware_reboot()
     38 
     39             logging.info("Verify dev mode after soft reboot.")
     40             self.check_state((self.checkers.crossystem_checker, {
     41                                 'devsw_boot': '1',
     42                                 'mainfw_type': 'developer',
     43                                 }))
     44             self.switcher.mode_aware_reboot(
     45                     'custom',
     46                     lambda:self.suspend_as_reboot(self.wake_by_power_button))
     47 
     48         logging.info("Complete, final check for dev mode.")
     49         self.check_state((self.checkers.crossystem_checker, {
     50                             'devsw_boot': '1',
     51                             'mainfw_type': 'developer',
     52                             }))
     53