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_StatsUSB', tag=tag) 43 client_at.run_test('power_Resume', tag=tag) 44 client_at.run_test('power_UiResume', tag=tag) 45 46 # Tests that are only run on battery power here. 47 client_at.run_test('power_Display', 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 client_at.run_test('power_UiResume', tag=tag) 58 59 60def _run_client_test(machine): 61 """Runs client tests - all with battery actively discharging.""" 62 client = hosts.create_host(machine) 63 if not client.has_power(): 64 # Because this is a control file these test errors do not 65 # get printed...logging ensures test_that users can see it. 66 msg = 'This test requires RPM support.' 67 logging.info('********************%s', msg) 68 raise error.TestError(msg) 69 70 try: 71 client.power_off() 72 _iterate_tests(client, machine) 73 finally: 74 client.power_on() 75 76 77job.parallel_on_machines(_run_client_test, machines) 78