1if ! test -x $RESIZE2FS_EXE -o ! -x $DEBUGFS_EXE; then 2 echo "$test_name: $test_description: skipped (no debugfs/resize2fs)" 3 return 0 4fi 5 6if [ $(uname -s) = "Darwin" ]; then 7 # creates a 3GB filesystem 8 echo "$test_name: $DESCRIPTION: skipped for HFS+ (no sparse files)" 9 return 0 10fi 11 12FSCK_OPT=-fn 13OUT=$test_name.log 14EXP=$test_dir/expect 15CONF=$TMPFILE.conf 16 17#gzip -d < $EXP.gz > $EXP 18 19cat > $CONF << ENDL 20[fs_types] 21 ext4h = { 22 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,^metadata_csum,64bit 23 blocksize = 1024 24 inode_size = 256 25 make_hugefiles = true 26 hugefiles_dir = / 27 hugefiles_slack = 16000K 28 hugefiles_name = aaaaa 29 hugefiles_digits = 4 30 hugefiles_size = 117K 31 zero_hugefiles = false 32 } 33ENDL 34 35echo "tune2fs test" > $OUT 36 37MKE2FS_CONFIG=$CONF $MKE2FS -F -T ext4h -I 128 $TMPFILE 786432 >> $OUT 2>&1 38rm -f $CONF 39 40# dump and check 41($DUMPE2FS -h $TMPFILE | grep -v '^Free blocks:'; $DUMPE2FS -g $TMPFILE) 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT.before 2> /dev/null 42$FSCK $FSCK_OPT -N test_filesys $TMPFILE >> $OUT 2>&1 43status=$? 44echo Exit status is $status >> $OUT 45 46# convert it 47echo "tune2fs -I 256 -O metadata_csum test.img" >> $OUT 48dd if=/dev/zero of=$TMPFILE conv=notrunc bs=1 count=1 seek=3221225471 2> /dev/null 49$TUNE2FS -I 256 -O metadata_csum $TMPFILE >> $OUT 2>&1 50status=$? 51echo Exit status is $status >> $OUT 52$FSCK -N test_filesys -y -f -D $TMPFILE >> $OUT 2>&1 53 54# dump and check 55($DUMPE2FS -h $TMPFILE | grep -v '^Free blocks:'; $DUMPE2FS -g $TMPFILE) 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT.after 2> /dev/null 56echo "Change in FS metadata:" >> $OUT 57diff -U 0 $OUT.before $OUT.after | sed -e '/^---.*/d' -e '/^+++.*/d' >> $OUT 58$FSCK $FSCK_OPT -N test_filesys $TMPFILE >> $OUT 2>&1 59status=$? 60echo Exit status is $status >> $OUT 61 62rm $TMPFILE 63 64# 65# Do the verification 66# 67 68sed -f $cmd_dir/filter.sed -e 's/test_filesys:.*//g' < $OUT > $OUT.new 69mv $OUT.new $OUT 70 71cmp -s $OUT $EXP 72status=$? 73 74if [ "$status" = 0 ] ; then 75 echo "$test_name: $test_description: ok" 76 touch $test_name.ok 77else 78 echo "$test_name: $test_description: failed" 79 diff $DIFF_OPTS $EXP $OUT > $test_name.failed 80fi 81 82rm $OUT.before $OUT.after 83 84unset IMAGE FSCK_OPT OUT EXP CONF 85