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