mdbx-test: re-seed keygen over iterations.

Change-Id: I2cfd635fc46c808dd8431217b75a30780e0c3958
This commit is contained in:
Leonid Yuriev 2019-06-22 16:11:25 +03:00
parent e6ad443178
commit 15403aadad
2 changed files with 20 additions and 5 deletions

View File

@ -461,8 +461,9 @@ void testcase::checkdata(const char *step, MDBX_dbi handle, MDBX_val key2check,
//-----------------------------------------------------------------------------
bool test_execute(const actor_config &config) {
bool test_execute(const actor_config &config_const) {
const mdbx_pid_t pid = osal_getpid();
actor_config config = config_const;
if (global::singlemode) {
logging::setup(format("single_%s", testcase2str(config.testcase)));
@ -526,6 +527,7 @@ bool test_execute(const actor_config &config) {
size_t(config.params.nrepeat));
else
log_info("test successed (iteration %zi)", iter);
config.params.keygen.seed += INT32_C(0xA4F4D37B);
}
} while (config.params.nrepeat == 0 || iter < config.params.nrepeat);
return true;

View File

@ -327,12 +327,25 @@ std::string format(const char *fmt, ...);
uint64_t entropy_ticks(void);
uint64_t entropy_white(void);
static inline uint64_t bleach64(uint64_t dirty) {
return mul_64x64_high(bswap64(dirty), UINT64_C(17048867929148541611));
static inline uint64_t bleach64(uint64_t v) {
// Tommy Ettinger, https://www.blogger.com/profile/04953541827437796598
// http://mostlymangling.blogspot.com/2019/01/better-stronger-mixer-and-test-procedure.html
v ^= rot64(v, 25) ^ rot64(v, 50);
v *= UINT64_C(0xA24BAED4963EE407);
v ^= rot64(v, 24) ^ rot64(v, 49);
v *= UINT64_C(0x9FB21C651E98DF25);
return v ^ v >> 28;
}
static inline uint32_t bleach32(uint32_t dirty) {
return (uint32_t)((bswap32(dirty) * UINT64_C(2175734609)) >> 32);
static inline uint32_t bleach32(uint32_t x) {
// https://github.com/skeeto/hash-prospector
// exact bias: 0.17353355999581582
x ^= x >> 16;
x *= UINT32_C(0x7feb352d);
x ^= 0x3027C563 ^ (x >> 15);
x *= UINT32_C(0x846ca68b);
x ^= x >> 16;
return x;
}
static inline uint64_t prng64_map1_careless(uint64_t state) {