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 """Runs a single iteration of the test.""" 28 for i in xrange(self.faft_iterations): 29 logging.info('======== Running FAFT ITERATION %d/%s ========', 30 i + 1, self.faft_iterations) 31 logging.info("Verify dev mode.") 32 self.check_state((self.checkers.crossystem_checker, { 33 'devsw_boot': '1', 34 'mainfw_type': 'developer', 35 })) 36 self.switcher.mode_aware_reboot() 37 38 logging.info("Verify dev mode after soft reboot.") 39 self.check_state((self.checkers.crossystem_checker, { 40 'devsw_boot': '1', 41 'mainfw_type': 'developer', 42 })) 43 self.suspend() 44 self.switcher.wait_for_client_offline() 45 self.servo.power_normal_press() 46 self.switcher.wait_for_client() 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