1# Copyright (c) 2014 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 = "Chromium OS Team"
8NAME = "PowerStatusStress"
9PURPOSE = "Checks the Power line / Battery status when AC is plugged/unplugged"
10TIME = "LONG"
11TEST_CATEGORY = "Stress"
12TEST_CLASS = "platform"
13TEST_TYPE = "server"
14ATTRIBUTES = "suite:stress3"
15DEPENDENCIES = "servo, power:battery"
16
17DOC = """
18Power stress test would be:
19-Connect power adapter to device
20-Check powerd that the device is charging
21-Remove power adapter
22-Check powerd that the device is discharging
23-Repeat
24The test should fail if the powerd status does not correspond to the RPM/PDU
25status.
26Arguments the test accepts:
27-loop_count - number of iterations to go through power on/off and checks
28-suspend_time - timeout for suspend wakealarm; default is 0 - no suspending
29(for each iteration)
30"""
31
32args_dict = utils.args_to_dict(args)
33servo_args = hosts.CrosHost.get_servo_arguments(args_dict)
34
35def run(machine):
36    host = hosts.create_host(machine, servo_args=servo_args)
37    loop_count = int(args_dict.get('loop_count', 20))
38    job.run_test("platform_PowerStatusStress", host=host,
39                 disable_sysinfo=True, loop_count=loop_count)
40
41parallel_simple(run, machines)
42