1# Copyright 2016 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 common
6from autotest_lib.server import test
7
8class infra_FirmwareAutoupdate(test.test):
9    """
10    Update RW firmware in the target DUT.
11
12    In production, consumer devices periodically update their read/write
13    firmware during auto-update cycles.  This happens when the firmware
14    bundled with a newly update image is different from the firmware
15    currently installed on the device.
16
17    In the test lab, this step is suppressed, to prevent devices from
18    inadvertently updating to a new firmware version as a consequence of
19    installing a new ChromeOS build for testing.  In particular,
20    because the firmware is updated whenever the bundled firmware is
21    _different_, and not merely _more recent_, suppressing the update
22    prevents unexpectedly downgrading the firmware.
23
24    Nonetheless, we sometimes want more recent firmware on a DUT than
25    the image that was delivered from the factory.  This test allows
26    updating the firmware to the installed firmware bundle, using the
27    same procedure as is used during autoupdate.
28    """
29    version = 1
30
31    def run_once(self, host):
32        host.run('chromeos-firmwareupdate --mode=autoupdate')
33        host.reboot()
34