Home | History | Annotate | Download | only in platform_LongPressPower
      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 import time
      6 
      7 from autotest_lib.client.common_lib import error
      8 from autotest_lib.server import test
      9 
     10 class platform_LongPressPower(test.test):
     11     """Uses servo pwr_button gpio to power the host off and back on.
     12     """
     13     version = 1
     14 
     15     def run_once(self, host):
     16         boot_id = host.get_boot_id()
     17 
     18         # turn off device
     19         host.servo.power_long_press()
     20 
     21         # ensure host is now off
     22         if host.is_up():
     23             raise error.TestError('DUT still up after long press power')
     24 
     25         # ensure host boots
     26         host.servo.boot_devmode()
     27         host.test_wait_for_boot(boot_id)
     28