1# Lint as: python3 2# Copyright 2022 The Chromium OS Authors. All rights reserved. 3# Use of this source code is governed by a BSD-style license that can be 4# found in the LICENSE file. 5 6from autotest_lib.server import utils 7 8AUTHOR = "klug" 9NAME = "power_PacWrapper" 10PURPOSE = "Measure power with a pacman debugger while running a client test." 11CRITERIA = "This test is a wrapper for a client test." 12TIME = "LONG" 13TEST_CATEGORY = "Benchmark" 14TEST_CLASS = "power" 15TEST_TYPE = "server" 16DEPENDENCIES = "servo_state:WORKING" 17PY_VERSION = 3 18 19DOC = """ 20This wrapper test automates the process of power measurement with a pacman 21debugger while running a client test. Please check the client test's control 22file for any hardware requirement, e.g. no AC power, no Ethernet. 23 24This test makes the following assumptions: 251. Pacman Debugger is connected to the DUT and can be run manually. 26 272. The workstation (or where the autotest is kicked off from) should be in same 28timezone with the DUT. 29 303. pacman.py is in path and discoverable using shutil.which('pacman.py') 31 32Installation: 33wget https://bootstrap.pypa.io/pip/3.6/get-pip.py 34sudo python ./get-pip.py 35pip3 install pandas plotly pyftdi 36 37Sample usage: 38test_that <ip address of DUT> power_PacWrapper --args \ 39'test=power_LoadTest.fast config=./boards/skyrim/skyrim_r1_pacs.py \ 40 mapping=./boards/skyrim/skyrim_r1_railmap.csv \ 41 gpio=./boards/skyrim/skyrim_r0_gpio.csv ' 42 43What are the parameters: 44test: the client test to run in wrapper test; DUT power is measured during this 45 client test; required. 46note: User supplied note to tag the specific test; optional. 47""" 48 49# Workaround to make it compatible with moblab autotest UI. 50global args_dict 51try: 52 args_dict 53except NameError: 54 args_dict = utils.args_to_dict(args) 55servo_args = hosts.CrosHost.get_servo_arguments(args_dict) 56 57def run(machine): 58 host = hosts.create_host(machine, servo_args=servo_args) 59 job.run_test("power_PacWrapper", host=host, config=args_dict) 60 61parallel_simple(run, machines) 62