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_ServodWrapper" 9PURPOSE = "Measure power with servod 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 servod while 19running a client test. Please check the client test's control file for any 20hardware requirement, e.g. no AC power, no Ethernet. 21 22This test makes the following assumptions: 231. Servod is already running, and its host and port are provided to this 24autotest. 25 262. The workstation (or where the autotest is kicked off from) should be in same 27timezone with the DUT. 28 29Sample usage: 30test_that <ip address of DUT> power_ServodWrapper --args \ 31'test=power_LoadTest.fast servo_host=localhost servo_port=9999 \ 32ina_rate=20 vbat_rate=60' 33 34What are the parameters: 35test: the client test to run in wrapper test; DUT power is measured during this 36 client test; required. 37servo_host: host of servod instance; required. 38servo_port: port that the servod instance is on; required. 39ina_rate: power measurement from INAs are logged every ina_rate seconds; 40 optional. 41vbat_rate: power measurement from EC is logged every vbat_rate seconds; 42 optional. 43note: User supplied note to tag the specific test; optional. 44""" 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) 52servo_args = hosts.CrosHost.get_servo_arguments(args_dict) 53 54def run(machine): 55 host = hosts.create_host(machine, servo_args=servo_args) 56 job.run_test("power_ServodWrapper", host=host, config=args_dict) 57 58parallel_simple(run, machines) 59