From 7447da02f05699894c6f277f2518bd00ffc33906 Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Mon, 30 Sep 2013 23:07:27 -0400 Subject: [PATCH] tests: add test for resize2fs -M with inode table in middle of block group Eric Sandeen reported that Fedora's mke2fs when compiled for ppc was creating a file system which caused problems with resize2fs -M. Closer examination showed that the problem was file system which looked like this: Filesystem features: ext_attr dir_index filetype sparse_super Inode count: 512 Block count: 1247 ... Group 0: (Blocks 1-1024) Primary superblock at 1, Group descriptors at 2-2 Block bitmap at 66 (+65), Inode bitmap at 67 (+66) Inode table at 68-99 (+67) Group 1: (Blocks 1025-1246) Backup superblock at 1025, Group descriptors at 1026-1026 Block bitmap at 1090 (+65), Inode bitmap at 1091 (+66) Inode table at 1092-1123 (+67) It's not obvious to me why Fedora's ppc mke2fs is creating file systems like this (I can't reproduce this on debian ppc systems), but resize2fs -M should be able to deal with such file systems, which is what this test is designed to check. Signed-off-by: "Theodore Ts'o" --- tests/r_min_itable/expect | 14 ++++++++++++++ tests/r_min_itable/image.gz | Bin 0 -> 3597 bytes tests/r_min_itable/name | 1 + tests/r_min_itable/script | 43 +++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 58 insertions(+) create mode 100644 tests/r_min_itable/expect create mode 100644 tests/r_min_itable/image.gz create mode 100644 tests/r_min_itable/name create mode 100644 tests/r_min_itable/script diff --git a/tests/r_min_itable/expect b/tests/r_min_itable/expect new file mode 100644 index 0000000..104688a --- /dev/null +++ b/tests/r_min_itable/expect @@ -0,0 +1,14 @@ +resize2fs test +resize2fs -M test.img +Resizing the filesystem on test.img to 1124 (1k) blocks. +The filesystem on test.img is now 1124 blocks long. + +Exit status is 0 +e2fsck 1.42.8 (20-Jun-2013) +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: 13/512 files (0.0% non-contiguous), 1120/1124 blocks +Exit status is 0 diff --git a/tests/r_min_itable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M with inode table in middle of last block group diff --git a/tests/r_min_itable/script b/tests/r_min_itable/script new file mode 100644 index 0000000..00aaa60 --- /dev/null +++ b/tests/r_min_itable/script @@ -0,0 +1,43 @@ +if test -x $RESIZE2FS_EXE -a -x $DEBUGFS_EXE; then + +IMAGE=$test_dir/image.gz +FSCK_OPT=-yf +OUT=$test_name.log +EXP=$test_dir/expect + +gunzip < $IMAGE > $TMPFILE + +echo "resize2fs test" > $OUT + +echo "resize2fs -M test.img" >> $OUT +$RESIZE2FS -M $TMPFILE 2>&1 >> $OUT.new 2>&1 +status=$? +echo Exit status is $status >> $OUT.new +sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new >> $OUT + +$FSCK $FSCK_OPT -N test_filesys $TMPFILE >> $OUT 2>&1 +echo Exit status is $status >> $OUT + +rm $TMPFILE $OUT.new + +# +# 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 IMAGE FSCK_OPT OUT EXP + +else #if test -x $RESIZE2FS_EXE -a -x $DEBUGFS_EXE; then + echo "$test_name: $test_description: skipped" +fi + -- 1.8.3.1