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