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