mirror of
https://github.com/amadvance/snapraid.git
synced 2026-10-26 19:01:57 -04:00
Ensures to test also the progress update.
This commit is contained in:
parent
61ce847d6a
commit
7054256c62
4 changed files with 16 additions and 3 deletions
|
|
@ -133,7 +133,7 @@ maintainer-clean-local:
|
|||
# --test-force-order-alpha
|
||||
# Ensures to process files always in the same order despites
|
||||
# the inode, physical location, and dir order assigned by the OS.
|
||||
CHECKFLAGS_BASE = --test-skip-device --test-skip-self --test-force-order-alpha
|
||||
CHECKFLAGS_BASE = --test-skip-device --test-skip-self --test-force-order-alpha --test-force-progress
|
||||
|
||||
# Verbose options
|
||||
CHECKFLAGS_VERBOSE = $(CHECKFLAGS_BASE) -v -G
|
||||
|
|
|
|||
|
|
@ -236,6 +236,7 @@ void config(char* conf, size_t conf_size, const char* argv0)
|
|||
#define OPT_TEST_RUN 278
|
||||
#define OPT_TEST_FORCE_SCAN_WINFIND 279
|
||||
#define OPT_TEST_IMPORT_CONTENT 280
|
||||
#define OPT_TEST_FORCE_PROGRESS 281
|
||||
|
||||
#if HAVE_GETOPT_LONG
|
||||
struct option long_options[] = {
|
||||
|
|
@ -337,6 +338,9 @@ struct option long_options[] = {
|
|||
/* Alternative import working by data */
|
||||
{ "test-import-content", 1, 0, OPT_TEST_IMPORT_CONTENT },
|
||||
|
||||
/* Force immediate progress state update */
|
||||
{ "test-force-progress", 0, 0, OPT_TEST_FORCE_PROGRESS },
|
||||
|
||||
{ 0, 0, 0, 0 }
|
||||
};
|
||||
#endif
|
||||
|
|
@ -644,6 +648,9 @@ int main(int argc, char* argv[])
|
|||
case OPT_TEST_FORCE_SCAN_WINFIND :
|
||||
opt.force_scan_winfind = 1;
|
||||
break;
|
||||
case OPT_TEST_FORCE_PROGRESS :
|
||||
opt.force_progress = 1;
|
||||
break;
|
||||
default :
|
||||
/* LCOV_EXCL_START */
|
||||
fprintf(stderr, "Unknown option '%c'\n", (char)c);
|
||||
|
|
|
|||
|
|
@ -4329,7 +4329,9 @@ int state_progress(struct snapraid_state* state, block_off_t blockpos, block_off
|
|||
pred -= PROGRESS_MAX;
|
||||
|
||||
/* if the previous measure is different */
|
||||
if (state->progress_tick == 0 || state->progress_time[pred] != now) {
|
||||
if (state->progress_tick == 0
|
||||
|| state->progress_time[pred] != now
|
||||
) {
|
||||
uint64_t tick_total;
|
||||
uint64_t tick_cpu;
|
||||
unsigned out_perc = 0;
|
||||
|
|
@ -4345,7 +4347,10 @@ int state_progress(struct snapraid_state* state, block_off_t blockpos, block_off
|
|||
out_perc = countpos * 100 / countmax;
|
||||
|
||||
/* if we have at least 5 measures */
|
||||
if (state->progress_tick >= 5) {
|
||||
if (state->progress_tick >= 5
|
||||
/* or if we are running in test mode, with at least one measure */
|
||||
|| (state->opt.force_progress && state->progress_tick >= 1)
|
||||
) {
|
||||
int oldest;
|
||||
int past;
|
||||
time_t delta_time;
|
||||
|
|
|
|||
|
|
@ -91,6 +91,7 @@ struct snapraid_option {
|
|||
int force_content_write; /**< Force the update of the content file. */
|
||||
int force_content_text; /**< Force the use of text version of content file. */
|
||||
int force_scan_winfind; /**< Force the use of FindFirst/Next in Windows to list directories. */
|
||||
int force_progress; /**< Force the use of the progress status. */
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue