| # 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 import utils |
| from autotest_lib.server.cros import chrome_sideloader |
| |
| AUTHOR = 'The ChromiumOS Authors' |
| METADATA = { |
| 'contacts': ['chromeos-sw-engprod@google.com'], |
| 'bug_component': 'b:1034523', # ChromeOS > Test > Harness > Tauto |
| 'criteria': 'Runs Tast tests with custom Lacros binaries', |
| 'hw_agnostic': False |
| } |
| NAME = 'tast.lacros-from-gcs' |
| TEST_TYPE = 'Server' |
| |
| MAX_RESULT_SIZE_KB = 256 * 1024 |
| |
| # tast.py uses binaries installed from autotest_server_package.tar.bz2. |
| REQUIRE_SSP = True |
| |
| # Location where chromite deploys Lacros artifacts. |
| LACROS_DIR = '/usr/local/lacros-chrome' |
| |
| DOC = ''' |
| Run the lacros test. |
| |
| This is a wrapper for lacros tast tests built by for Chromium builders. |
| |
| Chromium builders create Lacros binaries and upload to GCS. |
| The archive is expected to include chromite which in turn is used to deploy |
| Lacros onto the DUT. |
| |
| 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) |
| |
| # Because this wrapper servers Chromium/Chrome CI builders, the Lacros version |
| # should be always fresher than the rootfs Chrome bundled in OS. |
| chrome_dir = chrome_sideloader.chromite_deploy_chrome(host, |
| args_dict.get('lacros_gcs_path'), |
| 'lacros',**args_dict) |
| |
| tast_expr = chrome_sideloader.get_tast_expr_from_local_file(args_dict, chrome_dir) |
| if not tast_expr: |
| tast_expr = chrome_sideloader.get_tast_expr(args_dict) |
| logging.info('Tast expr: %s', tast_expr) |
| |
| varslist.append('lacros.DeployedBinary=%s' % LACROS_DIR) |
| |
| total_shards=args_dict.get('total_shards', 1) |
| shard_index=args_dict.get('shard_index', 0) |
| max_run_sec=int(args_dict.get('max_run_sec', 10800)) # 3 hours. |
| 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, LACROS_DIR, None) |
| |
| job.add_post_run_hook(cleanup) |
| |
| job.run_test('tast', |
| host=host, |
| test_exprs=[tast_expr], |
| download_data_lazily=False, |
| ignore_test_failures=False, |
| max_run_sec=max_run_sec, |
| 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) |