Home | History | Annotate | Download | only in t_enable_mcsum_ext3
      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
     10 		blocksize = 1024
     11 		inode_size = 128
     12 		make_hugefiles = true
     13 		hugefiles_dir = /
     14 		num_hugefiles = 10
     15 		hugefiles_name = aaaaa
     16 		hugefiles_digits = 4
     17 		hugefiles_size = 1M
     18 		zero_hugefiles = false
     19 	}
     20 ENDL
     21 
     22 echo "tune2fs metadata_csum test" > $OUT
     23 
     24 MKE2FS_CONFIG=$CONF $MKE2FS -F -T ext4h $TMPFILE 524288 >> $OUT 2>&1
     25 rm -rf $CONF
     26 
     27 # dump and check
     28 $DUMPE2FS $TMPFILE 2> /dev/null | grep '^Group 0:' -B99 -A20 | sed -f $cmd_dir/filter.sed > $OUT.before
     29 $FSCK $FSCK_OPT -N test_filesys $TMPFILE >> $OUT 2>&1
     30 status=$?
     31 echo Exit status is $status >> $OUT
     32 
     33 # add mcsum
     34 echo "tune2fs -O metadata_csum test.img" >> $OUT
     35 $TUNE2FS -O metadata_csum $TMPFILE >> $OUT 2>&1
     36 status=$?
     37 echo Exit status is $status >> $OUT
     38 
     39 # check
     40 $FSCK -yD -N test_filesys $TMPFILE >> $OUT 2>&1
     41 
     42 # dump and check
     43 $DUMPE2FS $TMPFILE 2> /dev/null | grep '^Group 0:' -B99 -A20 | sed -f $cmd_dir/filter.sed > $OUT.after
     44 echo "Change in FS metadata:" >> $OUT
     45 diff -u $OUT.before $OUT.after | tail -n +3 >> $OUT
     46 $FSCK $FSCK_OPT -N test_filesys $TMPFILE >> $OUT 2>&1
     47 status=$?
     48 echo Exit status is $status >> $OUT
     49 
     50 rm $TMPFILE $OUT.before $OUT.after
     51 
     52 #
     53 # Do the verification
     54 #
     55 
     56 sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" -e 's/test_filesys:.*//g' < $OUT > $OUT.new
     57 mv $OUT.new $OUT
     58 
     59 cmp -s $OUT $EXP
     60 status=$?
     61 
     62 if [ "$status" = 0 ] ; then
     63 	echo "$test_name: $test_description: ok"
     64 	touch $test_name.ok
     65 else
     66 	echo "$test_name: $test_description: failed"
     67 	diff $DIFF_OPTS $EXP $OUT > $test_name.failed
     68 fi
     69 
     70 unset IMAGE FSCK_OPT OUT EXP CONF
     71