1# Copyright (c) 2019 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 = "puthik" 6NAME = "power_Dashboard.fast_lab" 7TIME = "MEDIUM" 8TEST_CATEGORY = "Stress" 9TEST_CLASS = "suite" 10TEST_TYPE = "server" 11 12DOC = """ 13Sequence to make sure that power_Dashboard.full_lab tests work fine. 14""" 15 16from autotest_lib.client.common_lib import error 17from autotest_lib.client.common_lib import utils 18 19# Need separate list for client and server test due to how these test work. 20CLIENT_TESTS = [ 21 ('power_Standby', { 22 'tag' : '36sec', 'sample_hours' : 0.01, 'test_hours' : 0.01, 23 'bypass_check' : True}), 24 ('power_LoadTest', { 25 'tag' : 'fast', 'loop_time' : 180, 'loop_count' : 1, 26 'test_low_batt_p' : 6, 'check_network': False, 'ac_ok' : True, 27 'gaia_login' : False}), 28 ('power_Idle', { 29 'tag' : 'fast', 'warmup_secs' : 2, 'idle_secs' : 10}), 30 ('power_VideoPlayback', { 31 'tag' : 'fast', 'secs_per_video' : 10, 'fast' : True }), 32 ('power_VideoPlayback', { 33 'tag' : 'sw_decoder_fast', 'use_hw_decode' : False, 34 'secs_per_video' : 10, 'fast' : True }), 35 ('power_Display', { 36 'tag' : 'fast', 'secs_per_page' : 2}), 37 ('power_WebGL', { 38 'tag' : 'fast', 'duration' : 10}), 39] 40 41SERVO_V4_ETH_VENDOR = '0bda' 42SERVO_V4_ETH_PRODUCT = '8153' 43WIFI_SSID = 'powertest_ap' 44 45# Workaround to make it compatible with moblab autotest UI. 46global args_dict 47try: 48 args_dict 49except NameError: 50 args_dict = utils.args_to_dict(args) 51 52pdash_note = args_dict.get('pdash_note', '') 53 54def run_client_test(machine): 55 client = hosts.create_host(machine) 56 57 wlan_ip = client.get_wlan_ip() 58 if not wlan_ip: 59 autotest.Autotest(client).run_test('dummy_Pass') 60 if not client.connect_to_wifi(WIFI_SSID): 61 raise error.TestFail('Can not connect to wifi.') 62 wlan_ip = client.get_wlan_ip() 63 if not wlan_ip: 64 raise error.TestFail('Can not find wlan ip.') 65 66 # Check if we have servo v4 ethernet and can switch to wlan. 67 eth_usb = client.find_usb_devices(SERVO_V4_ETH_VENDOR, SERVO_V4_ETH_PRODUCT) 68 can_switch_to_wlan = len(eth_usb) == 1 and eth_usb[0] and wlan_ip 69 if can_switch_to_wlan: 70 wlan_machine = machine 71 if utils.host_is_in_power_lab(machine['hostname']): 72 wlan_machine['hostname'] = \ 73 utils.get_power_lab_wlan_hostname(machine['hostname']) 74 else: 75 wlan_machine['hostname'] = wlan_ip 76 client = hosts.create_host(wlan_machine) 77 eth_node = eth_usb[0] 78 79 client_at = autotest.Autotest(client) 80 81 for test, argv in CLIENT_TESTS: 82 client.reboot() 83 if can_switch_to_wlan: 84 client.unbind_usb_device(eth_node) 85 argv['pdash_note'] = pdash_note 86 argv['force_discharge'] = True 87 client_at.run_test(test, **argv) 88 89 client.reboot() 90 91 92parallel_simple(run_client_test, machines) 93