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