• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2017 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
5import logging
6import time
7
8from autotest_lib.client.common_lib import error
9from autotest_lib.client.common_lib.cros import cr50_utils
10from autotest_lib.server import autotest, test
11from autotest_lib.server.cros.faft.firmware_test import FirmwareTest
12
13
14class firmware_Cr50UpdateScriptStress(FirmwareTest):
15    """
16    Stress the Cr50 Update Script.
17
18    Clear the update state to force the device to retry the cr50 update. This
19    will not update cr50. It will just force the cr50-update script to get
20    the version and verify an update is not needed. If there are any reboots
21    caused by the update verification, then we know something failed.
22
23    This test is intended to be run with many iterations to ensure that the
24    update process is not flaky.
25    """
26    version = 1
27
28    def cleanup(self):
29        """Reenable CCD before cleanup"""
30        if hasattr(self, "cr50"):
31            self.cr50.ccd_enable()
32
33        super(firmware_Cr50UpdateScriptStress, self).cleanup()
34
35
36    def run_once(self, host, cmdline_args):
37        # Disable CCD so it doesn't interfere with the Cr50 AP usb connection.
38        if hasattr(self, "cr50"):
39            self.cr50.ccd_disable()
40
41        # Find the last cr50 update message already in /var/log/messages
42        last_message = cr50_utils.CheckForFailures(host, '')
43
44        # Clears the state and reboots the system to get the cr50-update to run
45        cr50_utils.ClearUpdateStateAndReboot(host)
46
47        cr50_utils.CheckForFailures(host, last_message)
48