Add test for detecting peripheral device after CfM reboot.
Reboot CfM and check detection of the device. The device is specified by
vid_pid argument.
BUG=b:74944360
TEST=Local DUT
Change-Id: Icf860863ce7c5934f04094b2430fa6ea11b1e528
Reviewed-on: https://chromium-review.googlesource.com/964364
Commit-Ready: Viktor Wilhelmsson <wilhelmsson@google.com>
Tested-by: Viktor Wilhelmsson <wilhelmsson@google.com>
Reviewed-by: Kristoffer Erlandsson <kerl@google.com>
diff --git a/server/site_tests/enterprise_CFM_PeripheralQualification/control.reboot_stress b/server/site_tests/enterprise_CFM_PeripheralQualification/control.reboot_stress
new file mode 100644
index 0000000..264aac8
--- /dev/null
+++ b/server/site_tests/enterprise_CFM_PeripheralQualification/control.reboot_stress
@@ -0,0 +1,53 @@
+# Copyright 2018 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.cros.cfm.configurable_test.dsl import *
+from autotest_lib.server import utils
+
+AUTHOR = "wilhelmsson@google.com, kerl@google.com, chromeos-meetings@google.com"
+NAME = "enterprise_CFM_PeripheralQualification.reboot_stress"
+PURPOSE = "Stresses a peripheral device by repeatedly rebooting the CfM."
+CRITERIA = "The device is detectable as a USB device after reboot"
+TIME = "LONG"
+TEST_CATEGORY = "Stress"
+TEST_TYPE = "server"
+
+DOC = """
+Repeatedly reboots the CfM and verifies that the device can be enumerated
+after each reboot.
+
+The test requires a vid_pid argument (e.g. 18d1:8001) that determines which
+device to detect after reboot. This enables testing custom devices from
+Moblab or from a local workstation.
+"""
+
+args_dict = utils.args_to_dict(args)
+vid,pid = args_dict['vid_pid'].split(':')
+product = 'CustomProduct' # The product is only informational, set it to whatever.
+# Interfaces are only needed when verifying them, set them to empty in this case.
+interfaces = []
+device = usb_device_spec.UsbDeviceSpec(vid, pid, product, interfaces)
+
+cfm_test = CfmTest(
+ configuration=Configuration(skip_enrollment=True),
+ scenario=Scenario(
+ AssertUsbDevices([device]),
+ RepeatTimes(10, Scenario(
+ RebootDut(),
+ AssertUsbDevices([device])
+ # TODO(crbug.com/814775): mosys-info always crashes on reboot, why
+ # we always have new crash files. Enable this check when that is
+ # fixed.
+ # AssertNoNewCrashes()
+ ))
+ ),
+)
+
+servo_args = hosts.CrosHost.get_servo_arguments(args_dict)
+def run_test(machine):
+ job.run_test("enterprise_CFM_PeripheralQualification",
+ cfm_test = cfm_test,
+ tag = 'reboot_stress',
+ host = hosts.create_host(machine, servo_args=servo_args))
+
+parallel_simple(run_test, machines)