Renamed kernel_usb suite and add one manual suite

Also, stopped running printer detection tests

BUG=None
TEST=None

Change-Id: I19fac36fd280e77d78c34ca406d5d956ecc28358
Reviewed-on: https://chromium-review.googlesource.com/371564
Reviewed-by: Sridhar Sonti <sontis@google.com>
Reviewed-by: Kalin Stoyanov <kalin@chromium.org>
Tested-by: Kalin Stoyanov <kalin@chromium.org>
diff --git a/server/site_tests/kernel_ExternalUsbPeripheralsDetectionTest/control b/server/site_tests/kernel_ExternalUsbPeripheralsDetectionTest/control
index 8661837..441a5fa 100644
--- a/server/site_tests/kernel_ExternalUsbPeripheralsDetectionTest/control
+++ b/server/site_tests/kernel_ExternalUsbPeripheralsDetectionTest/control
@@ -12,7 +12,7 @@
 TEST_CATEGORY = "Functional"
 TEST_CLASS = "platform, kernel"
 TEST_TYPE = "server"
-ATTRIBUTES = "suite:kernel_usb"
+ATTRIBUTES = "suite:usb_detect"
 DEPENDENCIES = "servo, kernel_usb"
 
 DOC = """
diff --git a/server/site_tests/kernel_ExternalUsbPeripheralsDetectionTest/control.printer_epson b/server/site_tests/kernel_ExternalUsbPeripheralsDetectionTest/control.printer_epson
index ec455a3..d90d08d 100644
--- a/server/site_tests/kernel_ExternalUsbPeripheralsDetectionTest/control.printer_epson
+++ b/server/site_tests/kernel_ExternalUsbPeripheralsDetectionTest/control.printer_epson
@@ -12,7 +12,6 @@
 TEST_CATEGORY = "Functional"
 TEST_CLASS = "platform, kernel"
 TEST_TYPE = "server"
-ATTRIBUTES = "suite:kernel_usb"
 DEPENDENCIES = "servo, usb_printer_epson"
 
 DOC = """
diff --git a/server/site_tests/kernel_ExternalUsbPeripheralsDetectionTest/control.printer_hp b/server/site_tests/kernel_ExternalUsbPeripheralsDetectionTest/control.printer_hp
index 3354e6f..971196f 100644
--- a/server/site_tests/kernel_ExternalUsbPeripheralsDetectionTest/control.printer_hp
+++ b/server/site_tests/kernel_ExternalUsbPeripheralsDetectionTest/control.printer_hp
@@ -12,7 +12,6 @@
 TEST_CATEGORY = "Functional"
 TEST_CLASS = "platform, kernel"
 TEST_TYPE = "server"
-ATTRIBUTES = "suite:kernel_usb"
 DEPENDENCIES = "servo, usb_printer_hp"
 
 DOC = """
diff --git a/server/site_tests/logging_GenerateCrashFiles/control.kernel b/server/site_tests/logging_GenerateCrashFiles/control.kernel
index 56bebf6..af8cb80 100644
--- a/server/site_tests/logging_GenerateCrashFiles/control.kernel
+++ b/server/site_tests/logging_GenerateCrashFiles/control.kernel
@@ -9,7 +9,7 @@
 TEST_CATEGORY = "Functional"
 TEST_CLASS = "logging"
 TEST_TYPE = "server"
-ATTRIBUTES = "suite:kernel_usb"
+ATTRIBUTES = "suite:usb_detect,suite:manual_platform_suite"
 
 DOC = """
 Crash process and confirm log files are generated.
diff --git a/server/site_tests/logging_GenerateCrashFiles/control.process b/server/site_tests/logging_GenerateCrashFiles/control.process
index c24c36c..85aa2b4 100644
--- a/server/site_tests/logging_GenerateCrashFiles/control.process
+++ b/server/site_tests/logging_GenerateCrashFiles/control.process
@@ -9,7 +9,7 @@
 TEST_CATEGORY = "Functional"
 TEST_CLASS = "logging"
 TEST_TYPE = "server"
