| # Copyright 2017 The Chromium OS Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| AUTHOR = "mruthven" |
| NAME = "firmware_Cr50Update" |
| PURPOSE = "Verify Cr50 update" |
| TIME = "SHORT" |
| TEST_TYPE = "server" |
| |
| DOC = """ |
| This test verifies Cr50 update works or recovery from erased nvmem. |
| |
| To test nvmem recovery set test to "nvmem_recovery" or use |
| firmware_Cr50Update.nvmem_recovery |
| |
| The test will rollback to the oldest Cr50 image and then verify each update to |
| the next newest image runs successfully. If testing nvmem recovery, nvmem will |
| be erased during the rollback from dev_image to release_image and |
| old_release_image will be ignored for nvmem_recovery tests. |
| |
| old_release_image should have a lower version than release_image and |
| release_image should have a version lower than the dev_image. The dev_image |
| needs to have a higher version than all of the given images and whatever is |
| running on Cr50 to guarantee that the state can be restored. |
| |
| After the test is complete the original Cr50 image will be reflashed onto the |
| device. |
| |
| @param iterations: the number of iterations to run |
| @param dev_image: the location of the dev image. Must be built with CR50_DEV=1 |
| @param release_image: the location of the release image |
| @param old_release_image: the location of the old release image. This is |
| optional. If it is included, the test will verify that |
| the old release can update to the new release, then |
| the new release can update to the dev image. |
| @param test: string representing the test type. use "nvmem_recovery" if nvmem |
| should be erased before updating to the release image. This can be |
| used to verify that Cr50 can recovery from erased nvmem. |
| """ |
| |
| from autotest_lib.client.common_lib import error |
| from autotest_lib.server import utils |
| |
| args_dict = utils.args_to_dict(args) |
| servo_args = hosts.CrosHost.get_servo_arguments(args_dict) |
| |
| iterations = int(args_dict.get("iterations", 1)) |
| old_release_image = args_dict.get("old_release_image", "") |
| release_image = args_dict.get("release_image", "") |
| dev_image = args_dict.get("dev_image", "") |
| test = args_dict.get("test", "") |
| |
| def run(machine): |
| host = hosts.create_host(machine, servo_args=servo_args) |
| |
| job.run_test("firmware_Cr50Update", host=host, cmdline_args=args, |
| release_image=release_image, dev_image=dev_image, |
| old_release_image=old_release_image, test=test, |
| iterations=iterations) |
| |
| parallel_simple(run, machines) |