Home | History | Annotate | Download | only in provision_AutoUpdate
      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 
      5 
      6 AUTHOR = "milleral, chromeos-lab-infrastructure"
      7 NAME = "provision_AutoUpdate"
      8 PURPOSE = "Provision a system to the correct OS version."
      9 TIME = "MEDIUM"
     10 TEST_CATEGORY = "System"
     11 TEST_CLASS = "provision"
     12 TEST_TYPE = "Server"
     13 
     14 DOC = """
     15 This is a test used by the provision control segment in autoserv to set the
     16 cros-version label of a host to the desired setting.
     17 
     18 To run locally:
     19 
     20 1. Start a devserver outside of a chroot like this:
     21 src/platform/dev/devserver.py --port=8082
     22 
     23 2. You will need to add a few lines to
     24 src/third_party/autotest/files/shadow_config.ini
     25 
     26 [CROS]
     27 dev_server: http://127.0.0.1:8082
     28 
     29 3. Use a command like this replacing the |value| arg with the device and build
     30 version you want to run the test against:
     31 
     32 test_that --args="value='samus-release/R60-9495.0.0'" <DUT-IPADDR>
     33 provision_AutoUpdate
     34 
     35 """
     36 
     37 
     38 from autotest_lib.client.bin import sysinfo
     39 from autotest_lib.client.common_lib import error, utils
     40 from autotest_lib.client.cros import constants
     41 
     42 
     43 # Uncomment the below line, and change it to the correct value if you are
     44 # running this from the AFE.
     45 # value = 'lumpy-release/R28-3993.0.0'
     46 
     47 
     48 if not locals().get('value'):
     49     args = utils.args_to_dict(args)
     50     if not args.get('value'):
     51         raise error.TestError("No provision value!")
     52     value = args['value']
     53 
     54 
     55 def run(machine):
     56     # Save preserved log after autoupdate is completed.
     57     job.sysinfo.add_logdir(
     58             sysinfo.logdir(constants.AUTOUPDATE_PRESERVE_LOG))
     59 
     60     host = hosts.create_host(machine)
     61     # Only collect pre-test sysinfo to save time.
     62     job.run_test('provision_AutoUpdate', host=host, value=value,
     63                  disable_sysinfo=False,
     64                  disable_before_test_sysinfo=False,
     65                  disable_before_iteration_sysinfo=True,
     66                  disable_after_test_sysinfo=True,
     67                  disable_after_iteration_sysinfo=True)
     68 
     69 
     70 job.parallel_simple(run, machines)
     71