]> git.ipfire.org Git - thirdparty/dovecot/core.git/commit
lib/lib-test: restore DOVECOT_SRAND feature in DEBUG builds
authorPhil Carmody <phil@dovecot.fi>
Mon, 11 Dec 2017 12:03:13 +0000 (14:03 +0200)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Thu, 14 Feb 2019 09:38:05 +0000 (11:38 +0200)
commit00a3985258940b76d91b939ebdc2e75b3f2c1e13
tree2acdaa71588413ef912219b5baa2e4dc503d5cc4
parentb8cc5abe094fb1e9afbb6f5f313b7ad97496fd57
lib/lib-test: restore DOVECOT_SRAND feature in DEBUG builds

Add a deterministic PRNG, an ability to force its use, and an
ability to re-use the same sequence later.

Since proper random numbers have been forced into use, making
reproducable tests isn't quite as easy as it used to be, it's 3 steps
rather than 2. When seeing an intermittent test failure:
 - rerun the tests with environmental variable DOVECOT_SRAND=kiss
 - upon seeing a new failure case, note the seed logged at the failure
 - debug using DOVECOT_SRAND=<that number>

In non-DEBUG builds, there's no trace of this code, and the
randomisation that is an inherent part of many tests remains
non-reproduceable.

Works with all of the RNG preferences, getrandom/urandom/arc4.

Signed-off-by: Phil Carmody <phil@dovecot.fi>
src/lib-test/test-common.c
src/lib/randgen.c
src/lib/randgen.h