1 FSCK_OPT=-fn 2 OUT=$test_name.log 3 EXP=$test_dir/expect 4 CONF=$TMPFILE.conf 5 6 cat > $CONF << ENDL 7 [fs_types] 8 ext4h = { 9 features = has_journal,^extent,huge_file,^flex_bg,^uninit_bg,dir_nlink,^extra_isize,sparse_super,filetype,dir_index,ext_attr,resize_inode,^64bit,^metadata_csum 10 blocksize = 1024 11 inode_size = 256 12 make_hugefiles = true 13 hugefiles_dir = / 14 num_hugefiles = 100 15 hugefiles_slack = 0 16 hugefiles_name = aaaaa 17 hugefiles_digits = 4 18 hugefiles_size = 1M 19 zero_hugefiles = false 20 } 21 ENDL 22 23 echo "rebuild extent metadata_csum test" > $OUT 24 25 MKE2FS_CONFIG=$CONF $MKE2FS -F -T ext4h $TMPFILE 524288 >> $OUT 2>&1 26 rm -rf $CONF 27 28 # dump and check 29 $DUMPE2FS $TMPFILE 2> /dev/null | grep '^Group 0:' -B99 -A20 | sed -f $cmd_dir/filter.sed > $OUT.before 30 $FSCK $FSCK_OPT -N test_filesys $TMPFILE >> $OUT 2>&1 31 status=$? 32 echo Exit status is $status >> $OUT 33 34 # check 35 $FSCK -fyD -N test_filesys -E bmap2extent $TMPFILE >> $OUT 2>&1 36 37 # dump and check 38 $DUMPE2FS $TMPFILE 2> /dev/null | grep '^Group 0:' -B99 -A20 | sed -f $cmd_dir/filter.sed > $OUT.after 39 echo "Change in FS metadata:" >> $OUT 40 diff -u $OUT.before $OUT.after | tail -n +3 >> $OUT 41 $FSCK $FSCK_OPT -N test_filesys $TMPFILE >> $OUT 2>&1 42 status=$? 43 echo Exit status is $status >> $OUT 44 45 rm $TMPFILE $OUT.before $OUT.after 46 47 # 48 # Do the verification 49 # 50 51 sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" -e 's/test_filesys:.*//g' < $OUT > $OUT.new 52 mv $OUT.new $OUT 53 54 cmp -s $OUT $EXP 55 status=$? 56 57 if [ "$status" = 0 ] ; then 58 echo "$test_name: $test_description: ok" 59 touch $test_name.ok 60 else 61 echo "$test_name: $test_description: failed" 62 diff $DIFF_OPTS $EXP $OUT > $test_name.failed 63 fi 64 65 unset IMAGE FSCK_OPT OUT EXP CONF 66