From: Theodore Ts'o Date: Sun, 23 Sep 2012 01:26:48 +0000 (-0400) Subject: mke2fs: fix progress suppression to make regression tests reliable X-Git-Tag: v1.42.6^0 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=c498cb11d3e72e41af760bd882675f44db8b77e7;p=tools%2Fe2fsprogs.git mke2fs: fix progress suppression to make regression tests reliable Signed-off-by: "Theodore Ts'o" --- diff --git a/lib/ext2fs/progress.c b/lib/ext2fs/progress.c index 1e791fe..8c9a6f1 100644 --- a/lib/ext2fs/progress.c +++ b/lib/ext2fs/progress.c @@ -17,6 +17,7 @@ #include static char spaces[80], backspaces[80]; +static time_t last_update; static int int_log10(unsigned int arg) { @@ -44,11 +45,11 @@ void ext2fs_numeric_progress_init(ext2_filsys fs, spaces[sizeof(spaces)-1] = 0; memset(backspaces, '\b', sizeof(backspaces)-1); backspaces[sizeof(backspaces)-1] = 0; - progress->skip_progress = 0; + + memset(progress, 0, sizeof(*progress)); if (getenv("E2FSPROGS_SKIP_PROGRESS")) progress->skip_progress++; - memset(progress, 0, sizeof(*progress)); /* * Figure out how many digits we need @@ -60,13 +61,14 @@ void ext2fs_numeric_progress_init(ext2_filsys fs, fputs(label, stdout); fflush(stdout); } + last_update = 0; } void ext2fs_numeric_progress_update(ext2_filsys fs, struct ext2fs_numeric_progress_struct * progress, __u64 val) { - static time_t now, last_update = 0; + time_t now; if (!(fs->flags & EXT2_FLAG_PRINT_PROGRESS)) return; diff --git a/misc/mke2fs.c b/misc/mke2fs.c index d7e51fc..7ec8cc2 100644 --- a/misc/mke2fs.c +++ b/misc/mke2fs.c @@ -94,7 +94,6 @@ int lazy_itable_init; char *bad_blocks_filename; __u32 fs_stride; int quotatype = -1; /* Initialize both user and group quotas by default */ -int no_progress; struct ext2_super_block fs_param; char *fs_uuid = NULL; @@ -318,8 +317,7 @@ static void write_inode_tables(ext2_filsys fs, int lazy_flag, int itable_zeroed) fs->group_desc_count); for (i = 0; i < fs->group_desc_count; i++) { - if (!no_progress) - ext2fs_numeric_progress_update(fs, &progress, i); + ext2fs_numeric_progress_update(fs, &progress, i); blk = ext2fs_inode_table_loc(fs, i); num = fs->inode_blocks_per_group; @@ -531,8 +529,7 @@ static void create_journal_dev(ext2_filsys fs) } blk += c; count -= c; - if (!no_progress) - ext2fs_numeric_progress_update(fs, &progress, blk); + ext2fs_numeric_progress_update(fs, &progress, blk); } ext2fs_zero_blocks2(0, 0, 0, 0, 0); @@ -1889,8 +1886,6 @@ profile_error: blocksize, sys_page_size); } - profile_get_boolean(profile, "options", "no_progress", 0, 0, - &no_progress); lazy_itable_init = 0; if (access("/sys/fs/ext4/features/lazy_itable_init", R_OK) == 0) lazy_itable_init = 1; @@ -2159,8 +2154,7 @@ static int mke2fs_discard_device(ext2_filsys fs) _("Discarding device blocks: "), blocks); while (cur < blocks) { - if (!no_progress) - ext2fs_numeric_progress_update(fs, &progress, cur); + ext2fs_numeric_progress_update(fs, &progress, cur); if (cur + count > blocks) count = blocks - cur; diff --git a/tests/test_config b/tests/test_config index 7c59766..0ba8b5e 100644 --- a/tests/test_config +++ b/tests/test_config @@ -31,4 +31,5 @@ E2FSCK_CONFIG=/dev/null export E2FSCK_CONFIG MKE2FS_CONFIG=./mke2fs.conf export MKE2FS_CONFIG - +E2FSPROGS_SKIP_PROGRESS=yes +export E2FSPROGS_SKIP_PROGRESS