1 if test -x $DEBUGFS_EXE; then 2 3 FSCK_OPT=-fy 4 OUT=$test_name.log 5 if [ -f $test_dir/expect.gz ]; then 6 EXP=$test_name.tmp 7 gunzip < $test_dir/expect.gz > $EXP1 8 else 9 EXP=$test_dir/expect 10 fi 11 12 cp /dev/null $OUT 13 14 JNLFILE=$TMPFILE.jnl 15 16 touch $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 20 echo "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 25 EOF 26 sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new >> $OUT 27 rm -f $OUT.new 28 29 $FSCK -fy -N test_filesys -j $JNLFILE $TMPFILE > $OUT.new 2>&1 30 status=$? 31 echo Exit status is $status >> $OUT.new 32 sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new >> $OUT 33 rm -f $OUT.new 34 35 echo "debugfs write journal" >> $OUT 36 echo "jo -f $JNLFILE" > $TMPFILE.cmd 37 echo "jw -b 259-4356 /dev/zero" >> $TMPFILE.cmd 38 echo "jc" >> $TMPFILE.cmd 39 echo "jo -f $JNLFILE" >> $TMPFILE.cmd 40 echo "jw -r 259-4356 /dev/zero" >> $TMPFILE.cmd 41 echo "jc" >> $TMPFILE.cmd 42 $DEBUGFS_EXE -w -f $TMPFILE.cmd $TMPFILE 2>> $OUT.new > /dev/null 43 sed -f $cmd_dir/filter.sed < $OUT.new >> $OUT 44 rm -rf $OUT.new 45 46 test -d "$JOURNAL_DUMP_DIR" -a -w "$JOURNAL_DUMP_DIR" && cp "$TMPFILE" "$JOURNAL_DUMP_DIR/$test_name.img" 47 test -d "$JOURNAL_DUMP_DIR" -a -w "$JOURNAL_DUMP_DIR" && cp "$JNLFILE" "$JOURNAL_DUMP_DIR/$test_name.img.jnl" 48 echo "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 50 rm -rf $TMPFILE.cmd 51 52 echo "debugfs fsck" >> $OUT 53 $FSCK -fy -N test_filesys -j $JNLFILE $TMPFILE > $OUT.new 2>&1 54 status=$? 55 echo Exit status is $status >> $OUT.new 56 sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new >> $OUT 57 rm -f $OUT.new 58 59 rm -f $TMPFILE $JNLFILE 60 61 cmp -s $OUT $EXP 62 status=$? 63 64 if [ "$status" = 0 ] ; then 65 echo "$test_name: $test_description: ok" 66 touch $test_name.ok 67 else 68 echo "$test_name: $test_description: failed" 69 diff $DIFF_OPTS $EXP $OUT > $test_name.failed 70 rm -f $test_name.tmp 71 fi 72 73 unset IMAGE FSCK_OPT OUT EXP JNLFILE 74 75 else #if test -x $DEBUGFS_EXE; then 76 echo "$test_name: $test_description: skipped" 77 fi 78