xref: /aosp_15_r20/external/autotest/server/site_tests/sequences/control.power_dashboard_fast (revision 9c5db1993ded3edbeafc8092d69fe5de2ee02df7)
1# Copyright 2018 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"
7TIME = "MEDIUM"
8TEST_CATEGORY = "Stress"
9TEST_CLASS = "suite"
10TEST_TYPE = "server"
11PY_VERSION = 3
12
13DOC = """
14Sequence to make sure that power_Dashboard tests work fine.
15"""
16
17import datetime
18from autotest_lib.client.common_lib import utils
19
20# Need separate list for client and server test due to how these test work.
21CLIENT_TESTS = [
22    ('power_Standby', {
23        'tag' : '36sec', 'sample_hours' : 0.01, 'test_hours' : 0.01,
24        'bypass_check' : True}),
25    ('power_LoadTest', {
26        'tag' : 'fast', 'loop_time' : 180, 'loop_count' : 1,
27        'test_low_batt_p' : 6, 'check_network': False, 'ac_ok' : True,
28        'gaia_login' : False}),
29    ('power_Idle', {
30        'tag' : 'fast', 'warmup_secs' : 2, 'idle_secs' : 10}),
31    ('power_VideoPlayback', {
32        'tag' : 'fast', 'secs_per_video' : 10, 'fast' : True }),
33    ('power_VideoPlayback', {
34        'tag' : 'sw_decoder_fast', 'use_hw_decode' : False,
35        'secs_per_video' : 10, 'fast' : True }),
36    ('power_Display', {
37        'tag' : 'fast', 'secs_per_page' : 2}),
38    ('power_WebGL', {
39        'tag' : 'fast', 'duration' : 10}),
40]
41
42# Tagged test name and sweetberry interval
43SWEETBERRY_TESTS = [
44    ('power_Standby.36sec', 1),
45    ('power_LoadTest.fast', 1),
46    ('power_Idle.fast', 1),
47    ('power_VideoPlayback.fast', 1),
48    ('power_VideoPlayback.sw_decoder_fast', 1),
49    ('power_Display.fast', 1),
50    ('power_WebGL.fast', 1),
51]
52
53POWERLOG_TESTNAME = 'power_PowerlogWrapper'
54
55# Workaround to make it compatible with moblab autotest UI.
56global args_dict
57try:
58    args_dict
59except NameError:
60    args_dict = utils.args_to_dict(args)
61
62# Use time as pdash_note if not supplied to track all tests in same suite.
63pdash_note = args_dict.get('pdash_note',
64                           NAME + '_' + datetime.datetime.utcnow().isoformat())
65sweetberry_serial = args_dict.get('sweetberry_serial', None)
66
67def run_client_test(machine):
68    client = hosts.create_host(machine)
69    client_at = autotest.Autotest(client)
70    for test, argv in CLIENT_TESTS:
71        client.reboot()
72        argv['pdash_note'] = pdash_note
73        client_at.run_test(test, **argv)
74
75def run_sweetberry_wrapper_test(machine):
76    client = hosts.create_host(machine)
77    for test, sweetberry_interval in SWEETBERRY_TESTS:
78        client.reboot()
79        argv = {
80            'pdash_note': pdash_note,
81            'test': test,
82            'sweetberry_interval': sweetberry_interval,
83        }
84        job.run_test(POWERLOG_TESTNAME, host=client, config=argv, tag=test)
85
86
87if sweetberry_serial:
88    parallel_simple(run_sweetberry_wrapper_test, machines)
89else:
90    job.parallel_on_machines(run_client_test, machines)
91