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