mke2fs: fix progress suppression to make regression tests reliable
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
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 <time.h>
static char spaces[80], backspaces[80];
+static time_t last_update;
static int int_log10(unsigned int arg)
{
@@ -44,11 +45,11 @@
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 @@
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 @@
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 @@
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 @@
}
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 @@
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 @@
_("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 @@
export E2FSCK_CONFIG
MKE2FS_CONFIG=./mke2fs.conf
export MKE2FS_CONFIG
-
+E2FSPROGS_SKIP_PROGRESS=yes
+export E2FSPROGS_SKIP_PROGRESS