Whamcloud - gitweb
Add regression tests for mke2fs.
authorTheodore Ts'o <tytso@mit.edu>
Mon, 1 Sep 2003 13:28:18 +0000 (09:28 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Mon, 1 Sep 2003 13:28:18 +0000 (09:28 -0400)
Mke2fs has been modified to honor the MKE2FS_SKIP_PROGRESS,
MKE2FS_DEVICE_SECTSIZE, and MKE2FS_SKIP_CHECK_MSG in order
facilitate the regression testing.

14 files changed:
misc/ChangeLog
misc/mke2fs.c
tests/ChangeLog
tests/f_dup_de/script
tests/m_dasd_bs/expect.1 [new file with mode: 0644]
tests/m_dasd_bs/script [new file with mode: 0644]
tests/m_large_file/expect.1 [new file with mode: 0644]
tests/m_large_file/script [new file with mode: 0644]
tests/m_no_opt/expect.1 [new file with mode: 0644]
tests/m_no_opt/script [new file with mode: 0644]
tests/m_std/expect.1 [new file with mode: 0644]
tests/m_std/script [new file with mode: 0644]
tests/run_e2fsck
tests/run_mke2fs [new file with mode: 0644]

index f93d887..0d0026d 100644 (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
index a2c8553..96f7b71 100644 (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;
index 455ae13..4a0ca5e 100644 (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,
index c0dfac0..ee583f3 100644 (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
diff --git a/tests/m_dasd_bs/expect.1 b/tests/m_dasd_bs/expect.1
new file mode 100644 (file)
index 0000000..13e7b6c
--- /dev/null
@@ -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
diff --git a/tests/m_dasd_bs/script b/tests/m_dasd_bs/script
new file mode 100644 (file)
index 0000000..e7b9085
--- /dev/null
@@ -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
diff --git a/tests/m_large_file/expect.1 b/tests/m_large_file/expect.1
new file mode 100644 (file)
index 0000000..1974205
--- /dev/null
@@ -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
diff --git a/tests/m_large_file/script b/tests/m_large_file/script
new file mode 100644 (file)
index 0000000..831789e
--- /dev/null
@@ -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
diff --git a/tests/m_no_opt/expect.1 b/tests/m_no_opt/expect.1
new file mode 100644 (file)
index 0000000..104bbb5
--- /dev/null
@@ -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
diff --git a/tests/m_no_opt/script b/tests/m_no_opt/script
new file mode 100644 (file)
index 0000000..2ac7e30
--- /dev/null
@@ -0,0 +1,4 @@
+DESCRIPTION="no filesystem extensions"
+FS_SIZE=65536
+MKE2FS_OPTS="-O ^sparse_super"
+. $cmd_dir/run_mke2fs
diff --git a/tests/m_std/expect.1 b/tests/m_std/expect.1
new file mode 100644 (file)
index 0000000..fb88900
--- /dev/null
@@ -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
diff --git a/tests/m_std/script b/tests/m_std/script
new file mode 100644 (file)
index 0000000..a2f2cda
--- /dev/null
@@ -0,0 +1,3 @@
+DESCRIPTION="standard filesystem options"
+FS_SIZE=65536
+. $cmd_dir/run_mke2fs
index 2797ae9..ed16af3 100644 (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
 
diff --git a/tests/run_mke2fs b/tests/run_mke2fs
new file mode 100644 (file)
index 0000000..d1a0657
--- /dev/null
@@ -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