| # Copyright 2022 The ChromiumOS Authors |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| AUTHOR = 'ChromiumOS Display team' |
| NAME = 'tast.chameleon-igt-daily' |
| 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' |
| ATTRIBUTES = 'suite:chameleon_igt_daily' |
| MAX_RESULT_SIZE_KB = 1024 * 1024 |
| PY_VERSION = 3 |
| DEPENDENCIES = 'chameleon' |
| |
| # tast.py uses binaries installed from autotest_server_package.tar.bz2. |
| REQUIRE_SSP = True |
| |
| DOC = """ |
| Run the Tast chameleon-igt test suite. |
| |
| Tast is an integration-testing framework analagous to the test-running portion |
| of Autotest. See https://chromium.googlesource.com/chromiumos/platform/tast/ for |
| more information. |
| |
| This test runs igt-gpu-tools against a remote DUT with chameleon connected. |
| Separate control files are needed because Tast doesn't isolate tests from each |
| other and a clean device state is needed by rebooting before running a |
| different graphics suite. |
| |
| See http://go/tast-failures for information about investigating failures. |
| """ |
| |
| import json |
| import tempfile |
| import yaml |
| |
| from autotest_lib.client.common_lib import utils |
| from autotest_lib.server import utils as server_utils |
| |
| |
| def run(machine): |
| # Get host objects for each device. |
| host = hosts.create_host(machine) |
| |
| # Extract Chameleon args from command line arguments |
| args_dict = utils.args_to_dict(args) |
| varslist = [] |
| |
| # In Skylab, Chameleon follows the naming convention '{DUT}-chameleon'. |
| # The series of tests are executed as Tast client tests, during which |
| # DUT would issues xmlrpc commands directly against Chameleon. |
| # The DUT and the corresponding Chameleon board access each other only |
| # through IP. The drone server can help look up the IP for '{DUT}-chameleon' |
| # and pass that to DUT. |
| if 'chameleon_host' in args_dict: |
| chameleon_host = args_dict['chameleon_host'] |
| else: |
| chameleon_host = f'{host.hostname}-chameleon' |
| # Hack that uses the fact that we can see the lab network from here. |
| # This should be fixed by official lab support, details in b/246566625. |
| chameleon_ip = server_utils.get_ip_address(chameleon_host) |
| |
| # Define list of Chameleon specific variables to pass to Tast. |
| varslist.append(f'graphics.chameleon_host={chameleon_host}') |
| varslist.append(f'graphics.chameleon_ip={chameleon_ip}') |
| if 'chameleon_port' in args_dict: |
| chameleon_port = args_dict['chameleon_port'] |
| varslist.append(f'graphics.chameleon_port={chameleon_port}') |
| if 'chameleon_ssh_port' in args_dict: |
| chameleon_ssh_port = args_dict['chameleon_ssh_port'] |
| varslist.append(f'graphics.chameleon_ssh_port={chameleon_ssh_port}') |
| if 'connected_ports' in args_dict: |
| connected_ports = args_dict['connected_ports'] |
| varslist.append(f'graphics.connected_ports={connected_ports}') |
| |
| logging.info(f'Running IGT with args: {args} and varslist: {varslist}') |
| |
| # TODO(ihf): Remove this hack when CFT can pass labels directly to Tast. |
| # Until then ask autotest for labels and pass them as yaml and vars to |
| # the DUT. |
| with tempfile.NamedTemporaryFile(suffix='.yaml', mode='w+') as temp_file: |
| host_info = host.host_info_store.get() |
| yaml.safe_dump({'autotest_host_info_labels': |
| json.dumps(host_info.labels)}, |
| stream=temp_file) |
| temp_file.flush() |
| |
| job.run_test( |
| 'tast', |
| host=host, |
| test_exprs=[ |
| '("group:graphics" && graphics_nightly && graphics_chameleon_igt)' |
| ], |
| ignore_test_failures=True, |
| max_run_sec=21600, |
| command_args=args, |
| varslist=varslist, |
| varsfiles=[temp_file.name]) |
| |
| |
| parallel_simple(run, machines) |