From: Darrick J. Wong Date: Tue, 27 Jan 2015 18:10:47 +0000 (-0500) Subject: resize2fs: fix regression test to not depend on ext4.ko being loaded X-Git-Tag: v1.43-WIP-2015-05-18~87 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f21c30d90cdae684b106402c001010aa90e9d637;p=thirdparty%2Fe2fsprogs.git resize2fs: fix regression test to not depend on ext4.ko being loaded The behavior of the r_fixup_lastbg_big test varies depending on whether or not ext4.ko is loaded and supports lazy_itable_init. This makes checking the bg flags after resize2fs hard to predict, so put in a way to force resize2fs to zero the inode tables, and compare the output based on lazy_itable_init == 0. Signed-off-by: Darrick J. Wong Signed-off-by: Theodore Ts'o --- diff --git a/resize/resize2fs.c b/resize/resize2fs.c index 2febfde30..041ff7502 100644 --- a/resize/resize2fs.c +++ b/resize/resize2fs.c @@ -904,7 +904,8 @@ retry: group_block = ext2fs_group_first_block2(fs, old_fs->group_desc_count); csum_flag = ext2fs_has_group_desc_csum(fs); - if (access("/sys/fs/ext4/features/lazy_itable_init", F_OK) == 0) + if (!getenv("RESIZE2FS_FORCE_ITABLE_INIT") && + access("/sys/fs/ext4/features/lazy_itable_init", F_OK) == 0) lazy_itable_init = 1; if (fs->super->s_feature_incompat & EXT2_FEATURE_INCOMPAT_META_BG) old_desc_blocks = fs->super->s_first_meta_bg; diff --git a/tests/r_fixup_lastbg_big/expect b/tests/r_fixup_lastbg_big/expect index 8f302a37f..edaabaf00 100644 --- a/tests/r_fixup_lastbg_big/expect +++ b/tests/r_fixup_lastbg_big/expect @@ -22,6 +22,8 @@ Group 2: (Blocks 16385-19999) Free blocks: 16385-19999 Free inodes: 833-1248 Resizing the filesystem on test.img to 40000 (1k) blocks. +Begin pass 1 (max = 2) +Extending the inode table ----------------------------------------XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX The filesystem on test.img is now 40000 (1k) blocks long. Group 2: (Blocks 16385-24576) [INODE_UNINIT, BLOCK_UNINIT] @@ -31,7 +33,7 @@ Group 2: (Blocks 16385-24576) [INODE_UNINIT, BLOCK_UNINIT] 8192 free blocks, 416 free inodes, 0 directories, 416 unused inodes Free blocks: 16385-24576 Free inodes: 833-1248 -Group 3: (Blocks 24577-32768) [INODE_UNINIT] +Group 3: (Blocks 24577-32768) [INODE_UNINIT, ITABLE_ZEROED] Backup superblock at 24577, Group descriptors at 24578-24578 Reserved GDT blocks at 24579-24656 Block bitmap at 413 (bg #0 + 412) diff --git a/tests/r_fixup_lastbg_big/script b/tests/r_fixup_lastbg_big/script index 4c4a3516a..97d9fd4af 100755 --- a/tests/r_fixup_lastbg_big/script +++ b/tests/r_fixup_lastbg_big/script @@ -13,7 +13,7 @@ $DEBUGFS -R "set_bg 2 flags 0" -w $TMPFILE > /dev/null 2>&1 $DEBUGFS -R "set_bg 2 checksum 0xd318" -w $TMPFILE > /dev/null 2>&1 $DUMPE2FS $TMPFILE 2>&1 | grep -A10 '^Group 2:' >> $OUT dd if=/dev/zero of=$TMPFILE bs=1 count=1 seek=$((1024 * 40000)) conv=notrunc >> $OUT 2> /dev/null -$RESIZE2FS_EXE -f -p $TMPFILE >> $OUT 2>&1 +RESIZE2FS_FORCE_ITABLE_INIT=1 $RESIZE2FS_EXE -f -p $TMPFILE >> $OUT 2>&1 $DUMPE2FS $TMPFILE 2>&1 | grep -A10 '^Group 2:' >> $OUT $E2FSCK -fy $TMPFILE >> $OUT 2>&1