xref: /aosp_15_r20/external/autotest/server/site_tests/power_BatteryChargeControl/control.args (revision 9c5db1993ded3edbeafc8092d69fe5de2ee02df7)
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 = "ChromeOS 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_state:WORKING"
16PY_VERSION = 3
17
18DOC = """
19DUT is connected to Servo v4 via USB type-C, and Servo v4 is connected to AC
20power.
21
22Sample usage:
23test_that <ip address of DUT> power_BatteryChargeControl.args \
24--args 'servo_host=localhost servo_port=9999 percent_charge_to_add=100'
25
26test_that <ip address of DUT> power_BatteryChargeControl.args \
27--args 'servo_host=localhost servo_port=9999 percent_target_charge=95'
28
29What are the parameters:
30percent_charge_to_add: percentage of the charge capacity charge to
31                       add. The target charge will be capped at the charge
32                       capacity. Optional.
33percent_target_charge: percentage of the charge capacity target charge. The
34                       target charge will be capped at the charge capacity.
35                       Optional.
36"""
37
38args_dict = utils.args_to_dict(args)
39servo_args = hosts.CrosHost.get_servo_arguments(args_dict)
40# percent_target_charge is prioritized over percent_charge_to_add.
41percent_charge_to_add = args_dict.get('percent_charge_to_add', 1)
42percent_target_charge = args_dict.get('percent_target_charge', None)
43
44def run(machine):
45    host = hosts.create_host(machine, servo_args=servo_args)
46    job.run_test("power_BatteryChargeControl",
47                 tag=NAME.split('.')[1],
48                 host=host,
49                 percent_charge_to_add=percent_charge_to_add,
50                 percent_target_charge=percent_target_charge)
51
52parallel_simple(run, machines)
53