1#!/bin/bash 2 3# Copyright 2019 The Chromium OS Authors. All rights reserved. 4# Use of this source code is governed by a BSD-style license that can be 5# found in the LICENSE file. 6 7set -e 8 9. $(dirname "$(readlink -f "${0}")")/common.sh 10 11echo "Running test to validate rollback version is obeyed" 12 13readonly RB0_FW_FILE="$1" 14readonly RB1_FW_FILE="$2" 15readonly RB9_FW_FILE="$3" 16 17check_file_exists "${RB0_FW_FILE}" 18check_file_exists "${RB1_FW_FILE}" 19check_file_exists "${RB9_FW_FILE}" 20 21echo "Making sure all write protect is enabled" 22check_hw_and_sw_write_protect_enabled 23 24echo "Validating initial state" 25check_has_dev_rw_firmware 26check_has_dev_ro_firmware 27check_running_rw_firmware 28check_fingerprint_task_is_running 29check_is_rollback_set_to_initial_val 30 31echo "Flashing RB1 version" 32flash_rw_firmware "${RB1_FW_FILE}" 33check_has_dev_ro_firmware 34check_has_rb1_rw_firmware 35check_running_rw_firmware 36check_fingerprint_task_is_running 37check_rollback_block_id_matches "2" 38check_rollback_min_version_matches "1" 39check_rollback_rw_version_matches "1" 40 41echo "Flashing RB0 version" 42flash_rw_firmware "${RB0_FW_FILE}" 43check_has_dev_ro_firmware 44check_has_rb0_rw_firmware 45check_running_ro_firmware 46check_fingerprint_task_is_not_running 47check_rollback_block_id_matches "2" 48check_rollback_min_version_matches "1" 49check_rollback_rw_version_matches "0" 50 51echo "Flashing RB9 version" 52flash_rw_firmware "${RB9_FW_FILE}" 53check_has_dev_ro_firmware 54check_has_rb9_rw_firmware 55check_running_rw_firmware 56check_fingerprint_task_is_running 57check_rollback_block_id_matches "3" 58check_rollback_min_version_matches "9" 59check_rollback_rw_version_matches "9" 60