xref: /aosp_15_r20/external/autotest/server/site_tests/autoupdate_P2P/control.local (revision 9c5db1993ded3edbeafc8092d69fe5de2ee02df7)
1# Copyright 2018 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
5AUTHOR = "dhaddock, Chromium OS"
6NAME = "autoupdate_P2P.local"
7PURPOSE = "Test autoupdate via peer to peer(P2P) locally."
8TIME = "MEDIUM"
9TEST_CATEGORY = "Functional"
10TEST_CLASS = "platform"
11TEST_TYPE = "server"
12PY_VERSION = 3
13
14DOC = """
15This tests autoupdate between two devices via peer to peer.
16
17Use this control file to debug the test at your desk. The test requires the
18lab to schedule and provision two DUTs before the test begins. We will need
19to do that setup manually before running the test.
20
21Steps to run from your desk:
221. Lease two DUTs in the lab. They need to be the same make/model and near
23each other.
242. ssh into both and make sure they can ping each other.
253. Provision both DUTs to the same build. You can use cros flash to do this.
264. Pass two args to test_that: companion_hosts and job_repo_url.
27
28A job_repo_url is a URL passed to each test that points to the autotest
29packages. The AU tests use that url to figure out the devserver to use for the
30test. When you are running locally you need to pass in a job_repo_url. An
31example is:
32http://100.115.245.194:8082/static/caroline-release/R82-12887.0.0/autotest/packages
33
34test_that <hostname>.cros autoupdate_P2P.local --companion_hosts="<hostname2>.cros" --args="job_repo_url=<job_repo_url> with_dlc=True"
35
36"""
37
38import logging
39from autotest_lib.server import utils
40
41args_dict = utils.args_to_dict(args)
42
43def run(machine):
44    if 'job_repo_url' in args_dict:
45        host1 = hosts.create_host(machine)
46        companions = hosts.create_companion_hosts(companion_hosts)
47        with_dlc = bool(args_dict.get('with_dlc', False))
48        job.run_test('autoupdate_P2P', host=host1, companions=companions, running_at_desk=True, job_repo_url=args_dict.get('job_repo_url'), with_dlc=with_dlc)
49    else:
50        logging.info('Please provide both "companion_hosts" and "job_repo_url" args to test_that.')
51
52job.parallel_simple(run, machines)
53