blob: 2da73edfe89538980088baa5cf6a3d70162db203 [file] [log] [blame] [edit]
# Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import logging
from autotest_lib.client.common_lib import error
from autotest_lib.client.common_lib import utils
from autotest_lib.server.cros import host_lock_manager
from autotest_lib.server.cros import sonic_client_utils
AUTHOR = "Chrome OS Team"
NAME = "sonic_AppTest"
PURPOSE = "Demonstrate the ability to start the chromecast app."
CRITERIA = "This test will fail if the app fails to start."
TIME = "SHORT"
TEST_CATEGORY = "General"
TEST_CLASS = "sonic"
TEST_TYPE = "server"
DOC = """
This is a sonic test that will cast a tab.
Tab cast is achieved through desktopui_SonicExtension, which is a client
test that handles all the extension manipulation necessary to talk to the
sonic device. Note that the sonic host and the DUT need to be on the same
subnet.
Usage: test_that <ip of Cros DUT> --board=<boardname of DUT>
--args="sonic_hostname=<ip of sonichost>"
"""
args_dict = utils.args_to_dict(args)
def run(machine):
extension_dir = args_dict.get('extension_dir')
lock_manager = host_lock_manager.HostLockManager()
# If the hostname of a sonic device to use with this test
# is passed through --args, just try to lock it, otherwise
# look for an unlocked host with the sonic label. The context
# manager handles unlocking hosts locked through the lock_manager.
with host_lock_manager.HostsLockedBy(lock_manager):
sonic_hostname = args_dict.get('sonic_hostname')
if sonic_hostname:
lock_manager.lock([sonic_hostname])
else:
sonic_hostname = sonic_client_utils.acquire_sonic(lock_manager)
logging.info('Using sonic host: %s', sonic_hostname)
cros_host = hosts.create_host(machine)
sonic_host = hosts.create_host(sonic_hostname)
job.run_test('sonic_AppTest', cros_host=cros_host,
sonic_host=sonic_host, extension_dir=extension_dir,
disable_sysinfo=True)
parallel_simple(run, machines)