1# Copyright (c) 2013 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. 4import logging 5 6from autotest_lib.client.common_lib import error, utils 7 8 9AUTHOR = "sbasi, chromeos-lab-infrastructure@google.com" 10NAME = "generic_RebootTest" 11TIME = "SHORT" 12TEST_CATEGORY = "Functional" 13TEST_CLASS = "Generic" 14TEST_TYPE = "server" 15 16DOC = """ 17This server side test checks if a host, specified through the command line, 18can successfully reboot. It automatically detects the type of the host, 19creates the appropriate host object, and calls reboot on the host object. 20 21Example usage: 22test_that generic_RebootTest <sonic/cros/beaglobonedevice ip> --board=<board> 23A note about --board: <unless you're emerging sonic sources you 24can just use a chromeos board here, as all we need is test_that 25from the sysroot>. 26 27Typically, for the case of an adb host, we can send adb commands to the 28android device either through usb or tcp. If no device_hostname is specified 29the adb commands are sent to the android device over usb, via the beaglebone, 30whereas if the ip of the android device is specified through device_hostname 31we'll send the adb commands over tcp. 32""" 33 34args_dict = utils.args_to_dict(args) 35 36def run_reboot_test(machine): 37 device_hostname = args_dict.get('device_hostname', None) 38 try: 39 host = hosts.create_host(machine, 40 device_hostname=device_hostname) 41 except error.AutoservError as e: 42 raise error.AutoservError( 43 'Failed to create host for %s: %s. If this is an android host that ' 44 'requires a beaglebone jump host, you need to specify the device ' 45 'hostname through test_that --args="device_hostname=<android ip>".' 46 % (machine, e)) 47 48 job.run_test("generic_RebootTest", host=host, disable_sysinfo=True) 49 50 51parallel_simple(run_reboot_test, machines) 52