Home | History | Annotate | Download | only in firmware_Cr50Update
      1 # Copyright 2017 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 AUTHOR = "mruthven"
      6 NAME = "firmware_Cr50Update.erase_nvmem"
      7 PURPOSE = "Verify Cr50 update"
      8 TIME = "SHORT"
      9 TEST_TYPE = "server"
     10 
     11 DOC = """
     12 This test verifies Cr50 can recover from erased nvmem.
     13 
     14 The test will update to the dev image and then rollback to the release image.
     15 During the rollback Cr50 will erase nvmem. The test verifies the device boots
     16 into normal mode and not recovery after nvmem has been erased.
     17 
     18 The release image needs to have a version lower than the dev image. The dev
     19 image has to be newer than all of the images including the original cr50 image
     20 on the dut to be able to guarantee that the original state can be restored.
     21 
     22 If no_release path is given, the test will use release_ver to fetch the image
     23 from gs://.
     24 
     25 If a valid path is given the version will be ignored. For example
     26 release_path='/tmp/cr50.bin.prod' or release_ver='0.0.18' could be used. The
     27 test will attempt to get the cr50 image from /tmp/cr50.bin.prod first. If that
     28 doesn't exist then it will download the version 18 image stored in google cloud
     29 storage. The version string needs to contain the epoch, major, and minor
     30 versions separated by '.'. The tests can be run against all versions since
     31 '0.0.13'.
     32 
     33 If dev_path is not specified, then the test will get the cr50 devids and
     34 attempt to get the debug image from gs://.
     35 
     36 After the test is complete the original Cr50 image will be reflashed onto the
     37 device.
     38 
     39 @param iterations: the number of iterations to run
     40 @param dev_path: the location of the dev image. Must be built with CR50_DEV=1
     41 @param release_path: the location of the release image
     42 @param release_ver: RW version string used to fetch the image from gs
     43 """
     44 
     45 from autotest_lib.client.common_lib import error
     46 from autotest_lib.server import utils
     47 
     48 args_dict = utils.args_to_dict(args)
     49 servo_args = hosts.CrosHost.get_servo_arguments(args_dict)
     50 
     51 iterations = int(args_dict.get("iterations", 1))
     52 release_path = args_dict.get("release_path", "")
     53 release_ver = args_dict.get("release_ver", "")
     54 dev_path = args_dict.get("dev_path", "")
     55 test = "erase_nvmem"
     56 
     57 def run(machine):
     58     host = hosts.create_host(machine, servo_args=servo_args)
     59 
     60     job.run_test("firmware_Cr50Update", host=host, cmdline_args=args,
     61                  release_path=release_path, release_ver=release_ver,
     62                  dev_path=dev_path, test=test, iterations=iterations)
     63 
     64 parallel_simple(run, machines)
     65