Add regression tests for mke2fs.

Mke2fs has been modified to honor the MKE2FS_SKIP_PROGRESS, 
MKE2FS_DEVICE_SECTSIZE, and MKE2FS_SKIP_CHECK_MSG in order 
facilitate the regression testing.
bitmap-optimize
Theodore Ts'o 2003-09-01 09:28:18 -04:00
parent 2a3a52367e
commit 1cca86f5d8
14 changed files with 179 additions and 6 deletions

View File

@ -1,3 +1,16 @@
2003-09-01 Theodore Ts'o <tytso@mit.edu>
* mke2fs.c (progress_init, progress_update): If the environment
variable MKE2FS_SKIP_PROGRESS is set, then don't print out
a progress bar; for regression test support.
(PRS): If the environment variable MKE2FS_DEVICE_SECTSIZE
is set, then override the device sector size. Again for
regression test support.
(main): If the environment variable MKE2FS_SKIP_CHECK_MSG
is set, then skip printing an information messages about
when the filesystem will be checked, since this number is
random and screws up the regression test expect script.
2003-08-31 Theodore Ts'o <tytso@mit.edu>
* mke2fs.c (set_fs_defaults): Fix bug which caused -T largefile or

View File

@ -327,6 +327,7 @@ struct progress_struct {
char format[20];
char backup[80];
__u32 max;
int skip_progress;
};
static void progress_init(struct progress_struct *progress,
@ -349,13 +350,17 @@ static void progress_init(struct progress_struct *progress,
progress->backup[(2*i)+1] = 0;
progress->max = max;
progress->skip_progress = 0;
if (getenv("MKE2FS_SKIP_PROGRESS"))
progress->skip_progress++;
fputs(label, stdout);
fflush(stdout);
}
static void progress_update(struct progress_struct *progress, __u32 val)
{
if (progress->format[0] == 0)
if ((progress->format[0] == 0) || progress->skip_progress)
return;
printf(progress->format, val, progress->max);
fputs(progress->backup, stdout);
@ -1213,6 +1218,9 @@ static void PRS(int argc, char *argv[])
_("while trying to determine hardware sector size"));
exit(1);
}
if (tmp = getenv("MKE2FS_DEVICE_SECTSIZE"))
sector_size = atoi(tmp);
set_fs_defaults(fs_type, &param, blocksize, sector_size, &inode_ratio);
blocksize = EXT2_BLOCK_SIZE(&param);
@ -1483,7 +1491,8 @@ no_journal:
}
if (!quiet) {
printf(_("done\n\n"));
print_check_message(fs);
if (!getenv("MKE2FS_SKIP_CHECK_MSG"))
print_check_message(fs);
}
val = ext2fs_close(fs);
return (retval || val) ? 1 : 0;

View File

@ -1,3 +1,13 @@
2003-09-01 Theodore Ts'o <tytso@mit.edu>
* f_dup_de: Remove spurious rm error messages when htree is
enabled
* run_e2fsck, run_mke2fs: Add new support for mke2fs test cases.
* m_dasd_bs, m_large_file, m_no_opt, m_std: New test cases
exercising mke2fs.
2003-08-20 Theodore Ts'o <tytso@mit.edu>
* f_bad_local_jnl, f_badorphan, f_h_badroot, f_h_reindex,

View File

@ -7,4 +7,4 @@ if test "$HTREE"x = x -o "$HTREE_CLR"x = yx; then
EXP2=$test_dir/expect-nohtree.2
fi
. $cmd_dir/run_e2fsck
rm "$TMPFILE".gz
rm -f "$TMPFILE".gz

25
tests/m_dasd_bs/expect.1 Normal file
View File

@ -0,0 +1,25 @@
Filesystem label=
OS type: Linux
Block size=2048 (log=1)
Fragment size=2048 (log=1)
16384 inodes, 32768 blocks
1638 blocks (5.00%) reserved for the super user
First data block=0
2 block groups
16384 blocks per group, 16384 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
16384
Writing inode tables: done
Writing superblocks and filesystem accounting information: done
Filesystem features: filetype sparse_super
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: 11/16384 files (0.0% non-contiguous), 1041/32768 blocks
Exit status is 0

6
tests/m_dasd_bs/script Normal file
View File

@ -0,0 +1,6 @@
DESCRIPTION="2048 byte sector devices"
FS_SIZE=65536
MKE2FS_DEVICE_SECTSIZE=2048
export MKE2FS_DEVICE_SECTSIZE
. $cmd_dir/run_mke2fs
unset MKE2FS_DEVICE_SECTSIZE

View File

@ -0,0 +1,23 @@
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
64 inodes, 16384 blocks
819 blocks (5.00%) reserved for the super user
First data block=0
1 block group
32768 blocks per group, 32768 fragments per group
64 inodes per group
Writing inode tables: done
Writing superblocks and filesystem accounting information: done
Filesystem features: filetype sparse_super
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: 11/64 files (0.0% non-contiguous), 11/16384 blocks
Exit status is 0

