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