• 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'
13# Note: This test can occasionally take more than 20 minutes to complete. Be
14# sure the suite max_runtime_mins is set to a large enough value. If the test
15# is terminated early, you will see a line in status.log "Job aborted by
16# autotest_system". You can double-check the "Max runtime" for the job in the
17# Autotest web frontend.
18ATTRIBUTES = "suite:bvt-inline, suite:push_to_prod, suite:skylab_staging_test"
19JOB_RETRIES = 2
20
21DOC = """
22This test is to ensure that we can provision out of a given build.
23When running this test with a cros-version label, the scheduler
24does the first-round provision by scheduling a provision special task
25on the host. And then this test is run to enforce a second-round
26provision that verifies the auto-update actually works.
27
28What does the failure of this test mean?
29
30If this test fails, any DUT with this build is likely going to require
31re-imaging from USB. We decided to add this test to bvt-inline and run it
32in parrallel with other tests, which means by the time this test reports
33failure, many duts in the pool will have been imaged with the bad build.
34
35We are taking the risk because
361) Blocking all testing until this test ran would impose a per-build
37   performance cost we don't want to pay.
382) History suggests that bugs of this sort are very rare.
393) We hope that in future, servo will be sufficiently reliable to offset
40   this kind of failure.
41"""
42
43
44from autotest_lib.client.bin import sysinfo
45from autotest_lib.client.common_lib import error
46from autotest_lib.client.cros import constants
47from autotest_lib.server import afe_utils
48from autotest_lib.server import utils as server_utils
49
50
51def run(machine):
52    # This test will try to access cautotest to get cros-label
53    # of the host and also update the label. This will fail
54    # when the test is kicked of by test_that on people's desk.
55    # As a workaround, we will check whether the test is running
56    # inside a chroot (as test_that requires chroot), if so,
57    # skip the test.
58    if server_utils.is_inside_chroot():
59        is_test_na = True
60        host = None
61        value = None
62    else:
63        is_test_na = False
64        # Save preserved log after autoupdate is completed.
65        job.sysinfo.add_logdir(
66                sysinfo.logdir(constants.AUTOUPDATE_PRESERVE_LOG))
67        host = hosts.create_host(machine)
68        info = host.host_info_store.get()
69        value = info.build
70    job.run_test('provision_AutoUpdate', host=host, value=value,
71                 force_update_engine=True, disable_sysinfo=False,
72                 tag='double', is_test_na=is_test_na)
73
74
75job.parallel_simple(run, machines)
76