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