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 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 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 23$DUMPE2FS $TMPFILE 2>&1 | grep '^Journal features:' >> $OUT.new 24 25echo "debugfs write journal" >> $OUT.new 26echo "jo -c" > $TMPFILE.cmd 27echo "jw -b $bitmaps /dev/zero" >> $TMPFILE.cmd 28echo "jc" >> $TMPFILE.cmd 29echo "jo" >> $TMPFILE.cmd 30echo "jw -r $bitmaps" >> $TMPFILE.cmd 31echo "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 36test -d "$JOURNAL_DUMP_DIR" -a -w "$JOURNAL_DUMP_DIR" && cp "$TMPFILE" "$JOURNAL_DUMP_DIR/$test_name.img" 37echo "logdump -c" > $TMPFILE.cmd 38$DEBUGFS -f $TMPFILE.cmd $TMPFILE >> $OUT.new 2>&1 39 40$FSCK -fy -N test_filesys $TMPFILE >> $OUT.new 2>&1 41status=$? 42echo Exit status is $status >> $OUT.new 43sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new > $OUT 44rm -f $TMPFILE $TMPFILE.cmd $OUT.new 45 46cmp -s $OUT $EXP 47status=$? 48 49if [ "$status" = 0 ] ; then 50 echo "$test_name: $test_description: ok" 51 touch $test_name.ok 52else 53 echo "$test_name: $test_description: failed" 54 diff $DIFF_OPTS $EXP $OUT > $test_name.failed 55 rm -f $test_name.tmp 56fi 57 58unset IMAGE FSCK_OPT OUT EXP 59