blob: 20bcef2228ceac9c119bed6c12cad0623d98fd3b [file] [log] [blame]
# Copyright 2018 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# Description
# Use Servo v4 to charge the DUT.
# DUT is connected to Servo v4 via USB type-C, and Servo v4 is connected to AC
# power.
# Sample usage:
# test_that <ip address of DUT> power_BatteryChargeControl.args \
# --args 'servo_host=localhost servo_port=9999 percent_charge_to_add=100'
# test_that <ip address of DUT> power_BatteryChargeControl.args \
# --args 'servo_host=localhost servo_port=9999 percent_target_charge=95'
# What are the parameters:
# percent_charge_to_add: percentage of the charge capacity charge to
# add. The target charge will be capped at the charge
# capacity. Optional.
# percent_target_charge: percentage of the charge capacity target charge. The
# target charge will be capped at the charge capacity.
# Optional.
NAME = "power_BatteryChargeControl.args"
METADATA = {
"contacts": ["chromeos-platform-power@google.com"],
"bug_component": "b:1361410",
"criteria": "",
"hw_agnostic": False
}
ATTRIBUTES = ""
TEST_TYPE = "server"
DEPENDENCIES = "servo_state:WORKING"
from autotest_lib.server import utils
args_dict = utils.args_to_dict(args)
servo_args = hosts.CrosHost.get_servo_arguments(args_dict)
# percent_target_charge is prioritized over percent_charge_to_add.
percent_charge_to_add = args_dict.get('percent_charge_to_add', 1)
percent_target_charge = args_dict.get('percent_target_charge', None)
def run(machine):
host = hosts.create_host(machine, servo_args=servo_args)
job.run_test("power_BatteryChargeControl",
tag=NAME.split('.')[1],
host=host,
percent_charge_to_add=percent_charge_to_add,
percent_target_charge=percent_target_charge)
parallel_simple(run, machines)