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=-fn 7 OUT=$test_name.log 8 EXP=$test_dir/expect 9 CONF=$TMPFILE.conf 10 11 #gzip -d < $EXP.gz > $EXP 12 13 cat > $CONF << ENDL 14 [fs_types] 15 ext4h = { 16 features = has_journal,extent,huge_file,uninit_bg,dir_nlink,extra_isize,sparse_super,filetype,dir_index,ext_attr,^resize_inode,^meta_bg,^flex_bg 17 blocksize = 1024 18 inode_size = 256 19 make_hugefiles = true 20 hugefiles_dir = / 21 hugefiles_slack = 0 22 hugefiles_name = aaaaa 23 hugefiles_digits = 4 24 hugefiles_size = 1M 25 zero_hugefiles = false 26 } 27 ENDL 28 29 echo "resize2fs test" > $OUT 30 31 MKE2FS_CONFIG=$CONF $MKE2FS -F -T ext4h $TMPFILE 786432 >> $OUT 2>&1 32 rm -f $CONF 33 34 # check 35 $FSCK $FSCK_OPT -N test_filesys $TMPFILE >> $OUT 2>&1 36 status=$? 37 echo Exit status is $status >> $OUT 38 39 # convert it 40 echo "resize2fs -b test.img" >> $OUT 41 $RESIZE2FS -b -f $TMPFILE >> $OUT 2>&1 42 $DUMPE2FS -g $TMPFILE >> $OUT.before 2> /dev/null 43 44 # grow it 45 echo "resize2fs test.img" >> $OUT 46 dd if=/dev/zero of=$TMPFILE conv=notrunc bs=1 count=1 seek=1207959552 2> /dev/null 47 $RESIZE2FS -f $TMPFILE >> $OUT 2>&1 48 status=$? 49 echo Exit status is $status >> $OUT 50 51 # dump and check 52 $DUMPE2FS -g $TMPFILE >> $OUT.after 2> /dev/null 53 echo "Change in FS metadata:" >> $OUT 54 diff -u $OUT.before $OUT.after | tail -n +3 >> $OUT 55 $FSCK $FSCK_OPT -N test_filesys $TMPFILE >> $OUT 2>&1 56 status=$? 57 echo Exit status is $status >> $OUT 58 59 rm $TMPFILE 60 61 # 62 # Do the verification 63 # 64 65 sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" -e 's/test_filesys:.*//g' < $OUT > $OUT.new 66 mv $OUT.new $OUT 67 68 cmp -s $OUT $EXP 69 status=$? 70 71 if [ "$status" = 0 ] ; then 72 echo "$test_name: $test_description: ok" 73 touch $test_name.ok 74 else 75 echo "$test_name: $test_description: failed" 76 diff $DIFF_OPTS $EXP $OUT > $test_name.failed 77 fi 78 79 rm $OUT.before $OUT.after 80 81 unset IMAGE FSCK_OPT OUT EXP CONF 82