blob: 51a6ac6eb461ea90e6ed3d3c0a0d620e24ac5ff8 [file] [log] [blame] [edit]
# 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.server import site_remote_power
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)
remote_power = site_remote_power.RemotePower(machine)
if remote_power:
remote_power.set_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.
remote_power.set_power_off()
try:
client_at.run_test('power_Consumption')
finally:
remote_power.set_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
remote_power.set_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:
remote_power.set_power_on()
job.parallel_on_machines(_run_client_test, machines)