diff options
author | Bill Richardson <wfrichar@chromium.org> | 2014-07-09 21:11:12 -0700 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2014-07-17 06:50:24 +0000 |
commit | bc2d2b21d97d35f69dc083ad44fb08419fe32a08 (patch) | |
tree | 6aef44ab684e3a77153b0d03e3387e6fc8784369 /tests/futility | |
parent | d2d08b2cc68f720a485cdfa6f044ddb234e8c42b (diff) | |
download | vboot-bc2d2b21d97d35f69dc083ad44fb08419fe32a08.tar.gz |
Increase test coverage for dump_fmap
This checks some additional cases where the FMAP is a bit messed up.
BUG=chromium:224734
BRANCH=ToT
TEST=make runtests
Change-Id: Ic2b16bd8afdd1247d1f24c9f976d967764cadb73
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/207719
Diffstat (limited to 'tests/futility')
-rw-r--r-- | tests/futility/data_fmap2.bin | bin | 0 -> 6144 bytes | |||
-rw-r--r-- | tests/futility/data_fmap2_expect_h.txt | 4 | ||||
-rw-r--r-- | tests/futility/data_fmap2_expect_hh.txt | 29 | ||||
-rw-r--r-- | tests/futility/data_fmap2_expect_hhH.txt | 32 | ||||
-rw-r--r-- | tests/futility/data_fmap_expect_x.txt | 12 | ||||
-rwxr-xr-x | tests/futility/test_dump_fmap.sh | 38 |
6 files changed, 100 insertions, 15 deletions
diff --git a/tests/futility/data_fmap2.bin b/tests/futility/data_fmap2.bin Binary files differnew file mode 100644 index 00000000..567af9ca --- /dev/null +++ b/tests/futility/data_fmap2.bin diff --git a/tests/futility/data_fmap2_expect_h.txt b/tests/futility/data_fmap2_expect_h.txt new file mode 100644 index 00000000..16d39913 --- /dev/null +++ b/tests/futility/data_fmap2_expect_h.txt @@ -0,0 +1,4 @@ +ERROR: RO_VPD and RO_UNUSED overlap + RO_VPD: 0x1a0000 - 0x1b0000 + RO_UNUSED: 0x1af000 - 0x200000 +Use more -h args to ignore this error diff --git a/tests/futility/data_fmap2_expect_hh.txt b/tests/futility/data_fmap2_expect_hh.txt new file mode 100644 index 00000000..acbb676b --- /dev/null +++ b/tests/futility/data_fmap2_expect_hh.txt @@ -0,0 +1,29 @@ +ERROR: RO_VPD and RO_UNUSED overlap + RO_VPD: 0x1a0000 - 0x1b0000 + RO_UNUSED: 0x1af000 - 0x200000 +# name start end size +RW_PRIVATE 003fc000 00400000 00004000 +RW_ENVIRONMENT 003fc000 00400000 00004000 // DUPLICATE +RW_SHARED 003f8000 003fc000 00004000 +SHARED_DATA 003f8000 003fc000 00004000 // DUPLICATE +RW_VPD 003f0000 003f8000 00008000 +RW_SECTION_B 00300000 003f0000 000f0000 + RW_FWID_B 003eff00 003f0000 00000100 + FW_MAIN_B 00302000 003eff00 000edf00 + VBLOCK_B 00300000 00302000 00002000 +RW_SECTION_A 00200000 002f0000 000f0000 + RW_FWID_A 002eff00 002f0000 00000100 + FW_MAIN_A 00202000 002eff00 000edf00 + VBLOCK_A 00200000 00202000 00002000 +WP_RO 00000000 00200000 00200000 + RO_UNUSED 001af000 00200000 00051000 + RO_VPD 001a0000 001b0000 00010000 + RO_SECTION 00000000 0019f000 0019f000 + GBB 000b0000 0019f000 000ef000 + RO_FRID 000aff00 000b0000 00000100 + FMAP 000a0000 000a1000 00001000 + U_BOOT 00006000 000a0000 0009a000 + BL2 SPL 00002000 00006000 00004000 + BL1 PRE_BOOT 00000000 00002000 00002000 + +WARNING: unused regions found. Use -H to see them diff --git a/tests/futility/data_fmap2_expect_hhH.txt b/tests/futility/data_fmap2_expect_hhH.txt new file mode 100644 index 00000000..e95a7b1b --- /dev/null +++ b/tests/futility/data_fmap2_expect_hhH.txt @@ -0,0 +1,32 @@ +ERROR: RO_VPD and RO_UNUSED overlap + RO_VPD: 0x1a0000 - 0x1b0000 + RO_UNUSED: 0x1af000 - 0x200000 +# name start end size +-entire flash- 00000000 00400000 00400000 + RW_PRIVATE 003fc000 00400000 00004000 + RW_ENVIRONMENT 003fc000 00400000 00004000 // DUPLICATE + RW_SHARED 003f8000 003fc000 00004000 + SHARED_DATA 003f8000 003fc000 00004000 // DUPLICATE + RW_VPD 003f0000 003f8000 00008000 + RW_SECTION_B 00300000 003f0000 000f0000 + RW_FWID_B 003eff00 003f0000 00000100 + FW_MAIN_B 00302000 003eff00 000edf00 + VBLOCK_B 00300000 00302000 00002000 + 002f0000 00300000 00010000 // gap in -entire flash- + RW_SECTION_A 00200000 002f0000 000f0000 + RW_FWID_A 002eff00 002f0000 00000100 + FW_MAIN_A 00202000 002eff00 000edf00 + VBLOCK_A 00200000 00202000 00002000 + WP_RO 00000000 00200000 00200000 + RO_UNUSED 001af000 00200000 00051000 + 001b0000 001af000 fffff000 // gap in WP_RO + RO_VPD 001a0000 001b0000 00010000 + 0019f000 001a0000 00001000 // gap in WP_RO + RO_SECTION 00000000 0019f000 0019f000 + GBB 000b0000 0019f000 000ef000 + RO_FRID 000aff00 000b0000 00000100 + 000a1000 000aff00 0000ef00 // gap in RO_SECTION + FMAP 000a0000 000a1000 00001000 + U_BOOT 00006000 000a0000 0009a000 + BL2 SPL 00002000 00006000 00004000 + BL1 PRE_BOOT 00000000 00002000 00002000 diff --git a/tests/futility/data_fmap_expect_x.txt b/tests/futility/data_fmap_expect_x.txt new file mode 100644 index 00000000..2d276d60 --- /dev/null +++ b/tests/futility/data_fmap_expect_x.txt @@ -0,0 +1,12 @@ +hit at 0x00000800 +fmap_signature __FMAP__ +fmap_version: 1.0 +fmap_base: 0x0 +fmap_size: 0x00800000 (8388608) +fmap_name: FMAP +fmap_nareas: 30 +area: 2 +area_offset: 0x00000000 +area_size: 0x00001000 (4096) +area_name: SI_DESC +saved as "SI_DESC" diff --git a/tests/futility/test_dump_fmap.sh b/tests/futility/test_dump_fmap.sh index 1151fc46..d8e37c10 100755 --- a/tests/futility/test_dump_fmap.sh +++ b/tests/futility/test_dump_fmap.sh @@ -1,17 +1,15 @@ -#!/bin/bash -eu +#!/bin/bash -eux # Copyright (c) 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##*/} -if [ -e "$OLDDIR/dump_fmap" ] ; then - echo old dump_fmap binary still exists 1>&2 - exit 1 -fi - -TMP="$OUTDIR/$me.tmp" +# Work in scratch directory +cd "$OUTDIR" +TMP="$me.tmp" +# Good FMAP "$FUTILITY" dump_fmap -f "${SCRIPTDIR}/data_fmap.bin" > "$TMP" cmp "${SCRIPTDIR}/data_fmap_expect_f.txt" "$TMP" @@ -23,14 +21,24 @@ 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. -cd "$OUTDIR" # TODO: we really need a directory argument for dump_fmap. -if "$FUTILITY" dump_fmap -x "${SCRIPTDIR}/data_fmap.bin" FMAP ; then - echo Wait, that was supposed to fail. 1>&2 - exit 1 -else - rm -f FMAP -fi +! "$FUTILITY" dump_fmap -x "${SCRIPTDIR}/data_fmap.bin" FMAP + +# However, this should work. +"$FUTILITY" dump_fmap -x "${SCRIPTDIR}/data_fmap.bin" SI_DESC > "$TMP" +cmp "${SCRIPTDIR}/data_fmap_expect_x.txt" "$TMP" + + +# This FMAP has problems, and will fail. +! "$FUTILITY" dump_fmap -h "${SCRIPTDIR}/data_fmap2.bin" > "$TMP" +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" +rm -f "$TMP" FMAP SI_DESC exit 0 |