• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1test_description="mke2fs with offset option (-E offset=N)"
2OUT="$test_name.log"
3
4echo "testing mke2fs with -E offset=524288 option (no fssize)" > "$OUT"
5yes 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
8crc_first1=`$DD if="$TMPFILE" bs=1k count=512 2>/dev/null | $CRCSUM`
9
10echo "testing mke2fs with -E offset=524288 option (explicit fssize)" >> "$OUT"
11yes 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
14crc_first2=`$DD if="$TMPFILE" bs=1k count=512 2>/dev/null | $CRCSUM`
15crc_last2=`$DD if="$TMPFILE" bs=1k count=512 skip=1536 2>/dev/null | $CRCSUM`
16crc_exp=`yes a | $DD bs=1k count=512 2>/dev/null | $CRCSUM`
17# a warning should be only emitted by the first mke2fs call
18warning=`grep -c "offset specified without an explicit file system size." \
19	"$OUT"`
20
21if [ "$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"
27else
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"
34fi
35