From 74430052bc5b3fffff3330f054849ca829fe24dc Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Tue, 26 Jun 2018 09:59:19 -0400 Subject: [PATCH] tests: explicitly force resize2fs's use of lazy (or not) Resize2fs will not enable lazy_itable if the kernel apparently does not support that feature. This will cause spurious test failures when the tests are running on such a system (or where sysfs is not mounted). So for the purposes of the regression test we need to force the use of lazy_itable so that the results conform to expected golden output. Signed-off-by: Theodore Ts'o --- resize/resize2fs.c | 5 +++-- tests/r_fixup_lastbg_big/script | 7 ++++++- tests/r_move_itable_realloc/expect | 2 +- tests/r_move_itable_realloc/script | 2 +- tests/test_config | 2 ++ 5 files changed, 13 insertions(+), 5 deletions(-) diff --git a/resize/resize2fs.c b/resize/resize2fs.c index fe52a61..e894050 100644 --- a/resize/resize2fs.c +++ b/resize/resize2fs.c @@ -920,8 +920,9 @@ retry: group_block = ext2fs_group_first_block2(fs, old_fs->group_desc_count); csum_flag = ext2fs_has_group_desc_csum(fs); - if (!getenv("RESIZE2FS_FORCE_ITABLE_INIT") && - access("/sys/fs/ext4/features/lazy_itable_init", F_OK) == 0) + if (getenv("RESIZE2FS_FORCE_LAZY_ITABLE_INIT") || + (!getenv("RESIZE2FS_FORCE_ITABLE_INIT") && + access("/sys/fs/ext4/features/lazy_itable_init", F_OK) == 0)) lazy_itable_init = 1; if (ext2fs_has_feature_meta_bg(fs->super)) old_desc_blocks = fs->super->s_first_meta_bg; diff --git a/tests/r_fixup_lastbg_big/script b/tests/r_fixup_lastbg_big/script index 113831b..ea169e6 100755 --- a/tests/r_fixup_lastbg_big/script +++ b/tests/r_fixup_lastbg_big/script @@ -15,7 +15,12 @@ $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_FORCE_ITABLE_INIT=1 $RESIZE2FS_EXE -f -p $TMPFILE >> $OUT 2>&1 +( +RESIZE2FS_FORCE_ITABLE_INIT=1 +export RESIZE2FS_FORCE_ITABLE_INIT +unset RESIZE2FS_FORCE_LAZY_ITABLE_INIT +$RESIZE2FS_EXE -f -p $TMPFILE >> $OUT 2>&1 +) $DUMPE2FS $TMPFILE 2>&1 | grep -A10 '^Group 2:' >> $OUT $E2FSCK -fy $TMPFILE >> $OUT 2>&1 diff --git a/tests/r_move_itable_realloc/expect b/tests/r_move_itable_realloc/expect index 73b2fef..f9a7f51 100644 --- a/tests/r_move_itable_realloc/expect +++ b/tests/r_move_itable_realloc/expect @@ -1,5 +1,5 @@ mke2fs -q -F -o Linux -b 1024 -i 1024 -O ^resize_inode -t ext4 test.img 1024000 -resize2fs -p test.img 10240000 +resize2fs -p test.img 100000000 Resizing the filesystem on test.img to 100000000 (1k) blocks. Begin pass 2 (max = 2061) Relocating blocks ----------------------------------------XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX diff --git a/tests/r_move_itable_realloc/script b/tests/r_move_itable_realloc/script index edc1303..ae875e4 100644 --- a/tests/r_move_itable_realloc/script +++ b/tests/r_move_itable_realloc/script @@ -30,7 +30,7 @@ echo mke2fs -q -F -o Linux -b 1024 -i 1024 -O ^resize_inode -t ext4 test.img 102 $MKE2FS -q -F -o Linux -b 1024 -i 1024 -O ^resize_inode -t ext4 \ $TMPFILE 1024000 >> $OUT 2>&1 -echo resize2fs -p test.img 10240000 >> $OUT +echo resize2fs -p test.img 100000000 >> $OUT $RESIZE2FS -p $TMPFILE 100000000 >> $OUT 2>&1 $FSCK $FSCK_OPT -N test_filesys $TMPFILE >> $OUT 2>&1 diff --git a/tests/test_config b/tests/test_config index 81fbf95..1f146ca 100644 --- a/tests/test_config +++ b/tests/test_config @@ -49,5 +49,7 @@ E2FSPROGS_SKIP_PROGRESS=yes export E2FSPROGS_SKIP_PROGRESS EXT2FS_NO_MTAB_OK=yes export EXT2FS_NO_MTAB_OK +RESIZE2FS_FORCE_LAZY_ITABLE_INIT=yes +export RESIZE2FS_FORCE_LAZY_ITABLE_INIT E2FSPROGS_LIBMAGIC_SUPPRESS=yes export E2FSPROGS_LIBMAGIC_SUPPRESS -- 1.8.3.1