diff --git a/src/bits.h b/src/bits.h index ad335b6b..8e8fc8de 100644 --- a/src/bits.h +++ b/src/bits.h @@ -1212,7 +1212,7 @@ static __inline pgno_t pgno_sub(pgno_t base, pgno_t subtrahend) { } static __inline void mdbx_jitter4testing(bool tiny) { -#ifndef NDEBUG +#if MDBX_DEBUG if (MDBX_DBG_JITTER & mdbx_runtime_flags) mdbx_osal_jitter(tiny); #else diff --git a/src/mdbx.c b/src/mdbx.c index 21a8d9b7..8e9db560 100644 --- a/src/mdbx.c +++ b/src/mdbx.c @@ -11639,6 +11639,7 @@ static int __cold mdbx_env_copy_asis(MDBX_env *env, MDBX_txn *read_txn, return rc; } + mdbx_jitter4testing(false); const size_t meta_bytes = pgno2bytes(env, NUM_METAS); /* Make a snapshot of meta-pages, * but writing ones after the data was flushed */ @@ -11654,6 +11655,7 @@ static int __cold mdbx_env_copy_asis(MDBX_env *env, MDBX_txn *read_txn, /* Copy the data */ const size_t data_bytes = pgno2bytes(env, read_txn->mt_next_pgno); + mdbx_jitter4testing(false); #if __GLIBC_PREREQ(2, 27) for (off_t in_offset = meta_bytes; in_offset < (off_t)data_bytes;) { off_t out_offset = in_offset; diff --git a/test/test.cc b/test/test.cc index 05b68d67..e9e925e9 100644 --- a/test/test.cc +++ b/test/test.cc @@ -139,6 +139,8 @@ void testcase::db_open() { if (!db_guard) db_prepare(); + + jitter_delay(true); int rc = mdbx_env_open(db_guard.get(), config.params.pathname_db.c_str(), (unsigned)config.params.mode_flags, 0640); if (unlikely(rc != MDBX_SUCCESS)) @@ -569,22 +571,27 @@ bool test_execute(const actor_config &config_const) { if (!test->setup()) { log_notice("test setup failed"); return false; - } else if (!test->run()) { + } + if (!test->run()) { log_notice("test failed"); return false; - } else if (!test->teardown()) { + } + if (!test->teardown()) { log_notice("test teardown failed"); return false; - } else { - if (config.params.nrepeat == 1) - log_info("test successed"); - else if (config.params.nrepeat) + } + + if (config.params.nrepeat == 1) + log_info("test successed"); + else { + if (config.params.nrepeat) log_info("test successed (iteration %zi of %zi)", iter, size_t(config.params.nrepeat)); else log_info("test successed (iteration %zi)", iter); config.params.keygen.seed += INT32_C(0xA4F4D37B); } + } while (config.params.nrepeat == 0 || iter < config.params.nrepeat); return true; } catch (const std::exception &pipets) {