blob: 3b2a0646ebed4b9d1602b3530f39370ce542fd48 [file] [log] [blame]
# Copyright 2023 The ChromiumOS Authors
# 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.server.cros import chrome_sideloader
from autotest_lib.server import utils
AUTHOR = 'ChromeOS SW Engprod Team (chromeos-sw-engprod@google.com)'
METADATA = {
'contacts': ['chromeos-sw-engprod@google.com'],
'bug_component': 'b:1034523', # ChromeOS > Test > Harness > Tauto
'criteria': 'PhoneHub test with sideloaded Chrome',
'hw_agnostic': False
}
NAME = 'tast.phonehub-cq-chrome-from-gcs'
TEST_TYPE = 'Server'
MAX_RESULT_SIZE_KB = 1024 * 1024
# tast.py uses binaries installed from autotest_server_package.tar.bz2.
REQUIRE_SSP = True
# This mount point controls the version of chrome to use
CHROME_MOUNT_POINT = '/opt/google/chrome'
# Location to put the sideloaded chrome artifacts
CHROME_DIR = '/usr/local/chrome'
DOC = '''
Run the Tast PhoneHub test suite with a custom chrome binary.
This test is used by Chrome builder for NearbyConnections CQ purposes.
Chromium builders create Ash Chrome binaries and upload to GCS.
The archive is expected to include chromite which in turn is used to deploy
chrome onto the primary CrOS DUT.
Tast tests uses the sideloaded version of chrome.
'''
from autotest_lib.server.cros.crossdevice import cross_device_util
def run(machine):
# Get host objects for each device.
host = hosts.create_host(machine)
companions = hosts.create_companion_hosts(companion_hosts)
phone = companions[0]
args_dict = utils.args_to_dict(args)
logging.info("Running %s on ChromeOS: %s and Phone:%s", NAME,
host, phone)
androidcomp = "android.companions=%s:%s:model" % (phone.associated_hostname, phone.serial_number)
# Setup DUT to use the chrome binary from gcs archive.
chrome_sideloader.chromite_deploy_chrome(host,
args_dict.get('lacros_gcs_path'),
'chrome',**args_dict)
max_run_sec=int(args_dict.get('max_run_sec', 10800))
retries=int(args_dict.get('retries', 0))
# Register a clean up callback to reset the chrome mount.
def cleanup():
chrome_sideloader.cleanup_host(host, CHROME_DIR, CHROME_MOUNT_POINT)
job.add_post_run_hook(cleanup)
job.run_test('tast',
host=host,
test_exprs=['("group:cross-device" && "cross-device_cq" && ("cross-device_crossdevice" || "cross-device_phonehub") && !"cross-device_floss")'],
ignore_test_failures=True,
max_run_sec=max_run_sec,
command_args=args,
varslist=[androidcomp],
clear_tpm=False,
retries=retries)
parallel_simple(run, machines)