xref: /aosp_15_r20/external/autotest/server/site_tests/platform_ExternalUsbPeripherals/control (revision 9c5db1993ded3edbeafc8092d69fe5de2ee02df7)
1# Copyright (c) 2012 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 = "platform_ExternalUsbPeripherals"
9PURPOSE = "Servo based USB boot stress test"
10CRITERIA = "This test will fail if any of the actions or checks fail."
11TIME = "LONG"
12TEST_CATEGORY = "Functional"
13TEST_CLASS = "platform"
14TEST_TYPE = "server"
15DEPENDENCIES = "servo_state:WORKING"
16PY_VERSION = 3
17
18DOC = """
19This test uses servo to connect/disconnect servo USB hub before and
20after events like reboot, login, suspend, resume etc.
21
22The test fails if
23- crash files are generated
24- device is pingable when suspended
25- wrong action passed through action_sequence flag
26- USB detected peripherals are different than expected
27- there is no servo board attached
28"""
29
30args_dict = utils.args_to_dict(args)
31servo_args = hosts.CrosHost.get_servo_arguments(args_dict)
32
33def run(machine):
34    host = hosts.create_host(machine, servo_args=servo_args)
35
36    repeat = int(args_dict.get("repeat", 10))
37
38    default_actions = str("reboot,unplug,plug,login,unplug,plug,"
39                          "suspend,resume,unplug,suspend,plug,resume,"
40                          "suspend,unplug,resume,plug")
41
42    action_sequence = str(args_dict.get("action_sequence", default_actions))
43
44    job.run_test("platform_ExternalUsbPeripherals", host=host,
45                 disable_sysinfo=True, client_autotest="desktopui_SimpleLogin",
46                 action_sequence=action_sequence, repeat=repeat)
47
48parallel_simple(run, machines)
49