mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-14 16:46:23 +00:00
A truncated BIOS with an otherwise valid FMAP that now points way off the end of the file shouldn't cause coredumps. BUG=none BRANCH=ToT TEST=make runtests Change-Id: Idf96e1e6a381bf0fe0b1cb2d16e3dad39ce7a0dc Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/245500 Reviewed-by: Randall Spangler <rspangler@chromium.org>
53 lines
1.7 KiB
Bash
Executable File
53 lines
1.7 KiB
Bash
Executable File
#!/bin/bash -eux
|
|
# Copyright 2013 The Chromium OS Authors. All rights reserved.
|
|
# Use of this source code is governed by a BSD-style license that can be
|
|
# found in the LICENSE file.
|
|
|
|
me=${0##*/}
|
|
TMP="$me.tmp"
|
|
|
|
# Work in scratch directory
|
|
cd "$OUTDIR"
|
|
|
|
# Good FMAP
|
|
"$FUTILITY" dump_fmap -f "${SCRIPTDIR}/data_fmap.bin" > "$TMP"
|
|
cmp "${SCRIPTDIR}/data_fmap_expect_f.txt" "$TMP"
|
|
|
|
"$FUTILITY" dump_fmap -p "${SCRIPTDIR}/data_fmap.bin" > "$TMP"
|
|
cmp "${SCRIPTDIR}/data_fmap_expect_p.txt" "$TMP"
|
|
|
|
"$FUTILITY" dump_fmap -h "${SCRIPTDIR}/data_fmap.bin" > "$TMP"
|
|
cmp "${SCRIPTDIR}/data_fmap_expect_h.txt" "$TMP"
|
|
|
|
|
|
# This should fail because the input file is truncated and doesn't really
|
|
# contain the stuff that the FMAP claims it does.
|
|
if "$FUTILITY" dump_fmap -x "${SCRIPTDIR}/data_fmap.bin" FMAP; then false; fi
|
|
|
|
# This should fail too
|
|
if "$FUTILITY" show "${SCRIPTDIR}/data_fmap.bin"; then false; fi
|
|
|
|
# However, this should work.
|
|
"$FUTILITY" dump_fmap -x "${SCRIPTDIR}/data_fmap.bin" SI_DESC > "$TMP"
|
|
cmp "${SCRIPTDIR}/data_fmap_expect_x.txt" "$TMP"
|
|
|
|
# Redirect dumping to a different place
|
|
"$FUTILITY" dump_fmap -x "${SCRIPTDIR}/data_fmap.bin" SI_DESC:FOO > "$TMP"
|
|
cmp "${SCRIPTDIR}/data_fmap_expect_x2.txt" "$TMP"
|
|
cmp SI_DESC FOO
|
|
|
|
# This FMAP has problems, and should fail.
|
|
if "$FUTILITY" dump_fmap -h "${SCRIPTDIR}/data_fmap2.bin" > "$TMP"; then false; fi
|
|
cmp "${SCRIPTDIR}/data_fmap2_expect_h.txt" "$TMP"
|
|
|
|
"$FUTILITY" dump_fmap -hh "${SCRIPTDIR}/data_fmap2.bin" > "$TMP"
|
|
cmp "${SCRIPTDIR}/data_fmap2_expect_hh.txt" "$TMP"
|
|
|
|
"$FUTILITY" dump_fmap -hhH "${SCRIPTDIR}/data_fmap2.bin" > "$TMP"
|
|
cmp "${SCRIPTDIR}/data_fmap2_expect_hhH.txt" "$TMP"
|
|
|
|
|
|
# cleanup
|
|
rm -f ${TMP}* FMAP SI_DESC FOO
|
|
exit 0
|