blob: e3a213a76331f71550100a9919f8d977ed091b0d [file] [log] [blame]
# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import logging
from autotest_lib.client.common_lib import utils
from autotest_lib.client.common_lib.cros import dev_server
from autotest_lib.server import host_attributes
AUTHOR = "Chrome OS Team"
NAME = "platform_InstallTestImage"
TIME = "MEDIUM"
TEST_CATEGORY = "Install"
TEST_CLASS = "platform"
TEST_TYPE = "server"
DOC = """
This test installs a specified test image onto a servo-connected DUT.
The principle purpose is to allow installing a known-good image onto
a wedged unit that would otherwise have to be re-imaged manually.
Here is the command to install a recovery image with a locally attached
servo:
run_remote_tests --args="image=$IMAGE_PATH" \
--servo --remote=$IP_ADDRESS --board=$BOARD \
platform_InstallTestImage
"""
DEFAULT_URL_FORMAT = '/static/servo-images/%s_test_image.bin'
args_dict = utils.args_to_dict(args)
servo_host = args_dict.get("servo_host", "localhost")
servo_port = args_dict.get("servo_port", None)
def run(machine):
# Setup the client machine.
host = hosts.create_host(machine, servo_host=servo_host,
servo_port=servo_port)
image = args_dict.get("image", None)
if image is None:
attributes = host_attributes.host_attributes(machine)
if hasattr(attributes, 'board'):
board = attributes.board
server = dev_server.ImageServer.devserver_url_for_servo(board)
image = server + (DEFAULT_URL_FORMAT % board)
logging.info("image URL is %s", image)
job.run_test("platform_InstallTestImage", host=host,
disable_sysinfo=True, image=image)
parallel_simple(run, machines)