blob: 351eeff862828f5a5861fde4798f1281cd197845 [file] [log] [blame]
# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
# 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
AUTHOR = "Chrome OS Team"
NAME = "ExternalUsbPeripheralsSet2"
PURPOSE = "Servo based USB detection test"
CRITERIA = "This test will fail if any of the actions or checks fail."
TIME = "LONG"
TEST_CATEGORY = "Functional"
TEST_CLASS = "platform"
TEST_TYPE = "server"
SUITE = "kernel_usb"
DEPENDENCIES = "servo"
DOC = """
This test uses servo to connect/disconnect servo USB hub before and
after events like reboot, login, suspend, resume etc.
The test fails if
- crash files are generated
- 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
Set2 is set of six USB peripherals plugged:
- USB headset
- USB Webcam
- USB SD card reader
- Android phone
- USB mouse
- GSM modem
"""
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", 2))
default_actions = str("reboot,unplug,plug,login,unplug,plug,"
"suspend,resume,unplug,suspend,plug,resume,"
"suspend,unplug,resume,plug")
action_sequence = str(args_dict.get("action_sequence", default_actions))
usb_list = ["Chicony Electronics Co., Ltd",
"Alcor Micro Corp.",
"Microsoft Corp.",
"Huawei Technologies Co., Ltd. Modem/Networkcard",
"Realtek Semiconductor Corp.",
"LG Electronics, Inc.",]
usb_checks = {
# Audio thread - active USB audio
str("loggedin:cras_test_client --dump_audio_thread | "
"awk '/devices/,/stream_dump/'") :
["output dev.*USB Audio", "input dev.*USB Audio"],
# USB Audio Output devices
str("cras_test_client --dump_server_info | "
"awk '/Output Devices:/,/Output Nodes:/'") :
["Microsoft LifeChat LX-3000: USB Audio" ],
# USB Audio Input devices
str("cras_test_client --dump_server_info | "
"awk '/Input Devices:/,/Input Nodes:/'") :
["TeckNet: USB Audio",
"Microsoft LifeChat LX-3000: USB Audio"],
# USB stick four partitions volumes
"loggedin:ls -l /media/removable/" :
["USB Drive"],
# USB Web camera
"cat /sys/class/video4linux/video*/name" :
["TeckNet"],
}
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)
parallel_simple(run, machines)