Home | History | Annotate | Download | only in j_short_trans_recover_mcsum_64bit
      1 if ! test -x $DEBUGFS_EXE; then
      2 	echo "$test_name: $test_description: skipped (no debugfs)"
      3 	return 0
      4 fi
      5 
      6 FSCK_OPT=-fy
      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 $MKE2FS -F -o Linux -b 4096 -O 64bit,has_journal,metadata_csum -T ext4 $TMPFILE 131072 > $OUT.new 2>&1
     16 
     17 $FSCK -fy -N test_filesys $TMPFILE >> $OUT.new 2>&1
     18 status=$?
     19 echo Exit status is $status >> $OUT.new
     20 
     21 bitmaps="$($DUMPE2FS $TMPFILE 2>&1 | grep 'bitmap at' | sed -e 's/^.*bitmap at \([0-9]*\).*$/\1/g' | tr '\n' ',')"
     22 
     23 $DUMPE2FS $TMPFILE 2>&1 | grep '^Journal features:' >> $OUT.new
     24 
     25 echo "debugfs write journal" >> $OUT.new
     26 echo "jo -c" > $TMPFILE.cmd
     27 echo "jw -b 333,$bitmaps /dev/zero" >> $TMPFILE.cmd
     28 echo "jc" >> $TMPFILE.cmd
     29 echo "jo" >> $TMPFILE.cmd
     30 echo "jw -r 333" >> $TMPFILE.cmd
     31 echo "jc" >> $TMPFILE.cmd
     32 $DEBUGFS -w -f $TMPFILE.cmd $TMPFILE 2>> $OUT.new > /dev/null
     33 
     34 $DUMPE2FS $TMPFILE 2>&1 | grep '^Journal features:' >> $OUT.new
     35 
     36 test -d "$JOURNAL_DUMP_DIR" -a -w "$JOURNAL_DUMP_DIR" && cp "$TMPFILE" "$JOURNAL_DUMP_DIR/$test_name.img"
     37 echo "logdump -c" > $TMPFILE.cmd
     38 $DEBUGFS -f $TMPFILE.cmd $TMPFILE >> $OUT.new 2>&1
     39 
     40 echo "debugfs recover journal" >> $OUT.new
     41 echo "jr" > $TMPFILE.cmd
     42 $DEBUGFS -w -f $TMPFILE.cmd $TMPFILE 2>> $OUT.new > /dev/null
     43 
     44 $FSCK -fy -N test_filesys $TMPFILE >> $OUT.new 2>&1
     45 status=$?
     46 echo Exit status is $status >> $OUT.new
     47 sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new > $OUT
     48 rm -f $TMPFILE $TMPFILE.cmd $OUT.new
     49 
     50 cmp -s $OUT $EXP
     51 status=$?
     52 
     53 if [ "$status" = 0 ] ; then
     54 	echo "$test_name: $test_description: ok"
     55 	touch $test_name.ok
     56 else
     57 	echo "$test_name: $test_description: failed"
     58 	diff $DIFF_OPTS $EXP $OUT > $test_name.failed
     59 	rm -f $test_name.tmp
     60 fi
     61 
     62 unset IMAGE FSCK_OPT OUT EXP
     63