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 15JNLFILE=$TMPFILE.jnl 16 17touch $JNLFILE 18$MKE2FS -F -o Linux -b 1024 -O journal_dev -T ext4 -U 1db3f677-6832-4adb-bafc-8e4059c30a34 $JNLFILE 262144 > $OUT.new 2>&1 19$MKE2FS -F -o Linux -b 1024 -O ^has_journal -T ext4 $TMPFILE 262144 >> $OUT.new 2>&1 20 21echo "debugfs add journal device/UUID" >> $OUT.new 22$DEBUGFS -w -f - $TMPFILE <<- EOF >> $OUT.new 2>&1 23 feature has_journal 24 ssv journal_dev 0x9999 25 ssv journal_uuid 1db3f677-6832-4adb-bafc-8e4059c30a34 26EOF 27 28$FSCK -fy -N test_filesys -j $JNLFILE $TMPFILE >> $OUT.new 2>&1 29status=$? 30echo Exit status is $status >> $OUT.new 31 32echo "debugfs write journal" >> $OUT.new 33echo "jo -f $JNLFILE" > $TMPFILE.cmd 34echo "jw -b 259-4356 /dev/zero" >> $TMPFILE.cmd 35echo "jc" >> $TMPFILE.cmd 36$DEBUGFS -w -f $TMPFILE.cmd $TMPFILE 2>> $OUT.new > /dev/null 37 38test -d "$JOURNAL_DUMP_DIR" -a -w "$JOURNAL_DUMP_DIR" && cp "$TMPFILE" "$JOURNAL_DUMP_DIR/$test_name.img" 39test -d "$JOURNAL_DUMP_DIR" -a -w "$JOURNAL_DUMP_DIR" && cp "$JNLFILE" "$JOURNAL_DUMP_DIR/$test_name.img.jnl" 40echo "logdump -c -f $JNLFILE" > $TMPFILE.cmd 41$DEBUGFS -f $TMPFILE.cmd $TMPFILE >> $OUT.new 2>&1 42 43echo "debugfs fsck" >> $OUT.new 44$FSCK -fy -N test_filesys -j $JNLFILE $TMPFILE >> $OUT.new 2>&1 45status=$? 46echo Exit status is $status >> $OUT.new 47sed -f $cmd_dir/filter.sed -e 's/logdump -c -f.*/logdump -c/g' $OUT.new > $OUT 48rm -f $TMPFILE $TMPFILE.cmd $JNLFILE $OUT.new 49 50cmp -s $OUT $EXP 51status=$? 52 53if [ "$status" = 0 ] ; then 54 echo "$test_name: $test_description: ok" 55 touch $test_name.ok 56else 57 echo "$test_name: $test_description: failed" 58 diff $DIFF_OPTS $EXP $OUT > $test_name.failed 59 rm -f $test_name.tmp 60fi 61 62unset IMAGE FSCK_OPT OUT EXP JNLFILE 63