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.full" 7TIME = "MEDIUM" 8TEST_CATEGORY = "Stress" 9TEST_CLASS = "suite" 10TEST_TYPE = "server" 11PY_VERSION = 3 12 13DOC = """ 14Sequence for upload common power test data to dashboard. 15""" 16 17import datetime 18from autotest_lib.client.common_lib import utils 19 20CLIENT_TESTS = [ 21 ('power_LoadTest', { 22 'tag' : '1hour', 'loop_time' : 3600, 'loop_count' : 1, 23 'test_low_batt_p' : 6}), 24 ('power_Idle', {}), 25 ('power_VideoPlayback', {}), 26 ('power_VideoPlayback', { 27 'tag' : 'sw_decoder', 'use_hw_decode' : False}), 28 ('power_Display', {}), 29 ('power_WebGL', {}), 30 ('power_Standby', { 31 'tag' : 'fast', 'sample_hours' : 0.334, 'test_hours' : 0.334}), 32] 33 34# Tagged test name and sweetberry interval 35SWEETBERRY_TESTS = [ 36 ('power_Standby.fast', 1), 37 ('power_LoadTest.1hour', 20), 38 ('power_Idle', 1), 39 ('power_VideoPlayback', 5), 40 ('power_VideoPlayback.sw_decoder', 5), 41 ('power_Display', 5), 42 ('power_WebGL', 5), 43] 44 45POWERLOG_TESTNAME = 'power_PowerlogWrapper' 46 47# Workaround to make it compatible with moblab autotest UI. 48global args_dict 49try: 50 args_dict 51except NameError: 52 args_dict = utils.args_to_dict(args) 53 54# Use time as pdash_note if not supplied to track all tests in same suite. 55pdash_note = args_dict.get('pdash_note', 56 NAME + '_' + datetime.datetime.utcnow().isoformat()) 57sweetberry_serial = args_dict.get('sweetberry_serial', None) 58 59 60def run_client_test(machine): 61 client = hosts.create_host(machine) 62 client_at = autotest.Autotest(client) 63 for test, argv in CLIENT_TESTS: 64 client.reboot() 65 argv['pdash_note'] = pdash_note 66 client_at.run_test(test, **argv) 67 68def run_sweetberry_wrapper_test(machine): 69 client = hosts.create_host(machine) 70 for test, sweetberry_interval in SWEETBERRY_TESTS: 71 client.reboot() 72 argv = { 73 'pdash_note': pdash_note, 74 'test': test, 75 'sweetberry_interval': sweetberry_interval, 76 } 77 job.run_test(POWERLOG_TESTNAME, host=client, config=argv, tag=test) 78 79if sweetberry_serial: 80 parallel_simple(run_sweetberry_wrapper_test, machines) 81else: 82 job.parallel_on_machines(run_client_test, machines) 83