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 5 import logging 6 7 from autotest_lib.client.common_lib import error 8 from autotest_lib.client.common_lib import utils 9 10 NAME = "provision_FactoryImage" 11 AUTHOR = "beeps (a] google.com, chromeos-lab-infrastructure (a] google.com" 12 TIME = "MEDIUM" 13 TEST_CATEGORY = "Install" 14 TEST_CLASS = "provision" 15 TEST_TYPE = "server" 16 17 DOC = """ 18 This test installs a specified factory image onto a servo-connected DUT. 19 It will attempt to retrieve the factory image from the canary branch, and 20 as such, the image_name must correspond to the name on that branch. For 21 example, to install the daisy_spring image from the canary-channel, one 22 would specify an image_name like: "daisy-spring/4262.320.0". 23 24 Here is the command to install a recovery image with a locally attached 25 servo: 26 test_that <remote_ip> provision_FactoryImage --board=<board> \ 27 --args="image_name=<board>/<build> servo_host=<ip of servo_host>" 28 29 where servo_host is the ip of beagle board running servod. If a servo_host 30 is not specified and the DUT is in .cros, we will construct the right name 31 for its servo, and if the DUT isn't in .cros we will attempt to use localhost 32 as the servohost. 33 """ 34 35 args_dict = utils.args_to_dict(args) 36 37 image_name = args_dict.get('image_name') 38 servo_host = args_dict.get('servo_host') 39 if not image_name: 40 raise error.AutoservError('Please specify --args="image_name=<board>/' 41 '<build> servo_host=<ip of servo_host>" when ' 42 'invoking test_that. Make sure the DUT you are ' 43 'trying to reimage has a beagle-board/servo ' 44 'attached.') 45 46 servo_args = hosts.CrosHost.get_servo_arguments(args_dict) 47 48 def run(machine): 49 """Create a host stage a factory image and reimage through servo.""" 50 host = hosts.create_host(machine, servo_args=servo_args) 51 image_url = host.stage_factory_image_for_servo(image_name=image_name) 52 job.run_test('provision_FactoryImage', host=host, 53 disable_sysinfo=True, image_url=image_url) 54 55 parallel_simple(run, machines) 56