1 if ! test -x $DEBUGFS_EXE; then 2 echo "$test_name: $test_description: skipped (no debugfs)" 3 return 0 4 fi 5 6 OUT=$test_name.log 7 EXP=$test_dir/expect 8 VERIFY_FSCK_OPT=-yf 9 10 TEST_DATA=$test_name.tmp 11 VERIFY_DATA=$test_name.ver.tmp 12 13 echo "debugfs load/dump test" > $OUT.new 14 15 dd if=/dev/zero of=$TMPFILE bs=1k count=512 > /dev/null 2>&1 16 17 echo "mke2fs -Fq -b 1024 test.img 512" >> $OUT.new 18 19 $MKE2FS -Fq -b 1024 $TMPFILE 512 > /dev/null 2>&1 20 status=$? 21 echo Exit status is $status >> $OUT.new 22 23 dd if=$TEST_BITS of=$TEST_DATA bs=128k count=1 conv=sync > /dev/null 2>&1 24 echo "file fragment odd size" >> $TEST_DATA 25 26 echo "debugfs -R ''write $TEST_DATA test_data'' -w test.img" >> $OUT.new 27 $DEBUGFS -R "write $TEST_DATA test_data" -w $TMPFILE >> $OUT.new 2>&1 28 status=$? 29 echo Exit status is $status >> $OUT.new 30 31 echo e2fsck $VERIFY_FSCK_OPT -N test_filesys >> $OUT.new 32 $FSCK $VERIFY_FSCK_OPT -N test_filesys $TMPFILE >> $OUT.new 2>&1 33 status=$? 34 echo Exit status is $status >> $OUT.new 35 36 echo "debugfs -R ''dump test_data $VERIFY_DATA'' test.img" >> $OUT.new 37 $DEBUGFS -R "dump test_data $VERIFY_DATA" $TMPFILE >> $OUT.new 2>&1 38 status=$? 39 echo Exit status is $status >> $OUT.new 40 41 echo "cmp $TEST_DATA $VERIFY_DATA" >> $OUT.new 42 cmp $TEST_DATA $VERIFY_DATA >>$OUT.new 43 status=$? 44 echo Exit status is $status >> $OUT.new 45 sed -f $cmd_dir/filter.sed $OUT.new > $OUT 46 47 # 48 # Do the verification 49 # 50 51 if [ "$SKIP_UNLINK" != "true" ]; then 52 rm -f $VERIFY_DATA $TEST_DATA $TMPFILE $OUT.new 53 else 54 echo "TMPFILE=$TMPFILE" 55 fi 56 cmp -s $OUT $EXP 57 status=$? 58 59 if [ "$status" = 0 ] ; then 60 echo "$test_name: $test_description: ok" 61 touch $test_name.ok 62 else 63 echo "$test_name: $test_description: failed" 64 diff $DIFF_OPTS $EXP $OUT > $test_name.failed 65 fi 66 67 unset VERIFY_FSCK_OPT NATIVE_FSCK_OPT OUT EXP TEST_DATA VERIFY_DATA 68