xref: /aosp_15_r20/external/autotest/server/site_tests/tast/control.generic (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
7from autotest_lib.server.site_tests.tast import tast
8
9AUTHOR = 'Chromium OS team'
10NAME = 'tast.generic'
11TIME = 'MEDIUM'
12TEST_TYPE = 'Server'
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.
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.Pass ${DUT} tast.generic
35    test_that --args=tast_expr='("group:mainline")' ${DUT} tast.generic
36    test_that --args='tast_expr=example.RuntimeVars tast.example.strvar="Hello_World"' ${DUT} tast.generic
37'''
38
39command_args, varslist = tast.split_arguments(args)
40
41def run(machine):
42    args_dict = utils.args_to_dict(command_args)
43    try:
44        expr = args_dict['tast_expr']
45    except KeyError:
46        raise error.TestFail(
47            'Attribute expression is unspecified; set --args=tast_expr=...')
48    job.run_test('tast',
49                 host=hosts.create_host(machine),
50                 test_exprs=[expr],
51                 ignore_test_failures=False, max_run_sec=3600,
52                 command_args=command_args,
53                 varslist=varslist,
54                 is_cft=is_cft)
55
56parallel_simple(run, machines)
57