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" 22enable_sw_write_protect 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