• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2014 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
5
6AUTHOR = 'fdeng, chromeos-lab-infrastructure'
7NAME = 'provision_AutoUpdate.double'
8PURPOSE = 'Verify autoupdate works by provisioning a host to its current build'
9TIME = 'MEDIUM'
10TEST_CATEGORY = 'System'
11TEST_CLASS = 'provision'
12TEST_TYPE = 'Server'
13ATTRIBUTES = "suite:bvt-inline, suite:push_to_prod"
14SUITE = 'push_to_prod, bvt-inline'
15# This test is expensive, just retry once
16JOB_RETRIES = 2
17
18DOC = """
19This test is to ensure that we can provision out of a given build.
20When running this test with a cros-version label, the scheduler
21does the first-round provision by scheduling a provision special task
22on the host. And then this test is run to enforce a second-round
23provision that verifies the auto-update actually works.
24
25What does the failure of this test mean?
26
27If this test fails, any DUT with this build is likely going to require
28re-imaging from USB. We decided to add this test to bvt-inline and run it
29in parrallel with other tests, which means by the time this test reports
30failure, many duts in the pool will have been imaged with the bad build.
31
32We are taking the risk because
331) Blocking all testing until this test ran would impose a per-build
34   performance cost we don't want to pay.
352) History suggests that bugs of this sort are very rare.
363) We hope that in future, servo will be sufficiently reliable to offset
37   this kind of failure.
38"""
39
40
41from autotest_lib.client.common_lib import error
42from autotest_lib.client.cros import constants
43from autotest_lib.server import afe_utils
44from autotest_lib.server import utils as server_utils
45
46
47def run(machine):
48    # This test will try to access cautotest to get cros-label
49    # of the host and also update the label. This will fail
50    # when the test is kicked of by test_that on people's desk.
51    # As a workaround, we will check whether the test is running
52    # inside a chroot (as test_that requires chroot), if so,
53    # skip the test.
54    if server_utils.is_inside_chroot():
55        is_test_na = True
56        host = None
57        value = None
58    else:
59        is_test_na = False
60        # Save preserved log after autoupdate is completed.
61        job.sysinfo.add_logdir(constants.AUTOUPDATE_PRESERVE_LOG)
62        host = hosts.create_host(machine)
63        value = afe_utils.get_build(host)
64    job.run_test('provision_AutoUpdate', host=host, value=value, force=True,
65                 disable_sysinfo=False, tag='double', is_test_na=is_test_na)
66
67
68job.parallel_simple(run, machines)
69