summaryrefslogtreecommitdiffstats
path: root/tests/m_mmp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--tests/m_mmp/expect.179
-rw-r--r--tests/m_mmp/script8
-rw-r--r--tests/m_mmp_bad_csum/expect23
-rw-r--r--tests/m_mmp_bad_csum/image.gzbin0 -> 2594 bytes
-rw-r--r--tests/m_mmp_bad_csum/name1
-rw-r--r--tests/m_mmp_bad_csum/script27
-rw-r--r--tests/m_mmp_bad_magic/.log9
-rw-r--r--tests/m_mmp_bad_magic/expect22
-rw-r--r--tests/m_mmp_bad_magic/image.gzbin0 -> 2597 bytes
-rw-r--r--tests/m_mmp_bad_magic/name1
-rw-r--r--tests/m_mmp_bad_magic/script27
11 files changed, 197 insertions, 0 deletions
diff --git a/tests/m_mmp/expect.1 b/tests/m_mmp/expect.1
new file mode 100644
index 0000000..0edb97d
--- /dev/null
+++ b/tests/m_mmp/expect.1
@@ -0,0 +1,79 @@
+Creating filesystem with 65536 4k blocks and 65536 inodes
+Superblock backups stored on blocks:
+ 32768
+
+Allocating group tables: done
+Writing inode tables: done
+Multiple mount protection is enabled with update interval 5 seconds.
+Writing superblocks and filesystem accounting information: done
+
+Filesystem features: ext_attr resize_inode dir_index filetype mmp sparse_super large_file
+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/65536 files (0.0% non-contiguous), 4141/65536 blocks
+Exit status is 0
+Filesystem volume name: <none>
+Last mounted on: <not available>
+Filesystem magic number: 0xEF53
+Filesystem revision #: 1 (dynamic)
+Filesystem features: ext_attr resize_inode dir_index filetype mmp sparse_super large_file
+Default mount options: (none)
+Filesystem state: clean
+Errors behavior: Continue
+Filesystem OS type: Linux
+Inode count: 65536
+Block count: 65536
+Reserved block count: 3276
+Overhead clusters: 4134
+Free blocks: 61395
+Free inodes: 65525
+First block: 0
+Block size: 4096
+Fragment size: 4096
+Reserved GDT blocks: 15
+Blocks per group: 32768
+Fragments per group: 32768
+Inodes per group: 32768
+Inode blocks per group: 2048
+Mount count: 0
+Check interval: 15552000 (6 months)
+Reserved blocks uid: 0
+Reserved blocks gid: 0
+First inode: 11
+Inode size: 256
+Required extra isize: 32
+Desired extra isize: 32
+Default directory hash: half_md4
+MMP block number: 2073
+MMP update interval: 5
+MMP_block:
+ mmp_magic: 0x4d4d50
+ mmp_check_interval: 5
+ mmp_sequence: 0xff4d4d50
+ mmp_update_date: test date
+ mmp_update_time: test_time
+ mmp_node_name: test_node
+ mmp_device_name: test.img
+
+
+Group 0: (Blocks 0-32767)
+ Primary superblock at 0, Group descriptors at 1-1
+ Reserved GDT blocks at 2-16
+ Block bitmap at 17 (+17)
+ Inode bitmap at 18 (+18)
+ Inode table at 19-2066 (+19)
+ 30694 free blocks, 32757 free inodes, 2 directories
+ Free blocks: 2074-32767
+ Free inodes: 12-32768
+Group 1: (Blocks 32768-65535)
+ Backup superblock at 32768, Group descriptors at 32769-32769
+ Reserved GDT blocks at 32770-32784
+ Block bitmap at 32785 (+17)
+ Inode bitmap at 32786 (+18)
+ Inode table at 32787-34834 (+19)
+ 30701 free blocks, 32768 free inodes, 0 directories
+ Free blocks: 34835-65535
+ Free inodes: 32769-65536
diff --git a/tests/m_mmp/script b/tests/m_mmp/script
new file mode 100644
index 0000000..e456183
--- /dev/null
+++ b/tests/m_mmp/script
@@ -0,0 +1,8 @@
+DESCRIPTION="enable MMP during mke2fs"
+FS_SIZE=65536
+MKE2FS_DEVICE_SECTSIZE=2048
+export MKE2FS_DEVICE_SECTSIZE
+
+MKE2FS_OPTS="-b 4096 -O mmp"
+. $cmd_dir/run_mke2fs
+unset MKE2FS_DEVICE_SECTSIZE
diff --git a/tests/m_mmp_bad_csum/expect b/tests/m_mmp_bad_csum/expect
new file mode 100644
index 0000000..a0678ac
--- /dev/null
+++ b/tests/m_mmp_bad_csum/expect
@@ -0,0 +1,23 @@
+dumpe2fs: MMP block checksum does not match while trying to open test.img
+dumpe2fs: MMP last updated by 'test_node' on test date
+Exit status is 1
+Superblock MMP block checksum does not match. Fix? yes
+
+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/128 files (0.0% non-contiguous), 19/512 blocks
+Exit status is 0
+dumpe2fs: it is safe to mount 'test.img', MMP is clean
+Exit status is 0
+MMP_block:
+ mmp_magic: 0x4d4d50
+ mmp_check_interval: 5
+ mmp_sequence: 0xff4d4d50
+ mmp_update_date: test date
+ mmp_update_time: test_time
+ mmp_node_name: test_node
+ mmp_device_name: test.img
+ mmp_block_number: 8
diff --git a/tests/m_mmp_bad_csum/image.gz b/tests/m_mmp_bad_csum/image.gz
new file mode 100644
index 0000000..c896ff6
--- /dev/null
+++ b/tests/m_mmp_bad_csum/image.gz
Binary files differ
diff --git a/tests/m_mmp_bad_csum/name b/tests/m_mmp_bad_csum/name
new file mode 100644
index 0000000..61c31d4
--- /dev/null
+++ b/tests/m_mmp_bad_csum/name
@@ -0,0 +1 @@
+mmp with bad csum (metadata_csum)
diff --git a/tests/m_mmp_bad_csum/script b/tests/m_mmp_bad_csum/script
new file mode 100644
index 0000000..a5e222e
--- /dev/null
+++ b/tests/m_mmp_bad_csum/script
@@ -0,0 +1,27 @@
+gzip -dc < $test_dir/image.gz > $TMPFILE
+
+OUT=$test_name.log
+EXP=$test_dir/expect
+$E2MMPSTATUS $TMPFILE > $OUT 2>&1
+echo Exit status is $? >> $OUT
+$FSCK -fy $TMPFILE >> $OUT 2>&1
+echo Exit status is $? >> $OUT
+$E2MMPSTATUS $TMPFILE >> $OUT 2>&1
+echo Exit status is $? >> $OUT
+$E2MMPSTATUS -i $TMPFILE >> $OUT 2>&1
+sed -f $cmd_dir/filter.sed $OUT > $OUT.new
+mv $OUT.new $OUT
+
+rm -f $TMPFILE
+cmp -s $OUT $EXP
+status=$?
+
+if [ "$status" = 0 ] ; then
+ echo "$test_name: $test_description: ok"
+ touch $test_name.ok
+else
+ echo "$test_name: $test_description: failed"
+ diff $DIFF_OPTS $EXP $OUT > $test_name.failed
+ rm -f $test_name.tmp
+fi
+unset OUT EXP
diff --git a/tests/m_mmp_bad_magic/.log b/tests/m_mmp_bad_magic/.log
new file mode 100644
index 0000000..b5dfb89
--- /dev/null
+++ b/tests/m_mmp_bad_magic/.log
@@ -0,0 +1,9 @@
+Superblock has invalid MMP magic. Fix? yes
+
+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/128 files (0.0% non-contiguous), 19/512 blocks
+Exit status is 0
diff --git a/tests/m_mmp_bad_magic/expect b/tests/m_mmp_bad_magic/expect
new file mode 100644
index 0000000..d5fa98c
--- /dev/null
+++ b/tests/m_mmp_bad_magic/expect
@@ -0,0 +1,22 @@
+dumpe2fs: MMP: invalid magic number while trying to open test.img
+Exit status is 2
+Superblock has invalid MMP magic. Fix? yes
+
+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/128 files (0.0% non-contiguous), 19/512 blocks
+Exit status is 0
+dumpe2fs: it is safe to mount 'test.img', MMP is clean
+Exit status is 0
+MMP_block:
+ mmp_magic: 0x4d4d50
+ mmp_check_interval: 5
+ mmp_sequence: 0xff4d4d50
+ mmp_update_date: test date
+ mmp_update_time: test_time
+ mmp_node_name: test_node
+ mmp_device_name: test.img
+ mmp_block_number: 8
diff --git a/tests/m_mmp_bad_magic/image.gz b/tests/m_mmp_bad_magic/image.gz
new file mode 100644
index 0000000..2d57fbf
--- /dev/null
+++ b/tests/m_mmp_bad_magic/image.gz
Binary files differ
diff --git a/tests/m_mmp_bad_magic/name b/tests/m_mmp_bad_magic/name
new file mode 100644
index 0000000..15a2d4d
--- /dev/null
+++ b/tests/m_mmp_bad_magic/name
@@ -0,0 +1 @@
+mmp with bad magic (metadata_csum)
diff --git a/tests/m_mmp_bad_magic/script b/tests/m_mmp_bad_magic/script
new file mode 100644
index 0000000..a5e222e
--- /dev/null
+++ b/tests/m_mmp_bad_magic/script
@@ -0,0 +1,27 @@
+gzip -dc < $test_dir/image.gz > $TMPFILE
+
+OUT=$test_name.log
+EXP=$test_dir/expect
+$E2MMPSTATUS $TMPFILE > $OUT 2>&1
+echo Exit status is $? >> $OUT
+$FSCK -fy $TMPFILE >> $OUT 2>&1
+echo Exit status is $? >> $OUT
+$E2MMPSTATUS $TMPFILE >> $OUT 2>&1
+echo Exit status is $? >> $OUT
+$E2MMPSTATUS -i $TMPFILE >> $OUT 2>&1
+sed -f $cmd_dir/filter.sed $OUT > $OUT.new
+mv $OUT.new $OUT
+
+rm -f $TMPFILE
+cmp -s $OUT $EXP
+status=$?
+
+if [ "$status" = 0 ] ; then
+ echo "$test_name: $test_description: ok"
+ touch $test_name.ok
+else
+ echo "$test_name: $test_description: failed"
+ diff $DIFF_OPTS $EXP $OUT > $test_name.failed
+ rm -f $test_name.tmp
+fi
+unset OUT EXP