xref: /aosp_15_r20/external/autotest/server/site_tests/tast/control.generic-servo (revision 9c5db1993ded3edbeafc8092d69fe5de2ee02df7)
1# Copyright 2020 The Chromium OS Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5from autotest_lib.client.common_lib import error
6from autotest_lib.client.common_lib import utils
7
8AUTHOR = 'Chromium OS team'
9NAME = 'tast.generic-servo'
10TIME = 'MEDIUM'
11TEST_TYPE = 'Server'
12DEPENDENCIES = 'servo_state:WORKING'
13# This test belongs to no suite; it is intended mainly for manual invocation
14# via test_that.
15ATTRIBUTES = ''
16MAX_RESULT_SIZE_KB = 256 * 1024
17PY_VERSION = 3
18
19# tast.py uses binaries installed from autotest_server_package.tar.bz2.
20REQUIRE_SSP = True
21
22DOC = '''
23Run arbitrary Tast tests with servo support.
24
25Tast is an integration-testing framework analagous to the test-running portion
26of Autotest. See https://chromium.googlesource.com/chromiumos/platform/tast/ for
27more information.
28
29This test runs arbitary Tast-based tests specified by args given to test_that.
30This test might be useful on debugging to simulate Tast test runs invoked via
31Autotest.
32
33Examples:
34    test_that --args="tast_expr=example.ServoEcho servo_host=${SERVO_HOST}
35            servo_port=${SERVO_PORT}" ${DUT} tast.generic-servo
36    test_that --args="tast_expr='(\"group:mainline\")' servo_host=${SERVO_HOST}
37            servo_port=${SERVO_PORT}" ${DUT} tast.generic-servo
38    test_that --args=tast_expr='("group:mainline")' ${DUT} tast.generic-servo
39'''
40
41args_dict = utils.args_to_dict(args)
42assert 'servo_state:WORKING' in DEPENDENCIES
43servo_args = hosts.CrosHost.get_servo_arguments(args_dict)
44
45try:
46    expr = args_dict['tast_expr']
47except KeyError:
48    raise error.TestFail(
49        'Attribute expression is unspecified; set --args=tast_expr=...')
50
51def run(machine):
52    job.run_test('tast',
53                 host=hosts.create_host(machine, servo_args=servo_args),
54                 test_exprs=[expr],
55                 ignore_test_failures=False, max_run_sec=3600,
56                 command_args=args)
57
58parallel_simple(run, machines)
59