1 if ! test -x $RESIZE2FS_EXE -o ! -x $DEBUGFS_EXE; then 2 echo "$test_name: $test_description: skipped (no debugfs/resize2fs)" 3 return 0 4 fi 5 6 FSCK_OPT=-yf 7 OUT=$test_name.log 8 if [ -f $test_dir/expect.gz ]; then 9 EXP=$test_name.tmp 10 gunzip < $test_dir/expect.gz > $EXP1 11 else 12 EXP=$test_dir/expect 13 fi 14 15 dd if=/dev/zero of=$TMPFILE bs=1k count=512 > /dev/null 2>&1 16 17 echo mke2fs -q -F -o Linux -b 1024 -g 256 test.img 1024 > $OUT.new 18 $MKE2FS -q -F -o Linux -b 1024 -g 256 $TMPFILE 1024 >> $OUT.new 2>&1 19 20 echo resize2fs -p test.img 10000 >> $OUT.new 21 $RESIZE2FS -p $TMPFILE 10000 >> $OUT.new 2>&1 22 23 $FSCK $FSCK_OPT -N test_filesys $TMPFILE >> $OUT.new 2>&1 24 status=$? 25 echo Exit status is $status >> $OUT.new 26 27 $DEBUGFS -R "set_super_value lastcheck 0" -w $TMPFILE >/dev/null 2>&1 28 $DEBUGFS -R "set_super_value hash_seed null" -w $TMPFILE >/dev/null 2>&1 29 $DEBUGFS -R "set_super_value mkfs_time 0" -w $TMPFILE >/dev/null 2>&1 30 $TUNE2FS -c 20 -U clear $TMPFILE >/dev/null 2>&1 31 32 echo dumpe2fs test.img >> $OUT.new 33 $DUMPE2FS $TMPFILE >> $OUT.new 2>&1 34 35 echo "--------------------------------" >> $OUT.new 36 37 echo resize2fs -p test.img 20000 >> $OUT.new 38 $RESIZE2FS -p $TMPFILE 20000 >> $OUT.new 2>&1 39 40 $FSCK $FSCK_OPT -N test_filesys $TMPFILE >> $OUT.new 2>&1 41 status=$? 42 echo Exit status is $status >> $OUT.new 43 44 $DEBUGFS -R "set_super_value lastcheck 0" -w $TMPFILE >/dev/null 2>&1 45 $DEBUGFS -R "set_super_value hash_seed null" -w $TMPFILE >/dev/null 2>&1 46 $DEBUGFS -R "set_super_value mkfs_time 0" -w $TMPFILE >/dev/null 2>&1 47 $TUNE2FS -c 20 -U clear $TMPFILE >/dev/null 2>&1 48 49 echo dumpe2fs test.img >> $OUT.new 50 $DUMPE2FS $TMPFILE >> $OUT.new 2>&1 51 52 echo "--------------------------------" >> $OUT.new 53 54 echo resize2fs -p test.img 30000 >> $OUT.new 55 $RESIZE2FS -p $TMPFILE 30000 >> $OUT.new 2>&1 56 57 $FSCK $FSCK_OPT -N test_filesys $TMPFILE >> $OUT.new 2>&1 58 status=$? 59 echo Exit status is $status >> $OUT.new 60 61 $DEBUGFS -R "set_super_value lastcheck 0" -w $TMPFILE >/dev/null 2>&1 62 $DEBUGFS -R "set_super_value hash_seed null" -w $TMPFILE >/dev/null 2>&1 63 $DEBUGFS -R "set_super_value mkfs_time 0" -w $TMPFILE >/dev/null 2>&1 64 $TUNE2FS -c 20 -U clear $TMPFILE >/dev/null 2>&1 65 66 echo dumpe2fs test.img >> $OUT.new 67 $DUMPE2FS $TMPFILE >> $OUT.new 2>&1 68 69 echo "--------------------------------" >> $OUT.new 70 71 echo resize2fs -p test.img 40000 >> $OUT.new 72 $RESIZE2FS -p $TMPFILE 40000 >> $OUT.new 2>&1 73 74 $FSCK $FSCK_OPT -N test_filesys $TMPFILE >> $OUT.new 2>&1 75 status=$? 76 echo Exit status is $status >> $OUT.new 77 78 $DEBUGFS -R "set_super_value lastcheck 0" -w $TMPFILE >/dev/null 2>&1 79 $DEBUGFS -R "set_super_value hash_seed null" -w $TMPFILE >/dev/null 2>&1 80 $DEBUGFS -R "set_super_value mkfs_time 0" -w $TMPFILE >/dev/null 2>&1 81 $TUNE2FS -c 20 -U clear $TMPFILE >/dev/null 2>&1 82 83 echo dumpe2fs test.img >> $OUT.new 84 $DUMPE2FS $TMPFILE >> $OUT.new 2>&1 85 sed -f $cmd_dir/filter.sed -e '/Block bitmap.*$/N;s/\n Inode bitmap/, Inode bitmap/g' < $OUT.new > $OUT 86 rm -f $TMPFILE $OUT.new 87 88 cmp -s $OUT $EXP 89 status=$? 90 91 if [ "$status" = 0 ] ; then 92 echo "$test_name: $test_description: ok" 93 touch $test_name.ok 94 else 95 echo "$test_name: $test_description: failed" 96 diff $DIFF_OPTS $EXP $OUT > $test_name.failed 97 rm -f $test_name.tmp 98 fi 99 100 unset IMAGE FSCK_OPT OUT EXP 101