-ATTRIBUTES = "suite:kernel_usb"
+ATTRIBUTES = "suite:usb_detect,suite:manual_platform_suite"
 
 DOC = """
 Crash process and confirm log files are generated.
diff --git a/server/site_tests/platform_ExternalUsbPeripherals/control.crashes b/server/site_tests/platform_ExternalUsbPeripherals/control.crashes
index 9c3eae4..8255331 100644
--- a/server/site_tests/platform_ExternalUsbPeripherals/control.crashes
+++ b/server/site_tests/platform_ExternalUsbPeripherals/control.crashes
@@ -12,7 +12,7 @@
 TEST_CATEGORY = "Functional"
 TEST_CLASS = "platform"
 TEST_TYPE = "server"
-ATTRIBUTES = "suite:kernel_usb"
+ATTRIBUTES = "suite:usb_detect_stress"
 DEPENDENCIES = "servo, usb_detect"
 
 DOC = """
diff --git a/server/site_tests/platform_ExternalUsbPeripherals/control.detect b/server/site_tests/platform_ExternalUsbPeripherals/control.detect
index 3c73637..018d439 100644
--- a/server/site_tests/platform_ExternalUsbPeripherals/control.detect
+++ b/server/site_tests/platform_ExternalUsbPeripherals/control.detect
@@ -12,7 +12,7 @@
 TEST_CATEGORY = "Functional"
 TEST_CLASS = "platform"
 TEST_TYPE = "server"
-ATTRIBUTES = "suite:kernel_usb"
+ATTRIBUTES = "suite:usb_detect_stress"
 DEPENDENCIES = "servo, usb_detect"
 
 DOC = """
diff --git a/server/site_tests/platform_ExternalUsbPeripherals/control.printer b/server/site_tests/platform_ExternalUsbPeripherals/control.printer
index cd0ff25..755250b 100644
--- a/server/site_tests/platform_ExternalUsbPeripherals/control.printer
+++ b/server/site_tests/platform_ExternalUsbPeripherals/control.printer
@@ -12,7 +12,6 @@
 TEST_CATEGORY = "Functional"
 TEST_CLASS = "platform"
 TEST_TYPE = "server"
-ATTRIBUTES = "suite:kernel_usb"
 DEPENDENCIES = "servo, usb_printer"
 
 DOC = """
diff --git a/server/site_tests/platform_ExternalUsbPeripherals/control.usb_detect.crashes b/server/site_tests/platform_ExternalUsbPeripherals/control.usb_detect.crashes
new file mode 100644
index 0000000..6d9b11f
--- /dev/null
+++ b/server/site_tests/platform_ExternalUsbPeripherals/control.usb_detect.crashes
@@ -0,0 +1,87 @@
+# Copyright (c) 2016 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 = "platform_ExternalUsbPeripherals.usb_detect.crashes"
+PURPOSE = "Servo based USB boot stress 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"
+ATTRIBUTES = "suite:manual_platform_suite"
+DEPENDENCIES = "servo, usb_detect"
+
+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
+- 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
+- USB mouse
+- USB 3G modem
+- USB SD card reader(one microSD card plugged)
+- USB connected phone(optional)
+"""
+
+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\"",
+                "\"Kingston Technology Company Inc.\"",
+                "\"Alcor Micro Corp.\"",
+                "\"Microsoft Corp.|C-Media Electronics, Inc. Audio Adapter\"",
+                "\"Huawei Technologies Co., Ltd. Modem/Networkcard\"",
+                "\"Realtek Semiconductor Corp.\"",
+                # Commenting out due to crbug.com/488667.
+                #"LG Electronics, Inc.",
+               ]
+    usb_checks = {
+        # USB Audio Output devices
+        str("cras_test_client --dump_server_info | "
+            "awk \"/Output Devices:/,/Output Nodes:/\" | grep -E ") :
+            ["\"Microsoft LifeChat LX-3000: 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 -E ") :
+            ["\"TeckNet: USB Audio|USB 2.0 PC Camera\"",
+             "\"Microsoft LifeChat LX-3000: USB Audio|C-Media USB Headphone Set: USB Audio\""],
+        # USB stick four partitions volumes
+        "loggedin:ls -l /media/removable/ | grep -i " :
+            ["\"USB Drive\"", "\"SD Card\"", "ExFAT", "Ext4", "FAT", "NTFS"],
+        # USB Web camera
+        "cat /sys/class/video4linux/video*/name | grep -E " :
+            ["\"TeckNet|USB 2.0 PC Camera\""],
+        }
+
+    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,
+                 crash_check=True, tag="usb_detect.crashes")
+
+parallel_simple(run, machines)
diff --git a/suite_scheduler.ini b/suite_scheduler.ini
index 5ef7466..518e33f 100644
--- a/suite_scheduler.ini
+++ b/suite_scheduler.ini
@@ -589,7 +589,7 @@
 
 [UsbDetectStress]
 run_on: nightly
-suite: kernel_usb
+suite: usb_detect_stress
 branch_specs: ==tot
 pool: usb_peripherals
 
diff --git a/test_suites/control.kernel_usb b/test_suites/control.manual_platform_suite
similarity index 62%
copy from test_suites/control.kernel_usb
copy to test_suites/control.manual_platform_suite
index ef8c800..ea404a4 100644
--- a/test_suites/control.kernel_usb
+++ b/test_suites/control.manual_platform_suite
@@ -1,10 +1,10 @@
-# Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
+# Copyright (c) 2016 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.
 
 AUTHOR = "Chrome OS Team"
-NAME = "kernel_usb"
-PURPOSE = "USB peripherals detection."
+NAME = "platform_manual_suite"
+PURPOSE = "USB peripherals detection during stress procedure."
 
 TIME = "LONG"
 TEST_CATEGORY = "Functional"
@@ -12,11 +12,11 @@
 TEST_TYPE = "Server"
 
 DOC = """
