Home | History | Annotate | Download | only in m_offset
      1 test_description="mke2fs with offset option (-E offset=N)"
      2 OUT="$test_name.log"
      3 
      4 echo "testing mke2fs with -E offset=524288 option (no fssize)" > "$OUT"
      5 yes a | dd of="$TMPFILE" bs=1k count=2048 iflag=fullblock 2>>"$OUT"
      6 $MKE2FS -F -b 1024 -E offset=524288 "$TMPFILE" >> "$OUT" 2>&1
      7 # compute crc of the first 512 1k blocks
      8 crc_first1=`dd if="$TMPFILE" bs=1k count=512 2>/dev/null | $CRCSUM`
      9 
     10 echo "testing mke2fs with -E offset=524288 option (explicit fssize)" >> "$OUT"
     11 yes a | dd of="$TMPFILE" bs=1k count=2048 iflag=fullblock 2>>"$OUT"
     12 $MKE2FS -F -b 1024 -E offset=524288 "$TMPFILE" 1024 >> "$OUT" 2>&1
     13 # compute crc of the first and last 512 1k blocks
     14 crc_first2=`dd if="$TMPFILE" bs=1k count=512 2>/dev/null | $CRCSUM`
     15 crc_last2=`dd if="$TMPFILE" bs=1k count=512 skip=1536 2>/dev/null | $CRCSUM`
     16 crc_exp=`yes a | dd bs=1k count=512 2>/dev/null | $CRCSUM`
     17 # a warning should be only emitted by the first mke2fs call
     18 warning=`grep -c "offset specified without an explicit file system size." \
     19 	"$OUT"`
     20 
     21 if [ "$warning" -eq 1 -a \
     22 	 "$crc_first1" = "$crc_first2" -a \
     23 	 "$crc_first2" = "$crc_last2" -a \
     24 	 "$crc_first2" = "$crc_exp" ]; then
     25 	echo "$test_name: $test_description: ok"
     26 	touch "$test_name.ok"
     27 else
     28 	echo "$test_name: $test_description: failed"
     29 	echo "warning: $warning" > "$test_name.failed"
     30 	echo "crc_first1: $crc_first1" >> "$test_name.failed"
     31 	echo "crc_first2: $crc_first2" >> "$test_name.failed"
     32 	echo "crc_last2: $crc_last2" >> "$test_name.failed"
     33 	echo "crc_exp: $crc_exp" >> "$test_name.failed"
     34 fi
     35