blob: 85fa53843beee5e57acad1c2f0f1da969b75c5b3 [file] [log] [blame]
# Copyright 2021 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
import os
from autotest_lib.server import utils
from autotest_lib.server.cros import chrome_sideloader
AUTHOR = 'The ChromiumOS Authors'
NAME = 'tast.lacros'
METADATA = {
'contacts': ['tauto-core@google.com'],
'bug_component': 'b:1034523', # ChromeOS > Test > Harness > Tauto
'criteria': 'Tauto wrapper for specified tast tests',
}
TIME = 'MEDIUM'
TEST_TYPE = 'Server'
MAX_RESULT_SIZE_KB = 256 * 1024
PY_VERSION = 3
# tast.py uses binaries installed from autotest_server_package.tar.bz2.
REQUIRE_SSP = True
# Location to put the sideloaded chrome artifacts
CHROME_DIR = '/usr/local/lacros'
DOC = '''
Run the lacros test.
This is a wrapper for lacros tast tests built by for Chromium builders. We
mount a lacros artifact provisioned by TLS and configure the tast to execute
lacros tests upon it.
Tast is an integration-testing framework analogous to the test-running portion
of Autotest. See https://chromium.googlesource.com/chromiumos/platform/tast/
for more information.
See http://go/tast-failures for information about investigating failures.
'''
def run(machine):
host=hosts.create_host(machine)
varslist = []
args_dict = utils.args_to_dict(args)
assert host.path_exists('/var/lib/imageloader/lacros'), ('lacros artifact'
'is not provisioned by CTP. Please check the CTP request.')
# Because this wrapper servers Chromium/Chrome CI builders, the Chrome version
# should be always fresher than the rootfs Chrome bundled in OS.
chrome_sideloader.setup_host(host, CHROME_DIR, None)
# lacros.DeployedBinary expects to set the directory containing chrome executable.
# If chrome is not under squashfs root, specify the relative path by exe_rel_path.
path_to_chrome = os.path.join(CHROME_DIR,
args_dict.get('exe_rel_path', 'chrome'))
assert host.path_exists(path_to_chrome), (
'lacros artifact is not provisioned at expected path, %s'
% path_to_chrome)
expr = chrome_sideloader.get_tast_expr_from_file(host, args_dict, '%s/' % job.resultdir, CHROME_DIR)
if not expr:
expr = chrome_sideloader.get_tast_expr(args_dict)
logging.info('Tast expr: %s', expr)
varslist.append('lacros.DeployedBinary=%s' %
os.path.dirname(path_to_chrome)
)
total_shards=args_dict.get('total_shards', 1)
shard_index=args_dict.get('shard_index', 0)
run_private_tests=args_dict.get('run_private_tests', 'true') == 'true'
retries=int(args_dict.get('retries', 0))
def cleanup():
chrome_sideloader.cleanup_host(host, CHROME_DIR, None)
job.add_post_run_hook(cleanup)
job.run_test('tast',
host=host,
test_exprs=[expr],
download_data_lazily=False,
ignore_test_failures=False, max_run_sec=3600,
command_args=args,
varslist=varslist,
clear_tpm=run_private_tests,
totalshards=total_shards,
shardindex=shard_index,
run_private_tests=run_private_tests,
retries=retries)
parallel_simple(run, machines)