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.mandatory" 7TIME = "LENGTHY" 8TEST_CATEGORY = "Stress" 9TEST_CLASS = "suite" 10TEST_TYPE = "server" 11EXTENDED_TIMEOUT = 58500 # 16 Hours + 900 second guard. 12PY_VERSION = 3 13 14DOC = """ 15Sequence for qualification for power, mandatory tests only. 16 17- power_LoadTest (from full battery to 5%) 18- power_BatteryCharge (from 5% to full battery) 19- power_VideoPlayback (h264 1080p & vp9 1080p 1 hour each) 20- power_VideoCall (2 hours) 21""" 22 23import datetime 24from autotest_lib.client.common_lib import utils 25 26HOURS=60*60 27 28CLIENT_TESTS = [ 29 ('power_BatteryCharge', { 30 'percent_target_charge' : 100, 'max_run_time': 5 * HOURS}), 31 ('power_WaitForCoolDown', {}), 32 ('power_LoadTest', { 33 'tag' : 'powerqual', 'force_discharge' : True, 'loop_time' : HOURS, 34 'loop_count' : 24, 'test_low_batt_p' : 5}), 35 36 ('power_BatteryCharge', { 37 'percent_target_charge' : 100, 'max_run_time': 5 * HOURS, 38 'tag' : 'powerqual'}), 39 ('power_WaitForCoolDown', {}), 40 ('power_VideoPlayback', { 41 'tag' : 'powerqual', 'force_discharge' : True, 'secs_per_video' : 3600, 42 'videos' : [('h264_1080_30fps', ''), ('vp9_1080_30fps', '')]}), 43 44 ('power_BatteryCharge', { 45 'percent_target_charge' : 100, 'max_run_time': 5 * HOURS, 46 'tag' : 'powerqual'}), 47 ('power_WaitForCoolDown', {}), 48 ('power_VideoCall', { 49 'tag' : 'powerqual', 'force_discharge' : True, 50 'min_run_time_percent': 75}), 51 52 ('power_WaitForCoolDown', {}), 53 ('power_UiResume', { 54 'tag' : 'powerqual'}), 55] 56 57# Workaround to make it compatible with moblab autotest UI. 58global args_dict 59try: 60 args_dict 61except NameError: 62 args_dict = utils.args_to_dict(args) 63 64# Use time as pdash_note if not supplied to track all tests in same suite. 65pdash_note = args_dict.get('pdash_note', 66 NAME + '_' + datetime.datetime.utcnow().isoformat()) 67 68def run_client_test(machine): 69 client = hosts.create_host(machine) 70 client_at = autotest.Autotest(client) 71 72 for test, argv in CLIENT_TESTS: 73 argv['pdash_note'] = pdash_note 74 client_at.run_test(test, timeout=EXTENDED_TIMEOUT, **argv) 75 76job.parallel_on_machines(run_client_test, machines) 77