1 # Copyright (c) 2010 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 5 AUTHOR = "Chrome OS Team" 6 NAME = "InstallFW" 7 TIME = "MEDIUM" 8 TEST_CATEGORY = "Install" 9 TEST_CLASS = "platform" 10 TEST_TYPE = "server" 11 12 DOC = """ 13 This test install the BIOS/EC on a specified device. 14 This is useful for testing firmware. 15 Here is the command to install a given firmware, which is either a raw binary 16 or a shellball: 17 test_that --args='fw_path=<PATH_TO_FW_FILE> 18 fw_name=<NAME_OF_THE_FILE>' 19 fw_type=<TYPE_OF_FW> 20 --board=<board name> 21 <IP addres> 22 platform_InstallFW 23 or install the local shellball (/usr/sbin/chromeos-firmwareupdate) in the 24 current client image: 25 test_that --args='fw_path=local 26 fw_type=<bios/ec>' 27 --board=<board name> 28 <IP addres> 29 platform_InstallFW 30 """ 31 32 import os 33 from autotest_lib.client.common_lib import error 34 35 # Convert autoserv args to something usable. 36 opts = dict([[k, v] for (k, _, v) in [x.partition('=') for x in args]]) 37 38 def run_installfw(machine): 39 # Verify FW type in arg. 40 if 'fw_type' not in opts: 41 raise error.TestFail('No --fw_type specified') 42 # Verify fw_type value either 'bios' or 'ec'. 43 if not (opts['fw_type'] == 'bios' or opts['fw_type'] == 'ec'): 44 raise error.TestFail('Wrong --fw_type specified. ' 45 'Correct FW Options are bios or ec.') 46 # Verify FW path arg. 47 if 'fw_path' not in opts: 48 raise error.TestFail('No --fw_path specified') 49 # Verify fw_name. 50 if 'fw_name' not in opts: 51 if opts['fw_path'] == 'local': 52 opts['fw_name'] = None 53 elif os.path.isfile(opts['fw_path']): 54 opts['fw_name'] = os.path.basename(opts['fw_path']) 55 opts['fw_path'] = os.path.dirname(opts['fw_path']) 56 else: 57 raise error.TestFail('No --fw_name specified') 58 # Setup the client machine. 59 host = hosts.create_host(machine) 60 job.run_test("platform_InstallFW", host=host, fw_path=opts['fw_path'], 61 fw_type=opts['fw_type'], fw_name=opts['fw_name'], 62 disable_sysinfo=True) 63 64 parallel_simple(run_installfw, machines) 65