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