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 5import logging 6 7from autotest_lib.client.common_lib import utils 8from autotest_lib.server.cros.faft.firmware_test import FirmwareTest 9 10 11class firmware_DevModeStress(FirmwareTest): 12 """ 13 Servo based, iterative developer firmware boot test. One iteration 14 of this test performs 2 reboots and 3 checks. 15 """ 16 version = 1 17 18 def initialize(self, host, cmdline_args): 19 # Parse arguments from command line 20 dict_args = utils.args_to_dict(cmdline_args) 21 self.faft_iterations = int(dict_args.get('faft_iterations', 1)) 22 super(firmware_DevModeStress, self).initialize(host, cmdline_args) 23 self.switcher.setup_mode('dev') 24 self.setup_usbkey(usbkey=False) 25 26 def run_once(self): 27 for i in xrange(self.faft_iterations): 28 logging.info('======== Running FAFT ITERATION %d/%s ========', 29 i + 1, self.faft_iterations) 30 logging.info("Verify dev mode.") 31 self.check_state((self.checkers.crossystem_checker, { 32 'devsw_boot': '1', 33 'mainfw_type': 'developer', 34 })) 35 self.switcher.mode_aware_reboot() 36 37 logging.info("Verify dev mode after soft reboot.") 38 self.check_state((self.checkers.crossystem_checker, { 39 'devsw_boot': '1', 40 'mainfw_type': 'developer', 41 })) 42 self.suspend() 43 self.switcher.wait_for_client_offline() 44 self.servo.power_normal_press() 45 self.switcher.wait_for_client() 46 47 logging.info("Complete, final check for dev mode.") 48 self.check_state((self.checkers.crossystem_checker, { 49 'devsw_boot': '1', 50 'mainfw_type': 'developer', 51 })) 52