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 5from autotest_lib.server import utils 6 7AUTHOR = "mqg" 8NAME = "power_PowerlogWrapper" 9PURPOSE = "Measure power with powerlog tool while running a client test." 10CRITERIA = "This test is a wrapper for a client test." 11TIME = "LONG" 12TEST_CATEGORY = "Benchmark" 13TEST_CLASS = "power" 14TEST_TYPE = "server" 15 16DOC = """ 17This wrapper test automates the process of power measurement with powerlog tool 18while running a client test. Please check the client test's control file for any 19hardware requirement, e.g. no AC power, no Ethernet. 20 21This test makes the following assumptions: 221. Sweetberry config files are in directory 23/usr/lib64/python2.7/site-packages/servo/data/ 24For example, 25/usr/lib64/python2.7/site-packages/servo/data/eve_rev7.board 26/usr/lib64/python2.7/site-packages/servo/data/eve_rev7.scenario 27 282. The workstation (or where the autotest is kicked off from) should be in same 29timezone with the DUT. 30 31Sample usage: 32test_that <ip address of DUT> power_PowerlogWrapper --args \ 33'test=power_LoadTest.fast sweetberry_interval=1 sweetberry_config=eve_rev7' 34 35What are the parameters: 36test: the client test to run in wrapper test; DUT power is measured during this 37 client test; required. 38sweetberry_interval: number of seconds between each Sweetberry measurement; 39 optional. 40sweetberry_config: use [].board and [].scenario as configuration file for 41 Sweetberry measurement; optional. 42sweetberry_serial: serial number of sweetberry to use; If not supplied use 43 the first sweetberry found; optional. 44pdash_note: User supplied note to tag the specific test; optional. 45""" 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 54def run(machine): 55 job.run_test('power_PowerlogWrapper', host=hosts.create_host(machine), 56 config=args_dict) 57 58parallel_simple(run, machines) 59