Home | History | Annotate | Download | only in sequences
      1 # Copyright (c) 2011 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 per-build tests"
      7 TIME = "MEDIUM"
      8 TEST_CATEGORY = "Functional"
      9 TEST_CLASS = "suite"
     10 ATTRIBUTES = "suite:power_build"
     11 SUITE = "power_build"
     12 TEST_TYPE = "server"
     13 DEPENDENCIES = "rpm"
     14 
     15 DOC = """
     16 This test suite runs automated power tests that should all pass. These
     17 tests are run on every build and thefore each test should be short
     18 and not take more than 5 minutes to run.
     19 
     20 This suite runs the test list on systems with AC off (on battery)
     21 since they require use of the rpm.
     22 
     23 The tests that run with AC on are run through their normal control
     24 files since they do not need to interact with the RPM.
     25 """
     26 
     27 import logging
     28 
     29 from autotest_lib.client.common_lib import error
     30 from autotest_lib.server import site_host_attributes
     31 
     32 
     33 def _iterate_tests(client, machine):
     34     client_at = autotest.Autotest(client)
     35 
     36     tag = 'AC_OFFLINE'
     37 
     38     # Tests that are also run on AC from their control file.
     39     client_at.run_test('power_CPUFreq', tag=tag)
     40     client_at.run_test('power_CPUIdle', tag=tag)
     41     client_at.run_test('power_ProbeDriver', tag=tag, test_which='Battery')
     42     client_at.run_test('power_StatsCPUFreq', tag=tag)
     43     client_at.run_test('power_StatsCPUIdle', tag=tag)
     44     client_at.run_test('power_StatsUSB', tag=tag)
     45     client_at.run_test('power_Resume', tag=tag)
     46     client_at.run_test('power_x86Settings',tag=tag)
     47 
     48     # Tests that are only run on battery power here.
     49     client_at.run_test('power_Backlight', tag=tag)
     50     client_at.run_test('power_Draw', tag=tag)
     51     client_at.run_test('power_Idle',tag=tag)
     52 
     53     # Run the short version of power_Consumption
     54     client_at.run_test('power_Consumption', short=True)
     55 
     56     client_attributes = site_host_attributes.HostAttributes(machine)
     57     if not client_attributes.has_resume_bug:
     58         client_at.run_test('power_Resume', tag=tag)
     59 
     60 
     61 def _run_client_test(machine):
     62     """Runs client tests - all with battery actively discharging."""
     63     client = hosts.create_host(machine)
     64     if not client.has_power():
     65         # Because this is a control file these test errors do not
     66         # get printed...logging ensures test_that users can see it.
     67         msg = 'This test requires RPM support.'
     68         logging.info('********************%s', msg)
     69         raise error.TestError(msg)
     70 
     71     client.power_off()
     72     try:
     73         _iterate_tests(client, machine)
     74     finally:
     75         client.power_on()
     76 
     77 
     78 job.parallel_on_machines(_run_client_test, machines)
     79