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
5from autotest_lib.client.common_lib.cros import cr50_utils
6from autotest_lib.server.cros.faft.cr50_test import Cr50Test
7
8
9class firmware_Cr50UpdateScriptStress(Cr50Test):
10    """
11    Stress the Cr50 Update Script.
12
13    Clear the update state to force the device to retry the cr50 update. This
14    will not update cr50. It will just force the cr50-update script to get
15    the version and verify an update is not needed. If there are any reboots
16    caused by the update verification, then we know something failed.
17
18    This test is intended to be run with many iterations to ensure that the
19    update process is not flaky.
20    """
21    version = 1
22
23    def run_once(self, host):
24        """Run the cr50 update script and make sure there aren't errors"""
25        # Find the last cr50 update message already in /var/log/messages
26        last_message = cr50_utils.CheckForFailures(host, '')
27
28        # Clears the state and reboots the system to get the cr50-update to run
29        cr50_utils.ClearUpdateStateAndReboot(host)
30
31        cr50_utils.CheckForFailures(host, last_message)
32