ChangeLog, expect, name, script:

d_loaddump: New test which verifies debugfs's dump and load routines.
dirblock.c:
  Fix misc. gcc -Wall errors
bitmap-optimize
Theodore Ts'o 2001-05-05 16:21:48 +00:00
parent d8998861a8
commit bfcd9a116f
5 changed files with 87 additions and 2 deletions

View File

@ -41,7 +41,7 @@ errcode_t ext2fs_read_dir_block(ext2_filsys fs, blk_t block,
p = (char *) buf;
end = (char *) buf + fs->blocksize;
while (p < end-8) {
dirent = (struct ext2_dir_entry_2 *) p;
dirent = (struct ext2_dir_entry *) p;
if (do_swap) {
dirent->inode = ext2fs_swab32(dirent->inode);
dirent->rec_len = ext2fs_swab16(dirent->rec_len);
@ -52,7 +52,7 @@ errcode_t ext2fs_read_dir_block(ext2_filsys fs, blk_t block,
rec_len = 8;
retval = EXT2_ET_DIR_CORRUPTED;
}
dirent2 = dirent;
dirent2 = (struct ext2_dir_entry_2 *) dirent;
if ((dirent2->name_len +8) > dirent2->rec_len)
retval = EXT2_ET_DIR_CORRUPTED;
p += rec_len;

View File

@ -1,3 +1,8 @@
2001-05-05 Theodore Tso <tytso@valinux.com>
* d_loaddump: New test which verifies debugfs's dump and load
routines.
2000-10-24 <tytso@snap.thunk.org>
* f_journal: Update to take into account new printing by the

18
tests/d_loaddump/expect Normal file
View File

@ -0,0 +1,18 @@
debugfs load/dump test
mke2fs -Fq ./test.img 512
Exit status is 0
debugfs -R ''write test.data test_data'' -w ./test.img
Allocated inode: 12
Exit status is 0
e2fsck -yf -N test_filesys
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
test_filesys: 12/64 files (0.0% non-contiguous), 156/512 blocks
Exit status is 0
debugfs -R ''dump test_data test.verify'' ./test.img
Exit status is 0
cmp test.data test.verify
Exit status is 0

1
tests/d_loaddump/name Normal file
View File

@ -0,0 +1 @@
debugfs load/dump test

61
tests/d_loaddump/script Normal file
View File

@ -0,0 +1,61 @@
OUT=$test_name.log
EXP=$test_dir/expect
VERIFY_FSCK_OPT=-yf
TEST_DATA=test.data
VERIFY_DATA=test.verify
echo "debugfs load/dump test" > $OUT
dd if=/dev/zero of=$TMPFILE bs=1k count=512 >& /dev/null
echo "mke2fs -Fq $TMPFILE 512" >> $OUT
$MKE2FS -Fq $TMPFILE 512 >& /dev/null
status=$?
echo Exit status is $status >> $OUT
dd if=$DEBUGFS of=$TEST_DATA bs=1k count=128 >& /dev/null
echo "file fragment odd size" >> $TEST_DATA
echo "debugfs -R ''write $TEST_DATA test_data'' -w $TMPFILE" > $OUT.new
$DEBUGFS -R "write $TEST_DATA test_data" -w $TMPFILE >> $OUT.new 2>&1
status=$?
echo Exit status is $status >> $OUT.new
sed -e '2d' $OUT.new >> $OUT
echo e2fsck $VERIFY_FSCK_OPT -N test_filesys > $OUT.new
$FSCK $VERIFY_FSCK_OPT -N test_filesys $TMPFILE >> $OUT.new 2>&1
status=$?
echo Exit status is $status >> $OUT.new
sed -e '2d' $OUT.new >> $OUT
echo "debugfs -R ''dump test_data $VERIFY_DATA'' $TMPFILE" > $OUT.new
$DEBUGFS -R "dump test_data $VERIFY_DATA" $TMPFILE >> $OUT.new 2>&1
status=$?
echo Exit status is $status >> $OUT.new
sed -e '2d' $OUT.new >> $OUT
echo "cmp $TEST_DATA $VERIFY_DATA" >> $OUT
cmp $TEST_DATA $VERIFY_DATA >>$OUT
status=$?
echo Exit status is $status >> $OUT
#
# Do the verification
#
rm -f $test_name.ok $test_name.failed $VERIFY_DATA $TEST_DATA $TMPFILE
cmp -s $OUT $EXP
status=$?
if [ "$status" = 0 ] ; then
echo "ok"
touch $test_name.ok
else
echo "failed"
diff -c $EXP $OUT > $test_name.failed
fi
unset VERIFY_FSCK_OPT NATIVE_FSCK_OPT OUT EXP TEST_DATA VERIFY_DATA