mirror of
https://github.com/isar/libmdbx.git
synced 2025-12-19 06:02:21 +08:00
mdbx-test: rework progess inticator.
Change-Id: Iaf3f7823ab7a0fe9f00607eb803390669c37005f
This commit is contained in:
23
test/test.cc
23
test/test.cc
@@ -307,21 +307,9 @@ bool testcase::wait4start() {
|
||||
}
|
||||
|
||||
void testcase::kick_progress(bool active) const {
|
||||
chrono::time now = chrono::now_motonic();
|
||||
if (active) {
|
||||
static int last_point = -1;
|
||||
int point = (now.fixedpoint >> 29) & 3;
|
||||
if (point != last_point) {
|
||||
last.progress_timestamp = now;
|
||||
fprintf(stderr, "%c\b", "-\\|/"[last_point = point]);
|
||||
fflush(stderr);
|
||||
}
|
||||
} else if (now.fixedpoint - last.progress_timestamp.fixedpoint >
|
||||
chrono::from_seconds(2).fixedpoint) {
|
||||
last.progress_timestamp = now;
|
||||
fprintf(stderr, "%c\b", "@*"[now.utc & 1]);
|
||||
fflush(stderr);
|
||||
}
|
||||
if (!global::config::progress_indicator)
|
||||
return;
|
||||
logging::progress_canary(active);
|
||||
}
|
||||
|
||||
void testcase::report(size_t nops_done) {
|
||||
@@ -333,8 +321,7 @@ void testcase::report(size_t nops_done) {
|
||||
log_debug("== complete +%" PRIuPTR " iteration, total %" PRIuPTR " done",
|
||||
nops_done, nops_completed);
|
||||
|
||||
if (global::config::progress_indicator)
|
||||
kick_progress(true);
|
||||
kick_progress(true);
|
||||
|
||||
if (config.signal_nops && !signalled &&
|
||||
config.signal_nops <= nops_completed) {
|
||||
@@ -389,7 +376,7 @@ bool testcase::should_continue(bool check_timeout_only) const {
|
||||
nops_completed >= config.params.test_nops)
|
||||
result = false;
|
||||
|
||||
if (result && global::config::progress_indicator)
|
||||
if (result)
|
||||
kick_progress(false);
|
||||
|
||||
return result;
|
||||
|
||||
Reference in New Issue
Block a user