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