2014-11-14 10:01:19

by Xiaoguang Wang

[permalink] [raw]
Subject: [PATCH 1/4] tests: regression test for resizing inodes on a metadata_csum fs

When using tune2fs to resize inodes, there is a bug that we do not
update the block group descriptor and inode checksum, this test is
written to check whether this bug has been fixed.

Signed-off-by: Xiaoguang Wang <[email protected]>
---
tests/t_iexpand_csum/expect | 21 ++++++++++++++++
tests/t_iexpand_csum/name | 1 +
tests/t_iexpand_csum/script | 59 +++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 81 insertions(+)
create mode 100644 tests/t_iexpand_csum/expect
create mode 100644 tests/t_iexpand_csum/name
create mode 100644 tests/t_iexpand_csum/script

diff --git a/tests/t_iexpand_csum/expect b/tests/t_iexpand_csum/expect
new file mode 100644
index 0000000..9cba9dc
--- /dev/null
+++ b/tests/t_iexpand_csum/expect
@@ -0,0 +1,21 @@
+tune2fs -I test
+Creating filesystem with 786432 1k blocks and 98304 inodes
+Superblock backups stored on blocks:
+ 8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409, 663553
+
+Allocating group tables: done
+Writing inode tables: done
+Creating journal (16384 blocks): done
+Writing superblocks and filesystem accounting information: done
+
+Exit status is 0
+tune2fs -I 256 test.img
+Setting inode size 256
+Exit status is 0
+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
+
+Exit status is 0
diff --git a/tests/t_iexpand_csum/name b/tests/t_iexpand_csum/name
new file mode 100644
index 0000000..8ac8be3
--- /dev/null
+++ b/tests/t_iexpand_csum/name
@@ -0,0 +1 @@
+expand inodes on a metadata_csum filesystem
diff --git a/tests/t_iexpand_csum/script b/tests/t_iexpand_csum/script
new file mode 100644
index 0000000..a7c6390
--- /dev/null
+++ b/tests/t_iexpand_csum/script
@@ -0,0 +1,59 @@
+if test -x $TUNE2FS -a -x $FSCK; then
+
+FSCK_OPT=-fn
+OUT=$test_name.log
+EXP=$test_dir/expect
+CONF=$TMPFILE.conf
+
+cat > $CONF << ENDL
+[fs_types]
+ ext4h = {
+ features = has_journal,extent,huge_file,uninit_bg,dir_nlink,extra_isize,sparse_super,filetype,dir_index,ext_attr,resize_inode,^flex_bg,metadata_csum,64bit
+ blocksize = 1024
+ }
+ENDL
+
+echo "tune2fs -I test" > $OUT
+
+MKE2FS_CONFIG=$CONF $MKE2FS -F -T ext4h -I 128 $TMPFILE 786432 >> $OUT 2>&1
+status=$?
+echo Exit status is $status >> $OUT
+rm -rf $CONF
+
+# expand inode size to 256
+echo "tune2fs -I 256 test.img" >> $OUT
+$TUNE2FS -I 256 $TMPFILE >> $OUT 2>&1
+status=$?
+echo Exit status is $status >> $OUT
+
+sed -f $cmd_dir/filter.sed < $OUT > $OUT.new
+mv $OUT.new $OUT
+
+$FSCK $FSCK_OPT -N test_filesys $TMPFILE >> $OUT 2>&1
+status=$?
+echo Exit status is $status >> $OUT
+
+rm $TMPFILE
+
+sed -f $cmd_dir/filter.sed -e 's/test_filesys:.*//g' < $OUT > $OUT.new
+mv $OUT.new $OUT
+
+#
+# Do the verification
+#
+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
+fi
+
+unset FSCK_OPT OUT EXP CONF
+
+else
+ echo "$test_name: $test_description: skipped"
+fi
--
1.8.3.1