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