1# Copyright (c) 2012 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.server import utils
6
7AUTHOR = "Chrome OS Team"
8NAME = "firmware_UpdateFirmwareVersion"
9PURPOSE = "Servo based firmware update test which checks the firmware version."
10CRITERIA = """
11Prerequirement is as follow:
121. This test should run in normal mode.
132. Fwid should match shellball's (/usr/sbin/chromeos-firmwareupdate) fwid,
14   unless this test use a given shellball.
153. A USB disk should be plugged-in, which contains a Chrome OS test image.
16
17This test will fail if one of the following conditions is met:
181. Firmware update fails.
192. After firmware update, device restart with firmware A.
203. Firmware version does not increase after firmware update.
214. Firmware version does not recover to original version after recovery.
22"""
23# TODO(waihong): Add back to the regular FAFT suite when the TPM recovery
24# is added to the lab infrastructure.
25ATTRIBUTES = "suite:faft_lv5"
26SUITE = "faft_lv5"
27TIME = "SHORT"
28TEST_CATEGORY = "Functional"
29TEST_CLASS = "firmware"
30TEST_TYPE = "server"
31
32DOC = """
33This test requires a USB test image plugged in. The firmware id
34the current running firmware must matches the system shellball's, or user
35can provide a shellball to do this test. In this way, the client will be
36update with the given shellball first. On runtime, this test modifies the
37firmware version of the shellball and runs autoupdate. Check firmware
38version after boot with firmware B, and then recover firmware A and B to
39original shellball.
40"""
41
42args_dict = utils.args_to_dict(args)
43servo_args = hosts.CrosHost.get_servo_arguments(args_dict)
44
45def run_updatefirmwareversion(machine):
46    host = hosts.create_host(machine, servo_args=servo_args)
47    job.run_test("firmware_UpdateFirmwareVersion", host=host, cmdline_args=args,
48                 disable_sysinfo=True)
49
50parallel_simple(run_updatefirmwareversion, machines)
51