Added closelid and openlid actions to the test.
BUG=chromium:623152
TEST=None
Change-Id: Ic09d3ad53dc66e152e3a84da03a8fa14f890e028
Reviewed-on: https://chromium-review.googlesource.com/357884
Commit-Ready: Sridhar Sonti <sontis@chromium.org>
Tested-by: Sridhar Sonti <sontis@chromium.org>
Reviewed-by: Kalin Stoyanov <kalin@chromium.org>
(cherry picked from commit b91faa5611e549c6bbcc6797317361c72826ebec)
Reviewed-on: https://chromium-review.googlesource.com/380521
Reviewed-by: Sridhar Sonti <sontis@chromium.org>
Tested-by: Kalin Stoyanov <kalin@chromium.org>
diff --git a/server/site_tests/platform_ExternalUsbPeripherals/control.detect.login_closelid_openlid b/server/site_tests/platform_ExternalUsbPeripherals/control.detect.login_closelid_openlid
new file mode 100644
index 0000000..8cb0c52
--- /dev/null
+++ b/server/site_tests/platform_ExternalUsbPeripherals/control.detect.login_closelid_openlid
@@ -0,0 +1,85 @@
+# Copyright 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.detect.login_closelid_openlid"
+PURPOSE = "Servo based USB boot stress test"
+CRITERIA = "This test will fail if any of the actions or checks fail."
+TIME = "SHORT"
+TEST_CATEGORY = "Functional"
+TEST_CLASS = "platform"
+TEST_TYPE = "server"
+ATTRIBUTES = "suite:usb_detect"
+DEPENDENCIES = "servo, usb_detect, use_lid"
+JOB_RETRIES = 2
+
+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
+- 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", 1))
+
+ default_actions = str("login,closelid,openlid")
+
+ 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, tag="detect.login_closelid_openlid")
+
+parallel_simple(run, machines)
diff --git a/server/site_tests/platform_ExternalUsbPeripherals/control.detect.login_closelid_unplug_openlid_plug b/server/site_tests/platform_ExternalUsbPeripherals/control.detect.login_closelid_unplug_openlid_plug
new file mode 100644
index 0000000..68e6cd9
--- /dev/null
+++ b/server/site_tests/platform_ExternalUsbPeripherals/control.detect.login_closelid_unplug_openlid_plug
@@ -0,0 +1,85 @@
+# Copyright 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.detect.login_closelid_unplug_openlid_plug"
+PURPOSE = "Servo based USB boot stress test"
+CRITERIA = "This test will fail if any of the actions or checks fail."
+TIME = "SHORT"
+TEST_CATEGORY = "Functional"
+TEST_CLASS = "platform"
+TEST_TYPE = "server"
+ATTRIBUTES = "suite:usb_detect"
+DEPENDENCIES = "servo, usb_detect, use_lid"
+JOB_RETRIES = 2
+
+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
+- 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", 1))
+
+ default_actions = str("login,closelid,unplug,openlid,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, tag="login_closelid_unplug_openlid_plug")
+
+parallel_simple(run, machines)
diff --git a/server/site_tests/platform_ExternalUsbPeripherals/control.detect.login_unplug_closelid_openlid_plug b/server/site_tests/platform_ExternalUsbPeripherals/control.detect.login_unplug_closelid_openlid_plug
new file mode 100644
index 0000000..c19c6fb
--- /dev/null
+++ b/server/site_tests/platform_ExternalUsbPeripherals/control.detect.login_unplug_closelid_openlid_plug
@@ -0,0 +1,85 @@
+# Copyright 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.detect.login_unplug_closelid_openlid_plug"
+PURPOSE = "Servo based USB boot stress test"
+CRITERIA = "This test will fail if any of the actions or checks fail."
+TIME = "SHORT"
+TEST_CATEGORY = "Functional"
+TEST_CLASS = "platform"
+TEST_TYPE = "server"
+ATTRIBUTES = "suite:usb_detect"
+DEPENDENCIES = "servo, usb_detect, use_lid"
+JOB_RETRIES = 2
+
+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
+- 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", 1))
+
+ default_actions = str("login,unplug,closelid,openlid,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, tag="login_unplug_closelid_openlid_plug")
+
+parallel_simple(run, machines)
diff --git a/server/site_tests/platform_ExternalUsbPeripherals/control.detect.login_unplug_closelid_plug_openlid b/server/site_tests/platform_ExternalUsbPeripherals/control.detect.login_unplug_closelid_plug_openlid
new file mode 100644
index 0000000..730a66b
--- /dev/null
+++ b/server/site_tests/platform_ExternalUsbPeripherals/control.detect.login_unplug_closelid_plug_openlid
@@ -0,0 +1,85 @@
+# Copyright 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.detect.login_unplug_closelid_plug_openlid"
+PURPOSE = "Servo based USB boot stress test"
+CRITERIA = "This test will fail if any of the actions or checks fail."
+TIME = "SHORT"
+TEST_CATEGORY = "Functional"
+TEST_CLASS = "platform"
+TEST_TYPE = "server"
+ATTRIBUTES = "suite:usb_detect"
+DEPENDENCIES = "servo, usb_detect, use_lid"
+JOB_RETRIES = 2
+
+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
+- 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", 1))
+
+ default_actions = str("login,unplug,closelid,plug,openlid")
+
+ 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, tag="login_unplug_closelid_plug_openlid")
+
+parallel_simple(run, machines)
diff --git a/server/site_tests/platform_ExternalUsbPeripherals/platform_ExternalUsbPeripherals.py b/server/site_tests/platform_ExternalUsbPeripherals/platform_ExternalUsbPeripherals.py
index 3fd46d2..5f5bfc6 100644
--- a/server/site_tests/platform_ExternalUsbPeripherals/platform_ExternalUsbPeripherals.py
+++ b/server/site_tests/platform_ExternalUsbPeripherals/platform_ExternalUsbPeripherals.py
@@ -129,6 +129,23 @@
logging.debug('--- Resumed')
self.suspend_status = False
+ def close_lid(self):
+ """Close lid through servo to suspend the device."""
+ boot_id = self.host.get_boot_id()
+ logging.info('Closing lid...')
+ self.host.servo.lid_close()
+ self.host.test_wait_for_sleep(_LONG_TIMEOUT)
+ self.suspend_status = True
+ return boot_id
+
+
+ def open_lid(self, boot_id):
+ """Open lid through servo to resume."""
+ logging.info('Opening lid...')
+ self.host.servo.lid_open()
+ self.host.test_wait_for_resume(boot_id, _LONG_TIMEOUT)
+ self.suspend_status = False
+
def crash_not_detected(self, crash_path):
"""Check for kernel, browser, process crashes
@@ -304,6 +321,9 @@
if action == 'RESUME':
self.action_resume(boot_id)
time.sleep(_WAIT_DELAY)
+ elif action == 'OPENLID':
+ self.open_lid(boot_id)
+ time.sleep(_WAIT_DELAY)
elif action == 'UNPLUG':
self.set_hub_power(False)
elif action == 'PLUG':
@@ -322,6 +342,8 @@
self.login_status = False
elif action == 'SUSPEND':
boot_id = self.action_suspend()
+ elif action == 'CLOSELID':
+ boot_id = self.close_lid()
else:
logging.info('WRONG ACTION: %s .', self.action_step)