Home | History | Annotate | Download | only in platform_ExternalUsbPeripherals
      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 
      5 from autotest_lib.server import utils
      6 
      7 AUTHOR = "Chrome OS Team"
      8 NAME = "platform_ExternalUsbPeripherals.set1"
      9 PURPOSE = "Servo based USB boot stress test"
     10 CRITERIA = "This test will fail if any of the actions or checks fail."
     11 TIME = "LONG"
     12 TEST_CATEGORY = "Functional"
     13 TEST_CLASS = "platform"
     14 TEST_TYPE = "server"
     15 ATTRIBUTES = "suite:kernel_usb"
     16 SUITE = "kernel_usb"
     17 DEPENDENCIES = "servo"
     18 
     19 DOC = """
     20 This test uses servo to connect/disconnect servo USB hub before and
     21 after events like reboot, login, suspend, resume etc.
     22 
     23 The test fails if
     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 - USB peripherals checks(usb_checks below) on command line fail
     29 Other detection checks can be added for each peripheral
     30 
     31 Set1 is set of four USB peripherals plugged
     32 - USB headset
     33 - USB HD Webcam - should be Logitech HD Pro Webcam C920
     34 - USB stick with four partitions named ExFAT  Ext4  FAT  NTFS
     35 """
     36 
     37 args_dict = utils.args_to_dict(args)
     38 servo_args = hosts.CrosHost.get_servo_arguments(args_dict)
     39 
     40 def run(machine):
     41     host = hosts.create_host(machine, servo_args=servo_args)
     42 
     43     repeat = int(args_dict.get("repeat", 2))
     44 
     45     default_actions = str("reboot,unplug,plug,login,unplug,plug,"
     46                           "suspend,resume,unplug,suspend,plug,resume,"
     47                           "suspend,unplug,resume,plug")
     48 
     49     action_sequence = str(args_dict.get("action_sequence", default_actions))
     50 
     51     usb_list = ["\"Chicony Electronics Co., Ltd\"",
     52                 "\"Kingston Technology Company Inc.\"",
     53                 "\"Alcor Micro Corp.\"",
     54                 "\"Microsoft Corp.|C-Media Electronics, Inc. Audio Adapter\"",
     55                 "\"Huawei Technologies Co., Ltd. Modem/Networkcard\"",
     56                 "\"Realtek Semiconductor Corp.\"",
     57                 # Commenting out due to crbug.com/488667.
     58                 #"LG Electronics, Inc.",
     59                ]
     60     usb_checks = {
     61         # USB Audio Output devices
     62         str("cras_test_client --dump_server_info | "
     63             "awk \"/Output Devices:/,/Output Nodes:/\" | grep -E ") :
     64             ["\"Microsoft LifeChat LX-3000: USB Audio|C-Media USB Headphone Set: USB Audio\"" ],
     65         # USB Audio Input devices
     66         str("loggedin:cras_test_client --dump_server_info | "
     67             "awk \"/Input Devices:/,/Input Nodes:/\" | grep -E ") :
     68             ["\"TeckNet: USB Audio|USB 2.0 PC Camera\"",
     69              "\"Microsoft LifeChat LX-3000: USB Audio|C-Media USB Headphone Set: USB Audio\""],
     70         # USB stick four partitions volumes
     71         "loggedin:ls -l /media/removable/ | grep -i " :
     72             ["\"USB Drive\"", "\"SD Card\"", "ExFAT", "Ext4", "FAT", "NTFS"],
     73         # USB Web camera
     74         "cat /sys/class/video4linux/video*/name | grep -E " :
     75             ["\"TeckNet|USB 2.0 PC Camera\""],
     76         }
     77 
     78     job.run_test("platform_ExternalUsbPeripherals", host=host,
     79                  disable_sysinfo=True, client_autotest="desktopui_SimpleLogin",
     80                  action_sequence=action_sequence, repeat=repeat,
     81                  usb_list=usb_list, usb_checks=usb_checks, tag="set1")
     82 
     83 parallel_simple(run, machines)
     84