Test to compare installed and available firmware.
In the lab the DUTs all run test images. That means that the firmware
updater is not automatically run. This test does a comparison of the
BIOS and EC (if available) versions installed against the ones
available in the firmware shellball.
No software is installed. This test is only to check the status of a
given DUT.
TEST=Manual; Ran agaist Peppy, Alex, and Zako
BUG=chromium:394517
Change-Id: I330884502a9591c7eb7f58492c2adcb8cd4c9801
Reviewed-on: https://chromium-review.googlesource.com/209679
Tested-by: Kris Rambish <krisr@chromium.org>
Reviewed-by: Yusuf Mohsinally <mohsinally@chromium.org>
Commit-Queue: Kris Rambish <krisr@chromium.org>
diff --git a/server/site_tests/firmware_CompareInstalledToShellBall/control b/server/site_tests/firmware_CompareInstalledToShellBall/control
new file mode 100644
index 0000000..032bd4a
--- /dev/null
+++ b/server/site_tests/firmware_CompareInstalledToShellBall/control
@@ -0,0 +1,25 @@
+# Copyright (c) 2014 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 = "firmware_CompareInstalledToShellBall"
+PURPOSE = "Compare the firmware version to that in the shellball"
+CRITERIA = "This test will pass if installed and available firmware match."
+TIME = "SHORT"
+TEST_CATEGORY = "Functional"
+TEST_CLASS = "firmware"
+TEST_TYPE = "server"
+
+DOC = """
+This test compares the installed BIOS and EC versions to those in the
+shallball. If they are not the same it will fail. This test is used
+to determine if devices in the lab need to be updated.
+"""
+
+def run(machine):
+ host = hosts.create_host(machine)
+
+ job.run_test('firmware_CompareInstalledToShellBall', host=host)
+
+parallel_simple(run, machines)
diff --git a/server/site_tests/firmware_CompareInstalledToShellBall/firmware_CompareInstalledToShellBall.py b/server/site_tests/firmware_CompareInstalledToShellBall/firmware_CompareInstalledToShellBall.py
new file mode 100644
index 0000000..ea2b449
--- /dev/null
+++ b/server/site_tests/firmware_CompareInstalledToShellBall/firmware_CompareInstalledToShellBall.py
@@ -0,0 +1,47 @@
+# Copyright (c) 2014 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.
+
+from autotest_lib.client.common_lib import error
+from autotest_lib.server import test
+from autotest_lib.server.cros.faft.rpc_proxy import RPCProxy
+
+class firmware_CompareInstalledToShellBall(test.test):
+ """Compare the installed BIOS and EC versions to those in the shellball."""
+ version = 1
+
+ def run_once(self, host):
+ self.faft_client = RPCProxy(host)
+ installed_ec = self.faft_client.ec.get_version()
+ installed_bios = self.faft_client.system.get_crossystem_value('fwid')
+
+ # Chromeboxes do not have an EC
+ if 'mosys' in installed_ec:
+ installed_ec = None
+
+ available_ec = None
+ available_bios = None
+ shellball = host.run('/usr/sbin/chromeos-firmwareupdate -V').stdout
+ for line in shellball.splitlines():
+ if line.startswith('BIOS version:'):
+ parts = line.split()
+ available_bios = parts[2].strip()
+ if line.startswith('EC version:'):
+ parts = line.split()
+ available_ec = parts[2].strip()
+
+ error_message = None
+ if installed_bios != available_bios:
+ error_message = str('BIOS versions do not match! Installed: %s '
+ 'Available %s' % (installed_bios,
+ available_bios))
+ if installed_ec != available_ec:
+ ec_message = str('EC versions do not match! Installed: %s '
+ 'Available %s ' % (installed_ec, available_ec))
+ if error_message:
+ error_message += '\n' + ec_message
+ else:
+ error_message = ec_message
+
+ if error_message:
+ raise error.TestFail(error_message)