diff options
Diffstat (limited to 'tests/futility/test_dump_fmap.sh')
-rwxr-xr-x | tests/futility/test_dump_fmap.sh | 38 |
1 files changed, 23 insertions, 15 deletions
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 |