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