1# Copyright 2020 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 = "PowerQual.full" 7ATTRIBUTES = "suite:power_qual_full" 8DEPENDENCIES = 'wifi_connected_dut' 9TIME = "LENGTHY" 10TEST_CATEGORY = "Stress" 11TEST_CLASS = "suite" 12TEST_TYPE = "server" 13EXTENDED_TIMEOUT = 58500 # 16 Hours + 900 second guard. 14PY_VERSION = 3 15 16DOC = """ 17Sequence for qualification for power. 18 19Mandatory tests 20- power_LoadTest (from full battery to 5%) 21- power_BatteryCharge (from 5% to full battery) 22- power_VideoPlayback (h264 1080p & vp9 1080p 1 hour each) 23- power_VideoCall (2 hours) 24 25Informational tests 26- power_Idle 27- power_VideoPlayback 28- power_VideoEncode 29- power_Display.brightness 30- power_Display.cabc 31""" 32 33import datetime 34from autotest_lib.client.common_lib import utils 35 36HOURS=60*60 37 38CLIENT_TESTS = [ 39 ('power_BatteryCharge', { 40 'percent_target_charge' : 100, 'max_run_time': 5 * HOURS}), 41 ('power_WaitForCoolDown', {}), 42 ('power_LoadTest', { 43 'tag' : 'powerqual', 'force_discharge' : True, 'loop_time' : HOURS, 44 'loop_count' : 24, 'test_low_batt_p' : 5}), 45 46 ('power_BatteryCharge', { 47 'percent_target_charge' : 100, 'max_run_time': 5 * HOURS, 48 'tag' : 'powerqual'}), 49 ('power_WaitForCoolDown', {}), 50 ('power_VideoPlayback', { 51 'tag' : 'powerqual', 'force_discharge' : True, 'secs_per_video' : 3600, 52 'videos' : [('h264_1080_30fps', ''), ('vp9_1080_30fps', '')]}), 53 54 ('power_BatteryCharge', { 55 'percent_target_charge' : 80, 'max_run_time': 5 * HOURS}), 56 ('power_WaitForCoolDown', {}), 57 ('power_VideoCall', { 58 'tag' : 'powerqual', 'force_discharge' : True, 59 'min_run_time_percent': 75}), 60 61 ('power_BatteryCharge', { 62 'percent_target_charge' : 40, 'max_run_time': 5 * HOURS}), 63 ('power_WaitForCoolDown', {}), 64 ('power_Idle', { 65 'tag' : 'powerqual', 'force_discharge' : True}), 66 67 ('power_BatteryCharge', { 68 'percent_target_charge' : 35, 'max_run_time': 5 * HOURS}), 69 ('power_WaitForCoolDown', {}), 70 ('power_VideoPlayback', { 71 'tag' : 'powerqual_info', 'force_discharge' : True}), 72 73 ('power_BatteryCharge', { 74 'percent_target_charge' : 30, 'max_run_time': 5 * HOURS}), 75 ('power_WaitForCoolDown', {}), 76 ('power_VideoEncode', { 77 'tag' : 'powerqual', 'force_discharge' : True}), 78 79 ('power_BatteryCharge', { 80 'percent_target_charge' : 25, 'max_run_time': 5 * HOURS}), 81 ('power_WaitForCoolDown', {}), 82 ('power_Display', { 83 'tag' : 'powerqual_brightness', 'force_discharge' : True, 84 'brightness' : 'all', 'pages' : ['white', 'black', 'checker1'], 85 'secs_per_page' : 20, 'seconds_period' : 1}), 86 87 ('power_BatteryCharge', { 88 'percent_target_charge' : 20, 'max_run_time': 5 * HOURS}), 89 ('power_WaitForCoolDown', {}), 90 ('power_Display', { 91 'tag' : 'powerqual_cabc', 'force_discharge' : True, 92 'brightness' : 'max', 'secs_per_page' : 20, 'seconds_period' : 1, 93 'pages' : ['white', 'black', 94 'white', 'grey10', 95 'white', 'grey20', 96 'white', 'grey30', 97 'white', 'grey40', 98 'white', 'grey50', 99 'white', 'checker1', 100 'white', 'checker90', 101 'white', 'checker80', 102 'white', 'checker70', 103 'white', 'checker60', 104 'white', 'checker50']}), 105 106 ('power_WaitForCoolDown', {}), 107 ('power_UiResume', { 108 'tag' : 'powerqual'}), 109] 110 111# Workaround to make it compatible with moblab autotest UI. 112global args_dict 113try: 114 args_dict 115except NameError: 116 args_dict = utils.args_to_dict(args) 117 118# Use time as pdash_note if not supplied to track all tests in same suite. 119pdash_note = args_dict.get('pdash_note', 120 NAME + '_' + datetime.datetime.utcnow().isoformat()) 121 122def run_client_test(machine): 123 client = hosts.create_host(machine) 124 client_at = autotest.Autotest(client) 125 126 for test, argv in CLIENT_TESTS: 127 argv['pdash_note'] = pdash_note 128 client_at.run_test(test, timeout=EXTENDED_TIMEOUT, **argv) 129 130job.parallel_on_machines(run_client_test, machines) 131