1#!/bin/bash -eux 2# Copyright 2013 The Chromium OS Authors. All rights reserved. 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# Good FMAP 13"$FUTILITY" dump_fmap -F "${SCRIPTDIR}/data_fmap.bin" > "$TMP" 14cmp "${SCRIPTDIR}/data_fmap_expect_f.txt" "$TMP" 15 16"$FUTILITY" dump_fmap -p "${SCRIPTDIR}/data_fmap.bin" > "$TMP" 17cmp "${SCRIPTDIR}/data_fmap_expect_p.txt" "$TMP" 18 19"$FUTILITY" dump_fmap -h "${SCRIPTDIR}/data_fmap.bin" > "$TMP" 20cmp "${SCRIPTDIR}/data_fmap_expect_h.txt" "$TMP" 21 22 23# This should fail because the input file is truncated and doesn't really 24# contain the stuff that the FMAP claims it does. 25if "$FUTILITY" dump_fmap -x "${SCRIPTDIR}/data_fmap.bin" FMAP; then false; fi 26 27# This should fail too 28if "$FUTILITY" show "${SCRIPTDIR}/data_fmap.bin"; then false; fi 29 30# However, this should work. 31"$FUTILITY" dump_fmap -x "${SCRIPTDIR}/data_fmap.bin" SI_DESC > "$TMP" 32cmp "${SCRIPTDIR}/data_fmap_expect_x.txt" "$TMP" 33 34# Redirect dumping to a different place 35"$FUTILITY" dump_fmap -x "${SCRIPTDIR}/data_fmap.bin" SI_DESC:FOO > "$TMP" 36cmp "${SCRIPTDIR}/data_fmap_expect_x2.txt" "$TMP" 37cmp SI_DESC FOO 38 39# This FMAP has problems, and should fail. 40if "$FUTILITY" dump_fmap -h "${SCRIPTDIR}/data_fmap2.bin" > "$TMP"; then false; fi 41cmp "${SCRIPTDIR}/data_fmap2_expect_h.txt" "$TMP" 42 43"$FUTILITY" dump_fmap -hh "${SCRIPTDIR}/data_fmap2.bin" > "$TMP" 44cmp "${SCRIPTDIR}/data_fmap2_expect_hh.txt" "$TMP" 45 46"$FUTILITY" dump_fmap -hhH "${SCRIPTDIR}/data_fmap2.bin" > "$TMP" 47cmp "${SCRIPTDIR}/data_fmap2_expect_hhH.txt" "$TMP" 48 49 50# cleanup 51rm -f ${TMP}* FMAP SI_DESC FOO 52exit 0 53