blob: c39e541e29945d75e3aef488c785751babeacc1c [file] [log] [blame]
# Copyright 2018 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from autotest_lib.server import utils
AUTHOR = "mqg"
NAME = "power_ServodWrapper"
PURPOSE = "Measure power with servod while running a client test."
CRITERIA = "This test is a wrapper for a client test."
TIME = "LONG"
TEST_CATEGORY = "Benchmark"
TEST_CLASS = "power"
TEST_TYPE = "server"
DEPENDENCIES = "servo_state:WORKING"
DOC = """
This wrapper test automates the process of power measurement with servod while
running a client test. Please check the client test's control file for any
hardware requirement, e.g. no AC power, no Ethernet.
This test makes the following assumptions:
1. Servod is already running, and its host and port are provided to this
autotest.
2. The workstation (or where the autotest is kicked off from) should be in same
timezone with the DUT.
Sample usage:
test_that <ip address of DUT> power_ServodWrapper --args \
'test=power_LoadTest.fast servo_host=localhost servo_port=9999 \
ina_rate=20 vbat_rate=60'
What are the parameters:
test: the client test to run in wrapper test; DUT power is measured during this
client test; required.
servo_host: host of servod instance; required.
servo_port: port that the servod instance is on; required.
ina_rate: power measurement from INAs are logged every ina_rate seconds;
optional.
vbat_rate: power measurement from EC is logged every vbat_rate seconds;
optional.
note: User supplied note to tag the specific test; optional.
"""
# Workaround to make it compatible with moblab autotest UI.
global args_dict
try:
args_dict
except NameError:
args_dict = utils.args_to_dict(args)
servo_args = hosts.CrosHost.get_servo_arguments(args_dict)
def run(machine):
host = hosts.create_host(machine, servo_args=servo_args)
job.run_test("power_ServodWrapper", host=host, config=args_dict)
parallel_simple(run, machines)