[autotest] Add a test for updating DUT RW firmware.
This adds a test that runs chromeos-firmwareupdate with 'autoupdate'
mode, in order to update firmware on a DUT target.
BUG=chromium:214729
TEST=`atest job create` for the test in a local instance
Change-Id: I9add079f9ea3ef0cb44c358d089d1c954043fb62
Reviewed-on: https://chromium-review.googlesource.com/342162
Commit-Ready: Richard Barnette <jrbarnette@chromium.org>
Tested-by: Richard Barnette <jrbarnette@chromium.org>
Reviewed-by: Dan Shi <dshi@google.com>
(cherry picked from commit fe247dd229c08eb1c3f3c40075dbbc91b03145c2)
Reviewed-on: https://chromium-review.googlesource.com/347512
Reviewed-by: Keith Haddow <haddowk@chromium.org>
Reviewed-by: Bernie Thompson <bhthompson@chromium.org>
Commit-Queue: Keith Haddow <haddowk@chromium.org>
Tested-by: Keith Haddow <haddowk@chromium.org>
diff --git a/client/site_tests/infra_FirmwareAutoupdate/control b/client/site_tests/infra_FirmwareAutoupdate/control
new file mode 100644
index 0000000..2baf03a
--- /dev/null
+++ b/client/site_tests/infra_FirmwareAutoupdate/control
@@ -0,0 +1,17 @@
+# Copyright 2016 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.
+
+AUTHOR = "Chrome OS Team"
+NAME = "infra_FirmwareAutoupdate"
+TIME = "SHORT"
+TEST_TYPE = "client"
+
+DOC = """
+This is an administrative procedure used to update the RW firmware
+on a test device in the lab by running the following command:
+
+ chromeos-firmwareupdate --mode=autoupdate
+"""
+
+job.run_test('infra_FirmwareAutoupdate')
diff --git a/client/site_tests/infra_FirmwareAutoupdate/infra_FirmwareAutoupdate.py b/client/site_tests/infra_FirmwareAutoupdate/infra_FirmwareAutoupdate.py
new file mode 100644
index 0000000..73ef0b4
--- /dev/null
+++ b/client/site_tests/infra_FirmwareAutoupdate/infra_FirmwareAutoupdate.py
@@ -0,0 +1,35 @@
+# Copyright 2016 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.
+
+import common
+from autotest_lib.client.bin import test
+from autotest_lib.client.common_lib import utils
+
+class infra_FirmwareAutoupdate(test.test):
+ """
+ Update RW firmware in the target DUT.
+
+ In production, consumer devices periodically update their read/write
+ firmware during auto-update cycles. This happens when the firmware
+ bundled with a newly update image is different from the firmware
+ currently installed on the device.
+
+ In the test lab, this step is suppressed, to prevent devices from
+ inadvertently updating to a new firmware version as a consequence of
+ installing a new Chrome OS build for testing. In particular,
+ because the firmware is updated whenever the bundled firmware is
+ _different_, and not merely _more recent_, suppressing the update
+ prevents unexpectedly downgrading the firmware.
+
+ Nonetheless, we sometimes want more recent firmware on a DUT than
+ the image that was delivered from the factory. This test allows
+ updating the firmware to the installed firmware bundle, using the
+ same procedure as is used during autoupdate.
+ """
+ version = 1
+
+ def run_once(self, host=None):
+ utils.run('chromeos-firmwareupdate --mode=autoupdate',
+ stdout_tee=utils.TEE_TO_LOGS,
+ stderr_tee=utils.TEE_TO_LOGS)