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"""
23ATTRIBUTES = "suite:faft_bios, suite:faft_bios_ro_qual, suite:faft_bios_rw_qual, suite:faft_normal, suite:faft_lv5, suite:faft_bios_ec3po, suite:faft_bios_tot, suite:faft_smoke"
24DEPENDENCIES = "servo_state:WORKING"
25TIME = "SHORT"
26TEST_CATEGORY = "Functional"
27TEST_CLASS = "firmware"
28TEST_TYPE = "server"
29
30DOC = """
31This test requires a USB test image plugged in. The firmware id
32the current running firmware must matches the system shellball's, or user
33can provide a shellball to do this test. In this way, the client will be
34update with the given shellball first. On runtime, this test modifies the
35firmware version of the shellball and runs autoupdate. Check firmware
36version after boot with firmware B, and then recover firmware A and B to
37original shellball.
38"""
39
40args_dict = utils.args_to_dict(args)
41servo_args = hosts.CrosHost.get_servo_arguments(args_dict)
42
43def run_updatefirmwareversion(machine):
44    host = hosts.create_host(machine, servo_args=servo_args)
45    job.run_test("firmware_UpdateFirmwareVersion", host=host, cmdline_args=args,
46                 disable_sysinfo=True)
47
48parallel_simple(run_updatefirmwareversion, machines)
49