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