blob: 6050df69837a1a18a06c8beef221d0a12050ed7d [file] [log] [blame] [edit]
# Copyright (c) 2019 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 = "puthik"
NAME = "power_Dashboard.full_lab"
TIME = "MEDIUM"
TEST_CATEGORY = "Stress"
TEST_CLASS = "suite"
TEST_TYPE = "server"
ATTRIBUTES = "suite:power_dashboard"
DOC = """
Sequence for upload common power test data to dashboard.
"""
import datetime
from autotest_lib.client.common_lib import error
from autotest_lib.client.common_lib import utils
CLIENT_TESTS = [
('power_LoadTest', {
'tag' : '1hour', 'loop_time' : 3600, 'loop_count' : 1,
'test_low_batt_p' : 6}),
('power_Idle', {}),
('power_VideoPlayback', {}),
('power_VideoPlayback', {
'tag' : 'sw_decoder', 'use_hw_decode' : False}),
('power_Display', {}),
('power_WebGL', {}),
('power_Standby', {
'tag' : 'fast', 'sample_hours' : 0.334, 'test_hours' : 0.334}),
]
SERVO_V4_ETH_VENDOR = '0bda'
SERVO_V4_ETH_PRODUCT = '8153'
WIFI_SSID = 'powertest_ap'
# Workaround to make it compatible with moblab autotest UI.
global args_dict
try:
args_dict
except NameError:
args_dict = utils.args_to_dict(args)
# Use time as pdash_note if not supplied to track all tests in same suite.
pdash_note = args_dict.get('pdash_note',
NAME + '_' + datetime.datetime.utcnow().isoformat())
def run_client_test(machine):
client = hosts.create_host(machine)
wlan_ip = client.get_wlan_ip()
if not wlan_ip:
autotest.Autotest(client).run_test('dummy_Pass')
if not client.connect_to_wifi(WIFI_SSID):
raise error.TestFail('Can not connect to wifi.')
wlan_ip = client.get_wlan_ip()
if not wlan_ip:
raise error.TestFail('Can not find wlan ip.')
# Check if we have servo v4 ethernet and can switch to wlan.
eth_usb = client.find_usb_devices(SERVO_V4_ETH_VENDOR, SERVO_V4_ETH_PRODUCT)
can_switch_to_wlan = len(eth_usb) == 1 and eth_usb[0] and wlan_ip
if can_switch_to_wlan:
wlan_machine = machine
if utils.host_is_in_power_lab(machine['hostname']):
wlan_machine['hostname'] = \
utils.get_power_lab_wlan_hostname(machine['hostname'])
else:
wlan_machine['hostname'] = wlan_ip
client = hosts.create_host(wlan_machine)
eth_node = eth_usb[0]
client_at = autotest.Autotest(client)
for test, argv in CLIENT_TESTS:
client.reboot()
if can_switch_to_wlan:
client.unbind_usb_device(eth_node)
argv['pdash_note'] = pdash_note
argv['force_discharge'] = True
client_at.run_test(test, **argv)
client.reboot()
parallel_simple(run_client_test, machines)