Home | History | Annotate | Download | only in sonic_AppTest
      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 
      5 import logging
      6 
      7 from autotest_lib.client.common_lib import error
      8 from autotest_lib.client.common_lib import utils
      9 from autotest_lib.server.cros import host_lock_manager
     10 from autotest_lib.server.cros import sonic_client_utils
     11 
     12 
     13 AUTHOR = "Chrome OS Team"
     14 NAME = "sonic_AppTest"
     15 PURPOSE = "Demonstrate the ability to start the chromecast app."
     16 CRITERIA = "This test will fail if the app fails to start."
     17 TIME = "SHORT"
     18 TEST_CATEGORY = "General"
     19 TEST_CLASS = "sonic"
     20 TEST_TYPE = "server"
     21 
     22 DOC = """
     23 This is a sonic test that will cast a tab.
     24 
     25 Tab cast is achieved through desktopui_SonicExtension, which is a client
     26 test that handles all the extension manipulation necessary to talk to the
     27 sonic device. Note that the sonic host and the DUT need to be on the same
     28 subnet.
     29 
     30 Usage: test_that <ip of Cros DUT> --board=<boardname of DUT>
     31            --args="sonic_hostname=<ip of sonichost>"
     32 """
     33 
     34 args_dict = utils.args_to_dict(args)
     35 
     36 def run(machine):
     37     extension_dir = args_dict.get('extension_dir')
     38     lock_manager = host_lock_manager.HostLockManager()
     39 
     40     # If the hostname of a sonic device to use with this test
     41     # is passed through --args, just try to lock it, otherwise
     42     # look for an unlocked host with the sonic label. The context
     43     # manager handles unlocking hosts locked through the lock_manager.
     44     with host_lock_manager.HostsLockedBy(lock_manager):
     45         sonic_hostname = args_dict.get('sonic_hostname')
     46         if sonic_hostname:
     47             lock_manager.lock([sonic_hostname])
     48         else:
     49             sonic_hostname = sonic_client_utils.acquire_sonic(lock_manager)
     50         logging.info('Using sonic host: %s', sonic_hostname)
     51         cros_host = hosts.create_host(machine)
     52         sonic_host = hosts.create_host(sonic_hostname)
     53         job.run_test('sonic_AppTest', cros_host=cros_host,
     54                      sonic_host=sonic_host, extension_dir=extension_dir,
     55                      disable_sysinfo=True)
     56 
     57 
     58 parallel_simple(run, machines)
     59