1# Copyright 2015 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 error 8from autotest_lib.server.cros.faft.firmware_test import FirmwareTest 9 10 11class firmware_ECKeyboardReboot(FirmwareTest): 12 """ 13 Test the dut-control ec_uart_cmd:reboot command. 14 This simulate the Power+refresh reboot but not exactly. The F3 + power EC 15 reset is triggered by the Silego IC, and it taps directly into the KB row 16 column lines to check the trigger (requires physical presence). 17 18 see test case: 1.3.8 Power+refresh; System reboots 19 https://testtracker.googleplex.com/efforts/testcase/detail/721602 20 """ 21 version = 1 22 23 # Delay between commands 24 CMD_DELAY = 1 25 26 def initialize(self, host, cmdline_args): 27 super(firmware_ECKeyboardReboot, self).initialize(host, cmdline_args) 28 # Only run in normal mode 29 self.switcher.setup_mode('normal') 30 self.host = host 31 32 def confirm_dut_off(self): 33 """Confirms the DUT is off.""" 34 if not self.host.ping_wait_down(timeout=10): 35 raise error.TestFail('DUT is on, expected off') 36 logging.info('DUT is off as expected') 37 38 def confirm_dut_on(self): 39 """Confirms the DUT is on.""" 40 if not self.host.wait_up(timeout=60): 41 raise error.TestFail('DUT is off, expected on') 42 logging.info('DUT is on as expected') 43 44 def run_once(self): 45 """Runs a single iteration of the test.""" 46 if not self.check_ec_capability(['keyboard']): 47 raise error.TestNAError("Nothing needs to be tested on this device") 48 logging.info("Test dut-control ec_uart_cmd:reboot command.") 49 50 self.ec.reboot() 51 self.confirm_dut_off() 52 self.confirm_dut_on() 53 54 self.ec.reboot('hard') 55 self.confirm_dut_off() 56 self.confirm_dut_on() 57 58 self.ec.reboot('ap-off') 59 self.confirm_dut_off() 60 self.ec.reboot() 61 self.confirm_dut_on() 62