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 5import logging 6 7from autotest_lib.client.common_lib import error 8from autotest_lib.client.common_lib import utils 9from autotest_lib.client.common_lib.cros import dev_server 10from autotest_lib.server import host_attributes 11 12AUTHOR = "Chrome OS Team" 13NAME = "platform_InstallTestImage" 14TIME = "MEDIUM" 15TEST_CATEGORY = "Install" 16TEST_CLASS = "platform" 17TEST_TYPE = "server" 18 19DOC = """ 20This test installs a specified test image onto a servo-connected DUT. 21The principle purpose is to allow installing a known-good image onto 22a wedged unit that would otherwise have to be re-imaged manually. 23 24Here is the command to install a recovery image with a locally attached 25servo: 26 test_that -b ${BOARD} ${IP_ADDRESS} \ 27 --args="image=$IMAGE_PATH" platform_InstallTestImage 28 29""" 30 31args_dict = utils.args_to_dict(args) 32servo_args = hosts.CrosHost.get_servo_arguments(args_dict) 33image_url = args_dict.get("image", None) 34 35def run(machine): 36 # Setup the client machine. 37 host = hosts.create_host(machine, servo_args=servo_args) 38 # If we're invoked from test_that, the user can pass an 39 # optional "image" argument. If it's omitted, we want to pass 40 # `None` to the test. 41 job.fast = True 42 job.run_test("platform_InstallTestImage", host=host, local=False, 43 disable_sysinfo=True, image_url=image_url) 44 45parallel_simple(run, machines) 46