blob: a1ae09a55c4ce5c03b91506574b6c6de5408887c [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.
from autotest_lib.server import utils
NAME = "platform_ExternalUsbPeripherals.detect.lid_close_open"
METADATA = {
"contacts": ["chromeos-usb@google.com"],
"bug_component": "b:958036",
"criteria": "Test fails if USB enumeration check fails.",
"hw_agnostic": False,
"doc" : "Control file for running in USB HTL lab.",
}
TEST_TYPE = "server"
ATTRIBUTES = "suite:usb_detect"
DEPENDENCIES = "servo_state:WORKING"
JOB_RETRIES = 1
DOC = """
This test uses servo to connect/disconnect servo USB hub before and
after events like reboot, login, closelid, openlid etc.
The test fails if
- device is pingable when suspended
- wrong action passed through action_sequence flag
- USB detected peripherals are different than expected
- there is no servo board attached
- USB peripherals checks(usb_checks below) on command line fail
Other detection checks can be added for each peripheral
Set of four USB peripherals plugged
- USB headset
- USB HD Webcam - should be Logitech HD Pro Webcam C920
- USB stick with four partitions named ExFAT Ext4 FAT NTFS
- etc.
"""
args_dict = utils.args_to_dict(args)
servo_args = hosts.CrosHost.get_servo_arguments(args_dict)
def run(machine):
host = hosts.create_host(machine, servo_args=servo_args)
repeat = int(args_dict.get("repeat", 1))
default_actions = str("plug,unplug,login,plug,unplug,closelid,openlid,plug,"
"closelid,unplug,openlid,"
"closelid,plug,openlid,unplug")
action_sequence = str(args_dict.get("action_sequence", default_actions))
usb_list = ["\"Netac Technology Co., Ltd OnlyDisk\"",
"\"Alcor Micro Corp.|GEMBIRD\"",
"\"USB PnP Sound Device: USB Audio|C-Media Electronics, Inc.* Audio\"",
]
usb_checks = {
# USB Audio Output devices
str("cras_test_client --dump_server_info | "
"awk \"/Output Devices:/,/Output Nodes:/\" | grep -E ") :
["\"USB PnP Sound Device: USB Audio|C-Media USB Headphone Set: USB Audio\"" ],
# USB Audio Input devices
str("loggedin:cras_test_client --dump_server_info | "
"awk \"/Input Devices:/,/Input Nodes:/\" | grep -iE ") :
["\"TeckNet: USB Audio|USB ?2.0 PC Camera\"",
"\"USB PnP Sound Device: USB Audio|C-Media USB Headphone Set: USB Audio\""],
# USB stick four partitions volumes
"loggedin:ls -l /media/removable/ | grep -i " :
["ExFAT", "Ext4", "FAT", "NTFS"],
# USB Web camera
"cat /sys/class/video4linux/video*/name | grep -iE " :
["\"TeckNet|USB ?2.0 PC Camera|Video Capture|Video Output|Metadata\""],
}
job.run_test("platform_ExternalUsbPeripherals", host=host,
disable_sysinfo=True, client_autotest="desktopui_SimpleLogin",
action_sequence=action_sequence, repeat=repeat,
usb_list=usb_list, usb_checks=usb_checks, tag="detect.lid_close_open")
parallel_simple(run, machines)