xref: /aosp_15_r20/external/autotest/server/site_tests/tast/control.firmware-Ti50Demo (revision 9c5db1993ded3edbeafc8092d69fe5de2ee02df7)
1# Copyright 2022 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 utils
6from autotest_lib.server.hosts import gsc_devboard_host
7
8AUTHOR = 'Chromium OS BaseOS Engprod'
9NAME = 'tast.firmware-Ti50Demo'
10TIME = 'MEDIUM'
11TEST_TYPE = 'Server'
12MAX_RESULT_SIZE_KB = 50 * 1024
13PY_VERSION = 3
14
15# tast.py uses binaries installed from autotest_server_package.tar.bz2.
16REQUIRE_SSP = True
17
18DOC = '''
19Run firmware.Ti50Demo test.
20
21Args:
22    ti50_build: ti50 build location -> gs://chromeos-releases/firmware-ti50-postsubmit/<build>
23    service_debugger_serial: serial of debugger connected to devboard, defaults to the first one found on the container
24    service_ip: devboard service ip, default is to start a new container
25    service_port: devboard service port, defaults to 39999
26
27Examples:
28
29    # To run test on a devboard connected to workstation:
30    #   Have setup SatLab gcr access according to official instructions.
31    #   docker installed outside of chroot
32    #   inside chroot, run src/third_party/autotest/files/utils/install_docker_chroot.sh
33    #   devboard connected to workstation, fake dut ssh fowarded on localhost:2222
34    #   outside chroot, start dockerd on local tcp port: dockerd -H tcp://127.0.0.1:2375
35    test_that --autotest_dir <path/to/autotest/files> --fast --args "ti50_build=gs://chromeos-releases/firmware-ti50-postsubmit/<build> service_debugger_serial=<serial>"  localhost:2222 tast.firmware-Ti50Demo
36
37    # To run test on a devboard connected to SatLab:
38    #   Have setup complete SatLab according to official instructions.
39    #   inside chroot, run src/third_party/autotest/files/utils/install_docker_chroot.sh
40    #   devboard connected to SatLab, fake dut ssh fowarded on localhost:2222
41    #   outside chroot, forward SatLab docker host: ssh -L 2377:192.168.231.1:2375 -N <mysatlab>
42    #   start service manually on SatLab, note the printed service ip and port: DOCKER_HOST=127.0.0.1:2377 python -m utils.start_gsc_devboard_host
43    #   outside chroot, forward service port: ssh -L 39999:<service ip>:<service port> -N <mysatlab>
44    test_that --autotest_dir <path/to/autotest/files> --fast --args "ti50_build=gs://chromeos-releases/firmware-ti50-postsubmit/<build> service_ip=<service ip> service_port=<service port>" localhost:2222 tast.firmware-Ti50Demo
45'''
46
47def run(machine):
48    args_dict = utils.args_to_dict(args)
49    devboard = hosts.create_host(machine, host_class=gsc_devboard_host.GSCDevboardHost, **args_dict)
50
51    with devboard.service_context() as service_ep:
52        varslist = ['devboardsvc=' + service_ep]
53        buildurl = args_dict.get('ti50_build')
54        if buildurl is not None:
55            varslist += ['buildurl=' + buildurl]
56        job.run_test('tast',
57                     host=hosts.create_host(machine),
58                     max_run_sec=10800,
59                     test_exprs=['firmware.Ti50Demo'],
60                     varslist=varslist,
61                     command_args=args)
62
63parallel_simple(run, machines)
64