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.charge_control" 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" 15DEPENDENCIES = "servo" 16 17DOC = """ 18This wrapper test automates the process of power measurement with powerlog tool 19while running a client test. It also uses Servo v4 to control charging and 20discharging the DUT. Please check the client test's control file for any 21hardware requirement, e.g. no AC power, no Ethernet. 22 23This test makes the following assumptions: 241. Sweetberry config files are in directory 25/usr/lib64/python2.7/site-packages/servo/data/ 26For example, 27/usr/lib64/python2.7/site-packages/servo/data/eve_rev7.board 28/usr/lib64/python2.7/site-packages/servo/data/eve_rev7.scenario 29 302. The workstation (or where the autotest is kicked off from) should be in same 31timezone with the DUT. 32 333. Servod is started for the Servo v4 connected to the DUT. AC should be plugged 34into the Servo v4. 35 36Sample usage: 37test_that <ip address of DUT> power_PowerlogWrapper --args \ 38'test=power_LoadTest.fast servo_host=localhost servo_port=9999 sweetberry_interval=1 sweetberry_config=eve_rev7' 39 40What are the parameters: 41test: the client test to run in wrapper test; DUT power is measured during this 42 client test; required. 43servo_host: host of servod instance; required. 44servo_port: port that the servod instance is on; required. 45sweetberry_interval: number of seconds between each Sweetberry measurement; 46 optional. 47sweetberry_config: use [].board and [].scenario as configuration file for 48 Sweetberry measurement; optional. 49sweetberry_serial: serial number of sweetberry to use; If not supplied use 50 the first sweetberry found; optional. 51pdash_note: User supplied note to tag the specific test; optional. 52""" 53 54# Workaround to make it compatible with moblab autotest UI. 55global args_dict 56try: 57 args_dict 58except NameError: 59 args_dict = utils.args_to_dict(args) 60 61servo_args = hosts.CrosHost.get_servo_arguments(args_dict) 62 63def run(machine): 64 host = hosts.create_host(machine, servo_args=servo_args) 65 job.run_test('power_PowerlogWrapper', host=host, tag=NAME.split('.')[1], 66 config=args_dict, charge_control=True) 67 68parallel_simple(run, machines) 69