Home | History | Annotate | Download | only in futility
      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 
      6 me=${0##*/}
      7 TMP="$me.tmp"
      8 
      9 # Work in scratch directory
     10 cd "$OUTDIR"
     11 
     12 # Good FMAP
     13 "$FUTILITY" dump_fmap -F "${SCRIPTDIR}/data_fmap.bin"  > "$TMP"
     14 cmp "${SCRIPTDIR}/data_fmap_expect_f.txt" "$TMP"
     15 
     16 "$FUTILITY" dump_fmap -p "${SCRIPTDIR}/data_fmap.bin"  > "$TMP"
     17 cmp "${SCRIPTDIR}/data_fmap_expect_p.txt" "$TMP"
     18 
     19 "$FUTILITY" dump_fmap -h "${SCRIPTDIR}/data_fmap.bin"  > "$TMP"
     20 cmp "${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.
     25 if "$FUTILITY" dump_fmap -x "${SCRIPTDIR}/data_fmap.bin" FMAP; then false; fi
     26 
     27 # This should fail too
     28 if "$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"
     32 cmp "${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"
     36 cmp "${SCRIPTDIR}/data_fmap_expect_x2.txt" "$TMP"
     37 cmp SI_DESC FOO
     38 
     39 # This FMAP has problems, and should fail.
     40 if "$FUTILITY" dump_fmap -h "${SCRIPTDIR}/data_fmap2.bin" > "$TMP"; then false; fi
     41 cmp "${SCRIPTDIR}/data_fmap2_expect_h.txt" "$TMP"
     42 
     43 "$FUTILITY" dump_fmap -hh "${SCRIPTDIR}/data_fmap2.bin" > "$TMP"
     44 cmp "${SCRIPTDIR}/data_fmap2_expect_hh.txt" "$TMP"
     45 
     46 "$FUTILITY" dump_fmap -hhH "${SCRIPTDIR}/data_fmap2.bin" > "$TMP"
     47 cmp "${SCRIPTDIR}/data_fmap2_expect_hhH.txt" "$TMP"
     48 
     49 
     50 # cleanup
     51 rm -f ${TMP}* FMAP SI_DESC FOO
     52 exit 0
     53