| 1 |
os=$(uname -s) |
| 2 |
if [ "$os" = "Darwin" -o "$os" = "GNU" -o "$os" = "FreeBSD" ]; then |
| 3 |
# creates a 96GB filesystem |
| 4 |
echo "$test_name: $test_description: skipped for $os" |
| 5 |
return 0 |
| 6 |
fi |
| 7 |
|
| 8 |
if ! test -x $RESIZE2FS_EXE -o ! -x $DEBUGFS_EXE; then |
| 9 |
echo "$test_name: $test_description: skipped (no debugfs/resize2fs)" |
| 10 |
return 0 |
| 11 |
fi |
| 12 |
|
| 13 |
FSCK_OPT=-yf |
| 14 |
OUT=$test_name.log |
| 15 |
if [ -f $test_dir/expect.gz ]; then |
| 16 |
EXP=$test_name.tmp |
| 17 |
gunzip < $test_dir/expect.gz > $EXP1 |
| 18 |
else |
| 19 |
EXP=$test_dir/expect |
| 20 |
fi |
| 21 |
|
| 22 |
dd if=/dev/zero of=$TMPFILE bs=1k count=512 > /dev/null 2>&1 |
| 23 |
|
| 24 |
echo mke2fs -q -F -o Linux -b 1024 -i 1024 -E stride=8192 -t ext4 test.img 1024000 > $OUT |
| 25 |
$MKE2FS -q -F -o Linux -b 1024 -i 1024 -E stride=8192 -t ext4 \ |
| 26 |
$TMPFILE 1024000 >> $OUT 2>&1 |
| 27 |
|
| 28 |
echo resize2fs -p test.img 10240000 >> $OUT |
| 29 |
$RESIZE2FS -p $TMPFILE 100000000 >> $OUT 2>&1 |
| 30 |
|
| 31 |
$FSCK $FSCK_OPT -N test_filesys $TMPFILE >> $OUT 2>&1 |
| 32 |
status=$? |
| 33 |
echo Exit status is $status >> $OUT |
| 34 |
|
| 35 |
$DEBUGFS -R "set_super_value lastcheck 0" -w $TMPFILE >/dev/null 2>&1 |
| 36 |
$DEBUGFS -R "set_super_value hash_seed null" -w $TMPFILE >/dev/null 2>&1 |
| 37 |
$DEBUGFS -R "set_super_value mkfs_time 0" -w $TMPFILE >/dev/null 2>&1 |
| 38 |
$TUNE2FS -c 20 -U clear $TMPFILE >/dev/null 2>&1 |
| 39 |
|
| 40 |
echo dumpe2fs -h test.img >> $OUT |
| 41 |
$DUMPE2FS -h $TMPFILE >> $OUT 2>&1 |
| 42 |
sed -f $cmd_dir/filter.sed -e '/Block bitmap.*$/N;s/\n Inode bitmap/, Inode bitmap/g' < $OUT > $OUT.new |
| 43 |
mv $OUT.new $OUT |
| 44 |
rm -f $TMPFILE |
| 45 |
|
| 46 |
cmp -s $OUT $EXP |
| 47 |
status=$? |
| 48 |
|
| 49 |
if [ "$status" = 0 ] ; then |
| 50 |
echo "$test_name: $test_description: ok" |
| 51 |
touch $test_name.ok |
| 52 |
else |
| 53 |
echo "$test_name: $test_description: failed" |
| 54 |
diff $DIFF_OPTS $EXP $OUT > $test_name.failed |
| 55 |
rm -f $test_name.tmp |
| 56 |
fi |
| 57 |
|
| 58 |
unset IMAGE FSCK_OPT OUT EXP |