xref: /aosp_15_r20/external/autotest/server/site_tests/sequences/control.power_qual_fast (revision 9c5db1993ded3edbeafc8092d69fe5de2ee02df7)
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.fast"
7ATTRIBUTES = "suite:power_qual_fast"
8DEPENDENCIES = 'wifi_connected_dut'
9TIME = "LENGTHY"
10TEST_CATEGORY = "Stress"
11TEST_CLASS = "suite"
12TEST_TYPE = "server"
13EXTENDED_TIMEOUT = 18900  # 5 Hours + 900 second guard.
14PY_VERSION = 3
15
16DOC = """
17Make sure that PowerQual.full works.
18"""
19
20import datetime
21from autotest_lib.client.common_lib import utils
22
23HOURS=60*60
24
25CLIENT_TESTS = [
26    ('power_BatteryCharge', {
27        'percent_target_charge' : 50, 'max_run_time': 5 * HOURS}),
28    ('power_WaitForCoolDown', {}),
29    ('power_LoadTest', {
30        'tag' : 'powerqual_fast', 'force_discharge' : True, 'loop_time' : 180,
31        'loop_count' : 1, 'test_low_batt_p' : 5}),
32
33    ('power_BatteryCharge', {
34        'percent_target_charge' : 50, 'max_run_time': 5 * HOURS,
35        'tag' : 'powerqual_fast'}),
36    ('power_WaitForCoolDown', {}),
37    ('power_VideoPlayback', {
38        'tag' : 'powerqual_fast', 'force_discharge' : True,
39        'secs_per_video' : 60,
40        'videos' : [('h264_1080_30fps', ''), ('vp9_1080_30fps', '')]}),
41
42    ('power_BatteryCharge', {
43        'percent_target_charge' : 50, 'max_run_time': 5 * HOURS}),
44    ('power_WaitForCoolDown', {}),
45    ('power_VideoCall', {
46        'tag' : 'powerqual_fast', 'force_discharge' : True, 'duration': 180}),
47
48    ('power_BatteryCharge', {
49        'percent_target_charge' : 50, 'max_run_time': 5 * HOURS}),
50    ('power_WaitForCoolDown', {}),
51    ('power_Idle', {
52        'tag' : 'powerqual_fast', 'force_discharge' : True, 'idle_secs': 10}),
53
54    ('power_BatteryCharge', {
55        'percent_target_charge' : 50, 'max_run_time': 5 * HOURS}),
56    ('power_WaitForCoolDown', {}),
57    ('power_VideoEncode', {
58        'tag' : 'powerqual_fast', 'force_discharge' : True,
59        'seconds_per_test' : 30, 'format' : [
60            ('h264', 'hd', 24),
61            ('vp9', 'hvga', 24),
62            ('vp8', 'qhvga', 15)]}),
63
64    ('power_BatteryCharge', {
65        'percent_target_charge' : 50, 'max_run_time': 5 * HOURS}),
66    ('power_WaitForCoolDown', {}),
67    ('power_Display', {
68        'tag' : 'powerqual_fast', 'force_discharge' : True,
69        'brightness' : 'max', 'secs_per_page' : 20, 'seconds_period' : 1,
70        'pages' : ['white', 'black', 'white', 'checker1', 'white']}),
71
72    ('power_WaitForCoolDown', {}),
73    ('power_UiResume', {
74        'tag' : 'powerqual_fast'}),
75]
76
77# Workaround to make it compatible with moblab autotest UI.
78global args_dict
79try:
80    args_dict
81except NameError:
82    args_dict = utils.args_to_dict(args)
83
84# Use time as pdash_note if not supplied to track all tests in same suite.
85pdash_note = args_dict.get('pdash_note',
86                           NAME + '_' + datetime.datetime.utcnow().isoformat())
87
88def run_client_test(machine):
89    client = hosts.create_host(machine)
90    client_at = autotest.Autotest(client)
91
92    for test, argv in CLIENT_TESTS:
93        argv['pdash_note'] = pdash_note
94        client_at.run_test(test, timeout=EXTENDED_TIMEOUT, **argv)
95
96job.parallel_on_machines(run_client_test, machines)
97