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 software write protect cannot be disabled when \ 12hardware write protect is enabled" 13 14echo "Making sure all write protect is enabled" 15check_hw_and_sw_write_protect_enabled 16 17echo "Validating initial state" 18check_has_mp_rw_firmware 19check_has_mp_ro_firmware 20check_running_rw_firmware 21check_is_rollback_set_to_initial_val 22 23echo "Reboot to RO" 24reboot_ec_to_ro 25check_has_mp_rw_firmware 26check_has_mp_ro_firmware 27check_running_ro_firmware 28check_hw_and_sw_write_protect_enabled 29 30echo "Disabling software write protect when hardware write protect is enabled \ 31when running RO" 32if (disable_sw_write_protect); then 33 echo "Disabling software write protect should fail" 34 exit 1 35fi 36 37echo "Validating write protection did not change" 38check_hw_and_sw_write_protect_enabled 39 40echo "Reboot to RW" 41reboot_ec 42check_has_mp_rw_firmware 43check_has_mp_ro_firmware 44check_running_rw_firmware 45check_hw_and_sw_write_protect_enabled 46 47echo "Disabling software write protect when hardware write protect is enabled \ 48when running RW" 49if (disable_sw_write_protect); then 50 echo "Disabling software write protect should fail" 51 exit 1 52fi 53 54echo "Validating write protection did not change" 55check_hw_and_sw_write_protect_enabled 56