1if test -x $DEBUGFS_EXE; then 2 3FSCK_OPT=-fy 4OUT=$test_name.log 5if [ -f $test_dir/expect.gz ]; then 6 EXP=$test_name.tmp 7 gunzip < $test_dir/expect.gz > $EXP1 8else 9 EXP=$test_dir/expect 10fi 11 12cp /dev/null $OUT 13 14$MKE2FS -F -o Linux -b 4096 -O has_journal,metadata_csum -T ext4 $TMPFILE 65536 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT 2>&1 15 16$FSCK -fy -N test_filesys $TMPFILE > $OUT.new 2>&1 17status=$? 18echo Exit status is $status >> $OUT.new 19sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new >> $OUT 20rm -f $OUT.new 21 22bitmaps="$($DUMPE2FS $TMPFILE 2>&1 | grep 'bitmap at' | sed -e 's/^.*bitmap at \([0-9]*\).*$/\1/g' | tr '\n' ',')" 23 24echo "debugfs write journal" >> $OUT 25echo "jo" > $TMPFILE.cmd 26echo "jw -b $bitmaps /dev/zero" >> $TMPFILE.cmd 27echo "jc" >> $TMPFILE.cmd 28$DEBUGFS_EXE -w -f $TMPFILE.cmd $TMPFILE 2>> $OUT.new > /dev/null 29sed -f $cmd_dir/filter.sed < $OUT.new >> $OUT 30rm -rf $OUT.new 31 32echo "disable metadata_csum on a dirty-journal fs" >> $OUT 33$TUNE2FS -O ^metadata_csum $TMPFILE 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT 2>&1 34 35echo "fsck the whole mess" >> $OUT 36$FSCK -fy -N test_filesys $TMPFILE > $OUT.new 2>&1 37status=$? 38echo Exit status is $status >> $OUT.new 39sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new >> $OUT 40rm -f $OUT.new 41 42rm -f $TMPFILE $TMPFILE.cmd 43 44cmp -s $OUT $EXP 45status=$? 46 47if [ "$status" = 0 ] ; then 48 echo "$test_name: $test_description: ok" 49 touch $test_name.ok 50else 51 echo "$test_name: $test_description: failed" 52 diff $DIFF_OPTS $EXP $OUT > $test_name.failed 53 rm -f $test_name.tmp 54fi 55 56unset IMAGE FSCK_OPT OUT EXP 57 58else #if test -x $DEBUGFS_EXE; then 59 echo "$test_name: $test_description: skipped" 60fi 61