From 89b5b53193952df837629b841bf651ce931a5d8d Mon Sep 17 00:00:00 2001 From: Leo Yuriev Date: Thu, 25 May 2017 09:51:26 +0300 Subject: [PATCH] test: refine oom-callback. --- test/test.cc | 10 ++++++---- test/test.h | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/test/test.cc b/test/test.cc index 6c296ad0..44d59209 100644 --- a/test/test.cc +++ b/test/test.cc @@ -100,9 +100,10 @@ int testcase::oom_callback(MDBX_env *env, int pid, mdbx_tid_t tid, uint64_t txn, ", txn #%" PRIu64 ", gap %d", pid, (size_t)tid, txn, gap); - if (retry > 0 && self->should_continue()) { + if (self->should_continue(true)) { osal_yield(); - osal_udelay(retry * 100); + if (retry > 0) + osal_udelay(retry * 100); return 1 /* always retry */; } @@ -308,7 +309,7 @@ bool testcase::teardown() { return true; } -bool testcase::should_continue() const { +bool testcase::should_continue(bool check_timeout_only) const { bool result = true; if (config.params.test_duration) { @@ -319,7 +320,8 @@ bool testcase::should_continue() const { result = false; } - if (config.params.test_nops && nops_completed >= config.params.test_nops) + if (!check_timeout_only && config.params.test_nops && + nops_completed >= config.params.test_nops) result = false; if (result && global::config::progress_indicator) diff --git a/test/test.h b/test/test.h index 34083805..939fc8b3 100644 --- a/test/test.h +++ b/test/test.h @@ -117,7 +117,7 @@ protected: bool wait4start(); void report(size_t nops_done); void signal(); - bool should_continue() const; + bool should_continue(bool check_timeout_only = false) const; void generate_pair(const keygen::serial_t serial, keygen::buffer &key, keygen::buffer &value, keygen::serial_t data_age = 0) {