blob: 69affdae6cebef2f9768feaee83b3c10f4955d30 [file] [log] [blame]
# Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
AUTHOR = "Chrome OS Team"
NAME = "Power daily tests"
SUITE = "power_daily"
TIME = "LONG"
TEST_CATEGORY = "Functional"
TEST_CLASS = "suite"
TEST_TYPE = "server"
DOC = """
This test suite runs automated power tests that should all pass. These tests
take a long time (several hours) to run and are run only once a day.
"""
from autotest_lib.server import site_host_attributes
from autotest_lib.client.common_lib import error
def _run_client_test(machine):
client = hosts.create_host(machine)
client_attributes = site_host_attributes.HostAttributes(machine)
client_at = autotest.Autotest(client)
if client.has_power():
client.power_on()
else:
raise error.TestNAError("No power switch configured")
# Charge the battery to at least 50% in preparation for the consumption
# test. Charging the battery from empty to full can take up to 4 hours.
client_at.run_test('power_BatteryCharge', percent_target_charge=50,
max_run_time=60*60*4, tag='CHARGE_50')
# Turn off power and run power_Consumption test.
client.power_off()
try:
client_at.run_test('power_Consumption')
finally:
client.power_on()
# Charge the battery to at least 99% in preparation for the load
# test. Charging the battery from empty to full can take up to 4 hours.
client_at.run_test('power_BatteryCharge', percent_target_charge=99,
max_run_time=60*60*5, tag='CHARGE_99')
# Turn off power and run power_LoadTest. The power_LoadTest can take
# up to 11 hours to run to completion
# TODO (snanda):
# 1. Make the test login automatically to facebook and gmail
# 2. Add audiovideo_V4L2 webcam test
client.power_off()
try:
if hasattr(client_attributes, 'wifi'):
wifi_ap, wifi_sec, wifi_pw = client_attributes.wifi.split(',')
client_at.run_test('power_LoadTest', loop_count=11, loop_time=3600,
force_wifi=True, wifi_ap=wifi_ap,
wifi_sec=wifi_sec, wifi_pw=wifi_pw, tag='WIFI')
else:
client_at.run_test('power_LoadTest', loop_count=9, loop_time=3600,
check_network=False, tag='WIRED')
finally:
client.power_on()
job.parallel_on_machines(_run_client_test, machines)