Home | History | Annotate | Download | only in sequences
      1 # Copyright (c) 2010 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 AUTHOR = "Chrome OS Team"
      6 NAME = "Power"
      7 TIME = "LONG"
      8 TEST_CATEGORY = "Functional"
      9 TEST_CLASS = "suite"
     10 TEST_TYPE = "server"
     11 DEPENDENCIES = "rpm"
     12 
     13 DOC = """
     14 This test suite runs automated power tests that should all pass and that
     15 require the power to be connected with a remote power manager.
     16 """
     17 
     18 from autotest_lib.server import site_host_attributes
     19 from autotest_lib.client.common_lib import error
     20 
     21 # Run power tests that don't take a long time
     22 TESTS = [
     23   'power_Backlight',
     24   'power_CPUFreq',
     25   'power_CPUIdle',
     26   'power_Draw',
     27   'power_Idle',
     28   'power_StatsCPUFreq',
     29   'power_StatsCPUIdle',
     30   'power_StatsUSB',
     31 ]
     32 
     33 
     34 def run_client_test(machine):
     35   client = hosts.create_host(machine)
     36   client_attributes = site_host_attributes.HostAttributes(client.hostname)
     37   client_at = autotest.Autotest(client)
     38 
     39   if client.has_power():
     40     client.power_on()
     41   else:
     42     raise error.TestNAError("No power switch configured")
     43 
     44   # Charge battery to at least 50% first
     45   client_at.run_test('power_BatteryCharge', percent_target_charge=50,
     46                      max_run_time=60*60*4, tag='CHARGE_50')
     47 
     48   try:
     49     client.power_off()
     50     for test in TESTS:
     51         client_at.run_test(test)
     52 
     53     if not client_attributes.has_resume_bug:
     54         client_at.run_test('power_Resume')
     55         client_at.run_test('power_UiResume')
     56 
     57   finally:
     58     client.power_on()
     59 
     60   # Run the 60/20/10/10 load test
     61   # Charge the battery to at least 99% in preparation for the load
     62   # test. Charging the battery from empty to full can take up to 4 hours.
     63   client_at.run_test('power_BatteryCharge', percent_target_charge=99,
     64                      max_run_time=60*60*5, tag='CHARGE_99')
     65 
     66   # Turn off power and run power_LoadTest. The power_LoadTest can take
     67   # up to 9 hours to run to completion
     68   # TODO (snanda):
     69   # 1. Make the test run over wifi instead of ethernet
     70   # 2. Make the test login automatically to facebook and gmail
     71   # 3. Add audiovideo_V4L2 webcam test
     72   client.power_off()
     73 
     74   try:
     75     if hasattr(client_attributes, 'wifi'):
     76       wifi_ap, wifi_sec, wifi_pw = client_attributes.wifi.split(',')
     77 
     78       client_at.run_test('power_LoadTest', loop_count=9, loop_time=3600,
     79                          force_wifi=True, wifi_ap=wifi_ap, wifi_sec=wifi_sec,
     80                          wifi_pw=wifi_pw, tag='WIFI')
     81     else:
     82       client_at.run_test('power_LoadTest', loop_count=9, loop_time=3600,
     83                          check_network=False, tag='WIRED')
     84   finally:
     85     client.power_on()
     86 
     87 
     88 job.parallel_on_machines(run_client_test, machines)
     89