mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-19 15:08:21 +08:00
mdbx-tests: переделка seed/salt ГПСЧ для более удобного контроля и воспроизведения тестов.
This commit is contained in:
parent
a994a9bbcc
commit
3c60e1e94c
@ -72,6 +72,7 @@ void configure_actor(unsigned &last_space_id, const actor_testcase testcase, con
|
||||
log_trace("configure_actor: space %lu for %s", space_id, testcase2str(testcase));
|
||||
global::actors.emplace_back(actor_config(testcase, params, unsigned(space_id), wait4id));
|
||||
global::databases.insert(params.pathname_db);
|
||||
params.prng_seed += bleach64(space_id);
|
||||
}
|
||||
|
||||
void testcase_setup(const char *casename, const actor_params ¶ms, unsigned &last_space_id) {
|
||||
|
@ -770,7 +770,7 @@ static bool execute_thunk(const actor_config *const_config, const mdbx_pid_t pid
|
||||
size_t iter = 0;
|
||||
do {
|
||||
if (iter) {
|
||||
prng_seed(config.params.prng_seed += INT32_C(0xA4F4D37B));
|
||||
prng_salt(iter);
|
||||
log_verbose("turn PRNG to %u", config.params.prng_seed);
|
||||
}
|
||||
iter++;
|
||||
|
@ -263,8 +263,8 @@ public:
|
||||
}
|
||||
|
||||
static bool review_params(actor_params ¶ms, unsigned space_id) {
|
||||
(void)space_id;
|
||||
// silently fix key/data length for fixed-length modes
|
||||
params.prng_seed += bleach32(space_id);
|
||||
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)
|
||||
|
@ -124,7 +124,8 @@ void prng_fill(uint64_t &state, void *ptr, size_t bytes) {
|
||||
|
||||
/* __thread */ uint64_t prng_state;
|
||||
|
||||
void prng_seed(uint64_t seed) { prng_state = bleach64(seed); }
|
||||
void prng_seed(uint64_t seed) { prng_state = seed; }
|
||||
void prng_salt(unsigned salt) { prng_state += bleach32(salt) * UINT64_C(0xD14A2783862DAB); }
|
||||
|
||||
uint32_t prng32(void) { return prng32_white(prng_state); }
|
||||
|
||||
|
@ -313,6 +313,7 @@ void prng_fill(uint64_t &state, void *ptr, size_t bytes);
|
||||
|
||||
extern uint64_t prng_state;
|
||||
void prng_seed(uint64_t seed);
|
||||
void prng_salt(unsigned salt);
|
||||
uint32_t prng32(void);
|
||||
uint64_t prng64(void);
|
||||
void prng_fill(void *ptr, size_t bytes);
|
||||
|
Loading…
x
Reference in New Issue
Block a user