1# Copyright 2019 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
5from autotest_lib.server import utils
6
7AUTHOR = "Chrome OS Team"
8NAME = "firmware_Fingerprint.RDP0"
9PURPOSE = """
10Verify that we can read flash when RDP (readout protection) is set to level 0.
11"""
12CRITERIA = """
13Fails if the bytes that we read do not exactly match the firmware that was
14flashed.
15"""
16ATTRIBUTES = "suite:fingerprint"
17TIME = "SHORT"
18TEST_CATEGORY = "Functional"
19TEST_CLASS = "firmware"
20TEST_TYPE = "server"
21DEPENDENCIES = "servo_state:WORKING, fingerprint"
22JOB_RETRIES = 0
23
24DOC = """
25The test setup ensures that neither hardware or software write protect is
26enabled, which means that RDP is set to level 0. The test script then reads the
27flash and verifies that the bytes exactly match the originally flashed
28firmware.
29"""
30
31test_images = [ 'TEST_IMAGE_ORIGINAL' ]
32
33args_dict = utils.args_to_dict(args)
34servo_args = hosts.CrosHost.get_servo_arguments(args_dict)
35
36def run(machine):
37    host = hosts.create_host(machine, servo_args=servo_args)
38    job.run_test("firmware_Fingerprint", host=host,
39                 test_exe="rdp0.sh",
40                 test_exe_args=test_images,
41                 enable_hardware_write_protect=False,
42                 enable_software_write_protect=False,
43                 # This test requires a forced flash without entropy
44                 # initialization to ensure that we get an exact match between
45                 # the original firmware that was flashed and the value that is
46                 # read.
47                 force_firmware_flashing=True,
48                 init_entropy=False)
49
50parallel_simple(run, machines)
51