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"""Wrapper test measures DUT power with Sweetberry via powerlog tool."""
6
7from autotest_lib.server.cros.power import power_base_wrapper
8from autotest_lib.server.cros.power import power_telemetry_logger
9
10
11class power_PowerlogWrapper(power_base_wrapper.PowerBaseWrapper):
12    """Wrapper test around a client test.
13
14    This wrapper test runs 1 client test given by user, and measures DUT power
15    with Sweetberry via powerlog tool.
16    """
17    version = 1
18
19    def _get_power_telemetry_logger(self, host, config, resultsdir):
20        """Return powerlog telemetry logger.
21
22        @param host: CrosHost object representing the DUT.
23        @param config: the args argument from test_that in a dict. Settings for
24                       power telemetry devices.
25                       required data: {'test': 'test_TestName.tag'}
26        @param resultsdir: path to directory where current autotest results are
27                           stored, e.g. /tmp/test_that_results/
28                           results-1-test_TestName.tag/test_TestName.tag/
29                           results/
30        """
31        return power_telemetry_logger.PowerlogTelemetryLogger(config,
32                                                              resultsdir,
33                                                              host)
34