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 enable_devserver_trigger_auto_update: True
     29 
     30 3. Use a command like this replacing the |value| arg with the device and build
     31 version you want to run the test against:
     32 
     33 test_that --args="value='samus-release/R60-9495.0.0'" <DUT-IPADDR>
     34 provision_AutoUpdate
     35 
     36 """
     37 
     38 
     39 from autotest_lib.client.bin import sysinfo
     40 from autotest_lib.client.common_lib import error, utils
     41 from autotest_lib.client.cros import constants
     42 
     43 
     44 # Uncomment the below line, and change it to the correct value if you are
     45 # running this from the AFE.
     46 # value = 'lumpy-release/R28-3993.0.0'
     47 
     48 
     49 if not locals().get('value'):
     50     args = utils.args_to_dict(args)
     51     if not args.get('value'):
     52         raise error.TestError("No provision value!")
     53     value = args['value']
     54 
     55 
     56 def run(machine):
     57     # Save preserved log after autoupdate is completed.
     58     job.sysinfo.add_logdir(
     59             sysinfo.logdir(constants.AUTOUPDATE_PRESERVE_LOG))
     60 
     61     host = hosts.create_host(machine)
     62     # Only collect pre-test sysinfo to save time.
     63     job.run_test('provision_AutoUpdate', host=host, value=value,
     64                  disable_sysinfo=False,
     65                  disable_before_test_sysinfo=False,
     66                  disable_before_iteration_sysinfo=True,
     67                  disable_after_test_sysinfo=True,
     68                  disable_after_iteration_sysinfo=True)
     69 
     70 
     71 job.parallel_simple(run, machines)
     72