• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 = "Chrome OS Team"
8NAME = "power_BatteryChargeControl.args"
9PURPOSE = "Use Servo v4 to charge the DUT"
10CRITERIA = ""
11TIME = "LONG"
12TEST_CATEGORY = "Functional"
13TEST_CLASS = "power"
14TEST_TYPE = "server"
15DEPENDENCIES = "servo"
16
17DOC = """
18DUT is connected to Servo v4 via USB type-C, and Servo v4 is connected to AC
19power.
20
21Sample usage:
22test_that <ip address of DUT> power_BatteryChargeControl.args \
23--args 'servo_host=localhost servo_port=9999 percent_charge_to_add=100'
24
25test_that <ip address of DUT> power_BatteryChargeControl.args \
26--args 'servo_host=localhost servo_port=9999 percent_target_charge=95'
27
28What are the parameters:
29percent_charge_to_add: percentage of the charge capacity charge to
30                       add. The target charge will be capped at the charge
31                       capacity. Optional.
32percent_target_charge: percentage of the charge capacity target charge. The
33                       target charge will be capped at the charge capacity.
34                       Optional.
35"""
36
37args_dict = utils.args_to_dict(args)
38servo_args = hosts.CrosHost.get_servo_arguments(args_dict)
39# percent_target_charge is prioritized over percent_charge_to_add.
40percent_charge_to_add = args_dict.get('percent_charge_to_add', 1)
41percent_target_charge = args_dict.get('percent_target_charge', None)
42
43def run(machine):
44    host = hosts.create_host(machine, servo_args=servo_args)
45    job.run_test("power_BatteryChargeControl",
46                 tag=NAME.split('.')[1],
47                 host=host,
48                 percent_charge_to_add=percent_charge_to_add,
49                 percent_target_charge=percent_target_charge)
50
51parallel_simple(run, machines)
52