| # Copyright 2020 The ChromiumOS Authors |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| NAME = "PowerQual.full" |
| METADATA = { |
| "contacts": ["chromeos-platform-power@google.com"], |
| "bug_component": "b:1361410", |
| "criteria": "This test is a benchmark test", |
| "hw_agnostic": False, |
| } |
| ATTRIBUTES = "suite:power_qual_full" |
| DEPENDENCIES = 'wifi_connected_dut' |
| TIME = "LENGTHY" |
| TEST_CATEGORY = "Stress" |
| TEST_CLASS = "suite" |
| TEST_TYPE = "server" |
| EXTENDED_TIMEOUT = 87300 # 24 Hours + 900 second guard. |
| PY_VERSION = 3 |
| |
| DOC = """ |
| Sequence for qualification for power. |
| |
| Mandatory tests |
| - power_LoadTest (from full battery to 5%) |
| - power_BatteryCharge (from 5% to full battery) |
| - power_VideoPlayback (h264 1080p & vp9 1080p 1 hour each) |
| - power_VideoCall (2 hours) |
| |
| Informational tests |
| - power_Idle |
| - power_VideoPlayback |
| - power_VideoEncode |
| - power_Display.brightness |
| - power_Display.cabc |
| """ |
| |
| import datetime |
| import os |
| from autotest_lib.client.common_lib import utils |
| from autotest_lib.client.cros.power import power_dashboard |
| |
| HOURS=60*60 |
| |
| CLIENT_TESTS = [ |
| ('power_BatteryCharge', { |
| 'percent_target_charge' : 100, |
| 'max_run_time': 5 * HOURS |
| } |
| ), |
| ('power_WaitForCoolDown', {}), |
| ('power_LoadTest', { |
| 'tag' : 'powerqual', |
| 'force_discharge' : True, |
| 'loop_time' : HOURS, |
| 'loop_count' : 24, |
| 'test_low_batt_p' : 5 |
| } |
| ), |
| ('power_BatteryDrain', { |
| 'force_discharge' : True, |
| 'drain_to_percent' : 5, |
| 'drain_timeout': HOURS, |
| } |
| ), |
| |
| ('power_BatteryCharge', { |
| 'percent_target_charge' : 100, |
| 'test_for_charging_speed': True, |
| 'percent_initial_charge_max': 10, |
| 'max_run_time': 5 * HOURS, |
| 'tag' : 'powerqual' |
| } |
| ), |
| ('power_WaitForCoolDown', {}), |
| ('power_VideoPlayback', { |
| 'tag' : 'powerqual', |
| 'force_discharge' : True, |
| 'secs_per_video' : 3600, |
| 'videos' : [('h264_1080_30fps', ''), ('vp9_1080_30fps', '')] |
| } |
| ), |
| |
| ('power_BatteryCharge', { |
| 'percent_target_charge' : 80, |
| 'max_run_time': 5 * HOURS |
| } |
| ), |
| ('power_WaitForCoolDown', {}), |
| ('power_VideoCall', { |
| 'tag' : 'powerqual', |
| 'force_discharge' : True, |
| 'min_run_time_percent': 75 |
| } |
| ), |
| |
| ('power_BatteryCharge', { |
| 'percent_target_charge' : 40, |
| 'max_run_time': 5 * HOURS |
| } |
| ), |
| ('power_WaitForCoolDown', {}), |
| ('power_Idle', { |
| 'tag' : 'powerqual', |
| 'force_discharge' : True |
| } |
| ), |
| |
| ('power_BatteryCharge', { |
| 'percent_target_charge' : 35, |
| 'max_run_time': 5 * HOURS |
| } |
| ), |
| ('power_WaitForCoolDown', {}), |
| ('power_VideoPlayback', { |
| 'tag' : 'powerqual_info', |
| 'force_discharge' : True |
| } |
| ), |
| |
| ('power_BatteryCharge', { |
| 'percent_target_charge' : 30, |
| 'max_run_time': 5 * HOURS |
| } |
| ), |
| ('power_WaitForCoolDown', {}), |
| ('power_VideoEncode', { |
| 'tag' : 'powerqual', |
| 'force_discharge' : True |
| } |
| ), |
| |
| ('power_BatteryCharge', { |
| 'percent_target_charge' : 25, |
| 'max_run_time': 5 * HOURS |
| } |
| ), |
| ('power_WaitForCoolDown', {}), |
| ('power_Display', { |
| 'tag' : 'powerqual_brightness', |
| 'force_discharge' : True, |
| 'brightness' : 'all', |
| 'pages' : ['white', 'black', 'checker1'], |
| 'secs_per_page' : 20, |
| 'seconds_period' : 1 |
| } |
| ), |
| |
| ('power_BatteryCharge', { |
| 'percent_target_charge' : 20, |
| 'max_run_time': 5 * HOURS |
| } |
| ), |
| ('power_WaitForCoolDown', {}), |
| ('power_Display', { |
| 'tag' : 'powerqual_cabc', |
| 'force_discharge' : True, |
| 'brightness' : 'max', |
| 'secs_per_page' : 20, |
| 'seconds_period' : 1, |
| 'pages' : ['white', 'black', |
| 'white', 'grey10', |
| 'white', 'grey20', |
| 'white', 'grey30', |
| 'white', 'grey40', |
| 'white', 'grey50', |
| 'white', 'checker1', |
| 'white', 'checker90', |
| 'white', 'checker80', |
| 'white', 'checker70', |
| 'white', 'checker60', |
| 'white', 'checker50'] |
| } |
| ), |
| |
| ('power_WaitForCoolDown', {}), |
| ('power_UiResume', { |
| 'tag' : 'powerqual' |
| } |
| ), |
| ] |
| |
| # Workaround to make it compatible with moblab autotest UI. |
| try: |
| # args_dict maybe declare before. It will cause SyntaxError |
| global args_dict |
| except SyntaxError: |
| pass |
| |
| try: |
| args_dict |
| except NameError: |
| args_dict = utils.args_to_dict(args) |
| |
| # Use time as pdash_note if not supplied to track all tests in same suite. |
| pdash_note = args_dict.get('pdash_note', |
| NAME + '_' + datetime.datetime.utcnow().isoformat()) |
| |
| def run_client_test(machine): |
| client = hosts.create_host(machine) |
| client_at = autotest.Autotest(client) |
| |
| for test, argv in CLIENT_TESTS: |
| argv['pdash_note'] = pdash_note |
| client_at.run_test(test, timeout=EXTENDED_TIMEOUT, **argv) |
| |
| power_dashboard.generate_parallax_report(output_dir=os.getcwd(), |
| local_dir=os.getcwd(), testname='PowerQual') |
| |
| job.parallel_on_machines(run_client_test, machines) |