View File

@ -0,0 +1,7 @@
DESCRIPTION="no filesystem extensions"
FS_SIZE=65536
MKE2FS_DEVICE_SECTSIZE=2048
export MKE2FS_DEVICE_SECTSIZE
MKE2FS_OPTS="-T largefile"
. $cmd_dir/run_mke2fs
unset MKE2FS_DEVICE_SECTSIZE

25
tests/m_no_opt/expect.1 Normal file
View File

@ -0,0 +1,25 @@
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
16384 inodes, 65536 blocks
3276 blocks (5.00%) reserved for the super user
First data block=1
8 block groups
8192 blocks per group, 8192 fragments per group
2048 inodes per group
Superblock backups stored on blocks:
8193, 16385, 24577, 32769, 40961, 49153, 57345
Writing inode tables: done
Writing superblocks and filesystem accounting information: done
Filesystem features:(none)
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: 11/16384 files (0.0% non-contiguous), 2094/65536 blocks
Exit status is 0

4
tests/m_no_opt/script Normal file
View File

@ -0,0 +1,4 @@
DESCRIPTION="no filesystem extensions"
FS_SIZE=65536
MKE2FS_OPTS="-O ^sparse_super"
. $cmd_dir/run_mke2fs

25
tests/m_std/expect.1 Normal file
View File

@ -0,0 +1,25 @@
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
16384 inodes, 65536 blocks
3276 blocks (5.00%) reserved for the super user
First data block=1
8 block groups
8192 blocks per group, 8192 fragments per group
2048 inodes per group
Superblock backups stored on blocks:
8193, 24577, 40961, 57345
Writing inode tables: done
Writing superblocks and filesystem accounting information: done
Filesystem features: filetype sparse_super
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: 11/16384 files (0.0% non-contiguous), 2088/65536 blocks
Exit status is 0

3
tests/m_std/script Normal file
View File

@ -0,0 +1,3 @@
DESCRIPTION="standard filesystem options"
FS_SIZE=65536
. $cmd_dir/run_mke2fs

View File

@ -1,3 +1,6 @@
if [ "$DESCRIPTION"x != x ]; then
echo -n "$DESCRIPTION: "
fi
if [ "$IMAGE"x = x ]; then
IMAGE=$test_dir/image.gz
fi
@ -26,14 +29,18 @@ if [ "$EXP2"x = x ]; then
EXP2=$test_dir/expect.2
fi
gunzip < $IMAGE > $TMPFILE
if [ "$SKIP_GUNZIP" != "true" ] ; then
gunzip < $IMAGE > $TMPFILE
fi
cp /dev/null $OUT1
eval $PREP_CMD
$FSCK $FSCK_OPT -N test_filesys $TMPFILE > $OUT1.new 2>&1
status=$?
echo Exit status is $status >> $OUT1.new
sed -e '1d' $OUT1.new | sed -e '/^JFS DEBUG:/d' | tr -d \\015 > $OUT1
sed -e '1d' $OUT1.new | sed -e '/^JFS DEBUG:/d' | tr -d \\015 >> $OUT1
rm -f $OUT1.new
if [ "$ONE_PASS_ONLY" != "true" ]; then
@ -70,6 +77,8 @@ if [ "$SKIP_VERIFY" != "true" ] ; then
fi
if [ "$SKIP_CLEANUP" != "true" ] ; then
unset IMAGE FSCK_OPT SECOND_FSCK_OPT OUT1 OUT2 EXP1 EXP2 ONE_PASS_ONLY PREP_CMD
unset IMAGE FSCK_OPT SECOND_FSCK_OPT OUT1 OUT2 EXP1 EXP2
unset SKIP_VERIFY SKIP_CLEANUP SKIP_GUNZIP ONE_PASS_ONLY PREP_CMD
unset DESCRIPTION
fi

14
tests/run_mke2fs Normal file
View File

@ -0,0 +1,14 @@
if [ "$FS_SIZE"x = x ]; then
FS_SIZE=1024
fi
OUT1=$test_name.1.log
OUT2=$test_name.2.log
SKIP_GUNZIP=true
ONE_PASS_ONLY=true
MKE2FS_SKIP_PROGRESS=true
MKE2FS_SKIP_CHECK_MSG=true
export MKE2FS_SKIP_PROGRESS MKE2FS_SKIP_CHECK_MSG
> $TMPFILE
PREP_CMD='$MKE2FS -F $MKE2FS_OPTS $TMPFILE $FS_SIZE 2>&1 | sed -e 1d > $OUT1 ; $DEBUGFS -R features $TMPFILE 2>&1 | sed -e 1d >> $OUT1 ; echo " " >> $OUT1'
. $cmd_dir/run_e2fsck
unset FS_SIZE MKE2FS_OPTS MKE2FS_SKIP_PROGRESS