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