diff options
| author | George Hazan <ghazan@miranda.im> | 2018-03-30 22:50:46 +0300 |
|---|---|---|
| committer | George Hazan <ghazan@miranda.im> | 2018-03-30 22:50:46 +0300 |
| commit | 628f23ab62e342bb0b1dddedb563e7f13faf9528 (patch) | |
| tree | 55c97c8453e2dc0036dfa65fb5eb268c886ada13 /plugins/Dbx_mdbx/src/libmdbx/test/test.cc | |
| parent | 67cd8dbde997606b40bd7dc2712ccc4c66d8d06f (diff) | |
merge with the final version of libmdbx
Diffstat (limited to 'plugins/Dbx_mdbx/src/libmdbx/test/test.cc')
| -rw-r--r-- | plugins/Dbx_mdbx/src/libmdbx/test/test.cc | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/plugins/Dbx_mdbx/src/libmdbx/test/test.cc b/plugins/Dbx_mdbx/src/libmdbx/test/test.cc index 8700d74add..02986b3d1a 100644 --- a/plugins/Dbx_mdbx/src/libmdbx/test/test.cc +++ b/plugins/Dbx_mdbx/src/libmdbx/test/test.cc @@ -123,7 +123,7 @@ void testcase::db_prepare() { if (config.params.loglevel <= logging::verbose) mdbx_dbg_opts |= MDBX_DBG_PRINT; int rc = mdbx_setup_debug(mdbx_dbg_opts, mdbx_logger); - log_info("set mdbx debug-opts: 0x%02x", rc); + log_trace("set mdbx debug-opts: 0x%02x", rc); MDBX_env *env = nullptr; rc = mdbx_env_create(&env); @@ -204,6 +204,7 @@ void testcase::txn_end(bool abort) { if (unlikely(rc != MDBX_SUCCESS)) failure_perror("mdbx_txn_abort()", rc); } else { + txn_inject_writefault(txn); int rc = mdbx_txn_commit(txn); if (unlikely(rc != MDBX_SUCCESS)) failure_perror("mdbx_txn_commit()", rc); @@ -218,6 +219,27 @@ void testcase::txn_restart(bool abort, bool readonly, unsigned flags) { txn_begin(readonly, flags); } +void testcase::txn_inject_writefault(void) { + if (txn_guard) + txn_inject_writefault(txn_guard.get()); +} + +void testcase::txn_inject_writefault(MDBX_txn *txn) { + if (config.params.inject_writefaultn && txn) { + if (config.params.inject_writefaultn <= nops_completed && + (mdbx_txn_flags(txn) & MDBX_RDONLY) == 0) { + log_info("== txn_inject_writefault(): got %u nops or more, inject FAULT", + config.params.inject_writefaultn); + log_flush(); +#if defined(_WIN32) || defined(_WIN64) || defined(_WINDOWS) + TerminateProcess(GetCurrentProcess(), 42); +#else + raise(SIGKILL); +#endif + } + } +} + bool testcase::wait4start() { if (config.wait4id) { log_trace(">> wait4start(%u)", config.wait4id); |
