1 # Copyright (c) 2016 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.printer" 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 DEPENDENCIES = "servo, usb_printer" 16 17 DOC = """ 18 This test uses servo to connect/disconnect servo USB hub before and 19 after events like reboot, login, suspend, resume etc. 20 21 The test fails if 22 - device is pingable when suspended 23 - wrong action passed through action_sequence flag 24 - USB detected peripherals are different than expected 25 - there is no servo board attached 26 - USB peripherals checks(usb_checks below) on command line fail 27 Other detection checks can be added for each peripheral 28 29 Set of USB peripherals plugged 30 - USB connected printer 31 """ 32 33 args_dict = utils.args_to_dict(args) 34 servo_args = hosts.CrosHost.get_servo_arguments(args_dict) 35 36 def run(machine): 37 host = hosts.create_host(machine, servo_args=servo_args) 38 39 repeat = int(args_dict.get("repeat", 2)) 40 41 default_actions = str("reboot,unplug,plug,login,unplug,plug," 42 "suspend,resume,unplug,suspend,plug,resume," 43 "suspend,unplug,resume,plug") 44 45 action_sequence = str(args_dict.get("action_sequence", default_actions)) 46 47 usb_list = ["\"Seiko Epson Corp.|Hewlett-Packard\""] 48 usb_checks = None 49 50 job.run_test("platform_ExternalUsbPeripherals", host=host, 51 disable_sysinfo=True, client_autotest="desktopui_SimpleLogin", 52 action_sequence=action_sequence, repeat=repeat, 53 usb_list=usb_list, usb_checks=usb_checks, tag="printer") 54 55 parallel_simple(run, machines) 56