-This is the kernel_usb test suite.
+This is the manually run usb detection test suite.
 
-This suite is meant to cover boards on different kernel version
-for ARM and non-ARM boards. USB detection tests will be exercizing
-short detect tests and stress scenarios.
+This suite is meant to cover manual test runs.
+USB detection tests will be exercizing
+USB detect tests during multiple steps.
 Consistent failure to detect peripherals will indicate kernel
 regression.
 
@@ -33,16 +33,8 @@
 from autotest_lib.server.cros import provision
 from autotest_lib.server.cros.dynamic_suite import dynamic_suite
 
-_BUG_TEMPLATE = {
-    'labels': ['OS-Chrome', 'KernelUsb-Bug'],
-    'components': ['OS>Kernel'],
-    'owner': 'kalin@chromium.org',
-}
 
-
-args_dict['add_experimental'] = True
-args_dict['bug_template'] = _BUG_TEMPLATE
-args_dict['name'] = 'kernel_usb'
+args_dict['name'] = 'platform_manual_suite'
 args_dict['version_prefix'] = provision.CROS_VERSION_PREFIX
 args_dict['job'] = job
 
diff --git a/test_suites/control.kernel_usb b/test_suites/control.usb_detect_stress
similarity index 73%
rename from test_suites/control.kernel_usb
rename to test_suites/control.usb_detect_stress
index ef8c800..faf25c1 100644
--- a/test_suites/control.kernel_usb
+++ b/test_suites/control.usb_detect_stress
@@ -1,10 +1,10 @@
-# Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
+# Copyright (c) 2016 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.
 
 AUTHOR = "Chrome OS Team"
-NAME = "kernel_usb"
-PURPOSE = "USB peripherals detection."
+NAME = "usb_detect_stress"
+PURPOSE = "USB peripherals detection during stress procedure."
 
 TIME = "LONG"
 TEST_CATEGORY = "Functional"
@@ -12,11 +12,11 @@
 TEST_TYPE = "Server"
 
 DOC = """
-This is the kernel_usb test suite.
+This is the usb_detect_stress test suite.
 
 This suite is meant to cover boards on different kernel version
 for ARM and non-ARM boards. USB detection tests will be exercizing
-short detect tests and stress scenarios.
+USB detect tests during multiple steps.
 Consistent failure to detect peripherals will indicate kernel
 regression.
 
@@ -33,16 +33,9 @@
 from autotest_lib.server.cros import provision
 from autotest_lib.server.cros.dynamic_suite import dynamic_suite
 
-_BUG_TEMPLATE = {
-    'labels': ['OS-Chrome', 'KernelUsb-Bug'],
-    'components': ['OS>Kernel'],
-    'owner': 'kalin@chromium.org',
-}
-
 
 args_dict['add_experimental'] = True
-args_dict['bug_template'] = _BUG_TEMPLATE
-args_dict['name'] = 'kernel_usb'
+args_dict['name'] = 'usb_detect_stress'
 args_dict['version_prefix'] = provision.CROS_VERSION_PREFIX
 args_dict['job'] = job