mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-30 22:47:16 +08:00
mdbx-tests: cleanup/simplity code (minor).
Change-Id: I9813ed3a29b331c1f995ce76766709f454bb49c2
This commit is contained in:
parent
12174187e8
commit
40e3f735ab
42
test/dead.cc
42
test/dead.cc
@ -1,4 +1,4 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2017-2018 Leonid Yuriev <leo@yuriev.ru>
|
* Copyright 2017-2018 Leonid Yuriev <leo@yuriev.ru>
|
||||||
* and other libmdbx authors: please see AUTHORS file.
|
* and other libmdbx authors: please see AUTHORS file.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
@ -14,50 +14,22 @@
|
|||||||
|
|
||||||
#include "test.h"
|
#include "test.h"
|
||||||
|
|
||||||
bool testcase_deadread::setup() {
|
|
||||||
log_trace(">> setup");
|
|
||||||
if (!inherited::setup())
|
|
||||||
return false;
|
|
||||||
|
|
||||||
log_trace("<< setup");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool testcase_deadread::run() {
|
bool testcase_deadread::run() {
|
||||||
db_open();
|
db_open();
|
||||||
txn_begin(true);
|
txn_begin(true);
|
||||||
|
cursor_guard.reset();
|
||||||
|
txn_guard.reset();
|
||||||
|
db_guard.reset();
|
||||||
return true;
|
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() {
|
bool testcase_deadwrite::run() {
|
||||||
db_open();
|
db_open();
|
||||||
txn_begin(false);
|
txn_begin(false);
|
||||||
|
cursor_guard.reset();
|
||||||
|
txn_guard.reset();
|
||||||
|
db_guard.reset();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool testcase_deadwrite::teardown() {
|
|
||||||
log_trace(">> teardown");
|
|
||||||
cursor_guard.release();
|
|
||||||
txn_guard.release();
|
|
||||||
db_guard.release();
|
|
||||||
return inherited::teardown();
|
|
||||||
}
|
|
||||||
|
18
test/hill.cc
18
test/hill.cc
@ -1,4 +1,4 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2017-2018 Leonid Yuriev <leo@yuriev.ru>
|
* Copyright 2017-2018 Leonid Yuriev <leo@yuriev.ru>
|
||||||
* and other libmdbx authors: please see AUTHORS file.
|
* and other libmdbx authors: please see AUTHORS file.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
@ -14,17 +14,6 @@
|
|||||||
|
|
||||||
#include "test.h"
|
#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() {
|
bool testcase_hill::run() {
|
||||||
db_open();
|
db_open();
|
||||||
|
|
||||||
@ -225,8 +214,3 @@ bool testcase_hill::run() {
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool testcase_hill::teardown() {
|
|
||||||
log_trace(">> teardown");
|
|
||||||
return inherited::teardown();
|
|
||||||
}
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2017-2018 Leonid Yuriev <leo@yuriev.ru>
|
* Copyright 2017-2018 Leonid Yuriev <leo@yuriev.ru>
|
||||||
* and other libmdbx authors: please see AUTHORS file.
|
* and other libmdbx authors: please see AUTHORS file.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
@ -14,15 +14,6 @@
|
|||||||
|
|
||||||
#include "test.h"
|
#include "test.h"
|
||||||
|
|
||||||
bool testcase_jitter::setup() {
|
|
||||||
log_trace(">> setup");
|
|
||||||
if (!inherited::setup())
|
|
||||||
return false;
|
|
||||||
|
|
||||||
log_trace("<< setup");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool testcase_jitter::run() {
|
bool testcase_jitter::run() {
|
||||||
while (should_continue()) {
|
while (should_continue()) {
|
||||||
jitter_delay();
|
jitter_delay();
|
||||||
@ -66,8 +57,3 @@ bool testcase_jitter::run() {
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool testcase_jitter::teardown() {
|
|
||||||
log_trace(">> teardown");
|
|
||||||
return inherited::teardown();
|
|
||||||
}
|
|
||||||
|
22
test/test.h
22
test/test.h
@ -1,4 +1,4 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2017-2018 Leonid Yuriev <leo@yuriev.ru>
|
* Copyright 2017-2018 Leonid Yuriev <leo@yuriev.ru>
|
||||||
* and other libmdbx authors: please see AUTHORS file.
|
* and other libmdbx authors: please see AUTHORS file.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
@ -152,56 +152,36 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
class testcase_hill : public testcase {
|
class testcase_hill : public testcase {
|
||||||
typedef testcase inherited;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
testcase_hill(const actor_config &config, const mdbx_pid_t pid)
|
testcase_hill(const actor_config &config, const mdbx_pid_t pid)
|
||||||
: testcase(config, pid) {}
|
: testcase(config, pid) {}
|
||||||
bool setup();
|
|
||||||
bool run();
|
bool run();
|
||||||
bool teardown();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class testcase_deadread : public testcase {
|
class testcase_deadread : public testcase {
|
||||||
typedef testcase inherited;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
testcase_deadread(const actor_config &config, const mdbx_pid_t pid)
|
testcase_deadread(const actor_config &config, const mdbx_pid_t pid)
|
||||||
: testcase(config, pid) {}
|
: testcase(config, pid) {}
|
||||||
bool setup();
|
|
||||||
bool run();
|
bool run();
|
||||||
bool teardown();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class testcase_deadwrite : public testcase {
|
class testcase_deadwrite : public testcase {
|
||||||
typedef testcase inherited;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
testcase_deadwrite(const actor_config &config, const mdbx_pid_t pid)
|
testcase_deadwrite(const actor_config &config, const mdbx_pid_t pid)
|
||||||
: testcase(config, pid) {}
|
: testcase(config, pid) {}
|
||||||
bool setup();
|
|
||||||
bool run();
|
bool run();
|
||||||
bool teardown();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class testcase_jitter : public testcase {
|
class testcase_jitter : public testcase {
|
||||||
typedef testcase inherited;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
testcase_jitter(const actor_config &config, const mdbx_pid_t pid)
|
testcase_jitter(const actor_config &config, const mdbx_pid_t pid)
|
||||||
: testcase(config, pid) {}
|
: testcase(config, pid) {}
|
||||||
bool setup();
|
|
||||||
bool run();
|
bool run();
|
||||||
bool teardown();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class testcase_try : public testcase {
|
class testcase_try : public testcase {
|
||||||
typedef testcase inherited;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
testcase_try(const actor_config &config, const mdbx_pid_t pid)
|
testcase_try(const actor_config &config, const mdbx_pid_t pid)
|
||||||
: testcase(config, pid) {}
|
: testcase(config, pid) {}
|
||||||
bool setup();
|
|
||||||
bool run();
|
bool run();
|
||||||
bool teardown();
|
|
||||||
};
|
};
|
||||||
|
19
test/try.cc
19
test/try.cc
@ -1,13 +1,4 @@
|
|||||||
#include "test.h"
|
#include "test.h"
|
||||||
|
|
||||||
bool testcase_try::setup() {
|
|
||||||
log_trace(">> setup");
|
|
||||||
if (!inherited::setup())
|
|
||||||
return false;
|
|
||||||
|
|
||||||
log_trace("<< setup");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool testcase_try::run() {
|
bool testcase_try::run() {
|
||||||
db_open();
|
db_open();
|
||||||
@ -27,11 +18,3 @@ bool testcase_try::run() {
|
|||||||
txn_guard.reset(txn);
|
txn_guard.reset(txn);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool testcase_try::teardown() {
|
|
||||||
log_trace(">> teardown");
|
|
||||||
cursor_guard.release();
|
|
||||||
txn_guard.release();
|
|
||||||
db_guard.release();
|
|
||||||
return inherited::teardown();
|
|
||||||
}
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user