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