Home | History | Annotate | Download | only in enterprise_CFM_PeripheralQualification
      1 # Copyright 2018 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 from autotest_lib.server.cros.cfm.configurable_test.dsl import *
      5 from autotest_lib.server import utils
      6 
      7 AUTHOR = "wilhelmsson (a] google.com, kerl (a] google.com, chromeos-meetings (a] google.com"
      8 NAME = "enterprise_CFM_PeripheralQualification.reboot_stress"
      9 PURPOSE = "Stresses a peripheral device by repeatedly rebooting the CfM."
     10 CRITERIA = "The device is detectable as a USB device after reboot"
     11 TIME = "LONG"
     12 TEST_CATEGORY = "Stress"
     13 TEST_TYPE = "server"
     14 
     15 DOC = """
     16 Repeatedly reboots the CfM and verifies that the device can be enumerated
     17 after each reboot.
     18 
     19 The test requires a vid_pid argument (e.g. 18d1:8001) that determines which
     20 device to detect after reboot. This enables testing custom devices from
     21 Moblab or from a local workstation.
     22 """
     23 
     24 args_dict = utils.args_to_dict(args)
     25 vid,pid = args_dict['vid_pid'].split(':')
     26 # The product is only informational, set it to whatever.
     27 product = args_dict.get('product', 'customProduct')
     28 # Interfaces are only needed when verifying them, set them to empty in this case.
     29 interfaces = []
     30 device = usb_device_spec.UsbDeviceSpec(vid, pid, product, interfaces)
     31 repeat = int(args_dict.get('repeat', 10))
     32 
     33 cfm_test = CfmTest(
     34     configuration=Configuration(skip_enrollment=True),
     35     scenario=Scenario(
     36         AssertUsbDevices([device]),
     37         RepeatTimes(repeat, Scenario(
     38             RebootDut(),
     39             AssertUsbDevices([device])
     40             # TODO(crbug.com/814775): mosys-info always crashes on reboot, why
     41             # we always have new crash files. Enable this check when that is
     42             # fixed.
     43             # AssertNoNewCrashes()
     44         ))
     45     ),
     46 )
     47 
     48 def run_test(machine):
     49     job.run_test("enterprise_CFM_PeripheralQualification",
     50                  cfm_test = cfm_test,
     51                  tag = 'reboot_stress',
     52                  host = hosts.create_host(machine))
     53 
     54 parallel_simple(run_test, machines)
     55