xref: /aosp_15_r20/external/vboot_reference/tests/futility/test_flash_util.sh (revision 8617a60d3594060b7ecbd21bc622a7c14f3cf2bc)
1#!/bin/bash -eux
2# Copyright 2023 The ChromiumOS Authors
3# Use of this source code is governed by a BSD-style license that can be
4# found in the LICENSE file.
5
6me=${0##*/}
7TMP="${me}.tmp"
8
9# Work in scratch directory
10cd "${OUTDIR}"
11
12# 8MB test image
13TEST_BIOS="${SCRIPT_DIR}/futility/data/bios_link_mp.bin"
14TEST_PROG="dummy:image=${TEST_BIOS},emulate=VARIABLE_SIZE,size=8388608"
15
16# Test flash size
17flash_size=$("${FUTILITY}" flash --flash-size -p "${TEST_PROG}")
18[ "${flash_size}" = "Flash size: 0x00800000" ]
19
20# Test WP status (VARIABLE_SIZE always has WP disabled)
21wp_status=$("${FUTILITY}" flash --wp-status --ignore-hw -p "${TEST_PROG}")
22[ "${wp_status}" = "WP status: disabled" ]
23
24# Cleanup
25rm -f "${TMP}"*
26exit 0
27