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"
      7 PURPOSE = "Verify Cr50 update"
      8 ATTRIBUTES = "suite:cr50_stress_flaky"
      9 TIME = "SHORT"
     10 TEST_TYPE = "server"
     11 DEPENDENCIES = "servo"
     12 
     13 DOC = """
     14 This test verifies Cr50 update works or recovery from erased nvmem.
     15 
     16 To test nvmem recovery set test to "erase_nvmem" or use
     17 firmware_Cr50Update.erase_nvmem
     18 
     19 The test will rollback to the oldest Cr50 image and then verify each update to
     20 the next newest image runs successfully. If testing nvmem recovery, nvmem will
     21 be erased during the rollback from the dev image to the release image and
     22 any old release args  will be ignored for erase_nvmem tests.
     23 
     24 The old release needs to have a version lower than the release image. The
     25 release image needs to have a version lower than the dev image. The dev image
     26 has to be newer than all of the images including the original cr50 image on
     27 the dut to be able to guarantee that the original state can be restored.
     28 
     29 If no_release path or old_release_path are given, the test will use
     30 old_release_ver and release_ver to fetch the images from gs://.
     31 
     32 If a valid path is given the version will be ignored. For example
     33 release_path='/tmp/cr50.bin.prod' or release_ver='0.0.23/ZZAF:ffffffff:7f00'
     34 could be used. The test will attempt to get the cr50 image from
     35 /tmp/cr50.bin.prod first. If that doesn't exist then it will download the
     36 version .23 image stored in google cloud storage. The version string needs to
     37 contain the epoch, major, and minor versions separated by '.' and the image
     38 board id. The image board id is optional. The tests can be run against all
     39 versions since '0.0.13'.
     40 
     41 If dev_path is not specified, then the test will get the cr50 devids and
     42 attempt to get the debug image from gs://.
     43 
     44 After the test is complete the original Cr50 image will be reflashed onto the
     45 device.
     46 
     47 @param iterations: the number of iterations to run
     48 @param dev_path: the location of the dev image. Must be built with CR50_DEV=1
     49 @param release_path: the location of the release image
     50 @param release_ver: RW and BID version string used to fetch the image from gs
     51 @param old_release_path: the location of the old release image.
     52 @param old_release_ver: RW version string used to fetch the image from gs
     53 @param test: string representing the test type. use "erase_nvmem" if nvmem
     54              should be erased before updating to the release image. This can be
     55              used to verify that Cr50 can recovery from erased nvmem.
     56 """
     57 
     58 from autotest_lib.client.common_lib import error
     59 from autotest_lib.server import utils
     60 
     61 args_dict = utils.args_to_dict(args)
     62 servo_args = hosts.CrosHost.get_servo_arguments(args_dict)
     63 
     64 iterations = int(args_dict.get("iterations", 1))
     65 old_release_path = args_dict.get("old_release_path", "")
     66 old_release_ver = args_dict.get("old_release_ver", "")
     67 release_path = args_dict.get("release_path", "")
     68 release_ver = args_dict.get("release_ver", "")
     69 dev_path = args_dict.get("dev_path", "")
     70 test = args_dict.get("test", "")
     71 
     72 def run(machine):
     73     host = hosts.create_host(machine, servo_args=servo_args)
     74 
     75     job.run_test("firmware_Cr50Update", host=host, cmdline_args=args,
     76                  release_path=release_path, release_ver=release_ver,
     77                  old_release_path=old_release_path,
     78                  old_release_ver=old_release_ver, dev_path=dev_path,
     79                  test=test, iterations=iterations)
     80 
     81 parallel_simple(run, machines)
     82