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. 4 import logging 5 6 from autotest_lib.client.common_lib import error, utils 7 8 9 AUTHOR = "sbasi, chromeos-lab-infrastructure (a] google.com" 10 ATTRIBUTES = "suite:bvt-cq" 11 NAME = "generic_RebootTest" 12 TIME = "SHORT" 13 TEST_CATEGORY = "Functional" 14 TEST_CLASS = "Generic" 15 TEST_TYPE = "server" 16 17 DOC = """ 18 This server side test checks if a host, specified through the command line, 19 can successfully reboot. It automatically detects the type of the host, 20 creates the appropriate host object, and calls reboot on the host object. 21 22 Example usage: 23 test_that generic_RebootTest <sonic/cros/beaglobonedevice ip> --board=<board> 24 A note about --board: <unless you're emerging sonic sources you 25 can just use a chromeos board here, as all we need is test_that 26 from the sysroot>. 27 28 Typically, for the case of an adb host, we can send adb commands to the 29 android device either through usb or tcp. If no device_hostname is specified 30 the adb commands are sent to the android device over usb, via the beaglebone, 31 whereas if the ip of the android device is specified through device_hostname 32 we'll send the adb commands over tcp. 33 """ 34 35 args_dict = utils.args_to_dict(args) 36 37 def 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 52 parallel_simple(run_reboot_test, machines) 53