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