xref: /aosp_15_r20/external/autotest/server/site_tests/sequences/control.thermal_qual_lab (revision 9c5db1993ded3edbeafc8092d69fe5de2ee02df7)
1# Copyright 2021 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 = "ThermalQual.lab"
7ATTRIBUTES = "suite:crosbolt_perf_perbuild"
8TIME = "LENGTHY"
9TEST_CATEGORY = "Stress"
10TEST_CLASS = "suite"
11TEST_TYPE = "server"
12EXTENDED_TIMEOUT = 3600 # 1 hour
13PY_VERSION = 3
14
15DOC = """
16Shorter thermal qual sequence for lab regression test. This should be able to
17detect if there is a thermal issue most of the time. And full thermal qual can
18be used to pin point which workload that caused the issue.
19
20* 30 minutes subtest instead of 2 to 2.5 hours.
21* Don't wait for cooldown between each subtest to make total heavy load time
22  to be about 2 hours.
23* power_BatteryCharge is not expected to run in normal lab environment.
24  Lab DUTs should have near-full battery charge.
25
26"""
27
28import datetime
29from autotest_lib.client.common_lib import utils
30
31MINUTES=60
32
33# Need separate list for client and server test due to how these test work.
34CLIENT_TESTS = [
35    ('power_WaitForCoolDown', {}),
36    ('power_Speedometer2', {'tag' : 'thermal_qual_lab_before'}),
37
38    ('power_BatteryCharge', {
39        'percent_target_charge' : 30, 'max_run_time': 30 * MINUTES}),
40    ('power_WaitForCoolDown', {}),
41
42    ('power_ThermalLoad', {
43        'tag' : 'thermal_qual_lab_discharge', 'force_discharge' : True,
44        'duration': 30 * MINUTES}),
45    ('power_VideoCall', {
46        'tag' : 'thermal_qual_lab_discharge', 'force_discharge' : True,
47        'duration': 30 * MINUTES}),
48    ('power_ThermalLoad', {
49        'tag' : 'thermal_qual_lab_charge', 'duration': 30 * MINUTES}),
50    ('power_VideoCall', {
51        'tag' : 'thermal_qual_lab_charge', 'duration': 30 * MINUTES}),
52
53    ('power_Speedometer2', {'tag' : 'thermal_qual_lab_after'})
54]
55
56# Workaround to make it compatible with moblab autotest UI.
57global args_dict
58try:
59    args_dict
60except NameError:
61    args_dict = utils.args_to_dict(args)
62
63# Use time as pdash_note if not supplied to track all tests in same suite.
64pdash_note = args_dict.get('pdash_note',
65                           NAME + '_' + datetime.datetime.utcnow().isoformat())
66
67def run_client_test(machine):
68    client = hosts.create_host(machine)
69    client_at = autotest.Autotest(client)
70
71    for test, argv in CLIENT_TESTS:
72        argv['pdash_note'] = pdash_note
73        client_at.run_test(test, timeout=EXTENDED_TIMEOUT, **argv)
74
75job.parallel_on_machines(run_client_test, machines)
76