From 40e3f735ab8e27e9359cf55c861c314c3a10581f Mon Sep 17 00:00:00 2001 From: Leonid Yuriev Date: Sun, 4 Nov 2018 18:57:27 +0300 Subject: [PATCH] mdbx-tests: cleanup/simplity code (minor). Change-Id: I9813ed3a29b331c1f995ce76766709f454bb49c2 --- test/dead.cc | 42 +++++++----------------------------------- test/hill.cc | 18 +----------------- test/jitter.cc | 16 +--------------- test/test.h | 22 +--------------------- test/try.cc | 19 +------------------ 5 files changed, 11 insertions(+), 106 deletions(-) diff --git a/test/dead.cc b/test/dead.cc index ee13fbd0..3dd1ee7b 100644 --- a/test/dead.cc +++ b/test/dead.cc @@ -1,4 +1,4 @@ -/* +/* * Copyright 2017-2018 Leonid Yuriev * and other libmdbx authors: please see AUTHORS file. * All rights reserved. @@ -14,50 +14,22 @@ #include "test.h" -bool testcase_deadread::setup() { - log_trace(">> setup"); - if (!inherited::setup()) - return false; - - log_trace("<< setup"); - return true; -} - bool testcase_deadread::run() { db_open(); txn_begin(true); + cursor_guard.reset(); + txn_guard.reset(); + db_guard.reset(); return true; } -bool testcase_deadread::teardown() { - log_trace(">> teardown"); - cursor_guard.release(); - txn_guard.release(); - db_guard.release(); - return inherited::teardown(); -} - //----------------------------------------------------------------------------- -bool testcase_deadwrite::setup() { - log_trace(">> setup"); - if (!inherited::setup()) - return false; - - log_trace("<< setup"); - return true; -} - bool testcase_deadwrite::run() { db_open(); txn_begin(false); + cursor_guard.reset(); + txn_guard.reset(); + db_guard.reset(); return true; } - -bool testcase_deadwrite::teardown() { - log_trace(">> teardown"); - cursor_guard.release(); - txn_guard.release(); - db_guard.release(); - return inherited::teardown(); -} diff --git a/test/hill.cc b/test/hill.cc index 10cb3089..856aeb93 100644 --- a/test/hill.cc +++ b/test/hill.cc @@ -1,4 +1,4 @@ -/* +/* * Copyright 2017-2018 Leonid Yuriev * and other libmdbx authors: please see AUTHORS file. * All rights reserved. @@ -14,17 +14,6 @@ #include "test.h" -bool testcase_hill::setup() { - log_trace(">> setup"); - if (!inherited::setup()) - return false; - - /* TODO */ - - log_trace("<< setup"); - return true; -} - bool testcase_hill::run() { db_open(); @@ -225,8 +214,3 @@ bool testcase_hill::run() { } return true; } - -bool testcase_hill::teardown() { - log_trace(">> teardown"); - return inherited::teardown(); -} diff --git a/test/jitter.cc b/test/jitter.cc index 25514004..48f9bd99 100644 --- a/test/jitter.cc +++ b/test/jitter.cc @@ -1,4 +1,4 @@ -/* +/* * Copyright 2017-2018 Leonid Yuriev * and other libmdbx authors: please see AUTHORS file. * All rights reserved. @@ -14,15 +14,6 @@ #include "test.h" -bool testcase_jitter::setup() { - log_trace(">> setup"); - if (!inherited::setup()) - return false; - - log_trace("<< setup"); - return true; -} - bool testcase_jitter::run() { while (should_continue()) { jitter_delay(); @@ -66,8 +57,3 @@ bool testcase_jitter::run() { } return true; } - -bool testcase_jitter::teardown() { - log_trace(">> teardown"); - return inherited::teardown(); -} diff --git a/test/test.h b/test/test.h index 4b10a40f..0de4b480 100644 --- a/test/test.h +++ b/test/test.h @@ -1,4 +1,4 @@ -/* +/* * Copyright 2017-2018 Leonid Yuriev * and other libmdbx authors: please see AUTHORS file. * All rights reserved. @@ -152,56 +152,36 @@ public: }; class testcase_hill : public testcase { - typedef testcase inherited; - public: testcase_hill(const actor_config &config, const mdbx_pid_t pid) : testcase(config, pid) {} - bool setup(); bool run(); - bool teardown(); }; class testcase_deadread : public testcase { - typedef testcase inherited; - public: testcase_deadread(const actor_config &config, const mdbx_pid_t pid) : testcase(config, pid) {} - bool setup(); bool run(); - bool teardown(); }; class testcase_deadwrite : public testcase { - typedef testcase inherited; - public: testcase_deadwrite(const actor_config &config, const mdbx_pid_t pid) : testcase(config, pid) {} - bool setup(); bool run(); - bool teardown(); }; class testcase_jitter : public testcase { - typedef testcase inherited; - public: testcase_jitter(const actor_config &config, const mdbx_pid_t pid) : testcase(config, pid) {} - bool setup(); bool run(); - bool teardown(); }; class testcase_try : public testcase { - typedef testcase inherited; - public: testcase_try(const actor_config &config, const mdbx_pid_t pid) : testcase(config, pid) {} - bool setup(); bool run(); - bool teardown(); }; diff --git a/test/try.cc b/test/try.cc index 1deae71d..150abd36 100644 --- a/test/try.cc +++ b/test/try.cc @@ -1,13 +1,4 @@ -#include "test.h" - -bool testcase_try::setup() { - log_trace(">> setup"); - if (!inherited::setup()) - return false; - - log_trace("<< setup"); - return true; -} +#include "test.h" bool testcase_try::run() { db_open(); @@ -27,11 +18,3 @@ bool testcase_try::run() { txn_guard.reset(txn); return true; } - -bool testcase_try::teardown() { - log_trace(">> teardown"); - cursor_guard.release(); - txn_guard.release(); - db_guard.release(); - return inherited::teardown(); -}