mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-04 16:44:13 +08:00
mdbx-test: more auto-adjustment of min/max length of key/values.
Change-Id: I22ac3845a341f8f4414ac0719f1a4c007f035b60
This commit is contained in:
parent
7522246ccd
commit
56809cb711
@ -15,7 +15,15 @@
|
|||||||
#include "test.h"
|
#include "test.h"
|
||||||
|
|
||||||
void configure_actor(unsigned &last_space_id, const actor_testcase testcase,
|
void configure_actor(unsigned &last_space_id, const actor_testcase testcase,
|
||||||
const char *space_id_cstr, const actor_params ¶ms) {
|
const char *space_id_cstr, actor_params params) {
|
||||||
|
// silently fix key/data length for fixed-length modes
|
||||||
|
if ((params.table_flags & MDBX_INTEGERKEY) &&
|
||||||
|
params.keylen_min != params.keylen_max)
|
||||||
|
params.keylen_min = params.keylen_max;
|
||||||
|
if ((params.table_flags & (MDBX_INTEGERDUP | MDBX_DUPFIXED)) &&
|
||||||
|
params.datalen_min != params.datalen_max)
|
||||||
|
params.datalen_min = params.datalen_max;
|
||||||
|
|
||||||
unsigned wait4id = 0;
|
unsigned wait4id = 0;
|
||||||
if (params.waitfor_nops) {
|
if (params.waitfor_nops) {
|
||||||
for (auto i = global::actors.rbegin(); i != global::actors.rend(); ++i) {
|
for (auto i = global::actors.rbegin(); i != global::actors.rend(); ++i) {
|
||||||
@ -56,7 +64,7 @@ void configure_actor(unsigned &last_space_id, const actor_testcase testcase,
|
|||||||
global::databases.insert(params.pathname_db);
|
global::databases.insert(params.pathname_db);
|
||||||
}
|
}
|
||||||
|
|
||||||
void testcase_setup(const char *casename, actor_params ¶ms,
|
void testcase_setup(const char *casename, const actor_params ¶ms,
|
||||||
unsigned &last_space_id) {
|
unsigned &last_space_id) {
|
||||||
if (strcmp(casename, "basic") == 0) {
|
if (strcmp(casename, "basic") == 0) {
|
||||||
log_notice(">>> testcase_setup(%s)", casename);
|
log_notice(">>> testcase_setup(%s)", casename);
|
||||||
|
25
test/main.cc
25
test/main.cc
@ -270,6 +270,27 @@ int main(int argc, char *const argv[]) {
|
|||||||
if ((params.table_flags & MDBX_DUPSORT) == 0)
|
if ((params.table_flags & MDBX_DUPSORT) == 0)
|
||||||
params.table_flags &=
|
params.table_flags &=
|
||||||
~(MDBX_DUPFIXED | MDBX_REVERSEDUP | MDBX_INTEGERDUP);
|
~(MDBX_DUPFIXED | MDBX_REVERSEDUP | MDBX_INTEGERDUP);
|
||||||
|
const unsigned keylen_max = params.mdbx_keylen_max();
|
||||||
|
if (params.keylen_min > keylen_max)
|
||||||
|
params.keylen_min = keylen_max;
|
||||||
|
if (params.keylen_max > keylen_max)
|
||||||
|
params.keylen_max = keylen_max;
|
||||||
|
const unsigned keylen_min = params.mdbx_keylen_min();
|
||||||
|
if (params.keylen_min < keylen_min)
|
||||||
|
params.keylen_min = keylen_min;
|
||||||
|
if (params.keylen_max < keylen_min)
|
||||||
|
params.keylen_max = keylen_min;
|
||||||
|
|
||||||
|
const unsigned datalen_max = params.mdbx_datalen_max();
|
||||||
|
if (params.datalen_min > datalen_max)
|
||||||
|
params.datalen_min = datalen_max;
|
||||||
|
if (params.datalen_max > datalen_max)
|
||||||
|
params.datalen_max = datalen_max;
|
||||||
|
const unsigned datalen_min = params.mdbx_datalen_min();
|
||||||
|
if (params.datalen_min < datalen_min)
|
||||||
|
params.datalen_min = datalen_min;
|
||||||
|
if (params.datalen_max < datalen_min)
|
||||||
|
params.datalen_max = datalen_min;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -371,7 +392,7 @@ int main(int argc, char *const argv[]) {
|
|||||||
params.datalen_min, config::no_scale,
|
params.datalen_min, config::no_scale,
|
||||||
params.mdbx_datalen_min(),
|
params.mdbx_datalen_min(),
|
||||||
params.mdbx_datalen_max())) {
|
params.mdbx_datalen_max())) {
|
||||||
if ((params.table_flags & MDBX_DUPFIXED) ||
|
if ((params.table_flags & (MDBX_INTEGERDUP | MDBX_DUPFIXED)) ||
|
||||||
params.datalen_max < params.datalen_min)
|
params.datalen_max < params.datalen_min)
|
||||||
params.datalen_max = params.datalen_min;
|
params.datalen_max = params.datalen_min;
|
||||||
continue;
|
continue;
|
||||||
@ -380,7 +401,7 @@ int main(int argc, char *const argv[]) {
|
|||||||
params.datalen_max, config::no_scale,
|
params.datalen_max, config::no_scale,
|
||||||
params.mdbx_datalen_min(),
|
params.mdbx_datalen_min(),
|
||||||
params.mdbx_datalen_max())) {
|
params.mdbx_datalen_max())) {
|
||||||
if ((params.table_flags & MDBX_DUPFIXED) ||
|
if ((params.table_flags & (MDBX_INTEGERDUP | MDBX_DUPFIXED)) ||
|
||||||
params.datalen_min > params.datalen_max)
|
params.datalen_min > params.datalen_max)
|
||||||
params.datalen_min = params.datalen_max;
|
params.datalen_min = params.datalen_max;
|
||||||
continue;
|
continue;
|
||||||
|
@ -42,10 +42,10 @@
|
|||||||
|
|
||||||
bool test_execute(const actor_config &config);
|
bool test_execute(const actor_config &config);
|
||||||
std::string thunk_param(const actor_config &config);
|
std::string thunk_param(const actor_config &config);
|
||||||
void testcase_setup(const char *casename, actor_params ¶ms,
|
void testcase_setup(const char *casename, const actor_params ¶ms,
|
||||||
unsigned &last_space_id);
|
unsigned &last_space_id);
|
||||||
void configure_actor(unsigned &last_space_id, const actor_testcase testcase,
|
void configure_actor(unsigned &last_space_id, const actor_testcase testcase,
|
||||||
const char *space_id_cstr, const actor_params ¶ms);
|
const char *space_id_cstr, actor_params params);
|
||||||
void keycase_setup(const char *casename, actor_params ¶ms);
|
void keycase_setup(const char *casename, actor_params ¶ms);
|
||||||
|
|
||||||
namespace global {
|
namespace global {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user