1# Copyright (c) 2013 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
6
7AUTHOR = "Chromium OS"
8NAME = "autoupdate_Rollback"
9TIME = "MEDIUM"
10TEST_CATEGORY = "Functional"
11TEST_CLASS = "platform"
12TEST_TYPE = "server"
13ATTRIBUTES = "suite:au"
14SUITE = "au"
15BUG_TEMPLATE = {
16    'cc': ['chromeos-installer-alerts@google.com'],
17    'labels': ['Cr-Internals-Installer'],
18}
19
20DOC = """
21This is a rollback test for Chrome OS releases. It first updates a machine and
22then invokes rollback to boot from its previously booted partition. It tests
23rollback using the update_engine_client rather than manipulating the UI.
24
25Setup for this test is exactly like platform_RebootAfterUpdate. Namely:
26
27Arg:
28  job_repo_url: repo url to use to find image to update from -- assumes caller
29                has staged image. By default if host[repo_job_url] is set, it'll
30                use that. This overrides that value. This value must follow
31                the package_url_pattern in the global config.
32
33To run locally:
34  1) Setup your devserver in your shadow config that your DUT can reach.
35  2) Start your devserver and stage the image you want for example:
36     http://localhost:8080/stage?archive_url=\
37     gs://chromeos-image-archive/parrot-release/R32-4793.0.0&\
38     artifacts=full_payload (and leave it on).
39  3) Run with test_that etc passing
40     args="job_repo_url=http://<your_hostname>:8080/static/\
41     parrot-release/R32-4793.0.0/autotest/packages"
42
43For example:
44
45test_that -b parrot --args="job_repo_url=http://<your_machine>:8080/static/\
46parrot-release/R32-4793.0.0/autotest/packages" --fast \
47<dut_ip> autoupdate_Rollback
48"""
49
50args_dict = utils.args_to_dict(args)
51job_repo_url = args_dict.get('job_repo_url')
52
53
54def run_test(machine):
55    """Execute a test configuration on a given machine."""
56    host = hosts.create_host(machine)
57    job.run_test("autoupdate_Rollback", host=host,
58                 job_repo_url=job_repo_url)
59
60
61# Invoke parallel tests.
62parallel_simple(run_test, machines)
63