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'
10TIME = 'MEDIUM'
11TEST_TYPE = 'Server'
12# This test belongs to no suite; it is intended mainly for manual invocation
13# via test_that.
14ATTRIBUTES = ''
15MAX_RESULT_SIZE_KB = 256 * 1024
16
17# tast.py uses binaries installed from autotest_server_package.tar.bz2.
18REQUIRE_SSP = True
19
20DOC = '''
21Run arbitrary Tast tests.
22
23Tast is an integration-testing framework analagous to the test-running portion
24of Autotest. See https://chromium.googlesource.com/chromiumos/platform/tast/ for
25more information.
26
27This test runs arbitary Tast-based tests specified by args given to test_that.
28This test might be useful on debugging to simulate Tast test runs invoked via
29Autotest.
30
31Examples:
32    test_that --args=tast_expr=example.Pass ${DUT} tast.generic
33    test_that --args=tast_expr='("group:mainline")' ${DUT} tast.generic
34'''
35
36def run(machine):
37    args_dict = utils.args_to_dict(args)
38    try:
39        expr = args_dict['tast_expr']
40    except KeyError:
41        raise error.TestFail(
42            'Attribute expression is unspecified; set --args=tast_expr=...')
43    job.run_test('tast',
44                 host=hosts.create_host(machine),
45                 test_exprs=[expr],
46                 ignore_test_failures=False, max_run_sec=3600,
47                 command_args=args)
48
49parallel_simple(run, machines)
50