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# shellcheck source=./common.sh 10. "$(dirname "$(readlink -f "${0}")")/common.sh" 11 12echo "Running test to validate rollback version is obeyed" 13 14readonly RB0_FW_FILE="$1" 15readonly RB1_FW_FILE="$2" 16readonly RB9_FW_FILE="$3" 17 18check_file_exists "${RB0_FW_FILE}" 19check_file_exists "${RB1_FW_FILE}" 20check_file_exists "${RB9_FW_FILE}" 21 22echo "Making sure all write protect is enabled" 23check_hw_and_sw_write_protect_enabled 24 25echo "Validating initial state" 26check_has_dev_rw_firmware 27check_has_dev_ro_firmware 28check_running_rw_firmware 29check_fingerprint_task_is_running 30check_is_rollback_set_to_initial_val 31 32echo "Flashing RB1 version" 33flash_rw_firmware "${RB1_FW_FILE}" 34check_has_dev_ro_firmware 35check_has_rb1_rw_firmware 36check_running_rw_firmware 37check_fingerprint_task_is_running 38check_rollback_block_id_matches "2" 39check_rollback_min_version_matches "1" 40check_rollback_rw_version_matches "1" 41 42echo "Flashing RB0 version" 43flash_rw_firmware "${RB0_FW_FILE}" 44check_has_dev_ro_firmware 45check_has_rb0_rw_firmware 46check_running_ro_firmware 47check_fingerprint_task_is_not_running 48check_rollback_block_id_matches "2" 49check_rollback_min_version_matches "1" 50check_rollback_rw_version_matches "0" 51 52echo "Flashing RB9 version" 53flash_rw_firmware "${RB9_FW_FILE}" 54check_has_dev_ro_firmware 55check_has_rb9_rw_firmware 56check_running_rw_firmware 57check_fingerprint_task_is_running 58check_rollback_block_id_matches "3" 59check_rollback_min_version_matches "9" 60check_rollback_rw_version_matches "9" 61