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 39$DEBUGFS_EXE -w -f $TMPFILE.cmd $TMPFILE 2>> $OUT.new > /dev/null 40sed -f $cmd_dir/filter.sed < $OUT.new >> $OUT 41rm -rf $OUT.new 42 43test -d "$JOURNAL_DUMP_DIR" -a -w "$JOURNAL_DUMP_DIR" && cp "$TMPFILE" "$JOURNAL_DUMP_DIR/$test_name.img" 44test -d "$JOURNAL_DUMP_DIR" -a -w "$JOURNAL_DUMP_DIR" && cp "$JNLFILE" "$JOURNAL_DUMP_DIR/$test_name.img.jnl" 45echo "logdump -c -f $JNLFILE" > $TMPFILE.cmd 46$DEBUGFS_EXE -f $TMPFILE.cmd $TMPFILE 2>&1 | sed -f $cmd_dir/filter.sed -e 's/logdump -c -f.*/logdump -c/g' >> $OUT 47rm -rf $TMPFILE.cmd 48 49echo "debugfs fsck" >> $OUT 50$FSCK -fy -N test_filesys -j $JNLFILE $TMPFILE > $OUT.new 2>&1 51status=$? 52echo Exit status is $status >> $OUT.new 53sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new >> $OUT 54rm -f $OUT.new 55 56rm -f $TMPFILE $JNLFILE 57 58cmp -s $OUT $EXP 59status=$? 60 61if [ "$status" = 0 ] ; then 62 echo "$test_name: $test_description: ok" 63 touch $test_name.ok 64else 65 echo "$test_name: $test_description: failed" 66 diff $DIFF_OPTS $EXP $OUT > $test_name.failed 67 rm -f $test_name.tmp 68fi 69 70unset IMAGE FSCK_OPT OUT EXP JNLFILE 71 72else #if test -x $DEBUGFS_EXE; then 73 echo "$test_name: $test_description: skipped" 74fi 75