| # Copyright 2020 The ChromiumOS Authors |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| from autotest_lib.client.common_lib import error |
| from autotest_lib.client.common_lib import utils |
| from autotest_lib.server.site_tests.tast import tast |
| |
| AUTHOR = 'The ChromiumOS Authors' |
| NAME = 'tast.generic-servo' |
| 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' |
| DEPENDENCIES = 'servo_state:WORKING' |
| # This test belongs to no suite; it is intended mainly for manual invocation |
| # via test_that. |
| # This test should be removed after crosfleet and Satlab support TFC. |
| ATTRIBUTES = '' |
| MAX_RESULT_SIZE_KB = 256 * 1024 |
| PY_VERSION = 3 |
| |
| # tast.py uses binaries installed from autotest_server_package.tar.bz2. |
| REQUIRE_SSP = True |
| |
| DOC = ''' |
| Run arbitrary Tast tests with servo support. |
| |
| 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 arbitary Tast-based tests specified by args given to test_that. |
| This test might be useful on debugging to simulate Tast test runs invoked via |
| Autotest. |
| |
| Examples: |
| test_that --args="tast_expr=example.ServoEcho servo_host=${SERVO_HOST} |
| servo_port=${SERVO_PORT}" ${DUT} tast.generic-servo |
| test_that --args="tast_expr='(\"group:mainline\")' servo_host=${SERVO_HOST} |
| servo_port=${SERVO_PORT}" ${DUT} tast.generic-servo |
| test_that --args=tast_expr='("group:mainline")' ${DUT} tast.generic-servo |
| ''' |
| |
| command_args, varslist = tast.split_arguments(args) |
| args_dict = utils.args_to_dict(command_args) |
| assert 'servo_state:WORKING' in DEPENDENCIES |
| servo_args = hosts.CrosHost.get_servo_arguments(args_dict) |
| try: |
| expr = args_dict['tast_expr'] |
| except KeyError: |
| raise error.TestFail( |
| 'Attribute expression is unspecified; set --args=tast_expr=...') |
| |
| def run(machine): |
| ephemeraldevserver = None |
| if 'ephemeraldevserver' in args_dict: |
| ephemeraldevserver = args_dict['ephemeraldevserver'] |
| max_run_sec = 3600 |
| if 'max_run_sec' in args_dict: |
| max_run_sec = int(args_dict['max_run_sec']) |
| |
| job.run_test('tast', |
| host=hosts.create_host(machine, servo_args=servo_args), |
| test_exprs=[expr], |
| ignore_test_failures=False, max_run_sec=max_run_sec, |
| command_args=command_args, |
| varslist=varslist, |
| ephemeraldevserver=ephemeraldevserver) |
| |
| parallel_simple(run, machines) |