diff options
author | Pieter Wuille <pieter.wuille@gmail.com> | 2015-03-03 07:49:12 -0800 |
---|---|---|
committer | Pieter Wuille <pieter.wuille@gmail.com> | 2015-03-03 09:01:46 -0800 |
commit | 51598b26319bf1ee98b399dee8152b902c62891a (patch) | |
tree | 21805efdbe19e67f3ed953695cb5f27c9d4ff4fe /src/db.h | |
parent | 86eb461c5bbe8200ab066f75b5acdf79fbae1086 (diff) |
Reinitialize state in between individual unit tests.
This changes the TestingSetup fixture to be per-unit-test rather than global.
Most tests don't need it, so it's only invoked in a few.
Diffstat (limited to 'src/db.h')
-rw-r--r-- | src/db.h | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -39,12 +39,14 @@ private: public: mutable CCriticalSection cs_db; - DbEnv dbenv; + DbEnv *dbenv; std::map<std::string, int> mapFileUseCount; std::map<std::string, Db*> mapDb; CDBEnv(); ~CDBEnv(); + void Reset(); + void MakeMock(); bool IsMock() { return fMockDb; } @@ -79,7 +81,7 @@ public: DbTxn* TxnBegin(int flags = DB_TXN_WRITE_NOSYNC) { DbTxn* ptxn = NULL; - int ret = dbenv.txn_begin(NULL, &ptxn, flags); + int ret = dbenv->txn_begin(NULL, &ptxn, flags); if (!ptxn || ret != 0) return NULL; return ptxn; |