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 6 AUTHOR = 'fdeng, chromeos-lab-infrastructure' 7 NAME = 'provision_AutoUpdate.double' 8 PURPOSE = 'Verify autoupdate works by provisioning a host to its current build' 9 TIME = 'MEDIUM' 10 TEST_CATEGORY = 'System' 11 TEST_CLASS = 'provision' 12 TEST_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. 18 ATTRIBUTES = "suite:bvt-inline, suite:push_to_prod, suite:skylab_staging_test" 19 JOB_RETRIES = 2 20 21 DOC = """ 22 This test is to ensure that we can provision out of a given build. 23 When running this test with a cros-version label, the scheduler 24 does the first-round provision by scheduling a provision special task 25 on the host. And then this test is run to enforce a second-round 26 provision that verifies the auto-update actually works. 27 28 What does the failure of this test mean? 29 30 If this test fails, any DUT with this build is likely going to require 31 re-imaging from USB. We decided to add this test to bvt-inline and run it 32 in parrallel with other tests, which means by the time this test reports 33 failure, many duts in the pool will have been imaged with the bad build. 34 35 We are taking the risk because 36 1) Blocking all testing until this test ran would impose a per-build 37 performance cost we don't want to pay. 38 2) History suggests that bugs of this sort are very rare. 39 3) We hope that in future, servo will be sufficiently reliable to offset 40 this kind of failure. 41 """ 42 43 44 from autotest_lib.client.bin import sysinfo 45 from autotest_lib.client.common_lib import error 46 from autotest_lib.client.cros import constants 47 from autotest_lib.server import afe_utils 48 from autotest_lib.server import utils as server_utils 49 50 51 def 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 75 job.parallel_simple(run, machines) 76